home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Simtel MSDOS - Coast to Coast
/
simteldosarchivecoasttocoast2.iso
/
c
/
shar.c
< prev
next >
Wrap
C/C++ Source or Header
|
1994-03-04
|
644b
|
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);
}