Code cleanup
This commit is contained in:
parent
c66c897c92
commit
8878a2564b
28
src/c99.c
28
src/c99.c
@ -127,25 +127,15 @@ static int _c99(Prefs * prefs, int filec, char * filev[])
|
|||||||
|
|
||||||
static int _c99_do_c(Prefs * prefs, FILE * outfp, char const * infile);
|
static int _c99_do_c(Prefs * prefs, FILE * outfp, char const * infile);
|
||||||
static int _c99_do_E(Prefs * prefs, FILE * outfp, char const * infile);
|
static int _c99_do_E(Prefs * prefs, FILE * outfp, char const * infile);
|
||||||
static int _c99_do_o(Prefs * prefs, FILE * outfp, char const * infile,
|
static int _c99_do_o(Prefs * prefs, FILE * outfp, char const * infile);
|
||||||
FILE * infp);
|
|
||||||
static int _c99_do(Prefs * prefs, FILE * outfp, char const * infile)
|
static int _c99_do(Prefs * prefs, FILE * outfp, char const * infile)
|
||||||
{
|
{
|
||||||
FILE * infp;
|
|
||||||
int ret;
|
|
||||||
|
|
||||||
if(prefs->flags & PREFS_c)
|
if(prefs->flags & PREFS_c)
|
||||||
return _c99_do_c(prefs, outfp, infile);
|
return _c99_do_c(prefs, outfp, infile);
|
||||||
else if(prefs->flags & PREFS_E)
|
else if(prefs->flags & PREFS_E)
|
||||||
return _c99_do_E(prefs, outfp, infile);
|
return _c99_do_E(prefs, outfp, infile);
|
||||||
if((infp = fopen(infile, "r")) == NULL)
|
|
||||||
return error_set_code(1, "%s: %s", infile, strerror(errno));
|
|
||||||
else
|
else
|
||||||
ret = _c99_do_o(prefs, outfp, infile, infp);
|
return _c99_do_o(prefs, outfp, infile);
|
||||||
/* FIXME implement */
|
|
||||||
if(fclose(infp) != 0 && ret == 0)
|
|
||||||
return error_set_code(1, "%s: %s", infile, strerror(errno));
|
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int _c99_do_c(Prefs * prefs, FILE * outfp, char const * infile)
|
static int _c99_do_c(Prefs * prefs, FILE * outfp, char const * infile)
|
||||||
@ -226,11 +216,18 @@ static int _c99_do_E(Prefs * prefs, FILE * outfp, char const * infile)
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int _c99_do_o(Prefs * prefs, FILE * outfp, char const * infile,
|
static int _c99_do_o(Prefs * prefs, FILE * outfp, char const * infile)
|
||||||
FILE * infp)
|
|
||||||
{
|
{
|
||||||
|
int ret;
|
||||||
|
FILE * infp;
|
||||||
|
|
||||||
|
if((infp = fopen(infile, "r")) == NULL)
|
||||||
|
return error_set_code(1, "%s: %s", infile, strerror(errno));
|
||||||
/* FIXME implement */
|
/* FIXME implement */
|
||||||
return error_set_code(1, "%s", strerror(ENOSYS));
|
ret = error_set_code(1, "%s", strerror(ENOSYS));
|
||||||
|
if(fclose(infp) != 0 && ret == 0)
|
||||||
|
return error_set_code(1, "%s: %s", infile, strerror(errno));
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -313,6 +310,7 @@ int main(int argc, char * argv[])
|
|||||||
case 'U':
|
case 'U':
|
||||||
if(_main_add_undefine(&prefs, optarg) != 0)
|
if(_main_add_undefine(&prefs, optarg) != 0)
|
||||||
return 2;
|
return 2;
|
||||||
|
break;
|
||||||
case '1':
|
case '1':
|
||||||
case '2':
|
case '2':
|
||||||
case '3':
|
case '3':
|
||||||
|
Loading…
Reference in New Issue
Block a user