Print this page
10120 smatch indenting fixes for usr/src/cmd
Reviewed by: Gergő Doma <domag02@gmail.com>
Portions contributed by: Joyce McIntosh <joyce.mcintosh@nexenta.com>


   6  * You may not use this file except in compliance with the License.
   7  *
   8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
   9  * or http://www.opensolaris.org/os/licensing.
  10  * See the License for the specific language governing permissions
  11  * and limitations under the License.
  12  *
  13  * When distributing Covered Code, include this CDDL HEADER in each
  14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  15  * If applicable, add the following below this CDDL HEADER, with the
  16  * fields enclosed by brackets "[]" replaced with your own identifying
  17  * information: Portions Copyright [yyyy] [name of copyright owner]
  18  *
  19  * CDDL HEADER END
  20  */
  21 /*
  22  * Copyright (c) 1992, 2010, Oracle and/or its affiliates. All rights reserved.
  23  */
  24 
  25 /*




  26  * auditconfig - set and display audit parameters
  27  */
  28 
  29 #include <locale.h>
  30 #include <sys/types.h>
  31 #include <ctype.h>
  32 #include <stdlib.h>
  33 #include <stdarg.h>
  34 #include <unistd.h>
  35 #include <errno.h>
  36 #include <sys/param.h>
  37 #include <stdio.h>
  38 #include <string.h>
  39 #include <strings.h>
  40 #include <nlist.h>
  41 #include <fcntl.h>
  42 #include <sys/socket.h>
  43 #include <netdb.h>
  44 #include <netinet/in.h>
  45 #include <arpa/inet.h>


2555                                 (void) strcat(policy_str, ",");
2556                         }
2557                         (void) strlcat(policy_str, policy_table[i].policy_str,
2558                             len);
2559                 }
2560         }
2561 
2562         if (*policy_str)
2563                 return (0);
2564 
2565         return (1);
2566 }
2567 
2568 
2569 static int
2570 strisnum(char *s)
2571 {
2572         if (s == NULL || !*s)
2573                 return (0);
2574 
2575         for (; *s == '-' || *s == '+'; s++)
2576 
2577         if (!*s)
2578                 return (0);

2579 
2580         for (; *s; s++)
2581                 if (!isdigit(*s))
2582                         return (0);

2583 
2584         return (1);
2585 }
2586 
2587 static int
2588 strisipaddr(char *s)
2589 {
2590         int dot = 0;
2591         int colon = 0;
2592 
2593         /* no string */
2594         if ((s == NULL) || (!*s))
2595                 return (0);
2596 
2597         for (; *s; s++) {
2598                 if (!(isxdigit(*s) || *s != '.' || *s != ':'))
2599                         return (0);
2600                 if (*s == '.')
2601                         dot++;
2602                 if (*s == ':')




   6  * You may not use this file except in compliance with the License.
   7  *
   8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
   9  * or http://www.opensolaris.org/os/licensing.
  10  * See the License for the specific language governing permissions
  11  * and limitations under the License.
  12  *
  13  * When distributing Covered Code, include this CDDL HEADER in each
  14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  15  * If applicable, add the following below this CDDL HEADER, with the
  16  * fields enclosed by brackets "[]" replaced with your own identifying
  17  * information: Portions Copyright [yyyy] [name of copyright owner]
  18  *
  19  * CDDL HEADER END
  20  */
  21 /*
  22  * Copyright (c) 1992, 2010, Oracle and/or its affiliates. All rights reserved.
  23  */
  24 
  25 /*
  26  * Copyright (c) 2019, Joyent, Inc.
  27  */
  28 
  29 /*
  30  * auditconfig - set and display audit parameters
  31  */
  32 
  33 #include <locale.h>
  34 #include <sys/types.h>
  35 #include <ctype.h>
  36 #include <stdlib.h>
  37 #include <stdarg.h>
  38 #include <unistd.h>
  39 #include <errno.h>
  40 #include <sys/param.h>
  41 #include <stdio.h>
  42 #include <string.h>
  43 #include <strings.h>
  44 #include <nlist.h>
  45 #include <fcntl.h>
  46 #include <sys/socket.h>
  47 #include <netdb.h>
  48 #include <netinet/in.h>
  49 #include <arpa/inet.h>


2559                                 (void) strcat(policy_str, ",");
2560                         }
2561                         (void) strlcat(policy_str, policy_table[i].policy_str,
2562                             len);
2563                 }
2564         }
2565 
2566         if (*policy_str)
2567                 return (0);
2568 
2569         return (1);
2570 }
2571 
2572 
2573 static int
2574 strisnum(char *s)
2575 {
2576         if (s == NULL || !*s)
2577                 return (0);
2578 
2579         for (; *s == '-' || *s == '+'; s++) {

2580                 if (!*s)
2581                         return (0);
2582         }
2583 
2584         for (; *s; s++) {
2585                 if (!isdigit(*s))
2586                         return (0);
2587         }
2588 
2589         return (1);
2590 }
2591 
2592 static int
2593 strisipaddr(char *s)
2594 {
2595         int dot = 0;
2596         int colon = 0;
2597 
2598         /* no string */
2599         if ((s == NULL) || (!*s))
2600                 return (0);
2601 
2602         for (; *s; s++) {
2603                 if (!(isxdigit(*s) || *s != '.' || *s != ':'))
2604                         return (0);
2605                 if (*s == '.')
2606                         dot++;
2607                 if (*s == ':')