static char *sccsid
= "@(#)main.c 1.10 (Berkeley) %G%";
int notify
= 0; /* notify operator flag */
int blockswritten
= 0; /* number of blocks written on current tape */
int tapeno
= 0; /* current tape number */
int density
= 160; /* density in 0.1" units */
register struct fstab
*dt
;
if (TP_BSIZE
/ DEV_BSIZE
== 0 || TP_BSIZE
% DEV_BSIZE
!= 0) {
msg("TP_BSIZE must be a multiple of DEV_BSIZE\n");
lastdump('w'); /* tell us only what has to be done */
case 'W': /* what to do */
lastdump('W'); /* tell us the current state of what has been done */
exit(0); /* do nothing else */
case 'J': /* update old to new */
exit(0); /* do nothing else */
case 'f': /* output file */
case 'd': /* density, in bits per inch */
density
= atoi(*argv
) / 10;
case 's': /* tape size, feet */
case '0': /* dump level */
case 'u': /* update /etc/dumpdates */
case 'n': /* notify operators */
printf("bad key '%c%'\n", arg
[-1]);
msg("need keyletter ``f'' and device ``host:tape''");
if (signal(SIGHUP
, sighup
) == SIG_IGN
)
if (signal(SIGTRAP
, sigtrap
) == SIG_IGN
)
signal(SIGTRAP
, SIG_IGN
);
if (signal(SIGFPE
, sigfpe
) == SIG_IGN
)
if (signal(SIGBUS
, sigbus
) == SIG_IGN
)
if (signal(SIGSEGV
, sigsegv
) == SIG_IGN
)
signal(SIGSEGV
, SIG_IGN
);
if (signal(SIGTERM
, sigterm
) == SIG_IGN
)
signal(SIGTERM
, SIG_IGN
);
if (signal(SIGINT
, interrupt
) == SIG_IGN
)
set_operators(); /* /etc/group snarfed */
getfstab(); /* /etc/fstab snarfed */
* disk can be either the full special file name,
* the suffix of the special file name,
* the special name missing the leading '/',
* the file system name with or without the leading '/'.
disk
= rawname(dt
->fs_spec
);
getitime(); /* /etc/dumpdates snarfed */
msg("Date of this level %c dump: %s\n", incno
, prdate(spcl
.c_date
));
msg("Date of last level %c dump: %s\n", incno
, prdate(spcl
.c_ddate
));
msg("Dumping %s ", disk
);
msgtail("(%s) ", dt
->fs_file
);
msgtail("to %s on host %s\n", tape
, host
);
msgtail("to %s\n", tape
);
msg("Cannot open %s\n", disk
);
sblock
= (struct fs
*)buf
;
bread(SBLOCK
, sblock
, SBSIZE
);
if (sblock
->fs_magic
!= FS_MAGIC
) {
msg("bad sblock magic number\n");
msiz
= roundup(howmany(sblock
->fs_ipg
* sblock
->fs_ncg
, NBBY
),
clrmap
= (char *)calloc(msiz
, sizeof(char));
dirmap
= (char *)calloc(msiz
, sizeof(char));
nodmap
= (char *)calloc(msiz
, sizeof(char));
msg("mapping (Pass I) [regular files]\n");
pass(mark
, (char *)NULL
); /* mark updates esize */
msg("mapping (Pass II) [directories]\n");
* TP_BSIZE
/* bytes / block */
* (1.0/density
) /* 0.1" / byte */
* (1.0/NTREC
) /* IRG's / block */
) * (1.0 / tsize
) /* tape / 0.1" */
etapes
= fetapes
; /* truncating assignment */
/* count the nodemap on each additional tape */
for (i
= 1; i
< etapes
; i
++)
esize
+= i
+ 10; /* headers + 10 trailer blocks */
msg("estimated %ld tape blocks on %3.2f tape(s).\n", esize
, fetapes
);
otape(); /* bitmap is the first to tape write */
msg("dumping (Pass III) [directories]\n");
msg("dumping (Pass IV) [regular files]\n");
msg("DUMP: %ld tape blocks on %d tape(s)\n",spcl
.c_tapea
,spcl
.c_volume
);
broadcast("DUMP IS DONE!\7\7\n");
int sighup(){ msg("SIGHUP() try rewriting\n"); sigAbort();}
int sigtrap(){ msg("SIGTRAP() try rewriting\n"); sigAbort();}
int sigfpe(){ msg("SIGFPE() try rewriting\n"); sigAbort();}
int sigbus(){ msg("SIGBUS() try rewriting\n"); sigAbort();}
int sigsegv(){ msg("SIGSEGV() ABORTING!\n"); abort();}
int sigalrm(){ msg("SIGALRM() try rewriting\n"); sigAbort();}
int sigterm(){ msg("SIGTERM() try rewriting\n"); sigAbort();}
msg("Rewriting attempted as response to unknown signal.\n");
char *dp
= rindex(cp
, '/');