X-Git-Url: https://git.wh0rd.org/?a=blobdiff_plain;f=dump%2Fitime.c;h=81d8dc7e7b85b34c2594d13f24006c39070bebbe;hb=2c99ad2dc97978b437794b14d58d9ae698ecabb9;hp=20aa69a2b6f6cb55a2de6d1abb06c1f34339b311;hpb=d6967896bc4e18f9b4359a2ef5be5c0f1bcc456a;p=dump.git diff --git a/dump/itime.c b/dump/itime.c index 20aa69a..81d8dc7 100644 --- a/dump/itime.c +++ b/dump/itime.c @@ -41,19 +41,28 @@ #ifndef lint static const char rcsid[] = - "$Id: itime.c,v 1.14 2000/12/21 11:14:54 stelian Exp $"; + "$Id: itime.c,v 1.18 2001/03/21 09:37:13 stelian Exp $"; #endif /* not lint */ #include +#include +#include +#include +#ifdef __STDC__ +#include +#include +#endif + #include #include #ifdef __linux__ #include +#include +#include #include #include #include -#else -#ifdef sunos +#elif defined sunos #include #include @@ -62,22 +71,9 @@ static const char rcsid[] = #else #include #endif -#endif #include -#include -#include -#include -#ifdef __STDC__ -#include -#include -#endif - -#ifdef __linux__ -#include -#endif - #include "dump.h" struct dumpdates **ddatev; @@ -160,12 +156,10 @@ getdumptime(int createdumpdates) { register struct dumpdates *ddp; register int i; - char *fname; - fname = disk; #ifdef FDEBUG msg("Looking for name %s in dumpdates = %s for level = %c\n", - fname, dumpdates, level); + disk, dumpdates, level); #endif spcl.c_ddate = 0; lastlevel = '0'; @@ -184,15 +178,11 @@ getdumptime(int createdumpdates) * and older date */ ITITERATE(i, ddp) { - if (strncmp(fname, ddp->dd_name, sizeof (ddp->dd_name)) != 0) + if (strncmp(disk, ddp->dd_name, sizeof (ddp->dd_name)) != 0) continue; if (ddp->dd_level >= level) continue; -#ifdef __linux__ if (ddp->dd_ddate <= (time_t)spcl.c_ddate) -#else - if (ddp->dd_ddate <= spcl.c_ddate) -#endif continue; spcl.c_ddate = ddp->dd_ddate; lastlevel = ddp->dd_level; @@ -206,7 +196,6 @@ putdumptime(void) register struct dumpdates *dtwalk; register int i; int fd; - char *fname; if(uflag == 0) return; @@ -214,7 +203,6 @@ putdumptime(void) quit("cannot rewrite %s: %s\n", dumpdates, strerror(errno)); fd = fileno(df); (void) flock(fd, LOCK_EX); - fname = disk; free((char *)ddatev); ddatev = 0; nddates = 0; @@ -225,7 +213,7 @@ putdumptime(void) quit("fseek: %s\n", strerror(errno)); spcl.c_ddate = 0; ITITERATE(i, dtwalk) { - if (strncmp(fname, dtwalk->dd_name, + if (strncmp(disk, dtwalk->dd_name, sizeof (dtwalk->dd_name)) != 0) continue; if (dtwalk->dd_level != level) @@ -240,7 +228,7 @@ putdumptime(void) (struct dumpdates *)calloc(1, sizeof (struct dumpdates)); nddates += 1; found: - (void) strncpy(dtwalk->dd_name, fname, sizeof (dtwalk->dd_name)); + (void) strncpy(dtwalk->dd_name, disk, sizeof (dtwalk->dd_name)); dtwalk->dd_level = level; dtwalk->dd_ddate = spcl.c_date; @@ -252,12 +240,6 @@ putdumptime(void) if (ftruncate(fd, ftell(df))) quit("ftruncate (%s): %s\n", dumpdates, strerror(errno)); (void) fclose(df); - msg("level %c dump on %s", level, -#ifdef __linux__ - spcl.c_date == 0 ? "the epoch\n" : ctime4(&spcl.c_date)); -#else - spcl.c_date == 0 ? "the epoch\n" : ctime(&spcl.c_date)); -#endif } static void