dont open output file until input sucessfully read
This commit is contained in:
@@ -97,11 +97,6 @@ int main(int argc,char **argv)
|
||||
outFilename = dbCalloc(1,strlen(argv[2])+1);
|
||||
strcpy(outFilename,argv[2]);
|
||||
}
|
||||
outFile = fopen(outFilename,"w");
|
||||
if(!outFile) {
|
||||
errPrintf(0,__FILE__,__LINE__,"Error opening %s\n",outFilename);
|
||||
exit(-1);
|
||||
}
|
||||
pdbbase = dbAllocBase();
|
||||
pdbbase->ignoreMissingMenus = TRUE;
|
||||
status = dbReadDatabase(&pdbbase,argv[1],path,sub);
|
||||
@@ -109,6 +104,11 @@ int main(int argc,char **argv)
|
||||
fprintf(stderr,"Terminal error For input file %s\n",argv[1]);
|
||||
exit(-1);
|
||||
}
|
||||
outFile = fopen(outFilename,"w");
|
||||
if(!outFile) {
|
||||
errPrintf(0,__FILE__,__LINE__,"Error opening %s\n",outFilename);
|
||||
exit(-1);
|
||||
}
|
||||
pdbMenu = (dbMenu *)ellFirst(&pdbbase->menuList);
|
||||
while(pdbMenu) {
|
||||
fprintf(outFile,"#ifndef INC%sH\n",pdbMenu->name);
|
||||
|
||||
@@ -109,11 +109,6 @@ int main(int argc,char **argv)
|
||||
isdbCommonRecord = TRUE;
|
||||
}
|
||||
}
|
||||
outFile = fopen(outFilename,"w");
|
||||
if(!outFile) {
|
||||
errPrintf(0,__FILE__,__LINE__,"Error opening %s\n",outFilename);
|
||||
exit(-1);
|
||||
}
|
||||
pdbbase = dbAllocBase();
|
||||
pdbbase->ignoreMissingMenus = TRUE;
|
||||
pdbbase->loadCdefs = TRUE;
|
||||
@@ -122,6 +117,11 @@ int main(int argc,char **argv)
|
||||
fprintf(stderr,"Terminal error For input file %s\n",argv[1]);
|
||||
exit(-1);
|
||||
}
|
||||
outFile = fopen(outFilename,"w");
|
||||
if(!outFile) {
|
||||
errPrintf(0,__FILE__,__LINE__,"Error opening %s\n",outFilename);
|
||||
exit(-1);
|
||||
}
|
||||
fprintf(outFile,"#include \"ellLib.h\"\n");
|
||||
fprintf(outFile,"#include \"epicsMutex.h\"\n");
|
||||
fprintf(outFile,"#include \"link.h\"\n");
|
||||
|
||||
Reference in New Issue
Block a user