itime.c (138314) | itime.c (179275) |
---|---|
1/*- 2 * Copyright (c) 1980, 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 18 unchanged lines hidden (view full) --- 27 * SUCH DAMAGE. 28 */ 29 30#ifndef lint 31#if 0 32static char sccsid[] = "@(#)itime.c 8.1 (Berkeley) 6/5/93"; 33#endif 34static const char rcsid[] = | 1/*- 2 * Copyright (c) 1980, 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 18 unchanged lines hidden (view full) --- 27 * SUCH DAMAGE. 28 */ 29 30#ifndef lint 31#if 0 32static char sccsid[] = "@(#)itime.c 8.1 (Berkeley) 6/5/93"; 33#endif 34static const char rcsid[] = |
35 "$FreeBSD: head/sbin/dump/itime.c 138314 2004-12-02 13:56:53Z maxim $"; | 35 "$FreeBSD: head/sbin/dump/itime.c 179275 2008-05-24 05:20:46Z mckusick $"; |
36#endif /* not lint */ 37 38#include <sys/param.h> 39#include <sys/queue.h> 40#include <sys/time.h> 41 42#include <ufs/ufs/dinode.h> 43 --- 83 unchanged lines hidden (view full) --- 127getdumptime(void) 128{ 129 struct dumpdates *ddp; 130 int i; 131 char *fname; 132 133 fname = disk; 134#ifdef FDEBUG | 36#endif /* not lint */ 37 38#include <sys/param.h> 39#include <sys/queue.h> 40#include <sys/time.h> 41 42#include <ufs/ufs/dinode.h> 43 --- 83 unchanged lines hidden (view full) --- 127getdumptime(void) 128{ 129 struct dumpdates *ddp; 130 int i; 131 char *fname; 132 133 fname = disk; 134#ifdef FDEBUG |
135 msg("Looking for name %s in dumpdates = %s for level = %c\n", | 135 msg("Looking for name %s in dumpdates = %s for level = %d\n", |
136 fname, dumpdates, level); 137#endif 138 spcl.c_ddate = 0; | 136 fname, dumpdates, level); 137#endif 138 spcl.c_ddate = 0; |
139 lastlevel = '0'; | 139 lastlevel = 0; |
140 141 initdumptimes(); 142 /* 143 * Go find the entry with the same name for a lower increment 144 * and older date 145 */ 146 ITITERATE(i, ddp) { 147 if (strncmp(fname, ddp->dd_name, sizeof (ddp->dd_name)) != 0) --- 60 unchanged lines hidden (view full) --- 208 quit("ftruncate (%s): %s\n", dumpdates, strerror(errno)); 209 (void) fclose(df); 210 if (spcl.c_date == 0) { 211 tmsg = "the epoch\n"; 212 } else { 213 time_t t = _time64_to_time(spcl.c_date); 214 tmsg = ctime(&t); 215 } | 140 141 initdumptimes(); 142 /* 143 * Go find the entry with the same name for a lower increment 144 * and older date 145 */ 146 ITITERATE(i, ddp) { 147 if (strncmp(fname, ddp->dd_name, sizeof (ddp->dd_name)) != 0) --- 60 unchanged lines hidden (view full) --- 208 quit("ftruncate (%s): %s\n", dumpdates, strerror(errno)); 209 (void) fclose(df); 210 if (spcl.c_date == 0) { 211 tmsg = "the epoch\n"; 212 } else { 213 time_t t = _time64_to_time(spcl.c_date); 214 tmsg = ctime(&t); 215 } |
216 msg("level %c dump on %s", level, tmsg); | 216 msg("level %d dump on %s", level, tmsg); |
217} 218 219static void 220dumprecout(FILE *file, const struct dumpdates *what) 221{ 222 223 if (fprintf(file, DUMPOUTFMT, what->dd_name, 224 what->dd_level, ctime(&what->dd_ddate)) < 0) --- 11 unchanged lines hidden (view full) --- 236 if ( (fgets(tbuf, sizeof (tbuf), df)) != tbuf) 237 return(-1); 238 recno++; 239 if (makedumpdate(ddatep, tbuf) < 0) 240 msg("Unknown intermediate format in %s, line %d\n", 241 dumpdates, recno); 242 243#ifdef FDEBUG | 217} 218 219static void 220dumprecout(FILE *file, const struct dumpdates *what) 221{ 222 223 if (fprintf(file, DUMPOUTFMT, what->dd_name, 224 what->dd_level, ctime(&what->dd_ddate)) < 0) --- 11 unchanged lines hidden (view full) --- 236 if ( (fgets(tbuf, sizeof (tbuf), df)) != tbuf) 237 return(-1); 238 recno++; 239 if (makedumpdate(ddatep, tbuf) < 0) 240 msg("Unknown intermediate format in %s, line %d\n", 241 dumpdates, recno); 242 243#ifdef FDEBUG |
244 msg("getrecord: %s %c %s", ddatep->dd_name, ddatep->dd_level, | 244 msg("getrecord: %s %d %s", ddatep->dd_name, ddatep->dd_level, |
245 ddatep->dd_ddate == 0 ? "the epoch\n" : ctime(&ddatep->dd_ddate)); 246#endif 247 return(0); 248} 249 250static int 251makedumpdate(struct dumpdates *ddp, const char *tbuf) 252{ 253 char un_buf[128]; 254 255 (void) sscanf(tbuf, DUMPINFMT, ddp->dd_name, &ddp->dd_level, un_buf); 256 ddp->dd_ddate = unctime(un_buf); 257 if (ddp->dd_ddate < 0) 258 return(-1); 259 return(0); 260} | 245 ddatep->dd_ddate == 0 ? "the epoch\n" : ctime(&ddatep->dd_ddate)); 246#endif 247 return(0); 248} 249 250static int 251makedumpdate(struct dumpdates *ddp, const char *tbuf) 252{ 253 char un_buf[128]; 254 255 (void) sscanf(tbuf, DUMPINFMT, ddp->dd_name, &ddp->dd_level, un_buf); 256 ddp->dd_ddate = unctime(un_buf); 257 if (ddp->dd_ddate < 0) 258 return(-1); 259 return(0); 260} |