Subject: date(1) vs. AD2000, cpp, {get,set}hostid(2), more... (#327) Index: bin/date.c,many_others 2.11BSD Description: 1. date(1) does not do the right thing when given a year past 1999. 2. gethostid(2) is declared differently in two system include files. 3. sethostid(2) is misdeclared as a 'void' function in both unistd.h and the lint library. 4. time(2) does not have a declaration in time.h. 5. cpp still thinks the system is 2.10BSD. 6. ctimed and the matching stub module do not belong in the sendmail source directory. Repeat-By: 1. Currently, any digits in the "year" field to the date command below "70" are translated into "1970". Fix: 1. The simplest fix (contributed by shoppa@triumf.ca) was to interpret years between "00" and "38" as 2000 to 2038. Thus midnight Jan 1, 2000 would be entered as "date 0001010000". 2. This problem was spotted by Victor.Langeveld@mbfys.kun.nl. In netdb.h gethostid() was declared as returning a "unsigned long" but in unistd.h the same function was declared as "long". It's not good to have multiple declarations present but it's bad news to have conflicting declarations. The fix was to remove the declaration from netdb.h. Programs which use 'gethostid()' (and there are only two in the entire system: hostid(1) and hunt(6)) should include unistd.h. 3. When unistd.h was ported from 4.4-Lite the declaration of sethostid(2) was not fixed. A sucess/fail status is returned from the kernel, thus it was a mistake to declare sethostid() as 'void'. 4. time(2) had no declaration in the system include files. Individual programs would locally declare time() as returning 'long'. This is bad because it makes changing the type of time(2) much more difficult. time(2) is now declared (in time.h) to return a 'time_t'. For now 'time_t' is a 'long'. In the future this may change to be an 'unsigned long' in order to handle dates up to the year 2099. The current 'long' type is sufficient to handle up to 2035 or so. Ask me in 30 years if I feel like changing 'time_t' ;-). 5. The C preprocessor (/lib/cpp) still thought the system was a 2.10BSD system. This made it very hard to #ifdef code based on whether 'BSD2_11' instead of 'BSD2_10' was defined (BSD2_10 was always defined, even on a 2.11 system). 6. 'ctimed' is a program used to move ctime(3) external to a process. A large program (sendmail for example) links with a set of "stub" routines which replace ctime() (and other functions). Sendmail(8) was the first program for which 'ctimed' and "stubs" were written so the sources to 'ctimed' were incorrectly placed in the sendmail source directory. This made it appear that only sendmail could use 'ctimed' which is definitely not the case. Kermit uses 'ctimed' for example. The changes to kermit (makefile, etc) will be published later, for now kermit will continue to use. 'ctimed' should have been entered into a separate directory. For this purpose '/usr/libexec' is being introduced into the system. Eventually the lead of 4.4 will be followed and other system executables (telnetd, rlogind, rshd, fingerd, etc) will be relocated into /usr/libexec. The "stubs" module has been made into a library residing in /usr/lib. Programs which want to use 'ctimed' now simply include "-lstubs" at the end (but before '-lc') of their list of libraries being linked with. The shar archive below contains the following files: 1) A patch file (/tmp/327.patch) which is fed to 'patch' and updates the following files: /usr/include/netdb.h /usr/include/paths.h /usr/include/time.h /usr/include/unistd.h /usr/lib/lint/llib-lc /usr/src/Makefile /usr/src/bin/date.c /usr/src/bin/hostid.c /usr/src/games/hunt/answer.c /usr/src/lib/cpp/Makefile /usr/src/lib/cpp/cpp.c /usr/src/usr.lib/Makefile /usr/src/usr.lib/sendmail/src/Makefile.m4 /VERSION 2) A shell script (/tmp/327.sh) which renames the following files to .old files: /usr/src/usr.lib/sendmail/src/ctime.c /usr/src/usr.lib/sendmail/src/ctimed.c /usr/src/usr.lib/sendmail/src/Makefile.ns (these files could be removed - they are no longer needed) 3) A shar archive (/tmp/327.shar) which adds the following new files to the system: /usr/libexec: total 0 /usr/src/libexec: total 2 -rw-r--r-- 1 root 521 Jun 25 20:11 Makefile drwxr-xr-x 2 root 512 Jun 25 20:34 ctimed /usr/src/libexec/ctimed: total 7 -rw-r--r-- 1 root 450 Jun 25 20:34 Makefile -rw-r--r-- 1 root 5289 Jun 25 20:16 ctimed.c /usr/src/usr.lib/libstubs: total 8 -rw-r--r-- 1 root 558 Jun 25 20:24 Makefile -rw-r--r-- 1 root 4323 Jun 25 20:31 stubs.c -rw-r--r-- 1 root 1600 Jun 25 20:09 stubtest.c To install this update cut where indicated and save to a tmp file (/tmp/327). Then: cd /tmp sh 327 sh 327.sh sh 327.shar patch -p0 < 327.patch Next the C preprocessor (cpp) is rebuilt: cd /usr/src/lib/cpp make make install make clean The lint libraries are next: cd /usr/src/usr.bin/lint ./libs Now do the 'stubs' library: cd /usr/src/usr.lib/libstubs make make install make clean and the new 'ctimed' program: cd /usr/src/libexec/ctimed make make install make clean Now that the infrastructure is in place 'sendmail' is rebuilt: cd /usr/src/usr.lib/sendmail/src m4 < Makefile.m4 > Makefile make make install /usr/lib/sendmail -bz make clean At this point the currently running 'sendmail' process should be killed and restarted (if you are running sendmail from inetd this is not necessary). The one other program in the system (excluding locally written works of art) which uses 'gethostid' is then built: cd /usr/src/games/hunt make make install make clean Last of all, the 'hostid' and 'date' programs are rebuilt: cd /usr/src/bin make hostid date install -m 755 -s hostid date /bin All done. You may want to clean up /tmp by removing the various 327.* files at this point. This and previous updates are available via anonymous FTP to either FTP.2BSD.COM or FTP.IIPO.GTEGSC.COM in the directory /pub/2.11BSD. -----------------------------cut here------------------------ #! /bin/sh # This is a shell archive, meaning: # 1. Remove everything above the #! /bin/sh line. # 2. Save the resulting text in a file. # 3. Execute the file with /bin/sh (not csh) to create: # /tmp/327.patch # /tmp/327.sh # /tmp/327.shar # This archive created: Fri Jul 12 21:16:39 1996 export PATH; PATH=/bin:/usr/bin:$PATH if test -f '/tmp/327.patch' then echo shar: "will not over-write existing file '/tmp/327.patch'" else sed 's/^Z//' << \SHAR_EOF > '/tmp/327.patch' Z*** /usr/include/netdb.h.old Mon Jan 10 21:25:47 1994 Z--- /usr/include/netdb.h Wed Jul 10 20:01:54 1996 Z*************** Z*** 9,15 **** Z * software without specific prior written permission. This software Z * is provided ``as is'' without express or implied warranty. Z * Z! * @(#)netdb.h 5.9.1 (2.11BSD GTE) 12/31/93 Z */ Z Z /* Z--- 9,15 ---- Z * software without specific prior written permission. This software Z * is provided ``as is'' without express or implied warranty. Z * Z! * @(#)netdb.h 5.9.2 (2.11BSD GTE) 96/7/10 Z */ Z Z /* Z*************** Z*** 67,71 **** Z #define NO_RECOVERY 3 /* Non recoverable errors, FORMERR, REFUSED, NOTIMP */ Z #define NO_DATA 4 /* Valid name, no data record of requested type */ Z #define NO_ADDRESS NO_DATA /* no address, look for MX record */ Z- Z- unsigned long gethostid(); Z--- 67,69 ---- Z*** /usr/include/paths.h.old Mon Apr 10 22:10:57 1995 Z--- /usr/include/paths.h Tue Jun 25 20:30:50 1996 Z*************** Z*** 14,20 **** Z * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED Z * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. Z * Z! * @(#)pathnames.h 5.3.4 (2.11BSD) 1995/04/10 Z */ Z Z #define _PATH_BSHELL "/bin/sh" Z--- 14,20 ---- Z * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED Z * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. Z * Z! * @(#)pathnames.h 5.3.5 (2.11BSD) 1996/6/25 Z */ Z Z #define _PATH_BSHELL "/bin/sh" Z*************** Z*** 32,34 **** Z--- 32,35 ---- Z #define _PATH_SENDMAIL "/usr/lib/sendmail" Z #define _PATH_DEVDB "/var/run/dev" Z #define _PATH_VARRUN "/var/run/" Z+ #define _PATH_CTIMED "/usr/libexec/ctimed" Z*** /usr/include/time.h.old Mon Mar 30 17:57:18 1987 Z--- /usr/include/time.h Wed Jul 10 19:56:06 1996 Z*************** Z*** 3,11 **** Z * All rights reserved. The Berkeley software License Agreement Z * specifies the terms and conditions for redistribution. Z * Z! * @(#)time.h 1.2 (Berkeley) 3/4/87 Z */ Z Z /* Z * Structure returned by gmtime and localtime calls (see ctime(3)). Z */ Z--- 3,13 ---- Z * All rights reserved. The Berkeley software License Agreement Z * specifies the terms and conditions for redistribution. Z * Z! * @(#)time.h 1.3 (2.11BSD) 96/7/10 Z */ Z Z+ #include /* for time_t */ Z+ Z /* Z * Structure returned by gmtime and localtime calls (see ctime(3)). Z */ Z*************** Z*** 25,27 **** Z--- 27,30 ---- Z Z extern struct tm *gmtime(), *localtime(); Z extern char *asctime(), *ctime(); Z+ extern time_t time(); Z*** /usr/include/unistd.h.old Fri Jan 12 22:02:40 1996 Z--- /usr/include/unistd.h Thu Jul 11 19:34:32 1996 Z*************** Z*** 30,36 **** Z * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF Z * SUCH DAMAGE. Z * Z! * @(#)unistd.h 8.10.1 (2.11BSD) 1996/1/12 Z */ Z Z /* Z--- 30,36 ---- Z * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF Z * SUCH DAMAGE. Z * Z! * @(#)unistd.h 8.10.2 (2.11BSD) 1996/7/11 Z */ Z Z /* Z*************** Z*** 83,89 **** Z extern char *sys_siglist[]; Z char *re_comp(); Z char *sbrk(); Z! void sethostid(); Z void setusershell(); Z void sync(); Z unsigned int ualarm(); Z--- 83,89 ---- Z extern char *sys_siglist[]; Z char *re_comp(); Z char *sbrk(); Z! int sethostid(); Z void setusershell(); Z void sync(); Z unsigned int ualarm(); Z*** /usr/lib/lint/llib-lc.old Tue Mar 26 23:32:27 1996 Z--- /usr/lib/lint/llib-lc Thu Jul 11 19:32:55 1996 Z*************** Z*** 1,4 **** Z! /* @(#)llib-lc 1.43 (2.11BSD GTE) 1996/3/26 */ Z Z /* LINTLIBRARY */ Z Z--- 1,4 ---- Z! /* @(#)llib-lc 1.44 (2.11BSD GTE) 1996/7/10 */ Z Z /* LINTLIBRARY */ Z Z*************** Z*** 74,80 **** Z uid_t geteuid() { return((uid_t)1); } Z gid_t getgid() { return((gid_t)1); } Z int getgroups( n, g ) int n, *g; { return 0; } Z! u_long gethostid() { return 1L; } Z int gethostname( n, l ) char *n; int l; { return 0 ;} Z int getitimer( w, v ) struct itimerval *v; { return 0; } Z int getloadavg( d, n) double d[]; int n; { return 0; } Z--- 74,80 ---- Z uid_t geteuid() { return((uid_t)1); } Z gid_t getgid() { return((gid_t)1); } Z int getgroups( n, g ) int n, *g; { return 0; } Z! long gethostid() { return 1L; } Z int gethostname( n, l ) char *n; int l; { return 0 ;} Z int getitimer( w, v ) struct itimerval *v; { return 0; } Z int getloadavg( d, n) double d[]; int n; { return 0; } Z*************** Z*** 131,137 **** Z int recvmsg( s, m, f ) struct msghdr m[]; { return 1; } Z int rename( f, t ) char *f, *t; { return 0;} Z int rmdir( p ) char *p; { return 0;} Z- int rtp(f) { return(0); } Z char *sbrk(i) { return((char *)0); } Z int select( n, r, w, e, t ) fd_set *r, *w, *e; struct timeval *t; { return n; } Z int send( s, m, l, f ) char *m; { return l; } Z--- 131,136 ---- Z*************** Z*** 138,144 **** Z int sendto( s, m, l, f, t, tl ) char *m; struct sockaddr *t; { return l; } Z int sendmsg( s, m, l) struct msghdr m[]; { return l; } Z int setgroups( n, g) int *g; { return 0; } Z! int sethostid( h ) long h; { return 0;} Z int sethostname( n, l ) char *n; int l; { return 0 ;} Z int setitimer( w, v, ov ) struct itimerval *v, *ov; { return 0; } Z int setpgrp( g, pg) { return 0; } Z--- 137,143 ---- Z int sendto( s, m, l, f, t, tl ) char *m; struct sockaddr *t; { return l; } Z int sendmsg( s, m, l) struct msghdr m[]; { return l; } Z int setgroups( n, g) int *g; { return 0; } Z! int sethostid( h ) long h; { return 0; } Z int sethostname( n, l ) char *n; int l; { return 0 ;} Z int setitimer( w, v, ov ) struct itimerval *v, *ov; { return 0; } Z int setpgrp( g, pg) { return 0; } Z*************** Z*** 407,413 **** Z int system(s) char *s; { return(0); } Z long tell(f) { return((long)0); } Z long telldir( p ) DIR *p; { return 1L; } Z! long time(t) long *t; { return( 0L );} Z int times(tmsp) struct tms *tmsp; { return 0; } Z char * timezone( z, d ){ return (char *)0; } Z char * tmpnam(s) char *s; { return s; } Z--- 406,412 ---- Z int system(s) char *s; { return(0); } Z long tell(f) { return((long)0); } Z long telldir( p ) DIR *p; { return 1L; } Z! time_t time(t) time_t *t; { return( (time_t)0 );} Z int times(tmsp) struct tms *tmsp; { return 0; } Z char * timezone( z, d ){ return (char *)0; } Z char * tmpnam(s) char *s; { return s; } Z*** /usr/src/Makefile.old Sat Jan 23 15:59:57 1993 Z--- /usr/src/Makefile Tue Jun 25 20:05:01 1996 Z*************** Z*** 3,9 **** Z # All rights reserved. The Berkeley software License Agreement Z # specifies the terms and conditions for redistribution. Z # Z! # @(#)Makefile 4.13 (Berkeley) 5/15/86 Z # Z # This makefile is designed to be run as: Z # make build Z--- 3,9 ---- Z # All rights reserved. The Berkeley software License Agreement Z # specifies the terms and conditions for redistribution. Z # Z! # @(#)Makefile 4.14 (2.11BSD) 96/6/25 Z # Z # This makefile is designed to be run as: Z # make build Z*************** Z*** 43,49 **** Z # Programs that live in subdirectories, and have makefiles of their own. Z # Z LIBDIR= lib usr.lib Z! SRCDIR= bin etc games local new ucb usr.bin man Z Z all: ${LIBDIR} ${SRCDIR} Z Z--- 43,49 ---- Z # Programs that live in subdirectories, and have makefiles of their own. Z # Z LIBDIR= lib usr.lib Z! SRCDIR= bin etc games libexec local new ucb usr.bin man Z Z all: ${LIBDIR} ${SRCDIR} Z Z*** /usr/src/bin/date.c.old Sun Jul 3 16:05:03 1988 Z--- /usr/src/bin/date.c Wed Jul 10 20:00:34 1996 Z*************** Z*** 4,18 **** Z * specifies the terms and conditions for redistribution. Z */ Z Z! #ifndef lint Z char copyright[] = Z "@(#) Copyright (c) 1985 Regents of the University of California.\n\ Z All rights reserved.\n"; Z- #endif not lint Z Z! #ifndef lint Z! static char sccsid[] = "@(#)date.c 4.20 (Berkeley) 3/24/87"; Z! #endif not lint Z Z /* Z * Date - print and set date Z--- 4,16 ---- Z * specifies the terms and conditions for redistribution. Z */ Z Z! #if !defined(LINT) && defined(DOSCCS) Z char copyright[] = Z "@(#) Copyright (c) 1985 Regents of the University of California.\n\ Z All rights reserved.\n"; Z Z! static char sccsid[] = "@(#)date.c 4.20.1 (2.11BSD) 96/7/10"; Z! #endif Z Z /* Z * Date - print and set date Z*************** Z*** 28,33 **** Z--- 26,33 ---- Z #include Z #include Z #include Z+ #include Z+ #include Z Z #define WTMP "/usr/adm/wtmp" Z #define ATOI2(ar) (ar[0] - '0') * 10 + (ar[1] - '0'); ar += 2; Z*************** Z*** 47,54 **** Z int argc; Z char **argv; Z { Z- extern int optind; Z- extern char *optarg; Z static char usage[] = "usage: date [-nu] [-d dst] [-t timezone] [yymmddhhmm[.ss]]\n"; Z struct timezone tz; Z char *ap, /* time string */ Z--- 47,52 ---- Z*************** Z*** 57,65 **** Z uflag, /* do it in GMT */ Z nflag, /* only set time locally */ Z wf; /* wtmp file descriptor */ Z! long time(); Z! uid_t getuid(); Z! char *username, *getlogin(); Z Z nflag = uflag = 0; Z tz.tz_dsttime = tz.tz_minuteswest = 0; Z--- 55,61 ---- Z uflag, /* do it in GMT */ Z nflag, /* only set time locally */ Z wf; /* wtmp file descriptor */ Z! char *username; Z Z nflag = uflag = 0; Z tz.tz_dsttime = tz.tz_minuteswest = 0; Z*************** Z*** 215,220 **** Z--- 211,220 ---- Z Z tv.tv_sec = 0; Z year += TM_YEAR_BASE; Z+ /* If year < EPOCH_YEAR, assume it's in the next century and Z+ the system has not yet been patched to move TM_YEAR_BASE up yet */ Z+ if (year < EPOCH_YEAR) Z+ year += 100; Z if (isleap(year) && month > 2) Z ++tv.tv_sec; Z for (--year;year >= EPOCH_YEAR;--year) Z*************** Z*** 237,243 **** Z #define WAITACK 2 /* seconds */ Z #define WAITDATEACK 5 /* seconds */ Z Z- extern int errno; Z /* Z * Set the date in the machines controlled by timedaemons Z * by communicating the new date to the local timedaemon. Z--- 237,242 ---- Z*** /usr/src/bin/hostid.c.old Sun Jan 2 14:26:39 1994 Z--- /usr/src/bin/hostid.c Thu Jul 11 19:45:31 1996 Z*************** Z*** 8,14 **** Z char copyright[] = Z "@(#) Copyright (c) 1983 Regents of the University of California.\n\ Z All rights reserved.\n"; Z! static char sccsid[] = "@(#)hostid.c 1.2 (2.11BSD GTE) 1/1/94"; Z #endif Z Z #include Z--- 8,14 ---- Z char copyright[] = Z "@(#) Copyright (c) 1983 Regents of the University of California.\n\ Z All rights reserved.\n"; Z! static char sccsid[] = "@(#)hostid.c 1.3 (2.11BSD GTE) 96/7/10"; Z #endif Z Z #include Z*************** Z*** 15,24 **** Z #include Z #include Z #include Z Z- extern char *index(); Z- extern unsigned long inet_addr(); Z- Z main(argc, argv) Z int argc; Z char **argv; Z--- 15,24 ---- Z #include Z #include Z #include Z+ #include Z+ #include Z+ #include Z Z main(argc, argv) Z int argc; Z char **argv; Z*************** Z*** 29,45 **** Z struct hostent *hp; Z Z if (argc < 2) { Z! #ifdef pdp11 Z! { Z! long val; Z! if (val = gethostid()) Z! printf("0x%lx\n",val); Z! else Z! puts("0"); Z! } Z! #else Z! printf("%#lx\n", gethostid()); Z! #endif Z exit(0); Z } Z Z--- 29,35 ---- Z struct hostent *hp; Z Z if (argc < 2) { Z! printf("0x%lx\n", gethostid()); Z exit(0); Z } Z Z*************** Z*** 48,71 **** Z bcopy(hp->h_addr, &addr, sizeof(addr)); Z hostid = addr; Z } else if (index(id, '.')) { Z! if ((hostid = inet_addr(id)) == -1) Z! goto usage; Z } else { Z if (id[0] == '0' && (id[1] == 'x' || id[1] == 'X')) Z id += 2; Z! if (sscanf(id, "%lx", &hostid) != 1) { Z! usage: Z! fprintf(stderr, Z! "usage: %s [hexnum or internet address]\n", Z! argv[0]); Z! exit(1); Z! } Z } Z Z! if (sethostid(hostid) < 0) { Z! perror("sethostid"); Z! exit(1); Z! } Z! Z exit(0); Z } Z--- 38,59 ---- Z bcopy(hp->h_addr, &addr, sizeof(addr)); Z hostid = addr; Z } else if (index(id, '.')) { Z! if ((hostid = inet_addr(id)) == -1L) Z! usage(); Z } else { Z if (id[0] == '0' && (id[1] == 'x' || id[1] == 'X')) Z id += 2; Z! if (sscanf(id, "%lx", &hostid) != 1) Z! usage(); Z } Z Z! if (sethostid(hostid) < 0) Z! err(1, "sethostid"); Z exit(0); Z } Z+ Z+ usage() Z+ { Z+ errx(1,"usage: [hexnum or internet name/address]"); Z+ /* NOTREACHED */ Z+ } Z*** /usr/src/games/hunt/answer.c.old Mon Aug 26 20:28:20 1985 Z--- /usr/src/games/hunt/answer.c Wed Jul 10 20:19:11 1996 Z*************** Z*** 6,15 **** Z--- 6,18 ---- Z * Copyright (c) 1985 Regents of the University of California. Z * All rights reserved. The Berkeley software License Agreement Z * specifies the terms and conditions for redistribution. Z+ * Z+ * @(#) answer.c 1.1 (2.11BSD) 96/7/10 Z */ Z Z # include "hunt.h" Z # include Z+ # include /* for gethostid() */ Z Z # define MAXPERMACH 3 /* Max player/monitor per machine */ Z Z*** /usr/src/lib/cpp/Makefile.old Sun Jan 2 23:10:43 1994 Z--- /usr/src/lib/cpp/Makefile Thu Jul 11 19:55:10 1996 Z*************** Z*** 1,4 **** Z! # Makefile 1.2 83/07/02 Z # Z Z # Defined SHARED_DATA to be whatever will make your compiler make initialized Z--- 1,4 ---- Z! # Makefile 1.3 (2.11BSD) 96/7/11 Z # Z Z # Defined SHARED_DATA to be whatever will make your compiler make initialized Z*************** Z*** 12,18 **** Z # If you don't have split I/D, you'll have to edit the constant Z # SBSIZE in cpp.c to reflect this. Z Z! CFLAGS=-O -Dpdp11=1 -DFLEXNAMES Z SEPFLAG=-i Z Z cpp : cpp.o cpy.o rodata.o Z--- 12,18 ---- Z # If you don't have split I/D, you'll have to edit the constant Z # SBSIZE in cpp.c to reflect this. Z Z! CFLAGS=-O -Dpdp11=1 -DFLEXNAMES -DBSD2_11 -UBSD2_10 Z SEPFLAG=-i Z Z cpp : cpp.o cpy.o rodata.o Z*************** Z*** 21,28 **** Z cpy.c : cpy.y Z yacc cpy.y Z ../pcc/:yyfix yyexca yyact yypact yypgo yyr1 yyr2 yychk yydef Z! fgrep -v "static char yaccpar_sccsid" y.tab.c >cpy.c Z! rm -f y.tab.c Z Z cpy.o : cpy.c yylex.c Z Z--- 21,27 ---- Z cpy.c : cpy.y Z yacc cpy.y Z ../pcc/:yyfix yyexca yyact yypact yypgo yyr1 yyr2 yychk yydef Z! mv y.tab.c cpy.c Z Z cpy.o : cpy.c yylex.c Z Z*************** Z*** 30,36 **** Z $(CC) $(CFLAGS) ${SHARED_DATA} -c rodata.c Z Z clean : Z! rm -f *.s *.o cpy.c rodata.c Z Z install : cpp Z install -s cpp $(DESTDIR)/lib Z--- 29,35 ---- Z $(CC) $(CFLAGS) ${SHARED_DATA} -c rodata.c Z Z clean : Z! rm -f *.s *.o cpy.c rodata.c cpp Z Z install : cpp Z install -s cpp $(DESTDIR)/lib Z*** /usr/src/lib/cpp/cpp.c.old Wed Jun 12 19:41:13 1996 Z--- /usr/src/lib/cpp/cpp.c Thu Jul 11 16:46:18 1996 Z*************** Z*** 1,4 **** Z! /* static char sccsid[] = "@(#)cpp.c 1.8.1 1996/6/12"; */ Z Z #ifdef FLEXNAMES Z #define NCPS 128 Z--- 1,4 ---- Z! /* static char sccsid[] = "@(#)cpp.c 1.8.2 1996/7/11"; */ Z Z #ifdef FLEXNAMES Z #define NCPS 128 Z*************** Z*** 1215,1220 **** Z--- 1215,1223 ---- Z # endif Z # if sun Z varloc=stsym("sun"); Z+ # endif Z+ # if BSD2_11 Z+ varloc=stsym("BSD2_11"); Z # endif Z # if BSD2_10 Z varloc=stsym("BSD2_10"); Z*** /usr/src/usr.lib/Makefile.old Wed Mar 20 20:30:53 1996 Z--- /usr/src/usr.lib/Makefile Thu Jul 11 20:16:36 1996 Z*************** Z*** 3,9 **** Z # All rights reserved. The Berkeley software License Agreement Z # specifies the terms and conditions for redistribution. Z # Z! # @(#)Makefile 5.12 (2.11BSD GTE) 1996/3/20 Z # Z DESTDIR= Z CFLAGS= -O Z--- 3,9 ---- Z # All rights reserved. The Berkeley software License Agreement Z # specifies the terms and conditions for redistribution. Z # Z! # @(#)Makefile 5.12.1 (2.11BSD GTE) 1996/7/11 Z # Z DESTDIR= Z CFLAGS= -O Z*************** Z*** 24,30 **** Z # Z SUBDIR= learn lib2648 libF77 libI77 libU77 libcurses libdbm libln \ Z libom libmp libplot libtermlib liby lpr me sendmail libutil libvmf \ Z! liberrlst Z Z # Shell scripts that need only be installed and are never removed. Z # Z--- 24,30 ---- Z # Z SUBDIR= learn lib2648 libF77 libI77 libU77 libcurses libdbm libln \ Z libom libmp libplot libtermlib liby lpr me sendmail libutil libvmf \ Z! liberrlst libstubs Z Z # Shell scripts that need only be installed and are never removed. Z # Z*** /usr/src/usr.lib/sendmail/src/Makefile.m4.old Fri Mar 22 22:38:47 1996 Z--- /usr/src/usr.lib/sendmail/src/Makefile.m4 Tue Jun 25 21:00:41 1996 Z*************** Z*** 7,13 **** Z # All rights reserved. The Berkeley software License Agreement Z # specifies the terms and conditions for redistribution. Z # Z! # @(#)Makefile.m4 5.10.4 (2.11BSD GTE) 1996/3/22 Z # Z # Z # SENDMAIL Makefile. Z--- 7,13 ---- Z # All rights reserved. The Berkeley software License Agreement Z # specifies the terms and conditions for redistribution. Z # Z! # @(#)Makefile.m4 5.10.5 (2.11BSD GTE) 1996/6/25 Z # Z # Z # SENDMAIL Makefile. Z*************** Z*** 27,33 **** Z savemail.o err.o readcf.o stab.o headers.o recipient.o \ Z stats.o daemon.o usersmtp.o srvrsmtp.o queue.o \ Z macro.o util.o clock.o trace.o envelope.o Z! OBJS2= sysexits.o arpadate.o convtime.o ctime.o Z OBJS= $(OBJS1) $(OBJS2) $(EXTRACT) Version.o str.o Z Z SBASE= conf.o parseaddr.o alias.o deliver.o headers.o \ Z--- 27,33 ---- Z savemail.o err.o readcf.o stab.o headers.o recipient.o \ Z stats.o daemon.o usersmtp.o srvrsmtp.o queue.o \ Z macro.o util.o clock.o trace.o envelope.o Z! OBJS2= sysexits.o arpadate.o convtime.o Z OBJS= $(OBJS1) $(OBJS2) $(EXTRACT) Version.o str.o Z Z SBASE= conf.o parseaddr.o alias.o deliver.o headers.o \ Z*************** Z*** 34,40 **** Z recipient.o srvrsmtp.o queue.o util.o \ Z envelope.o sysexits.o convtime.o Version.o \ Z $(EXTRACT) str.o Z! SOV1= main.o readcf.o macro.o ctime.o Z SOV2= daemon.o savemail.o usersmtp.o err.o clock.o stats.o trace.o stab.o \ Z arpadate.o Z SOV3= collect.o Z--- 34,40 ---- Z recipient.o srvrsmtp.o queue.o util.o \ Z envelope.o sysexits.o convtime.o Version.o \ Z $(EXTRACT) str.o Z! SOV1= main.o readcf.o macro.o Z SOV2= daemon.o savemail.o usersmtp.o err.o clock.o stats.o trace.o stab.o \ Z arpadate.o Z SOV3= collect.o Z*************** Z*** 44,52 **** Z sysexits.c util.c arpadate.c collect.c \ Z macro.c headers.c readcf.c stab.c recipient.c stats.c daemon.c \ Z usersmtp.c srvrsmtp.c queue.c clock.c trace.c envelope.c \ Z! convtime.c ctime.c Version.c Z Z! ALL= sendmail ctimed Z Z O= -O Z COPTS= Z--- 44,52 ---- Z sysexits.c util.c arpadate.c collect.c \ Z macro.c headers.c readcf.c stab.c recipient.c stats.c daemon.c \ Z usersmtp.c srvrsmtp.c queue.c clock.c trace.c envelope.c \ Z! convtime.c Version.c Z Z! ALL= sendmail Z Z O= -O Z COPTS= Z*************** Z*** 67,79 **** Z Z sendmail: $(OBJS) Z ld $(SEPFLAG) $(COPTS) /lib/crt0.o -o sendmail \ Z! -Z $(SOV1) -Z $(SOV2) -Z $(SOV3) -Y $(SBASE) $(LIBS) -lc Z chmod $(OBJMODE) sendmail Z size sendmail; ls -l sendmail Z Z- ctimed: Z- cc $(SEPFLAG) $(CFLAGS) ctimed.c -o ctimed Z- Z install: all Z $(INSTALL) -m 4755 -o root sendmail $(DESTDIR)/usr/lib Z cp /dev/null $(DESTDIR)/usr/lib/sendmail.fc Z--- 67,76 ---- Z Z sendmail: $(OBJS) Z ld $(SEPFLAG) $(COPTS) /lib/crt0.o -o sendmail \ Z! -Z $(SOV1) -Z $(SOV2) -Z $(SOV3) -Y $(SBASE) $(LIBS) -lstubs -lc Z chmod $(OBJMODE) sendmail Z size sendmail; ls -l sendmail Z Z install: all Z $(INSTALL) -m 4755 -o root sendmail $(DESTDIR)/usr/lib Z cp /dev/null $(DESTDIR)/usr/lib/sendmail.fc Z*************** Z*** 81,87 **** Z install -c -o bin -m 644 sendmail.sr \ Z $(DESTDIR)/usr/lib/sendmail.sr; \ Z fi Z- install -c -s -o bin -m 0755 ctimed $(DESTDIR)/usr/lib/ctimed Z Z tags: FRC Z ctags -a -t ${SRCS} Z--- 78,83 ---- Z*************** Z*** 100,106 **** Z Z clean: Z rm -f sendmail a.out XREF sendmail.cf Z! rm -f sendmail.sr *.o ctimed strings version.c xs.c Z Z print: $(SRCS) Z @ls -l | pr -h "sendmail directory" Z--- 96,102 ---- Z Z clean: Z rm -f sendmail a.out XREF sendmail.cf Z! rm -f sendmail.sr *.o strings version.c xs.c Z Z print: $(SRCS) Z @ls -l | pr -h "sendmail directory" Z*** /VERSION.old Thu Jun 20 20:16:39 1996 Z--- /VERSION Wed Jul 10 20:41:34 1996 Z*************** Z*** 1,4 **** Z! Current Patch Level: 326 Z Z 2.11 BSD Z ============ Z--- 1,4 ---- Z! Current Patch Level: 327 Z Z 2.11 BSD Z ============ SHAR_EOF fi if test -f '/tmp/327.sh' then echo shar: "will not over-write existing file '/tmp/327.sh'" else sed 's/^Z//' << \SHAR_EOF > '/tmp/327.sh' Z#!/bin/sh Z Zcd /usr/src/usr.lib/sendmail/src Zmv -f ctime.c ctime.c.old Zmv -f ctimed.c ctimed.c.old Zmv -f Makefile.ns Makefile.ns.old SHAR_EOF chmod +x '/tmp/327.sh' fi if test -f '/tmp/327.shar' then echo shar: "will not over-write existing file '/tmp/327.shar'" else sed 's/^Z//' << \SHAR_EOF > '/tmp/327.shar' Z#! /bin/sh Z# This is a shell archive, meaning: Z# 1. Remove everything above the #! /bin/sh line. Z# 2. Save the resulting text in a file. Z# 3. Execute the file with /bin/sh (not csh) to create: Z# /usr/libexec Z# /usr/src/libexec Z# /usr/src/usr.lib/libstubs Z# This archive created: Thu Jul 11 20:20:10 1996 Zexport PATH; PATH=/bin:/usr/bin:$PATH Zif test ! -d '/usr/libexec' Zthen Z mkdir '/usr/libexec' Zfi Zcd '/usr/libexec' Zchmod 755 . Zcd .. Zif test ! -d '/usr/src/libexec' Zthen Z mkdir '/usr/src/libexec' Zfi Zcd '/usr/src/libexec' Zif test -f 'Makefile' Zthen Z echo shar: "will not over-write existing file 'Makefile'" Zelse Zsed 's/^X//' << \SHAR_EOF > 'Makefile' ZX# ZX# Steven Schultz - put in the public domain 1996/6/25. ZX# ZX# @(#)Makefile 1.0 (2.11BSD) 1996/6/25 ZX# ZXDESTDIR= ZXCFLAGS= -O ZXSEPFLAG= -i ZXTAGSFILE=tags ZX ZXSUBDIR= ctimed ZX ZXall: ${SUBDIR} ZX ZX${SUBDIR}: FRC ZX cd $@; make SEPFLAG=${SEPFLAG} ${MFLAGS} ZX ZXFRC: ZX ZXinstall: ZX -for i in ${SUBDIR}; do \ ZX (cd $$i; make SEPFLAG=${SEPFLAG} ${MFLAGS} \ ZX DESTDIR=${DESTDIR} install); done ZX ZXtags: ZX cd libc; make ${MFLAGS} TAGSFILE=../${TAGSFILE} tags ZX ZXclean: ZX rm -f a.out core *.s *.o ZX -for i in ${SUBDIR}; do (cd $$i; make ${MFLAGS} clean); done ZSHAR_EOF Zchmod 644 'Makefile' Zfi Zif test ! -d 'ctimed' Zthen Z mkdir 'ctimed' Zfi Zcd 'ctimed' Zif test -f 'Makefile' Zthen Z echo shar: "will not over-write existing file 'Makefile'" Zelse Zsed 's/^X//' << \SHAR_EOF > 'Makefile' ZX# ZX# Public Domain. 1996/6/25 - Steven Schultz ZX# ZX# @(#)Makefile 1.0 (2.11BSD GTE) 1996/6/25 ZX# ZXCFLAGS= -O ZXSEPFLAG= -i ZXSRCS= ctimed.c ZXOBJS= ctimed.o ZX ZXall: ctimed ZX ZXctimed: ${OBJS} ZX ${CC} ${CFLAGS} ${SEPFLAG} -o $@ ${OBJS} ZX ZXclean: ZX rm -f ${OBJS} ctimed tags ZX ZXdepend: ${SRCS} ZX mkdep ${CFLAGS} ${SRCS} ZX ZXinstall: ctimed ZX install -s -o root -g bin -m 755 ctimed ${DESTDIR}/usr/libexec/ctimed ZX ZXlint: ${SRCS} ZX lint -hax ${SRCS} ZX ZXtags: ${SRCS} ZX ctags ${SRCS} ZSHAR_EOF Zchmod 644 'Makefile' Zfi Zif test -f 'ctimed.c' Zthen Z echo shar: "will not over-write existing file 'ctimed.c'" Zelse Zsed 's/^X//' << \SHAR_EOF > 'ctimed.c' ZX/* ZX * Steven Schultz - sms@moe.2bsd.com ZX * ZX * @(#)ctimed.c 1.0 (2.11BSD) 1996/6/25 ZX * ZX * ctimed - the daemon that supports the ctime() and getpw*() stubs ZX * in 'libcstubs.a'. ZX*/ ZX ZX#include ZX#include ZX#include ZX#include ZX#include ZX#include ZX#include ZX#include ZX ZX/* ZX * These should probably be placed in an include file. If you add anything ZX * here then you will also have to modify /usr/src/usr.lib/libstubs/stubs.c ZX * (if for no other reason than to add the stub code). ZX*/ ZX ZX#define CTIME 1 ZX#define ASCTIME 2 ZX#define TZSET 3 ZX#define LOCALTIME 4 ZX#define GMTIME 5 ZX#define OFFTIME 6 ZX ZX#define GETPWENT 7 ZX#define GETPWNAM 8 ZX#define GETPWUID 9 ZX#define SETPASSENT 10 ZX#define ENDPWENT 11 ZX ZXextern struct tm *offtime(); ZX ZX jmp_buf env; ZX char *cp; ZX char junk[256 + sizeof (struct passwd) + 4]; ZX long off; ZX time_t l; ZX void timeout(), checkppid(); ZX struct tm tmtmp, *tp; ZX ZXmain() ZX { ZX register int i; ZX register struct passwd *pw; ZX struct itimerval it; ZX u_char c, xxx; ZX int len, tosslen; ZX uid_t uid; ZX ZX signal(SIGPIPE, SIG_DFL); ZX for (i = getdtablesize(); --i > 2; ) ZX close(i); ZX/* ZX * Need a timer running while we disassociate from the control terminal ZX * in case of a modem line which has lost carrier. ZX*/ ZX timerclear(&it.it_interval); ZX it.it_value.tv_sec = 5; ZX it.it_value.tv_usec = 0; ZX signal(SIGALRM, timeout); ZX setitimer(ITIMER_REAL, &it, (struct itimerval *) NULL); ZX if (setjmp(env) == 0) ZX { ZX i = open("/dev/tty", 0); ZX if (i >= 0) ZX { ZX ioctl(i, TIOCNOTTY, NULL); ZX close(i); ZX } ZX } ZX/* ZX * Now start a timer with one minute refresh. In the signal service ZX * routine, check the parent process id to see if this process has ZX * been orphaned and if so exit. This is primarily aimed at removing ZX * the 'ctimed' process left behind by 'sendmail's multi-fork startup ZX * but may prove useful in preventing accumulation of 'ctimed' processes ZX * in other circumstances as well. Normally this process is short ZX * lived. ZX*/ ZX it.it_interval.tv_sec = 60; ZX it.it_interval.tv_usec = 0; ZX it.it_value.tv_sec = 60; ZX it.it_value.tv_usec = 0; ZX signal(SIGALRM, checkppid); ZX setitimer(ITIMER_REAL, &it, (struct itimerval *) NULL); ZX ZX while (read(fileno(stdin), &c, 1) == 1) ZX { ZX switch (c) ZX { ZX case CTIME: ZX l = 0L; ZX getb(fileno(stdin), &l, sizeof l); ZX cp = ctime(&l); ZX write(fileno(stdout), cp, 26); ZX break; ZX case ASCTIME: ZX getb(fileno(stdin), &tmtmp, sizeof tmtmp); ZX cp = asctime(&tmtmp); ZX write(fileno(stdout), cp, 26); ZX break; ZX case TZSET: ZX (void) tzset(); ZX break; ZX case LOCALTIME: ZX l = 0L; ZX getb(fileno(stdin), &l, sizeof l); ZX tp = localtime(&l); ZX write(fileno(stdout), tp, sizeof (*tp)); ZX strcpy(junk, tp->tm_zone); ZX junk[24] = '\0'; ZX write(fileno(stdout), junk, 24); ZX break; ZX case GMTIME: ZX l = 0L; ZX getb(fileno(stdin), &l, sizeof l); ZX tp = gmtime(&l); ZX write(fileno(stdout), tp, sizeof (*tp)); ZX strcpy(junk, tp->tm_zone); ZX junk[24] = '\0'; ZX write(fileno(stdout), junk, 24); ZX break; ZX case OFFTIME: ZX getb(fileno(stdin), &l, sizeof l); ZX getb(fileno(stdin), &off, sizeof off); ZX#ifdef __bsdi__ ZX l += off; ZX tp = localtime(&l); ZX#else ZX tp = offtime(&l, off); ZX#endif ZX write(fileno(stdout), tp, sizeof (*tp)); ZX break; ZX case GETPWENT: ZX pw = getpwent(); ZX do_pw(pw); ZX break; ZX case GETPWNAM: ZX getb(fileno(stdin), &len, sizeof (int)); ZX if (len > UT_NAMESIZE) ZX { ZX tosslen = len - UT_NAMESIZE; ZX len = UT_NAMESIZE; ZX } ZX else ZX tosslen = 0; ZX getb(fileno(stdin), junk, len); ZX for (;tosslen; tosslen--) ZX getb(fileno(stdin), &xxx, 1); ZX junk[len] = '\0'; ZX pw = getpwnam(junk); ZX do_pw(pw); ZX break; ZX case GETPWUID: ZX getb(fileno(stdin), &uid, sizeof (uid_t)); ZX pw = getpwuid(uid); ZX do_pw(pw); ZX break; ZX case SETPASSENT: ZX getb(fileno(stdin), &len, sizeof (int)); ZX if (setpassent(len)) ZX len = 1; ZX else ZX len = 0; ZX write(fileno(stdout), &len, sizeof (int)); ZX break; ZX case ENDPWENT: ZX endpwent(); ZX break; ZX default: ZX abort("switch"); ZX } ZX } ZX } ZX ZXgetb(f, p, n) ZX int f; ZX register char *p; ZX register int n; ZX { ZX register int i; ZX ZX while (n) ZX { ZX i = read(f, p, n); ZX if (i <= 0) ZX return; ZX p += i; ZX n -= i; ZX } ZX } ZX ZXvoid ZXtimeout() ZX { ZX ZX longjmp(env, 1); ZX } ZX ZXvoid ZXcheckppid() ZX { ZX ZX if (getppid() == 1) ZX exit(0); ZX } ZX ZXdo_pw(pw) ZX struct passwd *pw; ZX { ZX int len; ZX ZX if (!pw) ZX { ZX len = 0; ZX write(fileno(stdout), &len, sizeof (int)); ZX return; ZX } ZX len = packpwtobuf(pw, junk); ZX write(fileno(stdout), &len, sizeof (int)); ZX write(fileno(stdout), pw, sizeof (*pw)); ZX write(fileno(stdout), junk, len); ZX return; ZX } ZX ZXpackpwtobuf(pw, buf) ZX register struct passwd *pw; ZX char *buf; ZX { ZX register char *cp = buf; ZX register char *dp; ZX ZX dp = pw->pw_name; ZX pw->pw_name = (char*) 0; ZX while (*cp++ = *dp++) ZX ; ZX dp = pw->pw_passwd; ZX pw->pw_passwd = (char*) (cp - buf); ZX while (*cp++ = *dp++) ZX ; ZX dp = pw->pw_class; ZX pw->pw_class = (char*) (cp - buf); ZX while (*cp++ = *dp++) ZX ; ZX dp = pw->pw_gecos; ZX pw->pw_gecos = (char*) (cp - buf); ZX while (*cp++ = *dp++) ZX ; ZX dp = pw->pw_dir; ZX pw->pw_dir = (char*) (cp - buf); ZX while (*cp++ = *dp++) ZX ; ZX dp = pw->pw_shell; ZX pw->pw_shell = (char*) (cp - buf); ZX while (*cp++ = *dp++) ZX ; ZX return(cp - buf); ZX } ZSHAR_EOF Zchmod 644 'ctimed.c' Zfi Zchmod 755 . Zcd .. Zchmod 755 . Zcd .. Zif test ! -d '/usr/src/usr.lib/libstubs' Zthen Z mkdir '/usr/src/usr.lib/libstubs' Zfi Zcd '/usr/src/usr.lib/libstubs' Zif test -f 'stubtest.c' Zthen Z echo shar: "will not over-write existing file 'stubtest.c'" Zelse Zsed 's/^X//' << \SHAR_EOF > 'stubtest.c' ZX#include ZX#include ZX#include ZX#include ZX ZXmain() ZX { ZX struct tm *tm; ZX struct passwd *pw; ZX char *cp; ZX time_t l; ZX uid_t uid; ZX ZX l = time(0); ZX cp = ctime(&l); ZX printf("ctime(%ld) = %s", l, cp); ZX tm = gmtime(&l); ZX dump_tm("gmtime", tm); ZX cp = asctime(tm); ZX printf("asctime(tm) = %s", cp); ZX tm = localtime(&l); ZX dump_tm("localtime", tm); ZX ZX if (setpassent(1)) ZX printf("setpassent(1) returned non-zero (success) status\n"); ZX else ZX printf("setpassent(1) returned zero (shouldn't happen)\n"); ZX ZX printf("getpwent\n"); ZX while (pw = getpwent()) ZX { ZX dump_pw(pw); ZX } ZX printf("getpwnam(root)\n"); ZX pw = getpwnam("root"); ZX if (!pw) ZX printf("OOPS - root doesn't apparently exist\n"); ZX else ZX dump_pw(pw); ZX printf("getpwnam(nobody)\n"); ZX pw = getpwnam("nobody"); ZX if (!pw) ZX printf("OOPS - nobody doesn't apparently exist\n"); ZX uid = pw->pw_uid; ZX printf("getpwuid\n"); ZX pw = getpwuid(uid); ZX if (!pw) ZX printf("OOPS - uid %u (from nobody) doesn't exist\n", uid); ZX else ZX dump_pw(pw); ZX ZX printf("endpwent\n"); ZX endpwent(); ZX } ZX ZXdump_tm(str, tm) ZX char *str; ZX struct tm *tm; ZX { ZX printf("%s sec: %d min: %d hr: %d mday: %d mon: %d yr: %d wday: %d yday: %d isdst: %d zone: %s gmtoff: %d\n", ZX str, ZX tm->tm_sec, ZX tm->tm_min, ZX tm->tm_hour, ZX tm->tm_mday, ZX tm->tm_mon, ZX tm->tm_year, ZX tm->tm_wday, ZX tm->tm_yday, ZX tm->tm_isdst, ZX tm->tm_zone, ZX tm->tm_gmtoff); ZX } ZX ZXdump_pw(p) ZX struct passwd *p; ZX { ZX printf("%s:%s:%u:%u:%s:%ld:%ld:%s:%s:%s\n", ZX p->pw_name, ZX p->pw_passwd, ZX p->pw_uid, p->pw_gid, ZX p->pw_class, p->pw_change, p->pw_expire, ZX p->pw_gecos, p->pw_dir, p->pw_shell); ZX } ZSHAR_EOF Zchmod 644 'stubtest.c' Zfi Zif test -f 'stubs.c' Zthen Z echo shar: "will not over-write existing file 'stubs.c'" Zelse Zsed 's/^X//' << \SHAR_EOF > 'stubs.c' ZX#include ZX#include ZX#include ZX#include ZX ZX#include ZX#include ZX#include ZX#include ZX ZX#define SEND_FD W[1] ZX#define RECV_FD R[0] ZX ZX#define CTIME 1 ZX#define ASCTIME 2 ZX#define TZSET 3 ZX#define LOCALTIME 4 ZX#define GMTIME 5 ZX#define OFFTIME 6 ZX ZX#define GETPWENT 7 ZX#define GETPWNAM 8 ZX#define GETPWUID 9 ZX#define SETPASSENT 10 ZX#define ENDPWENT 11 ZX ZX static int R[2], W[2], inited; ZX static char result[256 + 4]; ZX static struct tm tmtmp; ZX static struct passwd _pw, *getandfixpw(); ZX ZXchar * ZXctime(t) ZX time_t *t; ZX { ZX u_char fnc = CTIME; ZX ZX sewer(); ZX write(SEND_FD, &fnc, sizeof fnc); ZX write(SEND_FD, t, sizeof (*t)); ZX getb(RECV_FD, result, 26); ZX return(result); ZX } ZX ZXchar * ZXasctime(tp) ZX struct tm *tp; ZX { ZX u_char fnc = ASCTIME; ZX ZX sewer(); ZX write(SEND_FD, &fnc, sizeof fnc); ZX write(SEND_FD, tp, sizeof (*tp)); ZX getb(RECV_FD, result, 26); ZX return(result); ZX } ZX ZXvoid ZXtzset() ZX { ZX u_char fnc = TZSET; ZX ZX sewer(); ZX write(SEND_FD, &fnc, sizeof fnc); ZX } ZX ZXstruct tm * ZXlocaltime(tp) ZX time_t *tp; ZX { ZX u_char fnc = LOCALTIME; ZX ZX sewer(); ZX write(SEND_FD, &fnc, sizeof fnc); ZX write(SEND_FD, tp, sizeof (*tp)); ZX getb(RECV_FD, &tmtmp, sizeof tmtmp); ZX getb(RECV_FD, result, 24); ZX tmtmp.tm_zone = result; ZX return(&tmtmp); ZX } ZX ZXstruct tm * ZXgmtime(tp) ZX time_t *tp; ZX { ZX u_char fnc = GMTIME; ZX ZX sewer(); ZX write(SEND_FD, &fnc, sizeof fnc); ZX write(SEND_FD, tp, sizeof (*tp)); ZX getb(RECV_FD, &tmtmp, sizeof tmtmp); ZX getb(RECV_FD, result, 24); ZX tmtmp.tm_zone = result; ZX return(&tmtmp); ZX } ZX ZXstruct tm * ZXofftime(clock, offset) ZX time_t *clock; ZX long offset; ZX { ZX u_char fnc = OFFTIME; ZX ZX sewer(); ZX write(SEND_FD, &fnc, sizeof fnc); ZX write(SEND_FD, clock, sizeof (*clock)); ZX write(SEND_FD, &offset, sizeof offset); ZX getb(RECV_FD, &tmtmp, sizeof tmtmp); ZX tmtmp.tm_zone = ""; ZX return(&tmtmp); ZX } ZX ZXstruct passwd * ZXgetpwent() ZX { ZX u_char fnc = GETPWENT; ZX ZX sewer(); ZX write(SEND_FD, &fnc, sizeof fnc); ZX return(getandfixpw()); ZX } ZX ZXstruct passwd * ZXgetpwnam(nam) ZX char *nam; ZX { ZX u_char fnc = GETPWNAM; ZX char lnam[UT_NAMESIZE + 1]; ZX int len; ZX ZX len = strlen(nam); ZX if (len > UT_NAMESIZE) ZX len = UT_NAMESIZE; ZX bcopy(nam, lnam, len); ZX lnam[len] = '\0'; ZX ZX sewer(); ZX write(SEND_FD, &fnc, 1); ZX write(SEND_FD, &len, sizeof (int)); ZX write(SEND_FD, lnam, len); ZX return(getandfixpw()); ZX } ZX ZXstruct passwd * ZXgetpwuid(uid) ZX uid_t uid; ZX { ZX u_char fnc = GETPWUID; ZX ZX sewer(); ZX write(SEND_FD, &fnc, sizeof fnc); ZX write(SEND_FD, &uid, sizeof (uid_t)); ZX return(getandfixpw()); ZX } ZX ZXsetpwent() ZX { ZX return(setpassent(0)); ZX } ZX ZXsetpassent(stayopen) ZX int stayopen; ZX { ZX u_char fnc = SETPASSENT; ZX int sts; ZX ZX sewer(); ZX write(SEND_FD, &fnc, sizeof fnc); ZX write(SEND_FD, &stayopen, sizeof (int)); ZX getb(RECV_FD, &sts, sizeof (int)); ZX return(sts); ZX } ZX ZXvoid ZXendpwent() ZX { ZX u_char fnc = ENDPWENT; ZX ZX sewer(); ZX write(SEND_FD, &fnc, sizeof fnc); ZX return; ZX } ZX ZX/* setpwfile() is deprecated */ ZXvoid ZXsetpwfile(file) ZX char *file; ZX { ZX return; ZX } ZX ZXstruct passwd * ZXgetandfixpw() ZX { ZX short sz; ZX ZX getb(RECV_FD, &sz, sizeof (int)); ZX if (sz == 0) ZX return(NULL); ZX getb(RECV_FD, &_pw, sizeof (_pw)); ZX getb(RECV_FD, result, sz); ZX _pw.pw_name += (int)result; ZX _pw.pw_passwd += (int)result; ZX _pw.pw_class += (int)result; ZX _pw.pw_gecos += (int)result; ZX _pw.pw_dir += (int)result; ZX _pw.pw_shell += (int)result; ZX return(&_pw); ZX } ZX ZXgetb(f, p, n) ZX register int f, n; ZX register char *p; ZX { ZX int i; ZX ZX while (n) ZX { ZX i = read(f, p, n); ZX if (i <= 0) ZX return; ZX p += i; ZX n -= i; ZX } ZX } ZX ZXsewer() ZX { ZX register int pid, ourpid = getpid(); ZX ZX if (inited == ourpid) ZX return; ZX if (inited) ZX { ZX close(SEND_FD); ZX close(RECV_FD); ZX } ZX pipe(W); ZX pipe(R); ZX pid = vfork(); ZX if (pid == 0) ZX { /* child */ ZX alarm(0); /* cancel alarms */ ZX dup2(W[0], 0); /* parent write side to our stdin */ ZX dup2(R[1], 1); /* parent read side to our stdout */ ZX close(SEND_FD); /* copies made, close the... */ ZX close(RECV_FD); /* originals now */ ZX execl(_PATH_CTIMED, "ctimed", 0); ZX _exit(EX_OSFILE); ZX } ZX if (pid == -1) ZX abort(); /* nothing else really to do */ ZX close(W[0]); /* close read side of SEND channel */ ZX close(R[1]); /* close write side of RECV channel */ ZX inited = ourpid; /* don't do this again in this proc */ ZX } ZX ZXXXctime() ZX { ZX ZX if (SEND_FD) ZX close(SEND_FD); ZX if (RECV_FD) ZX close(RECV_FD); ZX SEND_FD = RECV_FD = 0; ZX inited = 0; ZX } ZSHAR_EOF Zchmod 644 'stubs.c' Zfi Zif test -f 'Makefile' Zthen Z echo shar: "will not over-write existing file 'Makefile'" Zelse Zsed 's/^X//' << \SHAR_EOF > 'Makefile' ZX# ZX# Public Domain. 1996/6/25 - Steven Schultz ZX# ZX# @(#)Makefile 1.0 (2.11BSD GTE) 1996/6/25 ZX# ZXDEFS= ZXCFLAGS=-O $(DEFS) ZXTAGSFILE=tags ZX ZXall: libstubs.a libstubs_p.a ZX ZXlibstubs.a: stubs.c ZX ${CC} -c ${CFLAGS} stubs.c ZX ld -r -X -o libstubs.a stubs.o ZX rm -f stubs.o ZX ZXlibstubs_p.a: stubs.c ZX ${CC} -p -c ${CFLAGS} stubs.c ZX ld -r -X -o libstubs_p.a stubs.o ZX rm -f stubs.o ZX ZXinstall: all ZX install -m 644 libstubs.a $(DESTDIR)/usr/lib ZX install -m 644 libstubs_p.a $(DESTDIR)/usr/lib ZX ZXtags: ZX ctags -a -f ${TAGSFILE} `pwd`/stubs.c ZX ZXclean: ZX rm -f *.o libstubs.a libstubs_p.a ZSHAR_EOF Zchmod 644 'Makefile' Zfi Zchmod 755 . Zcd .. Zexit 0 Z# End of shell archive SHAR_EOF fi exit 0 # End of shell archive