Print this page
4307 Variable is used before it is initialized in kwarndtest.c
Reviewed by: Igor Kozhukhov <ikozhukhov@gmail.com>
   1 /*
   2  * Copyright 1995-2002 Sun Microsystems, Inc.  All rights reserved.
   3  * Use is subject to license terms.


   4  */
   5 
   6 #pragma ident   "%Z%%M% %I%     %E% SMI"
   7 
   8 /*
   9  * Test client for kwarnd.  This program is not shipped on the binary
  10  * release. This code was taken and modified from gssdtest.c
  11  */
  12 
  13 #include <stdio.h>
  14 #include <strings.h>
  15 #include <ctype.h>
  16 #include <stdlib.h>
  17 #include "kwarnd.h"
  18 #include <rpc/rpc.h>
  19 
  20 #define LOOP_COUNTER  100
  21 
  22 #define OCTAL_MACRO "%03.3o."
  23 #define MALLOC(n) malloc(n)
  24 #define CALLOC(n, s) calloc((n), (s))
  25 #define FREE(x, n) free(x)
  26 
  27 static void instructs(void);


  78         return (0);
  79 }
  80 
  81 static int
  82 do_kwarndtest(char *buf)
  83 {
  84         int argc;
  85         char **argv, **argv_array;
  86 
  87         char *cmd;
  88 
  89         argv = 0;
  90 
  91         if (parse_input_line(buf, &argc, &argv) == 0) {
  92                 printf(gettext("\n"));
  93                 return (1);
  94         }
  95 
  96         if (argc == 0) {
  97                 usage();
  98                 /*LINTED*/
  99                 FREE(argv_array, (argc+1)*sizeof (char *));
 100                 return (0);
 101         }
 102 
 103         /*
 104          * remember argv_array address, which is memory calloc'd by
 105          * parse_input_line, so it can be free'd at the end of the loop.
 106          */
 107 
 108         argv_array = argv;
 109 
 110         cmd = argv[0];
 111 
 112         argc--;
 113         argv++;
 114 
 115         if (strcmp(cmd, "kwarn_add_warning") == 0 ||
 116             strcmp(cmd, "add") == 0) {
 117                 _kwarnd_add_warning(argc, argv);
 118         } else if (strcmp(cmd, "kwarn_del_warning") == 0 ||
 119                 strcmp(cmd, "delete") == 0) {


   1 /*
   2  * Copyright 1995-2002 Sun Microsystems, Inc.  All rights reserved.
   3  * Use is subject to license terms.
   4  *
   5  * Copyright 2013 Nexenta Systems. All rights reserved.
   6  */
   7 


   8 /*
   9  * Test client for kwarnd.  This program is not shipped on the binary
  10  * release. This code was taken and modified from gssdtest.c
  11  */
  12 
  13 #include <stdio.h>
  14 #include <strings.h>
  15 #include <ctype.h>
  16 #include <stdlib.h>
  17 #include "kwarnd.h"
  18 #include <rpc/rpc.h>
  19 
  20 #define LOOP_COUNTER  100
  21 
  22 #define OCTAL_MACRO "%03.3o."
  23 #define MALLOC(n) malloc(n)
  24 #define CALLOC(n, s) calloc((n), (s))
  25 #define FREE(x, n) free(x)
  26 
  27 static void instructs(void);


  78         return (0);
  79 }
  80 
  81 static int
  82 do_kwarndtest(char *buf)
  83 {
  84         int argc;
  85         char **argv, **argv_array;
  86 
  87         char *cmd;
  88 
  89         argv = 0;
  90 
  91         if (parse_input_line(buf, &argc, &argv) == 0) {
  92                 printf(gettext("\n"));
  93                 return (1);
  94         }
  95 
  96         if (argc == 0) {
  97                 usage();
  98                 FREE(argv, (argc+1)*sizeof (char *));

  99                 return (0);
 100         }
 101 
 102         /*
 103          * remember argv_array address, which is memory calloc'd by
 104          * parse_input_line, so it can be free'd at the end of the loop.
 105          */
 106 
 107         argv_array = argv;
 108 
 109         cmd = argv[0];
 110 
 111         argc--;
 112         argv++;
 113 
 114         if (strcmp(cmd, "kwarn_add_warning") == 0 ||
 115             strcmp(cmd, "add") == 0) {
 116                 _kwarnd_add_warning(argc, argv);
 117         } else if (strcmp(cmd, "kwarn_del_warning") == 0 ||
 118             strcmp(cmd, "delete") == 0) {