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>
   1 /*
   2  * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
   3  * Use is subject to license terms.
   4  */
   5 
   6 /*




   7  * zdump 7.24
   8  * Taken from elsie.nci.nih.gov to replace the existing Solaris zdump,
   9  * which was based on an earlier version of the elsie code.
  10  *
  11  * For zdump 7.24, the following changes were made to the elsie code:
  12  *   locale/textdomain/messages to match existing Solaris style.
  13  *   Solaris verbose mode is documented to display the current time first.
  14  *   cstyle cleaned code.
  15  *   removed old locale/textdomain code.
  16  */
  17 
  18 static char     elsieid[] = "@(#)zdump.c        7.74";
  19 
  20 /*
  21  * This code has been made independent of the rest of the time
  22  * conversion package to increase confidence in the verification it provides.
  23  * You can use this code to help in verifying other implementations.
  24  */
  25 
  26 #include "stdio.h"      /* for stdout, stderr, perror */


 214                         vflag = 1;
 215                 else    cutarg = optarg;
 216         if (c != EOF ||
 217                 (optind == argc - 1 && strcmp(argv[optind], "=") == 0)) {
 218                         usage();
 219                         /* NOTREACHED */
 220         }
 221         if (vflag) {
 222                 if (cutarg != NULL) {
 223                         long    lo;
 224                         long    hi;
 225                         char    dummy;
 226 
 227                         if (sscanf(cutarg, "%ld%c", &hi, &dummy) == 1) {
 228                                 cuthiyear = hi;
 229                         } else if (sscanf(cutarg, "%ld,%ld%c",
 230                                 &lo, &hi, &dummy) == 2) {
 231                                         cutloyear = lo;
 232                                         cuthiyear = hi;
 233                         } else {
 234 (void) fprintf(stderr, gettext("%s: wild -c argument %s\n"),

 235                                         progname, cutarg);
 236                                 exit(EXIT_FAILURE);
 237                         }
 238                 }
 239                 setabsolutes();
 240                 cutlotime = yeartot(cutloyear);
 241                 cuthitime = yeartot(cuthiyear);
 242         }
 243         (void) time(&now);
 244         longest = 0;
 245         for (i = optind; i < argc; ++i)
 246                 if (strlen(argv[i]) > longest)
 247                         longest = strlen(argv[i]);
 248 
 249         for (i = optind; i < argc; ++i) {
 250                 static char     buf[MAX_STRING_LENGTH];
 251                 static char     *tzp = NULL;
 252 
 253                 (void) unsetenv("TZ");
 254                 if (tzp != NULL)


   1 /*
   2  * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
   3  * Use is subject to license terms.
   4  */
   5 
   6 /*
   7  * Copyright (c) 2018, Joyent, Inc.
   8  */
   9 
  10 /*
  11  * zdump 7.24
  12  * Taken from elsie.nci.nih.gov to replace the existing Solaris zdump,
  13  * which was based on an earlier version of the elsie code.
  14  *
  15  * For zdump 7.24, the following changes were made to the elsie code:
  16  *   locale/textdomain/messages to match existing Solaris style.
  17  *   Solaris verbose mode is documented to display the current time first.
  18  *   cstyle cleaned code.
  19  *   removed old locale/textdomain code.
  20  */
  21 
  22 static char     elsieid[] = "@(#)zdump.c        7.74";
  23 
  24 /*
  25  * This code has been made independent of the rest of the time
  26  * conversion package to increase confidence in the verification it provides.
  27  * You can use this code to help in verifying other implementations.
  28  */
  29 
  30 #include "stdio.h"      /* for stdout, stderr, perror */


 218                         vflag = 1;
 219                 else    cutarg = optarg;
 220         if (c != EOF ||
 221                 (optind == argc - 1 && strcmp(argv[optind], "=") == 0)) {
 222                         usage();
 223                         /* NOTREACHED */
 224         }
 225         if (vflag) {
 226                 if (cutarg != NULL) {
 227                         long    lo;
 228                         long    hi;
 229                         char    dummy;
 230 
 231                         if (sscanf(cutarg, "%ld%c", &hi, &dummy) == 1) {
 232                                 cuthiyear = hi;
 233                         } else if (sscanf(cutarg, "%ld,%ld%c",
 234                                 &lo, &hi, &dummy) == 2) {
 235                                         cutloyear = lo;
 236                                         cuthiyear = hi;
 237                         } else {
 238                                 (void) fprintf(stderr,
 239                                     gettext("%s: wild -c argument %s\n"),
 240                                     progname, cutarg);
 241                                 exit(EXIT_FAILURE);
 242                         }
 243                 }
 244                 setabsolutes();
 245                 cutlotime = yeartot(cutloyear);
 246                 cuthitime = yeartot(cuthiyear);
 247         }
 248         (void) time(&now);
 249         longest = 0;
 250         for (i = optind; i < argc; ++i)
 251                 if (strlen(argv[i]) > longest)
 252                         longest = strlen(argv[i]);
 253 
 254         for (i = optind; i < argc; ++i) {
 255                 static char     buf[MAX_STRING_LENGTH];
 256                 static char     *tzp = NULL;
 257 
 258                 (void) unsetenv("TZ");
 259                 if (tzp != NULL)