#include char tarfile[32]; char *tbuf; int hitr, tfile, blocks, type, verbos, xtract, cre8, nodev, nopath; main(argc,argv) int argc; char *argv[]; { extern int opterr; extern int optind; extern char *optarg; char c; nodev = nopath = hitr = tfile = opterr = 0; type = verbos = xtract = cre8 = 0; sprintf(tarfile, "/dev/rmt0"); blocks = 1; while((c = getopt(argc, argv, "xcvthpdb:f:")) != EOF) { switch(c) { case 'b': blocks = atoi(optarg); if(blocks == 0 || blocks > 255) { printf("Block values range from 1-255\n"); Exit(1); } break; case 'f': tfile = 1; strcpy(tarfile, optarg); break; case 'h': hitr = 1; break; case 'x': xtract = 1; break; case 'c': cre8 = 1; break; case 't': type = 1; break; case 'v': verbos = 1; break; case 'p': nopath = 1; break; case 'd': nodev = 1; break; default: hitr = 1; Usage(); Exit(1); break; } } if(!xtract && !cre8 && !type) { hitr = 1; Usage(); Exit(1); } if(xtract && cre8) { printf("Error: -c and -x are mutualy exclusive\n"); hitr = 1; Usage(); Exit(1); } argv += optind; if(cre8) { ctar(argc-optind, argv); } else if(xtract || type) { xtar(argc-optind, argv); } Exit(0); } Exit(stat) int stat; { if(hitr) { printf("exit(%d) - Hit when ready \n", stat); getc(stdin); } exit(stat); } Usage() { printf("tar - A unix compatible tape archive utility for the Atari ST\n\n"); printf("usage: tar -{c|x|t} -[vdph] [-b{blocks}] [-f{filename}] [pathname ... ]\n"); printf(" x Extract file(s) from tape to disk\n"); printf(" c Create tape from beginning of tape\n"); printf(" t print file name(s) in archive on screen\n"); printf(" v Verbose messages on screen\n"); printf(" d (ST Unique) Ignore drive name in tape archive when extracting\n"); printf(" p (ST Unique) Ignore directory path in tape archive when extracting\n"); printf(" h (ST Unique) Hold screen for when done before returning to desktop\n"); printf(" b Blocking factor 1-255 (the more the better but uses up memory)\n"); printf(" f Use disk file {filename} instead of tape device\n"); printf("\n"); }