usage: printf("Usage: -s [files to skip] -f [device to use] -n [number of files to scan] -l [tapenumber] -c <to create new catalog>\nDefaults: skip over label only, device=/dev/rsmt0, scan one file\n");
exit(1);
}
catname = catholder;
tmpname = getenv("HOME");
catname = strcpy(catname,tmpname);
catname = strcat(catname,"/.catalogs/");
tmpname = tmpholder;
tmpname = strcpy(tmpname,"/tmp/");
sfcname = sfcnholder;
usefile = tapename;
tapenumber = tapefile = restore = allbytes = 0;
system("date");
number = 1; /* default number of files to scan */
argc--;
while(argc) {
++argv;
argc -= 2; /* Take away two args */
for(cp = argv[0]+1; *cp; cp++) {
switch(*cp) { /* Grap options */
case 'f':
usefile = *++argv;
break;
case 's':
tapefile = atoi(*++argv);
/* skip this number of files before reading*/
break;
case 'n':
number = atoi(*++argv);
break;
case 'l':
tapenumber = atoi(*++argv);
catname = strcat(catname,*argv);
catname = strcat(catname,".catlg");
tmpname = strcat(tmpname,*argv);
break;
case 'c':
restore = 1;
break;
default :
printf("Unknown option\n");
goto usage;
}
}
}
if (restore) {
chbptr = charbuff;
chbptr = strcpy(chbptr,"test -d ");
chbptr = strcat(chbptr,getenv("HOME"));
chbptr = strcat(chbptr,"/.catalogs");
if (system(chbptr) != 0) {
fprintf(stderr,
"\n\nShame on you! You need a directory called '.catalogs' in\n");
fprintf(stderr,
"your home directory to run this program! Sorry.....\n\n\n");
exit(-3);
}
}
if((tapeunit = open(usefile,0)) < 0) {
printf("trouble opening tape unit\n");
exit(tapeunit);
}
if(!tapenumber) {
printf("You didn't specify a tape number with -l flag\n");