On Sun, Jul 23, 2017 at 03:04:54PM +0200, Anton Lindqvist wrote:

> Hi,
> Fairly straightforward and no intended functional change. If changes
> like this one is not encouraged I would advocate on at least using
> stdbool.h instead.
> 
> Comments? OK?

why? It might be old school, but there's noting wrong with this code.

        -Otto


> 
> Index: apm.c
> ===================================================================
> RCS file: /cvs/src/usr.sbin/apm/apm.c,v
> retrieving revision 1.33
> diff -u -p -r1.33 apm.c
> --- apm.c     23 Jul 2017 12:51:20 -0000      1.33
> +++ apm.c     23 Jul 2017 13:02:38 -0000
> @@ -45,9 +45,6 @@
>  #include "pathnames.h"
>  #include "apm-proto.h"
>  
> -#define FALSE 0
> -#define TRUE 1
> -
>  extern char *__progname;
>  
>  static int           do_zzz(int, enum apm_action);
> @@ -145,12 +142,12 @@ int
>  main(int argc, char *argv[])
>  {
>       const char *sockname = _PATH_APM_SOCKET;
> -     int doac = FALSE;
> -     int dopct = FALSE;
> -     int dobstate = FALSE;
> -     int domin = FALSE;
> -     int doperf = FALSE;
> -     int verbose = FALSE;
> +     int doac = 0;
> +     int dopct = 0;
> +     int dobstate = 0;
> +     int domin = 0;
> +     int doperf = 0;
> +     int verbose = 0;
>       int ch, fd, rval;
>       enum apm_action action = NONE;
>       struct apm_command command;
> @@ -164,7 +161,7 @@ main(int argc, char *argv[])
>       while ((ch = getopt(argc, argv, "ACHLlmbvaPSzZf:")) != -1) {
>               switch (ch) {
>               case 'v':
> -                     verbose = TRUE;
> +                     verbose = 1;
>                       break;
>               case 'f':
>                       sockname = optarg;
> @@ -207,31 +204,31 @@ main(int argc, char *argv[])
>               case 'b':
>                       if (action != NONE && action != GETSTATUS)
>                               usage();
> -                     dobstate = TRUE;
> +                     dobstate = 1;
>                       action = GETSTATUS;
>                       break;
>               case 'l':
>                       if (action != NONE && action != GETSTATUS)
>                               usage();
> -                     dopct = TRUE;
> +                     dopct = 1;
>                       action = GETSTATUS;
>                       break;
>               case 'm':
>                       if (action != NONE && action != GETSTATUS)
>                               usage();
> -                     domin = TRUE;
> +                     domin = 1;
>                       action = GETSTATUS;
>                       break;
>               case 'a':
>                       if (action != NONE && action != GETSTATUS)
>                               usage();
> -                     doac = TRUE;
> +                     doac = 1;
>                       action = GETSTATUS;
>                       break;
>               case 'P':
>                       if (action != NONE && action != GETSTATUS)
>                               usage();
> -                     doperf = TRUE;
> +                     doperf = 1;
>                       action = GETSTATUS;
>                       break;
>               default:
> @@ -280,7 +277,7 @@ main(int argc, char *argv[])
>               goto balony;
>       case NONE:
>               action = GETSTATUS;
> -             verbose = doac = dopct = dobstate = domin = doperf = TRUE;
> +             verbose = doac = dopct = dobstate = domin = doperf = 1;
>               /* FALLTHROUGH */
>       case GETSTATUS:
>               if (fd == -1) {

Reply via email to