Skip to content
Snippets Groups Projects
Commit ec16d311 authored by rswindell's avatar rswindell
Browse files

Optional command-line argument to specify output directory.

parent 47d5d2bd
Branches
Tags
No related merge requests found
...@@ -14,8 +14,9 @@ ...@@ -14,8 +14,9 @@
#include <io.h> /* open */ #include <io.h> /* open */
#endif #endif
int main(void) int main(int argc, char **argv)
{ {
char *dir=".";
char *files[]={ char *files[]={
"scfg.c" "scfg.c"
,"scfgsys.c" ,"scfgsys.c"
...@@ -34,17 +35,22 @@ int main(void) ...@@ -34,17 +35,22 @@ int main(void)
long l; long l;
FILE *stream,*out; FILE *stream,*out;
if((out=fopen("scfghelp.dat","wb"))==NULL) { if(argc>1)
printf("error opening scfghelp.dat\r\n"); dir=argv[1];
sprintf(str,"%s/scfghelp.dat",dir);
if((out=fopen(str,"wb"))==NULL) {
fprintf(stderr,"!error opening %s\n",str);
return(-1); } return(-1); }
if((ixb=open("scfghelp.ixb",O_WRONLY|O_CREAT|O_BINARY,S_IWRITE|S_IREAD))==-1) { sprintf(str,"%s/scfghelp.ixb",dir);
printf("error opening scfghelp.ixb\r\n"); if((ixb=open(str,O_WRONLY|O_CREAT|O_BINARY,S_IWRITE|S_IREAD))==-1) {
fprintf(stderr,"!error opening %s\n",str);
return(-1); } return(-1); }
for(i=0;files[i];i++) { for(i=0;files[i];i++) {
if((stream=fopen(files[i],"rb"))==NULL) { if((stream=fopen(files[i],"rb"))==NULL) {
printf("error opening %s\r\n",files[i]); fprintf(stderr,"!error opening %s\r\n",files[i]);
return(-3); } return(-3); }
printf("\r\n%s ",files[i]); printf("\r\n%s ",files[i]);
line=0; line=0;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment