@@ -133,6 +133,7 @@ static const char usage[] =
133133#if !_PACKAGE_ast
134134#include <errno.h>
135135#include <signal.h>
136+ #include <stdbool.h>
136137#include <stdlib.h>
137138#include <string.h>
138139#endif
@@ -201,11 +202,7 @@ typedef struct Dict_item_s /* dictionary item */
201202 struct Dict_item_s * left ; /* left child */
202203 struct Dict_item_s * right ; /* right child */
203204 void * value ; /* user defined value */
204- #if __STDC_VERSION__ >= 199901L
205205 char name []; /* 0 terminated name */
206- #else
207- char name [1 ];/* 0 terminated name */
208- #endif
209206} Dict_item_t ;
210207
211208typedef struct Dict_s /* dictionary handle */
@@ -248,11 +245,7 @@ typedef struct View_s /* viewpath level */
248245{
249246 struct View_s * next ; /* next level in viewpath */
250247 size_t node ; /* viewpath node path length */
251- #if __STDC_VERSION__ >= 199901L
252248 char dir []; /* viewpath level dir prefix */
253- #else
254- char dir [1 ]; /* viewpath level dir prefix */
255- #endif
256249} View_t ;
257250
258251typedef struct Makestate_s /* make() shareable state */
@@ -285,21 +278,21 @@ static struct /* program state */
285278 char * packageroot ; /* %{PACKAGEROOT} */
286279
287280 int active ; /* targets currently active */
288- int chaos ; /* don't save up parallel logs */
289281 int debug ; /* negative of debug level */
290282 int exitstatus ; /* > 0 if error(s) occurred */
291- int exec ; /* execute actions */
292- int explain ; /* explain actions */
293- int force ; /* all targets out of date */
294- int ignore ; /* ignore command errors */
295283 int indent ; /* debug indent */
296- int keepgoing ; /* do siblings on error */
297- int never ; /* never execute */
298- int probed ; /* probe already done */
299- int verified ; /* don't bother with verify() */
300284 int jobs , maxjobs ; /* for parallel sh execution */
301285 size_t installrootlen ; /* strlen of %{INSTALLROOT} */
302286 size_t packagerootlen ; /* strlen of %{PACKAGEROOT} */
287+ bool explain :1 ; /* explain actions */
288+ bool ignore :1 ; /* ignore command errors */
289+ bool keepgoing :1 ; /* do siblings on error */
290+ bool force :1 ; /* all targets out of date */
291+ bool exec :1 ; /* execute actions */
292+ bool never :1 ; /* never execute */
293+ bool probed :1 ; /* probe already done */
294+ bool verified :1 ; /* don't bother with verify() */
295+ bool chaos :1 ; /* don't save up parallel logs */
303296
304297 Stream_t streams [4 ]; /* input file stream stack */
305298 Stream_t * sp ; /* input stream stack pointer */
@@ -401,11 +394,7 @@ static void report(int level, char *text, char *item, Rule_t *r)
401394 fprintf (stderr , "%s: " , item );
402395 fprintf (stderr , "%s" , text );
403396 if (r && r -> time && state .debug <= -2 )
404- #if __STDC_VERSION__ >= 199901L
405397 fprintf (stderr , " %llu" , (unsigned long long )r -> time );
406- #else
407- fprintf (stderr , " %lu" , (unsigned long )r -> time );
408- #endif
409398 fprintf (stderr , "\n" );
410399 if (level > 2 )
411400 exit_wait (level - 2 );
@@ -1602,15 +1591,16 @@ static void run(Rule_t *r, char *s)
16021591{
16031592 Rule_t * q ;
16041593 char * t ;
1605- int c , i , j , x ;
1594+ int c , i , j ;
1595+ bool x ;
16061596 Buf_t * buf ;
16071597
16081598 if (r -> flags & RULE_error )
16091599 return ;
16101600 buf = buffer ();
16111601 if (!strncmp (s , "mamake -r " , 10 ))
16121602 {
1613- state .verified = 1 ;
1603+ state .verified = true ;
16141604 x = !state .never ;
16151605 }
16161606 else
@@ -2069,7 +2059,7 @@ static void propagate(Rule_t *q, Rule_t *r, time_t *modtime)
20692059
20702060static void exit_wait (int e )
20712061{
2072- state .keepgoing = 1 ;
2062+ state .keepgoing = true ;
20732063 walk (state .rules , wreap );
20742064 if (state .exitstatus > e )
20752065 e = state .exitstatus ;
@@ -2479,7 +2469,7 @@ static void make(Rule_t *r, Makestate_t *parentstate)
24792469 }
24802470 if (!state .probed && strcmp (t , "CC" ) == 0 )
24812471 {
2482- state .probed = 1 ;
2472+ state .probed = true ;
24832473 probe (r , & st );
24842474 }
24852475 continue ;
@@ -2781,7 +2771,7 @@ int main(int argc, char **argv)
27812771
27822772 state .id = argv [0 ];
27832773 state .active = 1 ;
2784- state .exec = 1 ;
2774+ state .exec = true ;
27852775 state .file = mamfile ;
27862776 state .opt = buffer ();
27872777 state .shim_buf = buffer ();
@@ -2801,15 +2791,15 @@ int main(int argc, char **argv)
28012791 {
28022792 case 'c' :
28032793 append (state .opt , " -c" );
2804- state .chaos = 1 ;
2794+ state .chaos = true ;
28052795 continue ;
28062796 case 'e' :
28072797 append (state .opt , " -e" );
2808- state .explain = 1 ;
2798+ state .explain = true ;
28092799 continue ;
28102800 case 'i' :
28112801 append (state .opt , " -i" );
2812- state .ignore = 1 ;
2802+ state .ignore = true ;
28132803 continue ;
28142804 case 'j' :
28152805 append (state .opt , " -j" );
@@ -2818,18 +2808,18 @@ int main(int argc, char **argv)
28182808 continue ;
28192809 case 'k' :
28202810 append (state .opt , " -k" );
2821- state .keepgoing = 1 ;
2811+ state .keepgoing = true ;
28222812 continue ;
28232813 case 'N' :
2824- state .never = 1 ;
2814+ state .never = true ;
28252815 /* FALLTHROUGH */
28262816 case 'n' :
28272817 append (state .opt , " -n" );
2828- state .exec = 0 ;
2818+ state .exec = false ;
28292819 continue ;
28302820 case 'F' :
28312821 append (state .opt , " -F" );
2832- state .force = 1 ;
2822+ state .force = true ;
28332823 continue ;
28342824 case 'V' :
28352825 return !(write (1 , id + 10 , strlen (id ) - 12 ) > 0 && putchar ('\n' ) == '\n' );
@@ -2918,30 +2908,30 @@ int main(int argc, char **argv)
29182908 break ;
29192909 case 'c' :
29202910 append (state .opt , " -c" );
2921- state .chaos = 1 ;
2911+ state .chaos = true ;
29222912 continue ;
29232913 case 'e' :
29242914 append (state .opt , " -e" );
2925- state .explain = 1 ;
2915+ state .explain = true ;
29262916 continue ;
29272917 case 'i' :
29282918 append (state .opt , " -i" );
2929- state .ignore = 1 ;
2919+ state .ignore = true ;
29302920 continue ;
29312921 case 'k' :
29322922 append (state .opt , " -k" );
2933- state .keepgoing = 1 ;
2923+ state .keepgoing = true ;
29342924 continue ;
29352925 case 'N' :
2936- state .never = 1 ;
2926+ state .never = true ;
29372927 /* FALLTHROUGH */
29382928 case 'n' :
29392929 append (state .opt , " -n" );
2940- state .exec = 0 ;
2930+ state .exec = false ;
29412931 continue ;
29422932 case 'F' :
29432933 append (state .opt , " -F" );
2944- state .force = 1 ;
2934+ state .force = true ;
29452935 continue ;
29462936 case 'G' :
29472937 append (state .opt , " -G" );
@@ -3009,7 +2999,7 @@ int main(int argc, char **argv)
30092999 */
30103000
30113001 if (state .force )
3012- state .explain = 0 ;
3002+ state .explain = false ;
30133003 if (state .recurse )
30143004 state .maxjobs = 0 ;
30153005
@@ -3133,7 +3123,7 @@ int main(int argc, char **argv)
31333123
31343124 if (!state .active && !state .verified )
31353125 {
3136- state .keepgoing = 1 ;
3126+ state .keepgoing = true ;
31373127 walk (state .rules , verify );
31383128 }
31393129
0 commit comments