home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Simtel MSDOS 1996 September
/
Simtel-MSDOS-Sep1996-CD2.iso
/
disc2
/
c
/
shar.c
< prev
next >
Wrap
C/C++ Source or Header
|
1985-07-06
|
672b
|
29 lines
/* make a shell archive out of the files passed as arguments */
#include <stdio.h>
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 <<xzyyz\n",
*argv, *argv);
while((i=getc(fi)) != EOF) putc(j=i, fo);
if(j != '\n') putc('\n', fo);
fclose(fi);
fprintf(fo, "xzyyz\n");
}
}
fprintf(fo, "echo done\n");
fclose(fo);
exit(0);
}