Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!seismo!rochester!ken From: ken@rochester.ARPA (SKY) Newsgroups: net.sources.bugs Subject: patch for new shar Message-ID: <25658@rochester.ARPA> Date: Sat, 7-Mar-87 01:26:05 EST Article-I.D.: rocheste.25658 Posted: Sat Mar 7 01:26:05 1987 Date-Received: Sun, 8-Mar-87 12:38:14 EST Reply-To: ken@rochester.UUCP (SKY) Organization: U of Rochester, CS Dept, Rochester, NY Lines: 96 Summary: not really a bug Rogue Monster's shar works very fast but I edited it to use getopt instead of getarg. The world doesn't need yet another getopt lookalike. Getopt is standard in many Unix distributions now. If you don't have it, rumage through old source postings. The -o option doesn't seem to work. How about a man page too? Ken *** Orig/shar.c Sat Mar 7 00:53:31 1987 --- shar.c Sat Mar 7 01:06:38 1987 *************** *** 17,23 **** extern int strlen(); extern char *strcpy(); extern int strcmp(); ! extern int getarg(); extern stat(); extern char strcat(); extern long atol(); --- 17,23 ---- extern int strlen(); extern char *strcpy(); extern int strcmp(); ! extern int getopt(); extern stat(); extern char strcat(); extern long atol(); *************** *** 529,535 **** * -p = use original permissions * -q = generate quite code */ ! while ((c = getarg(argc,argv,"cf:im:opq")) != EOF) switch (c){ case 'c': Check = 1; --- 529,535 ---- * -p = use original permissions * -q = generate quite code */ ! while ((c = getopt(argc,argv,"cf:im:opq")) != EOF) switch (c){ case 'c': Check = 1; *************** *** 553,567 **** case 'q': Quiet = 1; break; ! case '?': fprintf(stderr,"Unknown switch: -%c\n",c); break; ! default: /* * File names can be absolute or relative, decide which * tree the filename goes in. */ ! SourceName = optarg; if (*optarg == '/') tre = ParseFileName(&Abs,++optarg); else --- 553,568 ---- case 'q': Quiet = 1; break; ! default: fprintf(stderr,"Unknown switch: -%c\n",c); break; ! } ! while (optind < argc){ /* * File names can be absolute or relative, decide which * tree the filename goes in. */ ! SourceName = optarg = argv[optind++]; if (*optarg == '/') tre = ParseFileName(&Abs,++optarg); else *************** *** 571,577 **** */ if (tre && (tre->Flags & F_DIR)) ExpandTree(tre); ! } /* * Do tests, additional tree building if required. */ --- 572,578 ---- */ if (tre && (tre->Flags & F_DIR)) ExpandTree(tre); ! } /* * Do tests, additional tree building if required. */