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>

Split Close
Expand all
Collapse all
          --- old/usr/src/cmd/echo/echo.c
          +++ new/usr/src/cmd/echo/echo.c
↓ open down ↓ 17 lines elided ↑ open up ↑
  18   18   *
  19   19   * CDDL HEADER END
  20   20   */
  21   21  /*
  22   22   * Copyright (c) 1989, 2010, Oracle and/or its affiliates. All rights reserved.
  23   23   */
  24   24  
  25   25  /*      Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
  26   26  /*        All Rights Reserved   */
  27   27  
       28 +/*
       29 + * Copyright (c) 2018, Joyent, Inc.
       30 + */
  28   31  
  29   32  #include <stdio.h>
  30   33  #include <stdlib.h>
  31   34  #include <wchar.h>
  32   35  #include <string.h>
  33   36  #include <locale.h>
  34   37  
  35   38  int
  36   39  main(int argc, char *argv[])
  37   40  {
↓ open down ↓ 10 lines elided ↑ open up ↑
  48   51          if (--argc == 0) {
  49   52                  (void) putchar('\n');
  50   53                  if (fflush(stdout) != 0)
  51   54                          return (1);
  52   55                  return (0);
  53   56          }
  54   57  
  55   58          for (i = 1; i <= argc; i++) {
  56   59                  for (cp = argv[i], ep = cp + (int)strlen(cp);
  57   60                      cp < ep; cp += b_len) {
  58      -                if ((b_len = mbtowc(&wc, cp, MB_CUR_MAX)) <= 0) {
  59      -                        (void) putchar(*cp);
  60      -                        b_len = 1;
  61      -                        continue;
  62      -                }
       61 +                        if ((b_len = mbtowc(&wc, cp, MB_CUR_MAX)) <= 0) {
       62 +                                (void) putchar(*cp);
       63 +                                b_len = 1;
       64 +                                continue;
       65 +                        }
  63   66  
  64      -                if (wc != '\\') {
  65      -                        (void) putwchar(wc);
  66      -                        continue;
  67      -                }
       67 +                        if (wc != '\\') {
       68 +                                (void) putwchar(wc);
       69 +                                continue;
       70 +                        }
  68   71  
  69   72                          cp += b_len;
  70   73                          b_len = 1;
  71   74                          switch (*cp) {
  72   75                                  case 'a':       /* alert - XCU4 */
  73   76                                          (void) putchar('\a');
  74   77                                          continue;
  75   78  
  76   79                                  case 'b':
  77   80                                          (void) putchar('\b');
↓ open down ↓ 52 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX