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>


  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 /*      Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T     */
  22 /*        All Rights Reserved   */
  23 
  24 
  25 /*
  26  * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
  27  * Use is subject to license terms.
  28  */
  29 



  30 
  31 /*
  32  *      Concatenate files.
  33  */
  34 
  35 #include        <stdio.h>
  36 #include        <stdlib.h>
  37 #include        <ctype.h>
  38 #include        <sys/types.h>
  39 #include        <sys/stat.h>
  40 #include        <locale.h>
  41 #include        <unistd.h>
  42 #include        <sys/mman.h>
  43 #include        <errno.h>
  44 #include        <string.h>
  45 
  46 #include        <widec.h>
  47 #include        <wctype.h>
  48 #include        <limits.h>
  49 #include        <libintl.h>


 254                 if (fstat(fileno(fi), &source) < 0) {
 255                         if (!silent)
 256                                 (void) fprintf(stderr,
 257                                     gettext("cat: cannot stat %s: %s\n"),
 258                                     (stdinflg) ? "-" : *argv, strerror(errno));
 259                         status = 2;
 260                         continue;
 261                 }
 262 
 263 
 264                 /*
 265                  * If the source is not a character special file, socket or a
 266                  * block special file, make sure it is not identical
 267                  * to the target.
 268                  */
 269 
 270                 if (!S_ISCHR(target.st_mode) &&
 271                     !S_ISBLK(target.st_mode) &&
 272                     !S_ISSOCK(target.st_mode) &&
 273                     IDENTICAL(target, source)) {
 274                         if (!silent)
 275                         (void) fprintf(stderr,
 276                             gettext("cat: input/output files '%s' identical\n"),
 277                             stdinflg?"-": *argv);


 278                         if (fclose(fi) != 0)
 279                                 (void) fprintf(stderr,
 280                                     gettext("cat: close error: %s\n"),
 281                                     strerror(errno));
 282                         status = 2;
 283                         continue;
 284                 }
 285                 ibsize = source.st_blksize;
 286 
 287                 /*
 288                  * If in visible mode and/or nflg, use vncat;
 289                  * otherwise, use cat.
 290                  */
 291 
 292                 if (visi_mode || nflg)
 293                         estatus = vncat(fi);
 294                 else
 295                         estatus = cat(fi, &source, &target,
 296                             fi != stdin ? *argv : "standard input");
 297 




  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 /*      Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T     */
  22 /*        All Rights Reserved   */
  23 
  24 
  25 /*
  26  * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
  27  * Use is subject to license terms.
  28  */
  29 
  30 /*
  31  * Copyright (c) 2018, Joyent, Inc.
  32  */
  33 
  34 /*
  35  *      Concatenate files.
  36  */
  37 
  38 #include        <stdio.h>
  39 #include        <stdlib.h>
  40 #include        <ctype.h>
  41 #include        <sys/types.h>
  42 #include        <sys/stat.h>
  43 #include        <locale.h>
  44 #include        <unistd.h>
  45 #include        <sys/mman.h>
  46 #include        <errno.h>
  47 #include        <string.h>
  48 
  49 #include        <widec.h>
  50 #include        <wctype.h>
  51 #include        <limits.h>
  52 #include        <libintl.h>


 257                 if (fstat(fileno(fi), &source) < 0) {
 258                         if (!silent)
 259                                 (void) fprintf(stderr,
 260                                     gettext("cat: cannot stat %s: %s\n"),
 261                                     (stdinflg) ? "-" : *argv, strerror(errno));
 262                         status = 2;
 263                         continue;
 264                 }
 265 
 266 
 267                 /*
 268                  * If the source is not a character special file, socket or a
 269                  * block special file, make sure it is not identical
 270                  * to the target.
 271                  */
 272 
 273                 if (!S_ISCHR(target.st_mode) &&
 274                     !S_ISBLK(target.st_mode) &&
 275                     !S_ISSOCK(target.st_mode) &&
 276                     IDENTICAL(target, source)) {
 277                         if (!silent) {
 278                                 (void) fprintf(stderr, gettext("cat: "
 279                                     "input/output files '%s' identical\n"),
 280                                     stdinflg?"-": *argv);
 281                         }
 282 
 283                         if (fclose(fi) != 0)
 284                                 (void) fprintf(stderr,
 285                                     gettext("cat: close error: %s\n"),
 286                                     strerror(errno));
 287                         status = 2;
 288                         continue;
 289                 }
 290                 ibsize = source.st_blksize;
 291 
 292                 /*
 293                  * If in visible mode and/or nflg, use vncat;
 294                  * otherwise, use cat.
 295                  */
 296 
 297                 if (visi_mode || nflg)
 298                         estatus = vncat(fi);
 299                 else
 300                         estatus = cat(fi, &source, &target,
 301                             fi != stdin ? *argv : "standard input");
 302