Browse Source

fix bug when no -d option and more than one output file

tags/v1.2
Thierry Leconte 21 years ago
parent
commit
940363d0d7
1 changed files with 4 additions and 4 deletions
  1. +4
    -4
      main.c

+ 4
- 4
main.c View File

@@ -292,7 +292,7 @@ main(int argc, char **argv)
{ {
char pngfilename[1024]; char pngfilename[1024];
char name[1024]; char name[1024];
char *pngdirname=NULL;
char pngdirname[1024]="";
char imgopt[20]="ac"; char imgopt[20]="ac";
float *prow[3000]; float *prow[3000];
const char *chid[6]={ "1","2","3A","4","5","3B"}; const char *chid[6]={ "1","2","3A","4","5","3B"};
@@ -306,7 +306,7 @@ opterr=0;
while ((c=getopt(argc,argv,"c:d:i:ps:"))!=EOF) { while ((c=getopt(argc,argv,"c:d:i:ps:"))!=EOF) {
switch(c) { switch(c) {
case 'd': case 'd':
pngdirname=optarg;
strcpy(pngdirname,optarg);
break; break;
case 'c': case 'c':
readcmap(optarg); readcmap(optarg);
@@ -337,9 +337,9 @@ int a=0,b=0;
strcpy(pngfilename,argv[optind]); strcpy(pngfilename,argv[optind]);
strcpy(name,basename(pngfilename)); strcpy(name,basename(pngfilename));
strtok(name,"."); strtok(name,".");
if (pngdirname==NULL) {
if(pngdirname[0]=='\0') {
strcpy(pngfilename,argv[optind]); strcpy(pngfilename,argv[optind]);
pngdirname=dirname(pngfilename);
strcpy(pngdirname,dirname(pngfilename));
} }


/* open snd input */ /* open snd input */


Loading…
Cancel
Save