Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.2 9/18/84; site mcnc.mcnc.UUCP Path: utzoo!watmath!clyde!bonnie!akgua!whuxlm!harpo!decvax!mcnc!jnw From: jnw@mcnc.UUCP (John White) Newsgroups: net.micro.pc Subject: Re: PC-DOS version of shar Message-ID: <590@mcnc.mcnc.UUCP> Date: Tue, 18-Jun-85 22:33:13 EDT Article-I.D.: mcnc.590 Posted: Tue Jun 18 22:33:13 1985 Date-Received: Thu, 20-Jun-85 23:56:17 EDT References: <726@pyuxqq.UUCP> Organization: Microelectronics Center of NC; RTP, NC Lines: 44 > The "shar" command is a good way of sending multiple files > in a single mailing from one UNIX to another. > I'm wondering if anyone has developed companion shar commands, > one UNIX-based and the other PC-DOS based, that can be used > to create a shar file on unix, download it to the pc, > then extract files onto the pc. > A converse use would be to create a shar archive on the PC, > upload to UNIX, then extract on unix. > Here is a quick and dirty shar archiver that I use on an MS-DOS machine to package several C source files for porting to a UNIX system. The compiler I use (DeSmet) converts "\n" to "\r\n" so I run the resulting file through a '\r' remover (such as tr -d '\015'). The archive uses the "cat" format and goes to file "shar.out". ----------------------------------------------------------------- /* make a shell archive out of the files passed as arguments */ #include main(argc, argv) char **argv;{ int i, j; FILE *fo, *fi; if((fo=fopen("shar.out", "w")) == NULL){ printf("can't open file shar.out\n"); exit(1); } fprintf(fo, "#!/bin/sh\n"); while(++argv, --argc>0){ if((fi=fopen(*argv, "r")) == NULL){ printf("can't read file %s\n", *argv); } else{ fprintf(fo, "echo extracting %s ...\ncat >%s <