From 6a9163988d4b1ceb0c1229474cd3f699002e01ab Mon Sep 17 00:00:00 2001 From: "W. Eric Norum" Date: Thu, 3 Jun 2004 21:34:55 +0000 Subject: [PATCH] 1) Always print expanded line regardless of the state of the -V flag and the presence or absence of undefined macros. 2) Exit with status 2 if warnings are enabled (-V) and one or more macros is undefined. --- msi.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/msi.c b/msi.c index de578e309..6cee34fbe 100644 --- a/msi.c +++ b/msi.c @@ -45,6 +45,10 @@ static void substituteDestruct(void *substitutePvt); static void substituteOpen(void **substitutePvt,char *substitutionName); static int substituteGetNextSet(void *substitutePvt,char **filename); static char *substituteGetReplacements(void *substitutePvt); + +/*Exit status*/ +static int exitStatus = 0; + int main(int argc,char **argv) { @@ -116,7 +120,7 @@ int main(int argc,char **argv) inputDestruct(inputPvt); free((void *)templateName); free((void *)substitutionName); - return(0); + return(exitStatus); } void usageExit(void) @@ -219,10 +223,10 @@ static void makeSubstitutions(void *inputPvt,void *macPvt,char *templateName) endif: if(expand) { n = macExpandString(macPvt,input,buffer,MAX_BUFFER_SIZE-1); + fputs(buffer,stdout); if(n<0) { inputErrPrint(inputPvt); - } else { - printf("%s",buffer); + exitStatus = 2; } } }