explicit exit codes

This commit is contained in:
Gwenhael Le Moine 2011-07-04 10:39:00 +02:00
parent a4130d1526
commit e67b6382c7

6
star.c
View file

@ -510,7 +510,7 @@ int parse_args( int argc, char* argv[], struct options *o, struct state *s )
switch(c) { switch(c) {
case 'h' : case 'h' :
printf( "%s\n", help_text ); printf( "%s\n", help_text );
exit(0); exit( EXIT_SUCCESS );
case 'b' : case 'b' :
o->black_and_white = 1; o->black_and_white = 1;
break; break;
@ -526,7 +526,7 @@ int parse_args( int argc, char* argv[], struct options *o, struct state *s )
break; break;
case '?' : case '?' :
case ':' : case ':' :
exit( 0 ); exit( EXIT_SUCCESS );
default : break; default : break;
} }
} }
@ -555,7 +555,7 @@ int main( int argc, char* argv[] )
struct options *o = malloc( sizeof( struct options ) ); struct options *o = malloc( sizeof( struct options ) );
if ( s == NULL || o == NULL ) { if ( s == NULL || o == NULL ) {
exit( 1 ); /* Guys, we're out of memory */ exit( EXIT_FAILURE ); /* Guys, we're out of memory */
} }
/* trick to count how many levels we have */ /* trick to count how many levels we have */