Deleted Added
full compact
main.c (179267) main.c (179275)
1/*-
2 * Copyright (c) 1980, 1991, 1993, 1994
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

--- 24 unchanged lines hidden (view full) ---

33 The Regents of the University of California. All rights reserved.\n";
34#endif /* not lint */
35
36#ifndef lint
37#if 0
38static char sccsid[] = "@(#)main.c 8.6 (Berkeley) 5/1/95";
39#endif
40static const char rcsid[] =
1/*-
2 * Copyright (c) 1980, 1991, 1993, 1994
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

--- 24 unchanged lines hidden (view full) ---

33 The Regents of the University of California. All rights reserved.\n";
34#endif /* not lint */
35
36#ifndef lint
37#if 0
38static char sccsid[] = "@(#)main.c 8.6 (Berkeley) 5/1/95";
39#endif
40static const char rcsid[] =
41 "$FreeBSD: head/sbin/dump/main.c 179267 2008-05-23 23:13:14Z mckusick $";
41 "$FreeBSD: head/sbin/dump/main.c 179275 2008-05-24 05:20:46Z mckusick $";
42#endif /* not lint */
43
44#include <sys/param.h>
45#include <sys/stat.h>
46#include <sys/time.h>
47#include <sys/mount.h>
48#include <sys/disklabel.h>
49

--- 61 unchanged lines hidden (view full) ---

111
112 tsize = 0; /* Default later, based on 'c' option for cart tapes */
113 dumpdates = _PATH_DUMPDATES;
114 popenout = NULL;
115 tape = NULL;
116 temp = _PATH_DTMP;
117 if (TP_BSIZE / DEV_BSIZE == 0 || TP_BSIZE % DEV_BSIZE != 0)
118 quit("TP_BSIZE must be a multiple of DEV_BSIZE\n");
42#endif /* not lint */
43
44#include <sys/param.h>
45#include <sys/stat.h>
46#include <sys/time.h>
47#include <sys/mount.h>
48#include <sys/disklabel.h>
49

--- 61 unchanged lines hidden (view full) ---

111
112 tsize = 0; /* Default later, based on 'c' option for cart tapes */
113 dumpdates = _PATH_DUMPDATES;
114 popenout = NULL;
115 tape = NULL;
116 temp = _PATH_DTMP;
117 if (TP_BSIZE / DEV_BSIZE == 0 || TP_BSIZE % DEV_BSIZE != 0)
118 quit("TP_BSIZE must be a multiple of DEV_BSIZE\n");
119 level = '0';
119 level = 0;
120 rsync_friendly = 0;
121
122 if (argc < 2)
123 usage();
124
125 obsolete(&argc, &argv);
126 while ((ch = getopt(argc, argv,
127 "0123456789aB:b:C:cD:d:f:h:LnP:RrSs:T:uWw")) != -1)
128 switch (ch) {
129 /* dump level */
130 case '0': case '1': case '2': case '3': case '4':
131 case '5': case '6': case '7': case '8': case '9':
120 rsync_friendly = 0;
121
122 if (argc < 2)
123 usage();
124
125 obsolete(&argc, &argv);
126 while ((ch = getopt(argc, argv,
127 "0123456789aB:b:C:cD:d:f:h:LnP:RrSs:T:uWw")) != -1)
128 switch (ch) {
129 /* dump level */
130 case '0': case '1': case '2': case '3': case '4':
131 case '5': case '6': case '7': case '8': case '9':
132 level = ch;
132 level = 10 * level + ch - '0';
133 break;
134
135 case 'a': /* `auto-size', Write to EOM. */
136 unlimited = 1;
137 break;
138
139 case 'B': /* blocks per output file */
140 blocksperfile = numarg("number of blocks per file",

--- 70 unchanged lines hidden (view full) ---

211 case 'T': /* time of last dump */
212 spcl.c_ddate = unctime(optarg);
213 if (spcl.c_ddate < 0) {
214 (void)fprintf(stderr, "bad time \"%s\"\n",
215 optarg);
216 exit(X_STARTUP);
217 }
218 Tflag = 1;
133 break;
134
135 case 'a': /* `auto-size', Write to EOM. */
136 unlimited = 1;
137 break;
138
139 case 'B': /* blocks per output file */
140 blocksperfile = numarg("number of blocks per file",

--- 70 unchanged lines hidden (view full) ---

211 case 'T': /* time of last dump */
212 spcl.c_ddate = unctime(optarg);
213 if (spcl.c_ddate < 0) {
214 (void)fprintf(stderr, "bad time \"%s\"\n",
215 optarg);
216 exit(X_STARTUP);
217 }
218 Tflag = 1;
219 lastlevel = '?';
219 lastlevel = -1;
220 break;
221
222 case 'u': /* update /etc/dumpdates */
223 uflag = 1;
224 break;
225
226 case 'W': /* what to do */
227 case 'w':

--- 14 unchanged lines hidden (view full) ---

242 argc--;
243 if (argc >= 1) {
244 (void)fprintf(stderr, "Unknown arguments to dump:");
245 while (argc--)
246 (void)fprintf(stderr, " %s", *argv++);
247 (void)fprintf(stderr, "\n");
248 exit(X_STARTUP);
249 }
220 break;
221
222 case 'u': /* update /etc/dumpdates */
223 uflag = 1;
224 break;
225
226 case 'W': /* what to do */
227 case 'w':

--- 14 unchanged lines hidden (view full) ---

242 argc--;
243 if (argc >= 1) {
244 (void)fprintf(stderr, "Unknown arguments to dump:");
245 while (argc--)
246 (void)fprintf(stderr, " %s", *argv++);
247 (void)fprintf(stderr, "\n");
248 exit(X_STARTUP);
249 }
250 if (rsync_friendly && (level>'0')) {
250 if (rsync_friendly && (level > 0)) {
251 (void)fprintf(stderr, "%s %s\n", "rsync friendly options",
252 "can be used only with level 0 dumps.");
253 exit(X_STARTUP);
254 }
255 if (Tflag && uflag) {
256 (void)fprintf(stderr,
257 "You cannot use the T and u flags together.\n");
258 exit(X_STARTUP);

--- 134 unchanged lines hidden (view full) ---

393 if (fstat(diskfd, &sb) != 0)
394 err(X_STARTUP, "%s: stat", disk);
395 if (S_ISDIR(sb.st_mode))
396 errx(X_STARTUP, "%s: unknown file system", disk);
397 }
398
399 (void)strcpy(spcl.c_label, "none");
400 (void)gethostname(spcl.c_host, NAMELEN);
251 (void)fprintf(stderr, "%s %s\n", "rsync friendly options",
252 "can be used only with level 0 dumps.");
253 exit(X_STARTUP);
254 }
255 if (Tflag && uflag) {
256 (void)fprintf(stderr,
257 "You cannot use the T and u flags together.\n");
258 exit(X_STARTUP);

--- 134 unchanged lines hidden (view full) ---

393 if (fstat(diskfd, &sb) != 0)
394 err(X_STARTUP, "%s: stat", disk);
395 if (S_ISDIR(sb.st_mode))
396 errx(X_STARTUP, "%s: unknown file system", disk);
397 }
398
399 (void)strcpy(spcl.c_label, "none");
400 (void)gethostname(spcl.c_host, NAMELEN);
401 spcl.c_level = level - '0';
401 spcl.c_level = level;
402 spcl.c_type = TS_TAPE;
403 if (rsync_friendly) {
404 /* don't store real dump times */
405 spcl.c_date = 0;
406 spcl.c_ddate = 0;
407 }
408 if (spcl.c_date == 0) {
409 tmsg = "the epoch\n";
410 } else {
411 time_t t = _time64_to_time(spcl.c_date);
412 tmsg = ctime(&t);
413 }
402 spcl.c_type = TS_TAPE;
403 if (rsync_friendly) {
404 /* don't store real dump times */
405 spcl.c_date = 0;
406 spcl.c_ddate = 0;
407 }
408 if (spcl.c_date == 0) {
409 tmsg = "the epoch\n";
410 } else {
411 time_t t = _time64_to_time(spcl.c_date);
412 tmsg = ctime(&t);
413 }
414 msg("Date of this level %c dump: %s", level, tmsg);
414 msg("Date of this level %d dump: %s", level, tmsg);
415
416 if (!Tflag && (!rsync_friendly))
417 getdumptime(); /* /etc/dumpdates snarfed */
418 if (spcl.c_ddate == 0) {
419 tmsg = "the epoch\n";
420 } else {
421 time_t t = _time64_to_time(spcl.c_ddate);
422 tmsg = ctime(&t);
423 }
415
416 if (!Tflag && (!rsync_friendly))
417 getdumptime(); /* /etc/dumpdates snarfed */
418 if (spcl.c_ddate == 0) {
419 tmsg = "the epoch\n";
420 } else {
421 time_t t = _time64_to_time(spcl.c_ddate);
422 tmsg = ctime(&t);
423 }
424 msg("Date of last level %c dump: %s", lastlevel, tmsg);
424 if (lastlevel < 0)
425 msg("Date of last (level unknown) dump: %s", tmsg);
426 else
427 msg("Date of last level %d dump: %s", lastlevel, tmsg);
425
426 msg("Dumping %s%s ", snapdump ? "snapshot of ": "", disk);
427 if (dt != NULL)
428 msgtail("(%s) ", dt->fs_file);
429 if (host)
430 msgtail("to %s on host %s\n", tape, host);
431 else
432 msgtail("to %s\n", tape);

--- 342 unchanged lines hidden ---
428
429 msg("Dumping %s%s ", snapdump ? "snapshot of ": "", disk);
430 if (dt != NULL)
431 msgtail("(%s) ", dt->fs_file);
432 if (host)
433 msgtail("to %s on host %s\n", tape, host);
434 else
435 msgtail("to %s\n", tape);

--- 342 unchanged lines hidden ---