Added source extension "e" and fixed a bug on chdir() errors

This commit is contained in:
Pierre Pronchery 2004-07-29 12:52:30 +00:00
parent 7510cea6b3
commit 12d2bccff9

View File

@ -10,6 +10,10 @@ extern int optind;
/* configure */ /* configure */
/* PRE
* POST specified directory has been setup
* 2 chdir() failed
* else other errors occured */
static int _configure_config(Config * config); static int _configure_config(Config * config);
static int _configure(char const * directory) static int _configure(char const * directory)
{ {
@ -23,7 +27,7 @@ static int _configure(char const * directory)
return 2; return 2;
} }
if((config = config_new()) == NULL) if((config = config_new()) == NULL)
return 2; return 3;
if(config_load(config, "project.conf") == 0) if(config_load(config, "project.conf") == 0)
res = _configure_config(config); res = _configure_config(config);
else else
@ -49,7 +53,7 @@ static int _configure_config(Config * config)
return 1; return 1;
} }
if(_config_makefile(fp, config) != 0) if(_config_makefile(fp, config) != 0)
res = 2; res = 3;
fclose(fp); fclose(fp);
return res; return res;
} }
@ -99,7 +103,7 @@ static int _subdir_configure(char const * subdir)
if(strstr(subdir, "/") == NULL && strcmp(subdir, ".") if(strstr(subdir, "/") == NULL && strcmp(subdir, ".")
&& strcmp(subdir, "..")) && strcmp(subdir, ".."))
{ {
_configure(subdir); if(_configure(subdir) != 2)
chdir(".."); chdir("..");
return 0; return 0;
} }
@ -296,6 +300,13 @@ static void _obj_print(FILE * fp, char * obj)
obj[len+1] = 'c'; obj[len+1] = 'c';
return; return;
} }
if(strcmp(&obj[len+1], "e") == 0)
{
obj[len+1] = 'o';
fprintf(fp, "%s", obj);
obj[len+1] = 'e';
return;
}
fprintf(stderr, "%s%s%s", "configure: ", obj, fprintf(stderr, "%s%s%s", "configure: ", obj,
": Unknown source type\n"); ": Unknown source type\n");
} }