From 3d3be141551bb4622da1cb610e4f6f798dd1715e Mon Sep 17 00:00:00 2001 From: Fritz Elfert Date: Mon, 28 Jun 1999 08:55:07 +0000 Subject: First import --- COPYING | 280 +++++++++++++++++++++++++++++++++++ Makefile.am | 7 + Makefile.cvs | 17 +++ include/OSdefs.h | 13 ++ include/config.h | 30 ++++ include/config.h.in | 29 ++++ include/defs.h | 33 +++++ include/defs.h.in | 33 +++++ include/fparam.h | 21 +++ include/misc-aix3.h | 99 +++++++++++++ include/mp.h | 200 +++++++++++++++++++++++++ include/nfs_prot.h | 406 +++++++++++++++++++++++++++++++++++++++++++++++++++ include/os-aix3.h | 182 +++++++++++++++++++++++ include/sun_stdlib.h | 268 ++++++++++++++++++++++++++++++++++ install-sh | 238 ++++++++++++++++++++++++++++++ missing | 188 ++++++++++++++++++++++++ mkinstalldirs | 36 +++++ 17 files changed, 2080 insertions(+) create mode 100644 COPYING create mode 100644 Makefile.am create mode 100644 Makefile.cvs create mode 100644 include/OSdefs.h create mode 100644 include/config.h create mode 100644 include/config.h.in create mode 100644 include/defs.h create mode 100644 include/defs.h.in create mode 100644 include/fparam.h create mode 100644 include/misc-aix3.h create mode 100644 include/mp.h create mode 100644 include/nfs_prot.h create mode 100644 include/os-aix3.h create mode 100644 include/sun_stdlib.h create mode 100755 install-sh create mode 100755 missing create mode 100755 mkinstalldirs diff --git a/COPYING b/COPYING new file mode 100644 index 0000000..c7aea18 --- /dev/null +++ b/COPYING @@ -0,0 +1,280 @@ + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc. + 675 Mass Ave, Cambridge, MA 02139, USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Library General Public License instead.) You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + + END OF TERMS AND CONDITIONS diff --git a/Makefile.am b/Makefile.am new file mode 100644 index 0000000..2aae5db --- /dev/null +++ b/Makefile.am @@ -0,0 +1,7 @@ +# +# $Id$ +# +SUBDIRS = lib nfsd +EXTRA_DIST = COPYING README TODO INSTALL +AUTOMAKE_OPTIONS = foreign + diff --git a/Makefile.cvs b/Makefile.cvs new file mode 100644 index 0000000..aabf05f --- /dev/null +++ b/Makefile.cvs @@ -0,0 +1,17 @@ +all: + @echo "Use make devel for development, make dist for distribution" + +devel: + aclocal + autoheader + automake + autoconf + touch stamp-h.in + +dist: + aclocal + autoheader + automake --include-deps + autoconf + touch stamp-h.in + diff --git a/include/OSdefs.h b/include/OSdefs.h new file mode 100644 index 0000000..261f45a --- /dev/null +++ b/include/OSdefs.h @@ -0,0 +1,13 @@ +#ifdef __FreeBSD__ +# include +# include +# include +# include +#endif + +#if defined(__NeXT__) +# include +# include +# include +# define strdup NXCopyStringBuffer +#endif diff --git a/include/config.h b/include/config.h new file mode 100644 index 0000000..a2ced96 --- /dev/null +++ b/include/config.h @@ -0,0 +1,30 @@ +/* include/config.h. Generated automatically by configure. */ +/* include/config.h.in. Generated automatically from configure.in by autoheader. */ + +#define VERSION "0.1" + +#define PACKAGE "plpnfsd" + +/* Define if you have the header file. */ +#define HAVE_STDLIB_H 1 + +/* Define if you have the header file. */ +#define HAVE_SYS_ERRNO_H 1 + +/* Define if you have the header file. */ +#define HAVE_SYS_IOCTL_H 1 + +/* Define if you have the header file. */ +/* #undef HAVE_SYS_TTOLD_H */ + +/* Define if you have the bsd library (-lbsd). */ +/* #undef HAVE_LIBBSD */ + +/* Define if you have the nsl library (-lnsl). */ +#define HAVE_LIBNSL 1 + +/* Define if you have the rpcsoc library (-lrpcsoc). */ +/* #undef HAVE_LIBRPCSOC */ + +/* Define if you have the socket library (-lsocket). */ +/* #undef HAVE_LIBSOCKET */ diff --git a/include/config.h.in b/include/config.h.in new file mode 100644 index 0000000..5fc2ffd --- /dev/null +++ b/include/config.h.in @@ -0,0 +1,29 @@ +/* include/config.h.in. Generated automatically from configure.in by autoheader. */ + +#undef VERSION + +#undef PACKAGE + +/* Define if you have the header file. */ +#undef HAVE_STDLIB_H + +/* Define if you have the header file. */ +#undef HAVE_SYS_ERRNO_H + +/* Define if you have the header file. */ +#undef HAVE_SYS_IOCTL_H + +/* Define if you have the header file. */ +#undef HAVE_SYS_TTOLD_H + +/* Define if you have the bsd library (-lbsd). */ +#undef HAVE_LIBBSD + +/* Define if you have the nsl library (-lnsl). */ +#undef HAVE_LIBNSL + +/* Define if you have the rpcsoc library (-lrpcsoc). */ +#undef HAVE_LIBRPCSOC + +/* Define if you have the socket library (-lsocket). */ +#undef HAVE_LIBSOCKET diff --git a/include/defs.h b/include/defs.h new file mode 100644 index 0000000..8733d37 --- /dev/null +++ b/include/defs.h @@ -0,0 +1,33 @@ +#ifndef _defs_h_ +#define _defs_h_ + +#define MTAB_PATH "/etc/mtab" +#ifdef linux +# define MTAB_TMP "/etc/mtab~" +#else +# define MTAB_TMP "/etc/mtab.p3nfsd" +#endif + +#define DDEV "/dev/ttyS0" + +#ifdef _IBMR2 +# define DONT_UPDATE_MTAB /* The mount table is obtained from the kernel (!?) */ +#endif + +#define DUSER "root" + +#ifndef DDIR +# define DDIR "/psion.stand/mnt" +#endif + +#ifndef PSIONHOSTNAME +# define PSIONHOSTNAME "localhost" +#endif + +/* See CHANGES for comment */ +#ifdef linux +#define NO_WRITE_SELECT +#endif + +#include "config.h" +#endif diff --git a/include/defs.h.in b/include/defs.h.in new file mode 100644 index 0000000..9ee654e --- /dev/null +++ b/include/defs.h.in @@ -0,0 +1,33 @@ +#ifndef _defs_h_ +#define _defs_h_ + +#define MTAB_PATH "@MTAB@" +#ifdef linux +# define MTAB_TMP "@MTAB@~" +#else +# define MTAB_TMP "@MTAB@.p3nfsd" +#endif + +#define DDEV "@DDEV@" + +#ifdef _IBMR2 +# define DONT_UPDATE_MTAB /* The mount table is obtained from the kernel (!?) */ +#endif + +#define DUSER "root" + +#ifndef DDIR +# define DDIR "/psion.stand/mnt" +#endif + +#ifndef PSIONHOSTNAME +# define PSIONHOSTNAME "localhost" +#endif + +/* See CHANGES for comment */ +#ifdef linux +#define NO_WRITE_SELECT +#endif + +#include "config.h" +#endif diff --git a/include/fparam.h b/include/fparam.h new file mode 100644 index 0000000..cb881c2 --- /dev/null +++ b/include/fparam.h @@ -0,0 +1,21 @@ +/* $Id$ + * + */ + +#ifndef _fparam_h_ +#define _fparam_h_ + +#if defined(sun) && defined(__STDC__) && !defined(__SVR4) +# include "sun_stdlib.h" +# define __P(a) a +#endif + +#ifndef __P +# if defined(__STDC__) +# define __P(a) a +# else +# define __P(a) () +# endif +#endif + +#endif diff --git a/include/misc-aix3.h b/include/misc-aix3.h new file mode 100644 index 0000000..36ce41f --- /dev/null +++ b/include/misc-aix3.h @@ -0,0 +1,99 @@ +/* + * Copyright (c) 1990 Jan-Simon Pendry + * Copyright (c) 1990 Imperial College of Science, Technology & Medicine + * Copyright (c) 1990 The Regents of the University of California. + * All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * Jan-Simon Pendry at Imperial College, London. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * %W% (Berkeley) %G% + * + * $Id$ + * + */ + +#include +#include + +struct ufs_args { + char *fspec; /* Block device */ +}; + +struct nfs_args { + struct sockaddr_in addr; /* file server address */ + fhandle_t fh; /* File handle to be mounted */ + int flags; /* flags */ + int wsize; /* write size in bytes */ + int rsize; /* read size in bytes */ + int timeo; /* initial timeout in .1 secs */ + int retrans; /* times to retry send */ + char *hostname; /* server's hostname */ + int acregmin; /* attr cache file min secs */ + int acregmax; /* attr cache file max secs */ + int acdirmin; /* attr cache dir min secs */ + int acdirmax; /* attr cache dir max secs */ + char *netname; /* server's netname */ + int biods; /* number of BIODS */ +}; + +/* + * NFS mount option flags + */ +#define MNTOPT_RO "ro" /* read only */ +#define MNTOPT_RW "rw" /* read/write */ +#define MNTOPT_SOFT "soft" /* soft mount */ +#define MNTOPT_HARD "hard" /* hard mount */ +#define MNTOPT_NOSUID "nosuid"/* no set uid allowed */ +#define MNTOPT_NOAUTO "noauto"/* hide entry from mount -a */ +#define MNTOPT_INTR "intr" /* allow interrupts on hard mount */ +#define MNTOPT_SECURE "secure"/* use secure RPC for NFS */ +#define MNTOPT_GRPID "grpid" /* SysV-compatible group-id on create */ +#define MNTOPT_NOSUB "nosub" /* disallow mounts beneath this one */ +#define MNTOPT_MULTI "multi" /* Do multi-component lookup */ +#define MNTOPT_NOAC "noac" /* don't cache attributes */ + +#define NFSMNT_SOFT 0x001 /* soft mount (hard is default) */ +#define NFSMNT_WSIZE 0x002 /* set write size */ +#define NFSMNT_RSIZE 0x004 /* set read size */ +#define NFSMNT_TIMEO 0x008 /* set initial timeout */ +#define NFSMNT_RETRANS 0x010 /* set number of request retrys */ +#define NFSMNT_HOSTNAME 0x020 /* set hostname for error printf */ +#define NFSMNT_INT 0x040 /* allow interrupts on hard mount */ +#define NFSMNT_NOAC 0x080 /* don't cache attributes */ +#define NFSMNT_ACREGMIN 0x0100 /* set min secs for file attr cache */ +#define NFSMNT_ACREGMAX 0x0200 /* set max secs for file attr cache */ +#define NFSMNT_ACDIRMIN 0x0400 /* set min secs for dir attr cache */ +#define NFSMNT_ACDIRMAX 0x0800 /* set max secs for dir attr cache */ +#define NFSMNT_SECURE 0x1000 /* secure mount */ +#define NFSMNT_BIODS 0x10000 /* Number of biods for the file system */ + +#define DEF_BIODS 6 diff --git a/include/mp.h b/include/mp.h new file mode 100644 index 0000000..dd456d5 --- /dev/null +++ b/include/mp.h @@ -0,0 +1,200 @@ +/* $Id$ + * + */ + +#ifndef _mp_h_ +#define _mp_h_ + +#include "fparam.h" +#include "nfs_prot.h" + +#define PFS_OP_CREATE 0x01 +#define PFS_OP_GETATTR 0x02 +#define PFS_OP_MKDIR 0x03 +#define PFS_OP_READ 0x04 +#define PFS_OP_READDIR 0x05 +#define PFS_OP_REMOVE 0x06 +#define PFS_OP_RENAME 0x07 +#define PFS_OP_RMDIR 0x08 +#define PFS_OP_SETATTR 0x09 +#define PFS_OP_WRITE 0x0a +#define PFS_OP_GETDEVS 0x0b +/* The same as getattr without the stat (for linkcount purposes */ +#define PFS_OP_STATDEV 0x0c + +/* Only for the new nfsc */ +#define PFS_OP_TTYDATA 0x0d +#define PFS_OP_EXEC 0x0e +#define PFS_OP_ECHO 0x0f +#define PREFIX 0x80 + +typedef struct p_inode +{ + int inode; + char *name; + struct p_inode *nextnam, *nextnum; +} p_inode; + +/* + * Description of a Psion-Device + */ +typedef struct p_device +{ + char *name; /* Volume-Name */ + char letter; /* Drive-Number (zero-based, i.e. 0 = A, 1 = B, 2 = C ...) */ + long attrib; /* Device-Attribs */ + long total; /* Total capacity in bytes */ + long free; /* Free space in bytes */ + struct p_device *next; +} device; + +/* + * Description of a Psion-File/Dir + */ +typedef struct p_dentry +{ + char *name; + long time; + long attr; + long size; + long links; + struct p_dentry *next; +} dentry; + +/* data cache */ +struct dcache +{ + struct dcache *next; + unsigned char *data; + unsigned int offset, len; + int towrite; +}; + +/* attribute cache */ +struct cache +{ + struct cache *next; + unsigned int inode; + int actual_size; + struct dcache *dcache; + fattr attr; +}; + +struct entrycache +{ + int inode; + entry *head; + struct entrycache *next; +}; + +extern int debug, gmtoffset, exiting, psion_alive, dowakeup, + query_cache, series5; +extern fattr root_fattr; +extern struct cache *datacache, *attrcache; + +#ifdef __SVR4 +#define bzero(a,b) memset(a,0,b) +#define bcopy(a,b,c) memcpy(b,a,c) +#define bcmp(a,b,n) memcmp(a,b,n) +#define index strchr +#define rindex strrchr +#endif + +#if !defined(__STDC__) +extern char *index(), *rindex(), *strdup(); +#endif + + +#define THE_END (struct entry *)-1 +#define PBUFSIZE 8192 + +#define TIMEOUT -54 +#define BLOCKSIZE 1024 +#define FID 7 /* File system id */ + +#if defined(sun) && defined(__SVR4) +/* + * at least /opt/SUNWspro/bin/cc on Solaris 2.4 likes these: + */ +# define SIGARG (int arg) +#else +# define SIGARG () +#endif + +/* mp_main.c */ +#if defined(hpux) || defined(__SVR4) + /* HPUX 10.20 declares int usleep( useconds_t useconds); */ +# ifndef HPUX10 + extern void usleep __P((int usec)); +# endif +#endif + +/* mp_serial.c */ +int init_serial __P((char *dev, int speed)); +int fd_is_still_alive __P((int fd, int wake)); +void reset_serial __P((int fd)); + +/* crc.c */ +int docrc16 __P((unsigned char *, int)); + +/* mp_mount.c */ +void mount_and_run __P((char *dir, void (*proc)(), nfs_fh *root_fh)); + +/* mp_inode.c */ +extern p_inode *get_num __P((int)); +extern p_inode *get_nam __P((char *)); +extern p_inode *re_nam __P((char *, char *)); +extern void inode2fh __P((int, char *)); + +extern char *dirname __P((char *)); +extern char *filname __P((char *)); +extern char *build_path __P((char *, char *)); + +extern int fh2inode __P((char *)); +extern int getpinode __P((p_inode *inode)); +extern char *iso2cp __P((char *)); +extern char *cp2iso __P((char *)); + +extern struct cache *add_cache __P((struct cache **, unsigned int, fattr *)); +extern void rem_cache __P((struct cache **, unsigned int)); +extern void clean_cache __P((struct cache **)); +extern struct cache *search_cache __P((struct cache *, unsigned int)); + +extern struct dcache *add_dcache __P((struct cache *, unsigned int, unsigned int, unsigned char *)); +extern void clean_dcache __P((struct cache *)); +extern struct dcache *search_dcache __P((struct cache *, unsigned int, unsigned int)); + +/* mp_xmit.c */ +int sendop __P((int cmd, char *fname, char *rest, int restlen)); +int getstr __P((char *str)); +int getanswer __P((void)); +int sendcmd __P((int cmd, char *fname, char *rest, int restlen)); +int getcount __P((unsigned char *str, int num)); +int senddata __P((char *p, int len)); +void long2pstr __P((unsigned int l, unsigned char *s)); +void short2pstr __P((unsigned int l, unsigned char *s)); +unsigned int pstr2long __P((unsigned char *s)); + +/* mp_pfs_ops.c */ +extern void *nfsproc_null_2 __P((void)); +extern void *nfsproc_root_2 __P((void)); +extern void *nfsproc_writecache_2 __P((void)); +extern nfsstat *nfsproc_link_2 __P((struct linkargs *la)); +extern nfsstat *nfsproc_rmdir_2 __P((struct diropargs *da)); +extern nfsstat *nfsproc_remove_2 __P((struct diropargs *da)); +extern nfsstat *nfsproc_rename_2 __P((struct renameargs *ra)); +extern nfsstat *nfsproc_symlink_2 __P((struct symlinkargs *sa)); +extern struct readres *nfsproc_read_2 __P((struct readargs *ra)); +extern struct attrstat *nfsproc_write_2 __P((struct writeargs *wa)); +extern struct diropres *nfsproc_mkdir_2 __P((struct createargs *ca)); +extern struct diropres *nfsproc_create_2 __P((struct createargs *ca)); +extern struct diropres *nfsproc_lookup_2 __P((struct diropargs *da)); +extern struct attrstat *nfsproc_getattr_2 __P((struct nfs_fh *fh)); +extern struct attrstat *nfsproc_setattr_2 __P((struct sattrargs *sa)); +extern struct statfsres *nfsproc_statfs_2 __P((struct nfs_fh *fh)); +extern struct readdirres *nfsproc_readdir_2 __P((struct readdirargs *ra)); +extern struct readlinkres *nfsproc_readlink_2 __P((struct nfs_fh *fh)); + +extern int mp_main(int argc, char **argv); + +#endif diff --git a/include/nfs_prot.h b/include/nfs_prot.h new file mode 100644 index 0000000..16cc31f --- /dev/null +++ b/include/nfs_prot.h @@ -0,0 +1,406 @@ +#ifndef _nfs_prot_h_ +#define _nfs_prot_h_ + +#include "fparam.h" + +#ifdef hpux +#include +#include +#endif +#ifdef linux +# include +# include +#endif +#ifdef __sgi +# include +# include +# include +#endif + +/* + * Please do not edit this file. + * It was generated using rpcgen. + */ + +#include + +#define NFS_PORT 2049 +#define NFS_MAXDATA 8192 +#define NFS_MAXPATHLEN 1024 +#define NFS_MAXNAMLEN 255 +#define NFS_FHSIZE 32 +#define NFS_COOKIESIZE 4 +#ifndef NFS_FIFO_DEV +#define NFS_FIFO_DEV -1 +#endif +#define NFSMODE_FMT 0170000 +#define NFSMODE_DIR 0040000 +#define NFSMODE_CHR 0020000 +#define NFSMODE_BLK 0060000 +#define NFSMODE_REG 0100000 +#define NFSMODE_LNK 0120000 +#define NFSMODE_SOCK 0140000 +#define NFSMODE_FIFO 0010000 + +#if !defined(hpux) && !defined(linux) && !defined(__sgi) +enum nfsstat { + NFS_OK = 0, + NFSERR_PERM = 1, + NFSERR_NOENT = 2, + NFSERR_IO = 5, + NFSERR_NXIO = 6, + NFSERR_ACCES = 13, + NFSERR_EXIST = 17, + NFSERR_NODEV = 19, + NFSERR_NOTDIR = 20, + NFSERR_ISDIR = 21, + NFSERR_FBIG = 27, + NFSERR_NOSPC = 28, + NFSERR_ROFS = 30, + NFSERR_NAMETOOLONG = 63, + NFSERR_NOTEMPTY = 66, + NFSERR_DQUOT = 69, + NFSERR_STALE = 70, + NFSERR_WFLUSH = 99 +}; +#endif /* !hpux, linux */ + +#ifdef linux +typedef enum nfs_stat nfsstat; +#else +typedef enum nfsstat nfsstat; +#endif +bool_t xdr_nfsstat(); + +#if !defined(hpux) && !defined(linux) && !defined(__sgi) +enum ftype { + NFNON = 0, + NFREG = 1, + NFDIR = 2, + NFBLK = 3, + NFCHR = 4, + NFLNK = 5, + NFSOCK = 6, + NFBAD = 7, + NFFIFO = 8 +}; +typedef enum ftype ftype; +#endif /* !linux, hpux */ + +#ifdef __sgi +typedef enum nfsftype ftype; +#endif + +#ifdef hpux +typedef enum nfsftype ftype; +#endif +#ifdef linux +typedef enum nfs_ftype ftype; +#endif + +bool_t xdr_ftype(); + +#ifndef linux +struct nfs_fh { + char data[NFS_FHSIZE]; +}; +#endif +typedef struct nfs_fh nfs_fh; +bool_t xdr_nfs_fh(); + +struct nfstime { + u_int seconds; + u_int useconds; +}; +typedef struct nfstime nfstime; +bool_t xdr_nfstime(); + +struct fattr { + ftype type; + u_int mode; + u_int nlink; + u_int uid; + u_int gid; + u_int size; + u_int blocksize; + u_int rdev; + u_int blocks; + u_int fsid; + u_int fileid; + nfstime atime; + nfstime mtime; + nfstime ctime; +}; +typedef struct fattr fattr; +bool_t xdr_fattr(); + +struct sattr { + u_int mode; + u_int uid; + u_int gid; + u_int size; + nfstime atime; + nfstime mtime; +}; +typedef struct sattr sattr; +bool_t xdr_sattr(); + +typedef char *filename; +bool_t xdr_filename(); + +typedef char *nfspath; +bool_t xdr_nfspath(); + +struct attrstat { + nfsstat status; + union { + fattr attributes; + } attrstat_u; +}; +typedef struct attrstat attrstat; +bool_t xdr_attrstat(); + +struct sattrargs { + nfs_fh file; + sattr attributes; +}; +typedef struct sattrargs sattrargs; +bool_t xdr_sattrargs(); + +struct diropargs { + nfs_fh dir; + filename name; +}; +typedef struct diropargs diropargs; +bool_t xdr_diropargs(); + +struct diropokres { + nfs_fh file; + fattr attributes; +}; +typedef struct diropokres diropokres; +bool_t xdr_diropokres(); + +struct diropres { + nfsstat status; + union { + diropokres diropres; + } diropres_u; +}; +typedef struct diropres diropres; +bool_t xdr_diropres(); + +struct readlinkres { + nfsstat status; + union { + nfspath data; + } readlinkres_u; +}; +typedef struct readlinkres readlinkres; +bool_t xdr_readlinkres(); + +struct readargs { + nfs_fh file; + u_int offset; + u_int count; + u_int totalcount; +}; +typedef struct readargs readargs; +bool_t xdr_readargs(); + +struct readokres { + fattr attributes; + struct { + u_int data_len; + char *data_val; + } data; +}; +typedef struct readokres readokres; +bool_t xdr_readokres(); + +struct readres { + nfsstat status; + union { + readokres reply; + } readres_u; +}; +typedef struct readres readres; +bool_t xdr_readres(); + +struct writeargs { + nfs_fh file; + u_int beginoffset; + u_int offset; + u_int totalcount; + struct { + u_int data_len; + char *data_val; + } data; +}; +typedef struct writeargs writeargs; +bool_t xdr_writeargs(); + +struct createargs { + diropargs where; + sattr attributes; +}; +typedef struct createargs createargs; +bool_t xdr_createargs(); + +struct renameargs { + diropargs from; + diropargs to; +}; +typedef struct renameargs renameargs; +bool_t xdr_renameargs(); + +struct linkargs { + nfs_fh from; + diropargs to; +}; +typedef struct linkargs linkargs; +bool_t xdr_linkargs(); + +struct symlinkargs { + diropargs from; + nfspath to; + sattr attributes; +}; +typedef struct symlinkargs symlinkargs; +bool_t xdr_symlinkargs(); + +typedef char nfscookie[NFS_COOKIESIZE]; +bool_t xdr_nfscookie(); + +struct readdirargs { + nfs_fh dir; + nfscookie cookie; + u_int count; +}; +typedef struct readdirargs readdirargs; +bool_t xdr_readdirargs(); + +struct entry { + u_int fileid; + filename name; + nfscookie cookie; + struct entry *nextentry; +}; +typedef struct entry entry; +bool_t xdr_entry(); + +struct dirlist { + entry *entries; + bool_t eof; +}; +typedef struct dirlist dirlist; +bool_t xdr_dirlist(); + +struct readdirres { + nfsstat status; + union { + dirlist reply; + } readdirres_u; +}; +typedef struct readdirres readdirres; +bool_t xdr_readdirres(); + +struct statfsokres { + u_int tsize; + u_int bsize; + u_int blocks; + u_int bfree; + u_int bavail; +}; +typedef struct statfsokres statfsokres; +bool_t xdr_statfsokres(); + +struct statfsres { + nfsstat status; + union { + statfsokres reply; + } statfsres_u; +}; +typedef struct statfsres statfsres; +bool_t xdr_statfsres(); + +#ifndef NFS_PROGRAM +#define NFS_PROGRAM ((u_long)100003) +#endif +#ifndef NFS_VERSION +#define NFS_VERSION ((u_long)2) +#endif +#ifndef NFSPROC_NULL +#define NFSPROC_NULL ((u_long)0) +#endif +extern void *nfsproc_null_2 __P((void)); +#ifndef NFSPROC_GETATTR +#define NFSPROC_GETATTR ((u_long)1) +#endif +extern attrstat *nfsproc_getattr_2 __P((struct nfs_fh *fh)); +#ifndef NFSPROC_SETATTR +#define NFSPROC_SETATTR ((u_long)2) +#endif +extern attrstat *nfsproc_setattr_2 __P((struct sattrargs *sa)); +#ifndef NFSPROC_ROOT +#define NFSPROC_ROOT ((u_long)3) +#endif +extern void *nfsproc_root_2 __P((void)); +#ifndef NFSPROC_LOOKUP +#define NFSPROC_LOOKUP ((u_long)4) +#endif +extern diropres *nfsproc_lookup_2 __P((struct diropargs *da)); +#ifndef NFSPROC_READLINK +#define NFSPROC_READLINK ((u_long)5) +#endif +extern readlinkres *nfsproc_readlink_2 __P((struct nfs_fh *fh)); +#ifndef NFSPROC_READ +#define NFSPROC_READ ((u_long)6) +#endif +extern readres *nfsproc_read_2 __P((struct readargs *ra)); +#ifndef NFSPROC_WRITECACHE +#define NFSPROC_WRITECACHE ((u_long)7) +#endif +extern void *nfsproc_writecache_2 __P((void)); +#ifndef NFSPROC_WRITE +#define NFSPROC_WRITE ((u_long)8) +#endif +extern attrstat *nfsproc_write_2 __P((struct writeargs *wa)); +#ifndef NFSPROC_CREATE +#define NFSPROC_CREATE ((u_long)9) +#endif +extern diropres *nfsproc_create_2 __P((struct createargs *ca)); +#ifndef NFSPROC_REMOVE +#define NFSPROC_REMOVE ((u_long)10) +#endif +extern nfsstat *nfsproc_remove_2 __P((struct diropargs *da)); +#ifndef NFSPROC_RENAME +#define NFSPROC_RENAME ((u_long)11) +#endif +extern nfsstat *nfsproc_rename_2 __P((struct renameargs *ra)); +#ifndef NFSPROC_LINK +#define NFSPROC_LINK ((u_long)12) +#endif +extern nfsstat *nfsproc_link_2 __P((struct linkargs *la)); +#ifndef NFSPROC_SYMLINK +#define NFSPROC_SYMLINK ((u_long)13) +#endif +extern nfsstat *nfsproc_symlink_2 __P((struct symlinkargs *sa)); +#ifndef NFSPROC_MKDIR +#define NFSPROC_MKDIR ((u_long)14) +#endif +extern diropres *nfsproc_mkdir_2 __P((struct createargs *ca)); +#ifndef NFSPROC_RMDIR +#define NFSPROC_RMDIR ((u_long)15) +#endif +extern nfsstat *nfsproc_rmdir_2 __P((struct diropargs *da)); +#ifndef NFSPROC_READDIR +#define NFSPROC_READDIR ((u_long)16) +#endif +extern readdirres *nfsproc_readdir_2 __P((struct readdirargs *ra)); +#ifndef NFSPROC_STATFS +#define NFSPROC_STATFS ((u_long)17) +#endif +extern statfsres *nfsproc_statfs_2 __P((struct nfs_fh *fh)); + +#endif diff --git a/include/os-aix3.h b/include/os-aix3.h new file mode 100644 index 0000000..f95e083 --- /dev/null +++ b/include/os-aix3.h @@ -0,0 +1,182 @@ +/* + * Copyright (c) 1990 Jan-Simon Pendry + * Copyright (c) 1990 Imperial College of Science, Technology & Medicine + * Copyright (c) 1990 The Regents of the University of California. + * All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * Jan-Simon Pendry at Imperial College, London. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * %W% (Berkeley) %G% + * + * $Id$ + * + * AIX 3.1 definitions for Amd (automounter) + */ + +/* + * Does the compiler grok void * + */ +#define VOIDP + +/* + * Which version of the Sun RPC library we are using + * This is the implementation release number, not + * the protocol revision number. + */ +#define RPC_4 + +/* + * Which version of the NFS interface are we using. + * This is the implementation release number, not + * the protocol revision number. + */ +#define NFS_AIX3 + +/* + * Does this OS have NDBM support? + */ +#define OS_HAS_NDBM + +/* + * The mount table is obtained from the kernel + */ +#undef UPDATE_MTAB + +/* + * Pick up BSD bits from include files + * Try for 4.4 compatibility if available (AIX 3.2 and later) + */ +#define _BSD 44 + +/* + * No mntent info on AIX 3 + */ +#undef MNTENT_HDR +#define MNTENT_HDR + +/* + * Name of filesystem types + */ +#define MOUNT_TYPE_NFS MNT_NFS +#define MOUNT_TYPE_UFS MNT_JFS +#undef MTAB_TYPE_UFS +#define MTAB_TYPE_UFS "jfs" + +/* + * How to unmount filesystems + */ +#undef MOUNT_TRAP +#define MOUNT_TRAP(type, mnt, flag, mnt_data) \ + aix3_mount(mnt->mnt_fsname, mnt->mnt_dir, flag, type, mnt_data, mnt->mnt_opts) +#undef UNMOUNT_TRAP +#define UNMOUNT_TRAP(mnt) uvmount(mnt->mnt_passno, 0) + + +/* + * Byte ordering + */ +#ifndef BYTE_ORDER +#include +#endif /* BYTE_ORDER */ + +#undef ARCH_ENDIAN +#if BYTE_ORDER == LITTLE_ENDIAN +#define ARCH_ENDIAN "little" +#else +#if BYTE_ORDER == BIG_ENDIAN +#define ARCH_ENDIAN "big" +#else +XXX - Probably no hope of running Amd on this machine! +#endif /* BIG */ +#endif /* LITTLE */ + +/* + * Miscellaneous AIX 3 bits + */ +#define NEED_MNTOPT_PARSER +#define SHORT_MOUNT_NAME + +#define MNTMAXSTR 128 + +#define MNTTYPE_UFS "jfs" /* Un*x file system */ +#define MNTTYPE_NFS "nfs" /* network file system */ +#define MNTTYPE_IGNORE "ignore" /* No type specified, ignore this entry */ + +struct mntent { + char *mnt_fsname; /* name of mounted file system */ + char *mnt_dir; /* file system path prefix */ + char *mnt_type; /* MNTTYPE_* */ + char *mnt_opts; /* MNTOPT* */ + int mnt_freq; /* dump frequency, in days */ + int mnt_passno; /* pass number on parallel fsck */ +}; + +#define NFS_HDR "misc-aix3.h" +#define UFS_HDR "misc-aix3.h" +#undef NFS_FH_DREF +#define NFS_FH_DREF(dst, src) { (dst) = *(src); } +#undef NFS_SA_DREF +#define NFS_SA_DREF(dst, src) { (dst).addr = *(src); } +#define M_RDONLY MNT_READONLY + +/* + * How to get a mount list + */ +#undef READ_MTAB_FROM_FILE +#define READ_MTAB_AIX3_STYLE + +/* + * The data for the mount syscall needs the path in addition to the + * host name since that is the only source of information about the + * mounted filesystem. +#define NFS_ARGS_NEEDS_PATH + */ + +#define NFS_LOMAP 34 +#define NFS_HIMAP 99 +#define NFS_ERROR_MAPPING \ +static nfs_errormap[] = { 0,75,77,99,99,99, \ + 99,99,99,99,99,78,99,99,99,79, \ + 99,99,70,99,35,36,37,38,39,40, \ + 41,42,43,44,45,46,47,48,49,50, \ + 51,52,53,54,55,56,57,58,60,61, \ + 64,65,99,67,68,62,63,66,69,68, \ + 99,99,99,71,99,99,99,99,99,99 \ + }; + +#define MOUNT_HELPER_SOURCE "mount_aix.c" + +/* + * Need this too + */ +#include +#include diff --git a/include/sun_stdlib.h b/include/sun_stdlib.h new file mode 100644 index 0000000..ac6757a --- /dev/null +++ b/include/sun_stdlib.h @@ -0,0 +1,268 @@ +/* + * sun_stdlib.h 95/06/07 + * + * Copyright 1994, BBW + * + */ +/* + * Copyright 1992-1994 Rudolf Koenig. + * sun_stdlib.h + * + * This header file is redundant/wrong for architectures that have sane + * header files. Grrr. + */ +#ifndef __sun_stdlib_h +#define __sun_stdlib_h +#if defined(FILE) + +#if !defined(STDIO_WRITE_NOW) + +extern int fputs(char *, FILE *); +extern int fseek(FILE *, int, int); +extern int fclose(FILE *); +extern int fread(char *, int, int, FILE *); +extern int fwrite(char *, int, int, FILE *); +extern int fflush(FILE *); +extern int fprintf(FILE *, const char *, ... ); +extern void rewind(FILE *); +extern void setvbuf(FILE *stream, char *buf, int type, int size); +extern void setbuffer(FILE *stream, char *buf, int size); + +extern int _filbuf( FILE * ); +extern int _flsbuf(unsigned char, FILE*); +#else +extern int _fill_buffer_( FILE * ); +extern int _flush_buffer_(int, FILE*); +#endif + +#endif + +extern int puts(char *); + +#if !defined(STDIO_WRITE_NOW) +extern int printf( const char *, ... ); +#endif + + +extern int getpid(void); +extern int getppid(void); +extern int pipe(int *); + +#if 1 +extern char *sprintf( char *, const char *, ... ); +extern char *vsprintf( char *, const char *, ... ); +#endif +extern int vfork(void); +extern int fork(void); +extern int close(int); +extern int dup(int); + +#ifndef __sys_unistd_h /* GNUCC has another imagination about this */ +extern int execl(char *, ... ); +extern int execv(char *, char *[]); +extern int execle(char *, ... ); +extern int execlp(char *, ... ); +extern int execvp(char *, char *[]); +extern int setuid(int); +#endif + +extern int seteuid(int); + +extern int getpgrp(int); +extern int setpgrp(int, int); + +extern int gethostname (char *, int); +extern int sethostname (char *, int); + +#ifdef _sys_socket_h +extern int getpeername(int, struct sockaddr *, int *); +extern int send(int, char *, int, int); +extern int sendto(int, char *, int, int, struct sockaddr *, int); +extern int recv(int, char *, int, int); +extern int recvfrom(int, char *, int, int, struct sockaddr *, int *); +#endif + +#ifdef _sys_vfs_h +extern int statfs(const char *, struct statfs *); +#endif + +#ifdef __sys_types_h /* def of caddr_t */ +extern time_t time(time_t *); +extern int ioctl(int, int, caddr_t); +extern int truncate(char *, off_t); +extern int ftruncate(int, off_t); +caddr_t mmap(caddr_t, size_t, int, int, int, off_t); +int munmap(caddr_t, int); +#endif +extern void perror(char *); + +extern int openlog(char *, int, int); + +extern int syslog(int, char *, ... ); +extern int closelog(void); +extern int setlogmask(int); + +extern unsigned int alarm(unsigned int); + +extern char *crypt(char *, char *); +extern char *_crypt(char *, char *); +extern int setkey(char *); +extern int encrypt(char *, int); + +extern char *getenv(char *name); +extern int putenv(char *); +extern void bcopy(char *, char *, int); +extern void bzero(char *, int); +extern int bcmp(char *, char *, int); +extern int tolower(int); +extern int toupper(int); + +#if !defined(__memory_h__) +extern void memset(char *, int, int); +#if !defined(__GNUC__) +extern char *memcpy(char *, char *, int); +extern int memcmp(char *, char *, int); +#endif +#endif + +extern int ffs(int); + +extern int sigblock(int); +extern int sigsetmask(int); +extern int sigpause(int); + +extern int unmount(char *name); +extern int umount(char *name); +int mount(char *type, char *dir, int flags, char *data); + + +#ifdef __sys_stat_h +extern int fchmod(int fd, mode_t mode); +#endif + +#ifdef _mntent_h +extern FILE *setmntent(char *filep, char *type); +extern struct mntent *getmntent(FILE *filep); +extern int addmntent(FILE *filep, struct mntent *mnt); +extern char *hasmntopt(struct mntent *mnt, char *opt); +extern int endmntent(FILE *filep); +#endif + +#ifdef __pwd_h +extern struct passwd *getpwent(void); +extern void endpwent(void); +#endif + + +extern int usleep(unsigned); +#if 0 +extern int lseek(int, int, int); +#endif + +#ifndef __sys_unistd_h /* GNUCC has another imagination about this */ +extern int read(int, char *, int); +extern int write(int, char *, int); +extern int sleep(unsigned int); +extern int getuid(void); +extern int geteuid(void); +#endif +extern int fsync(int); + +extern int rename(const char *, const char *); +extern int unlink(const char *); +#if defined(__sys_dirent_h) +extern int scandir(char *, struct dirent ***, int (*)(), int (*)()); +#else +#if defined(_sys_dir_h) +extern int scandir(char *, struct direct ***, int (*)(), int (*)()); +#endif +#endif + +#ifndef __stdlib_h +extern int atoi(char *); +extern int qsort(char *, int, int, int (*)()); +#endif + +extern char *rindex(const char *, const char); +extern char *index(const char *, const char); + +#ifndef __string_h /* GNUCC string.h */ +extern int strcmp(const char *, const char *); +extern int strncmp(const char *, const char *, int); +extern char *strcat(char *, const char *); +extern char *strdup(const char *); + +extern int strcpy(char *, const char *); +extern int strncpy(char *, const char *, int); + +extern int strtok(char *, char *); +#endif + +extern int strtol(char *, char **, int); + +extern int system(char *); +#ifdef RLIMIT_NOFILE +extern int getrlimit(int, struct rlimit *); +extern int setrlimit(int, struct rlimit *); +#endif + +extern int chdir(const char *); +#if defined(_sys_time_h) && defined(__sys_types_h) +extern int select(int, fd_set *, fd_set *, fd_set *, struct timeval *); +extern int gettimeofday(struct timeval *tp, struct timezone *tzp); +extern int getitimer(int, struct itimerval *); +extern int setitimer(int, struct itimerval *, struct itimerval *); +#endif +extern char *getpass(char *); +#if !defined(__malloc_h) && !defined(__stdlib_h) /* GNU malloc defs */ +extern void *realloc(void *, unsigned); +extern void *calloc(unsigned, unsigned); +extern void *malloc(unsigned); +extern void free(const char *); +#endif + +#ifdef SOCK_STREAM +extern int socket(int, int, int); +extern int connect(int, struct sockaddr *, int); +extern int bind(int, struct sockaddr *, int); +extern int getsockname(int, struct sockaddr *, int *); +extern int accept(int, struct sockaddr *, int *); +extern int listen(int, int); +extern int shutdown(int, int); +extern int inet_addr(char *); +extern int getsockopt(int, int, int, char *, int *); +extern int setsockopt(int, int, int, char *, int); + +#endif + +#ifdef _nettli_tiuser_h +extern int t_open(char *, int, struct t_info *); +extern void t_error(char *); +extern int t_bind(int, struct t_bind *, struct t_bind *); +extern int t_listen(int, struct t_call *); +extern int t_accept(int, int, struct t_call *); +extern int t_rcv(int, char *, unsigned int, int *); +extern int t_snd(int, char *, unsigned int, int); +extern int t_close(int); +extern int t_connect(int, struct t_call *, struct t_call *); +#endif +#ifdef _sys_poll_h +extern int poll(struct pollfd *, unsigned long, int); +#endif + +#ifdef _sys_resource_h +int wait3(int *, int, struct rusage *); +#else +int wait3(int *, int, int); +#endif + +#ifdef _sys_asynch_h +extern aio_result_t *aiowait(struct timeval *); +extern int aioread(int, char *, int, int, int, aio_result_t *); +extern int aiowrite(int, char *, int, int, int, aio_result_t *); +extern int aiocancel(aio_result_t *); +#endif + +extern int on_exit(void (*procp)(), void *arg); + +#endif diff --git a/install-sh b/install-sh new file mode 100755 index 0000000..67c9429 --- /dev/null +++ b/install-sh @@ -0,0 +1,238 @@ +#! /bin/sh +# +# install - install a program, script, or datafile +# This comes from X11R5. +# +# Calling this script install-sh is preferred over install.sh, to prevent +# `make' implicit rules from creating a file called install from it +# when there is no Makefile. +# +# This script is compatible with the BSD install script, but was written +# from scratch. +# + + +# set DOITPROG to echo to test this script + +# Don't use :- since 4.3BSD and earlier shells don't like it. +doit="${DOITPROG-}" + + +# put in absolute paths if you don't have them in your path; or use env. vars. + +mvprog="${MVPROG-mv}" +cpprog="${CPPROG-cp}" +chmodprog="${CHMODPROG-chmod}" +chownprog="${CHOWNPROG-chown}" +chgrpprog="${CHGRPPROG-chgrp}" +stripprog="${STRIPPROG-strip}" +rmprog="${RMPROG-rm}" +mkdirprog="${MKDIRPROG-mkdir}" + +transformbasename="" +transform_arg="" +instcmd="$mvprog" +chmodcmd="$chmodprog 0755" +chowncmd="" +chgrpcmd="" +stripcmd="" +rmcmd="$rmprog -f" +mvcmd="$mvprog" +src="" +dst="" +dir_arg="" + +while [ x"$1" != x ]; do + case $1 in + -c) instcmd="$cpprog" + shift + continue;; + + -d) dir_arg=true + shift + continue;; + + -m) chmodcmd="$chmodprog $2" + shift + shift + continue;; + + -o) chowncmd="$chownprog $2" + shift + shift + continue;; + + -g) chgrpcmd="$chgrpprog $2" + shift + shift + continue;; + + -s) stripcmd="$stripprog" + shift + continue;; + + -t=*) transformarg=`echo $1 | sed 's/-t=//'` + shift + continue;; + + -b=*) transformbasename=`echo $1 | sed 's/-b=//'` + shift + continue;; + + *) if [ x"$src" = x ] + then + src=$1 + else + # this colon is to work around a 386BSD /bin/sh bug + : + dst=$1 + fi + shift + continue;; + esac +done + +if [ x"$src" = x ] +then + echo "install: no input file specified" + exit 1 +else + true +fi + +if [ x"$dir_arg" != x ]; then + dst=$src + src="" + + if [ -d $dst ]; then + instcmd=: + else + instcmd=mkdir + fi +else + +# Waiting for this to be detected by the "$instcmd $src $dsttmp" command +# might cause directories to be created, which would be especially bad +# if $src (and thus $dsttmp) contains '*'. + + if [ -f "$src" -o -d "$src" ] + then + true + else + echo "install: $src does not exist" + exit 1 + fi + + if [ x"$dst" = x ] + then + echo "install: no destination specified" + exit 1 + else + true + fi + +# If destination is a directory, append the input filename; if your system +# does not like double slashes in filenames, you may need to add some logic + + if [ -d $dst ] + then + dst="$dst"/`basename $src` + else + true + fi +fi + +## this sed command emulates the dirname command +dstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'` + +# Make sure that the destination directory exists. +# this part is taken from Noah Friedman's mkinstalldirs script + +# Skip lots of stat calls in the usual case. +if [ ! -d "$dstdir" ]; then +defaultIFS=' +' +IFS="${IFS-${defaultIFS}}" + +oIFS="${IFS}" +# Some sh's can't handle IFS=/ for some reason. +IFS='%' +set - `echo ${dstdir} | sed -e 's@/@%@g' -e 's@^%@/@'` +IFS="${oIFS}" + +pathcomp='' + +while [ $# -ne 0 ] ; do + pathcomp="${pathcomp}${1}" + shift + + if [ ! -d "${pathcomp}" ] ; + then + $mkdirprog "${pathcomp}" + else + true + fi + + pathcomp="${pathcomp}/" +done +fi + +if [ x"$dir_arg" != x ] +then + $doit $instcmd $dst && + + if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else true ; fi && + if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else true ; fi && + if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else true ; fi && + if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else true ; fi +else + +# If we're going to rename the final executable, determine the name now. + + if [ x"$transformarg" = x ] + then + dstfile=`basename $dst` + else + dstfile=`basename $dst $transformbasename | + sed $transformarg`$transformbasename + fi + +# don't allow the sed command to completely eliminate the filename + + if [ x"$dstfile" = x ] + then + dstfile=`basename $dst` + else + true + fi + +# Make a temp file name in the proper directory. + + dsttmp=$dstdir/#inst.$$# + +# Move or copy the file name to the temp name + + $doit $instcmd "$src" $dsttmp && + + trap "rm -f ${dsttmp}" 0 && + +# and set any options; do chmod last to preserve setuid bits + +# If any of these fail, we abort the whole thing. If we want to +# ignore errors from any of these, just make sure not to ignore +# errors from the above "$doit $instcmd $src $dsttmp" command. + + if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; else true;fi && + if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else true;fi && + if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else true;fi && + if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else true;fi && + +# Now rename the file to the real destination. + + $doit $rmcmd -f $dstdir/$dstfile && + $doit $mvcmd $dsttmp $dstdir/$dstfile + +fi && + + +exit 0 diff --git a/missing b/missing new file mode 100755 index 0000000..cbe2b0e --- /dev/null +++ b/missing @@ -0,0 +1,188 @@ +#! /bin/sh +# Common stub for a few missing GNU programs while installing. +# Copyright (C) 1996, 1997 Free Software Foundation, Inc. +# Franc,ois Pinard , 1996. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +# 02111-1307, USA. + +if test $# -eq 0; then + echo 1>&2 "Try \`$0 --help' for more information" + exit 1 +fi + +case "$1" in + + -h|--h|--he|--hel|--help) + echo "\ +$0 [OPTION]... PROGRAM [ARGUMENT]... + +Handle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an +error status if there is no known handling for PROGRAM. + +Options: + -h, --help display this help and exit + -v, --version output version information and exit + +Supported PROGRAM values: + aclocal touch file \`aclocal.m4' + autoconf touch file \`configure' + autoheader touch file \`config.h.in' + automake touch all \`Makefile.in' files + bison create \`y.tab.[ch]', if possible, from existing .[ch] + flex create \`lex.yy.c', if possible, from existing .c + lex create \`lex.yy.c', if possible, from existing .c + makeinfo touch the output file + yacc create \`y.tab.[ch]', if possible, from existing .[ch]" + ;; + + -v|--v|--ve|--ver|--vers|--versi|--versio|--version) + echo "missing - GNU libit 0.0" + ;; + + -*) + echo 1>&2 "$0: Unknown \`$1' option" + echo 1>&2 "Try \`$0 --help' for more information" + exit 1 + ;; + + aclocal) + echo 1>&2 "\ +WARNING: \`$1' is missing on your system. You should only need it if + you modified \`acinclude.m4' or \`configure.in'. You might want + to install the \`Automake' and \`Perl' packages. Grab them from + any GNU archive site." + touch aclocal.m4 + ;; + + autoconf) + echo 1>&2 "\ +WARNING: \`$1' is missing on your system. You should only need it if + you modified \`configure.in'. You might want to install the + \`Autoconf' and \`GNU m4' packages. Grab them from any GNU + archive site." + touch configure + ;; + + autoheader) + echo 1>&2 "\ +WARNING: \`$1' is missing on your system. You should only need it if + you modified \`acconfig.h' or \`configure.in'. You might want + to install the \`Autoconf' and \`GNU m4' packages. Grab them + from any GNU archive site." + files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER([^):]*:\([^)]*\)).*/\1/p' configure.in` + if test -z "$files"; then + files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^):]*\)).*/\1/p' configure.in` + test -z "$files" || files="$files.in" + else + files=`echo "$files" | sed -e 's/:/ /g'` + fi + test -z "$files" && files="config.h.in" + touch $files + ;; + + automake) + echo 1>&2 "\ +WARNING: \`$1' is missing on your system. You should only need it if + you modified \`Makefile.am', \`acinclude.m4' or \`configure.in'. + You might want to install the \`Automake' and \`Perl' packages. + Grab them from any GNU archive site." + find . -type f -name Makefile.am -print \ + | sed 's/^\(.*\).am$/touch \1.in/' \ + | sh + ;; + + bison|yacc) + echo 1>&2 "\ +WARNING: \`$1' is missing on your system. You should only need it if + you modified a \`.y' file. You may need the \`Bison' package + in order for those modifications to take effect. You can get + \`Bison' from any GNU archive site." + rm -f y.tab.c y.tab.h + if [ $# -ne 1 ]; then + eval LASTARG="\${$#}" + case "$LASTARG" in + *.y) + SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'` + if [ -f "$SRCFILE" ]; then + cp "$SRCFILE" y.tab.c + fi + SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'` + if [ -f "$SRCFILE" ]; then + cp "$SRCFILE" y.tab.h + fi + ;; + esac + fi + if [ ! -f y.tab.h ]; then + echo >y.tab.h + fi + if [ ! -f y.tab.c ]; then + echo 'main() { return 0; }' >y.tab.c + fi + ;; + + lex|flex) + echo 1>&2 "\ +WARNING: \`$1' is missing on your system. You should only need it if + you modified a \`.l' file. You may need the \`Flex' package + in order for those modifications to take effect. You can get + \`Flex' from any GNU archive site." + rm -f lex.yy.c + if [ $# -ne 1 ]; then + eval LASTARG="\${$#}" + case "$LASTARG" in + *.l) + SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'` + if [ -f "$SRCFILE" ]; then + cp "$SRCFILE" lex.yy.c + fi + ;; + esac + fi + if [ ! -f lex.yy.c ]; then + echo 'main() { return 0; }' >lex.yy.c + fi + ;; + + makeinfo) + echo 1>&2 "\ +WARNING: \`$1' is missing on your system. You should only need it if + you modified a \`.texi' or \`.texinfo' file, or any other file + indirectly affecting the aspect of the manual. The spurious + call might also be the consequence of using a buggy \`make' (AIX, + DU, IRIX). You might want to install the \`Texinfo' package or + the \`GNU make' package. Grab either from any GNU archive site." + file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'` + if test -z "$file"; then + file=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'` + file=`sed -n '/^@setfilename/ { s/.* \([^ ]*\) *$/\1/; p; q; }' $file` + fi + touch $file + ;; + + *) + echo 1>&2 "\ +WARNING: \`$1' is needed, and you do not seem to have it handy on your + system. You might have modified some files without having the + proper tools for further handling them. Check the \`README' file, + it often tells you about the needed prerequirements for installing + this package. You may also peek at any GNU archive site, in case + some other package would contain this missing \`$1' program." + exit 1 + ;; +esac + +exit 0 diff --git a/mkinstalldirs b/mkinstalldirs new file mode 100755 index 0000000..cc8783e --- /dev/null +++ b/mkinstalldirs @@ -0,0 +1,36 @@ +#! /bin/sh +# mkinstalldirs --- make directory hierarchy +# Author: Noah Friedman +# Created: 1993-05-16 +# Last modified: 1994-03-25 +# Public domain + +errstatus=0 + +for file in ${1+"$@"} ; do + set fnord `echo ":$file" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'` + shift + + pathcomp= + for d in ${1+"$@"} ; do + pathcomp="$pathcomp$d" + case "$pathcomp" in + -* ) pathcomp=./$pathcomp ;; + esac + + if test ! -d "$pathcomp"; then + echo "mkdir $pathcomp" 1>&2 + mkdir "$pathcomp" > /dev/null 2>&1 || lasterr=$? + fi + + if test ! -d "$pathcomp"; then + errstatus=$lasterr + fi + + pathcomp="$pathcomp/" + done +done + +exit $errstatus + +# mkinstalldirs ends here -- cgit v1.2.3