diff options
author | Niklas Hallqvist <niklas@cvs.openbsd.org> | 1996-07-31 11:11:36 +0000 |
---|---|---|
committer | Niklas Hallqvist <niklas@cvs.openbsd.org> | 1996-07-31 11:11:36 +0000 |
commit | f0af30c7f6cb35ba81656a2fd0608bc0562287de (patch) | |
tree | 9b87478dc8fdefdfa70c52b5902e3c3e95a26256 | |
parent | 6015e78903bcf0449b29861caecabb3041be2c0e (diff) |
Better use time_t instead of long when dealing with times
-rw-r--r-- | usr.bin/sup/src/scan.c | 15 | ||||
-rw-r--r-- | usr.bin/sup/src/supcdefs.h | 6 | ||||
-rw-r--r-- | usr.bin/sup/src/supcmain.c | 9 | ||||
-rw-r--r-- | usr.bin/sup/src/supcmeat.c | 19 | ||||
-rw-r--r-- | usr.bin/sup/src/supcmisc.c | 13 | ||||
-rw-r--r-- | usr.bin/sup/src/supfilesrv.c | 22 | ||||
-rw-r--r-- | usr.bin/sup/src/supmsg.c | 9 | ||||
-rw-r--r-- | usr.bin/sup/src/supmsg.h | 9 | ||||
-rw-r--r-- | usr.bin/sup/src/supscan.c | 15 |
9 files changed, 69 insertions, 48 deletions
diff --git a/usr.bin/sup/src/scan.c b/usr.bin/sup/src/scan.c index 7ce17a69a76..e0098c048b1 100644 --- a/usr.bin/sup/src/scan.c +++ b/usr.bin/sup/src/scan.c @@ -1,4 +1,4 @@ -/* $OpenBSD: scan.c,v 1.3 1996/06/26 05:39:46 deraadt Exp $ */ +/* $OpenBSD: scan.c,v 1.4 1996/07/31 11:11:24 niklas Exp $ */ /* * Copyright (c) 1992 Carnegie Mellon University @@ -30,6 +30,9 @@ ********************************************************************** * HISTORY * $Log: scan.c,v $ + * Revision 1.4 1996/07/31 11:11:24 niklas + * Better use time_t instead of long when dealing with times + * * Revision 1.3 1996/06/26 05:39:46 deraadt * rcsid * @@ -186,8 +189,8 @@ extern TREE *refuseT; /* files refused by client */ extern char *collname; /* collection name */ extern char *basedir; /* base directory name */ extern char *prefix; /* collection pathname prefix */ -extern long lasttime; /* time of last upgrade */ -extern long scantime; /* time of this scan */ +extern time_t lasttime; /* time of last upgrade */ +extern time_t scantime; /* time of this scan */ extern int trace; /* trace directories */ extern int newonly; /* new files only */ @@ -196,8 +199,6 @@ extern char *rcs_branch; extern int candorcs; #endif -extern long time(); - /************************************************* *** STATIC R O U T I N E S *** *************************************************/ @@ -443,7 +444,7 @@ char *listfile,*scanfile; listT = NULL; if (!getscanfile(scanfile)) { /* check for pre-scanned file list */ - scantime = time ((long *)NULL); + scantime = time ((time_t *)NULL); doscan (listfile); /* read list file and scan disk */ } } @@ -970,7 +971,7 @@ char *scanfile; if (rename (tname,fname) < 0) goaway ("Can't change %s to %s",tname,fname); (void) unlink (tname); - tbuf[0].tv_sec = time((long *)NULL); tbuf[0].tv_usec = 0; + tbuf[0].tv_sec = time((time_t *)NULL); tbuf[0].tv_usec = 0; tbuf[1].tv_sec = scantime; tbuf[1].tv_usec = 0; (void) utimes (fname,tbuf); } diff --git a/usr.bin/sup/src/supcdefs.h b/usr.bin/sup/src/supcdefs.h index 0283f6b253f..7e49c6a0c42 100644 --- a/usr.bin/sup/src/supcdefs.h +++ b/usr.bin/sup/src/supcdefs.h @@ -1,4 +1,4 @@ -/* $OpenBSD: supcdefs.h,v 1.2 1996/06/26 05:39:50 deraadt Exp $ */ +/* $OpenBSD: supcdefs.h,v 1.3 1996/07/31 11:11:26 niklas Exp $ */ /* * Copyright (c) 1992 Carnegie Mellon University @@ -35,6 +35,9 @@ * across the network to save BandWidth * * $Log: supcdefs.h,v $ + * Revision 1.3 1996/07/31 11:11:26 niklas + * Better use time_t instead of long when dealing with times + * * Revision 1.2 1996/06/26 05:39:50 deraadt * rcsid * @@ -90,7 +93,6 @@ extern int errno; extern uid_t getuid(); extern gid_t getgid(); -extern long time(); extern int PGMVERSION; diff --git a/usr.bin/sup/src/supcmain.c b/usr.bin/sup/src/supcmain.c index ab072451e01..83af14b5228 100644 --- a/usr.bin/sup/src/supcmain.c +++ b/usr.bin/sup/src/supcmain.c @@ -1,4 +1,4 @@ -/* $OpenBSD: supcmain.c,v 1.2 1996/06/26 05:39:51 deraadt Exp $ */ +/* $OpenBSD: supcmain.c,v 1.3 1996/07/31 11:11:27 niklas Exp $ */ /* * Copyright (c) 1992 Carnegie Mellon University @@ -176,6 +176,9 @@ * across the network to save BandWidth * * $Log: supcmain.c,v $ + * Revision 1.3 1996/07/31 11:11:27 niklas + * Better use time_t instead of long when dealing with times + * * Revision 1.2 1996/06/26 05:39:51 deraadt * rcsid * @@ -588,7 +591,7 @@ char **argv; register struct passwd *pw; register TREE *t; TREE *collT; /* collections we are interested in */ - long timenow; /* startup time */ + time_t timenow; /* startup time */ int checkcoll (); int oflags,aflags; int cwant; @@ -704,7 +707,7 @@ char **argv; if (cwant) (void) Tprocess (collT,checkcoll); Tfree (&collT); if (firstC == NULL) logquit (1,"No collections to upgrade"); - timenow = time ((long *)NULL); + timenow = time ((time_t *)NULL); if (*supfname == '\0') p = "standard input"; else if (sysflag) diff --git a/usr.bin/sup/src/supcmeat.c b/usr.bin/sup/src/supcmeat.c index ebfdaca991b..5f43a26b0c3 100644 --- a/usr.bin/sup/src/supcmeat.c +++ b/usr.bin/sup/src/supcmeat.c @@ -1,4 +1,4 @@ -/* $OpenBSD: supcmeat.c,v 1.2 1996/06/26 05:39:51 deraadt Exp $ */ +/* $OpenBSD: supcmeat.c,v 1.3 1996/07/31 11:11:28 niklas Exp $ */ /* * Copyright (c) 1992 Carnegie Mellon University @@ -34,6 +34,9 @@ * across the network to save BandWidth * * $Log: supcmeat.c,v $ + * Revision 1.3 1996/07/31 11:11:28 niklas + * Better use time_t instead of long when dealing with times + * * Revision 1.2 1996/06/26 05:39:51 deraadt * rcsid * @@ -273,7 +276,7 @@ int *tout; { register int x; int timeout; - long tloc; + time_t tloc; if ((thisC->Cflags&CFLOCAL) == 0 && thishost (thisC->Chost->Tname)) { vnotify ("SUP: Skipping local collection %s\n",collname); @@ -304,7 +307,7 @@ int *tout; x = msgsignonack (); /* receive signon ack from fileserver */ if (x != SCMOK) goaway ("Error reading signon reply from fileserver"); - tloc = time ((long *)NULL); + tloc = time ((time_t *)NULL); vnotify ("SUP Fileserver %d.%d (%s) %d on %s at %.8s\n", protver,pgmver,scmver,fspid,remotehost(),ctime (&tloc) + 11); free (scmver); @@ -874,7 +877,7 @@ register struct stat *statp; (void) chown (t->Tname,t->Tuid,t->Tgid); (void) chmod (t->Tname,t->Tmode&S_IMODE); } - tbuf[0].tv_sec = time((long *)NULL); tbuf[0].tv_usec = 0; + tbuf[0].tv_sec = time((time_t *)NULL); tbuf[0].tv_usec = 0; tbuf[1].tv_sec = t->Tmtime; tbuf[1].tv_usec = 0; (void) utimes (t->Tname,tbuf); vnotify ("SUP %s directory %s\n",new?"Created":"Updated",t->Tname); @@ -950,7 +953,7 @@ register struct stat *statp; (void) chown (t->Tname,t->Tuid,t->Tgid); (void) chmod (t->Tname,t->Tmode&S_IMODE); } - tbuf[0].tv_sec = time((long *)NULL); tbuf[0].tv_usec = 0; + tbuf[0].tv_sec = time((time_t *)NULL); tbuf[0].tv_usec = 0; tbuf[1].tv_sec = t->Tmtime; tbuf[1].tv_usec = 0; (void) utimes (t->Tname,tbuf); return (FALSE); @@ -1009,7 +1012,7 @@ register struct stat *statp; (void) chown (t->Tname,t->Tuid,t->Tgid); (void) chmod (t->Tname,t->Tmode&S_IMODE); } - tbuf[0].tv_sec = time((long *)NULL); tbuf[0].tv_usec = 0; + tbuf[0].tv_sec = time((time_t *)NULL); tbuf[0].tv_usec = 0; tbuf[1].tv_sec = t->Tmtime; tbuf[1].tv_usec = 0; (void) utimes (t->Tname,tbuf); return (FALSE); @@ -1295,7 +1298,7 @@ int x; char tname[STRINGLENGTH],fname[STRINGLENGTH]; char relsufix[STRINGLENGTH]; char collrelname[STRINGLENGTH]; - long tloc; + time_t tloc; FILE *finishfile; /* record of all filenames */ int f,finishone(); @@ -1314,7 +1317,7 @@ int x; goaway ((char *)NULL); (void) requestend (); } - tloc = time ((long *)NULL); + tloc = time ((time_t *)NULL); if (x != SCMOK) { notify ("SUP: Upgrade of %s aborted at %s", collrelname,ctime (&tloc) + 4); diff --git a/usr.bin/sup/src/supcmisc.c b/usr.bin/sup/src/supcmisc.c index 9b86c66babf..c71a67a196e 100644 --- a/usr.bin/sup/src/supcmisc.c +++ b/usr.bin/sup/src/supcmisc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: supcmisc.c,v 1.2 1996/06/26 05:39:52 deraadt Exp $ */ +/* $OpenBSD: supcmisc.c,v 1.3 1996/07/31 11:11:29 niklas Exp $ */ /* * Copyright (c) 1992 Carnegie Mellon University @@ -29,6 +29,9 @@ ********************************************************************** * HISTORY * $Log: supcmisc.c,v $ + * Revision 1.3 1996/07/31 11:11:29 niklas + * Better use time_t instead of long when dealing with times + * * Revision 1.2 1996/06/26 05:39:52 deraadt * rcsid * @@ -99,7 +102,7 @@ prtime () { char buf[STRINGLENGTH]; char relsufix[STRINGLENGTH]; - long twhen; + time_t twhen; int f; if ((thisC->Cflags&CFURELSUF) && thisC->Crelease) @@ -271,7 +274,7 @@ va_dcl #endif char buf[STRINGLENGTH]; char collrelname[STRINGLENGTH]; - long tloc; + time_t tloc; static FILE *noteF = NULL; /* mail program on pipe */ va_list ap; @@ -304,7 +307,7 @@ va_dcl } } else noteF = stdout; - tloc = time ((long *)NULL); + tloc = time ((time_t *)NULL); fprintf (noteF,"SUP Upgrade of %s at %s", collrelname,ctime (&tloc)); (void) fflush (noteF); @@ -331,7 +334,7 @@ int on; } char *fmttime (time) -long time; +time_t time; { static char buf[STRINGLENGTH]; int len; diff --git a/usr.bin/sup/src/supfilesrv.c b/usr.bin/sup/src/supfilesrv.c index b38f2269eef..60ad85401a2 100644 --- a/usr.bin/sup/src/supfilesrv.c +++ b/usr.bin/sup/src/supfilesrv.c @@ -1,4 +1,4 @@ -/* $OpenBSD: supfilesrv.c,v 1.3 1996/06/26 05:39:54 deraadt Exp $ */ +/* $OpenBSD: supfilesrv.c,v 1.4 1996/07/31 11:11:31 niklas Exp $ */ /* * Copyright (c) 1992 Carnegie Mellon University @@ -44,6 +44,9 @@ * across the network to save BandWidth * * $Log: supfilesrv.c,v $ + * Revision 1.4 1996/07/31 11:11:31 niklas + * Better use time_t instead of long when dealing with times + * * Revision 1.3 1996/06/26 05:39:54 deraadt * rcsid * @@ -281,7 +284,6 @@ static void quit(status) {}; #endif /* lint */ extern int errno; -long time (); uid_t getuid (); int maxchildren; @@ -373,7 +375,7 @@ char **argv; register int x,pid,signalmask; struct sigvec chldvec,ignvec,oldvec; void chldsig(); - long tloc; + time_t tloc; /* initialize global variables */ pgmversion = PGMVERSION; /* export version number */ @@ -389,7 +391,7 @@ char **argv; #endif logopen ("supfile"); - tloc = time ((long *)NULL); + tloc = time ((time_t *)NULL); loginfo ("SUP File Server Version %d.%d (%s) starting at %s", PROTOVERSION,PGMVERSION,scmversion,fmttime (tloc)); if (live) { @@ -614,7 +616,7 @@ char **argv; answer () { - long starttime; + time_t starttime; register int x; progpid = fspid = getpid (); @@ -629,7 +631,7 @@ answer () goawayreason = NULL; donereason = NULL; lockfd = -1; - starttime = time ((long *)NULL); + starttime = time ((time_t *)NULL); if (!setjmp (sjbuf)) { signon (); setup (); @@ -1323,13 +1325,13 @@ va_list ap; *****************************************/ finishup (starttime) -long starttime; +time_t starttime; { register int x = SCMOK; char tmpbuf[BUFSIZ], *p, lognam[STRINGLENGTH]; int logfd; struct stat sbuf; - long finishtime; + time_t finishtime; char *releasename; (void) netcrypt ((char *)NULL); @@ -1368,7 +1370,7 @@ long starttime; (void) sprintf (lognam,FILELOGFILE,collname); if ((logfd = open(lognam,O_APPEND|O_WRONLY,0644)) < 0) return; /* can not open file up...error */ - finishtime = time ((long *)NULL); + finishtime = time ((time_t *)NULL); p = tmpbuf; (void) sprintf (p,"%s ",fmttime (lasttime)); p += strlen(p); @@ -1693,7 +1695,7 @@ va_dcl } char *fmttime (time) -long time; +time_t time; { static char buf[STRINGLENGTH]; int len; diff --git a/usr.bin/sup/src/supmsg.c b/usr.bin/sup/src/supmsg.c index 13d07817777..a962041917e 100644 --- a/usr.bin/sup/src/supmsg.c +++ b/usr.bin/sup/src/supmsg.c @@ -1,4 +1,4 @@ -/* $OpenBSD: supmsg.c,v 1.2 1996/06/26 05:39:55 deraadt Exp $ */ +/* $OpenBSD: supmsg.c,v 1.3 1996/07/31 11:11:33 niklas Exp $ */ /* * Copyright (c) 1992 Carnegie Mellon University @@ -33,6 +33,9 @@ * across the network to save BandWidth * * $Log: supmsg.c,v $ + * Revision 1.3 1996/07/31 11:11:33 niklas + * Better use time_t instead of long when dealing with times + * * Revision 1.2 1996/06/26 05:39:55 deraadt * rcsid * @@ -137,7 +140,7 @@ extern char *collname; /* base directory */ extern char *basedir; /* base directory */ extern int basedev; /* base directory device */ extern int baseino; /* base directory inode */ -extern long lasttime; /* time of last upgrade */ +extern time_t lasttime; /* time of last upgrade */ extern int listonly; /* only listing files, no data xfer */ extern int newonly; /* only send new files */ extern char *release; /* release name */ @@ -307,7 +310,7 @@ int msgrefuse () * list files message */ extern TREE *listT; /* tree of files to list */ -extern long scantime; /* time that collection was scanned */ +extern time_t scantime; /* time that collection was scanned */ static int listone (t) register TREE *t; diff --git a/usr.bin/sup/src/supmsg.h b/usr.bin/sup/src/supmsg.h index 3a57cab83d3..5c8c3578e6a 100644 --- a/usr.bin/sup/src/supmsg.h +++ b/usr.bin/sup/src/supmsg.h @@ -1,4 +1,4 @@ -/* $OpenBSD: supmsg.h,v 1.2 1996/06/26 05:39:56 deraadt Exp $ */ +/* $OpenBSD: supmsg.h,v 1.3 1996/07/31 11:11:34 niklas Exp $ */ /* * Copyright (c) 1992 Carnegie Mellon University @@ -35,6 +35,9 @@ * across the network to save BandWidth * * $Log: supmsg.h,v $ + * Revision 1.3 1996/07/31 11:11:34 niklas + * Better use time_t instead of long when dealing with times + * * Revision 1.2 1996/06/26 05:39:56 deraadt * rcsid * @@ -153,7 +156,7 @@ EXTERN char *collname; /* collection name */ EXTERN char *basedir; /* base directory */ EXTERN int basedev; /* base directory device */ EXTERN int baseino; /* base directory inode */ -EXTERN long lasttime; /* time of last upgrade */ +EXTERN time_t lasttime; /* time of last upgrade */ EXTERN int listonly; /* only listing files, no data xfer */ EXTERN int newonly; /* only send new files */ EXTERN char *release; /* release name */ @@ -178,7 +181,7 @@ EXTERN TREE *refuseT; /* tree of files to refuse */ /* msglist */ EXTERN TREE *listT; /* tree of files to list */ -EXTERN long scantime; /* time that collection was scanned */ +EXTERN time_t scantime; /* time that collection was scanned */ /* msgneed */ EXTERN TREE *needT; /* tree of files to need */ diff --git a/usr.bin/sup/src/supscan.c b/usr.bin/sup/src/supscan.c index 0ac4b276467..9df754ec078 100644 --- a/usr.bin/sup/src/supscan.c +++ b/usr.bin/sup/src/supscan.c @@ -1,4 +1,4 @@ -/* $OpenBSD: supscan.c,v 1.2 1996/06/26 05:39:56 deraadt Exp $ */ +/* $OpenBSD: supscan.c,v 1.3 1996/07/31 11:11:35 niklas Exp $ */ /* * Copyright (c) 1992 Carnegie Mellon University @@ -41,6 +41,9 @@ ********************************************************************** * HISTORY * $Log: supscan.c,v $ + * Revision 1.3 1996/07/31 11:11:35 niklas + * Better use time_t instead of long when dealing with times + * * Revision 1.2 1996/06/26 05:39:56 deraadt * rcsid * @@ -163,8 +166,8 @@ COLLECTION *firstC; /* collection list pointer */ char *collname; /* collection name */ char *basedir; /* base directory name */ char *prefix; /* collection pathname prefix */ -long lasttime = 0; /* time of last upgrade */ -long scantime; /* time of this scan */ +time_t lasttime = 0; /* time of last upgrade */ +time_t scantime; /* time of this scan */ int newonly = FALSE; /* new files only */ jmp_buf sjbuf; /* jump location for errors */ @@ -172,8 +175,6 @@ TREELIST *listTL; /* list of all files specified by <coll>.list */ TREE *listT; /* final list of files in collection */ TREE *refuseT = NULL; /* list of all files specified by <coll>.list */ -long time (); - /************************************* *** M A I N R O U T I N E *** *************************************/ @@ -190,13 +191,13 @@ char **argv; basedir = c->Cbase; prefix = c->Cprefix; (void) chdir (basedir); - scantime = time ((long *)NULL); + scantime = time ((time_t *)NULL); printf ("SUP Scan for %s starting at %s",collname, ctime (&scantime)); (void) fflush (stdout); if (!setjmp (sjbuf)) { makescanlists (); /* record names in scan files */ - scantime = time ((long *)NULL); + scantime = time ((time_t *)NULL); printf ("SUP Scan for %s completed at %s",collname, ctime (&scantime)); } else |