Print this page
1154 cpio needs a quiet option

Split Close
Expand all
Collapse all
          --- old/usr/src/cmd/cpio/cpio.c
          +++ new/usr/src/cmd/cpio/cpio.c
↓ open down ↓ 13 lines elided ↑ open up ↑
  14   14   * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  15   15   * If applicable, add the following below this CDDL HEADER, with the
  16   16   * fields enclosed by brackets "[]" replaced with your own identifying
  17   17   * information: Portions Copyright [yyyy] [name of copyright owner]
  18   18   *
  19   19   * CDDL HEADER END
  20   20   */
  21   21  /*
  22   22   * Copyright (c) 1988, 2010, Oracle and/or its affiliates. All rights reserved.
  23   23   * Copyright 2012 Milan Jurik. All rights reserved.
       24 + * Copyright (c) 2012 Gary Mills
  24   25   */
  25   26  
  26   27  /*      Copyright (c) 1983, 1984, 1985, 1986, 1987, 1988, 1989 AT&T     */
  27   28  /*      All Rights Reserved                                     */
  28   29  
  29   30  /*
  30   31   * Portions of this source code were derived from Berkeley 4.3 BSD
  31   32   * under license from the Regents of the University of California.
  32   33   */
  33   34  
↓ open down ↓ 784 lines elided ↑ open up ↑
 818  819                  msg(EXT, "Impossible action.");
 819  820          }
 820  821          if (Ofile > 0) {
 821  822                  if (close(Ofile) != 0)
 822  823                          msg(EXTN, "close error");
 823  824          }
 824  825          if (Archive > 0) {
 825  826                  if (close(Archive) != 0)
 826  827                          msg(EXTN, "close error");
 827  828          }
 828      -        Blocks = (u_longlong_t)(Blocks * Bufsize + SBlocks + 0x1FF) >> 9;
 829      -        msg(EPOST, "%lld blocks", Blocks);
      829 +        if ((Args & OCq) == 0) {
      830 +                Blocks = (u_longlong_t)(Blocks * Bufsize + SBlocks +
      831 +                    0x1FF) >> 9;
      832 +                msg(EPOST, "%lld blocks", Blocks);
      833 +        }
 830  834          if (Error_cnt)
 831  835                  msg(EPOST, "%d error(s)", Error_cnt);
 832  836          return (EXIT_CODE);
 833  837  }
 834  838  
 835  839  /*
 836  840   * add_lnk: Add a linked file's header to the linked file data structure, by
 837  841   * either adding it to the end of an existing sub-list or starting
 838  842   * a new sub-list.  Each sub-list saves the links to a given file.
 839  843   *
↓ open down ↓ 5532 lines elided ↑ open up ↑
6372 6376  
6373 6377  static void
6374 6378  setup(int largc, char **largv)
6375 6379  {
6376 6380          extern int optind;
6377 6381          extern char *optarg;
6378 6382  
6379 6383  #if defined(O_XATTR)
6380 6384  #if defined(_PC_SATTR_ENABLED)
6381 6385  #ifdef WAITAROUND
6382      -        char    *opts_p = "zabcdfiklmoprstuvABC:DE:H:I:LM:O:PR:SV6@/";
     6386 +        char    *opts_p = "zabcdfiklmopqrstuvABC:DE:H:I:LM:O:PR:SV6@/";
6383 6387  #else
6384      -        char    *opts_p = "abcdfiklmoprstuvABC:DE:H:I:LM:O:PR:SV6@/";
     6388 +        char    *opts_p = "abcdfiklmopqrstuvABC:DE:H:I:LM:O:PR:SV6@/";
6385 6389  #endif  /* WAITAROUND */
6386 6390  
6387 6391  #else   /* _PC_SATTR_ENABLED */
6388 6392  #ifdef WAITAROUND
6389      -        char    *opts_p = "zabcdfiklmoprstuvABC:DE:H:I:LM:O:PR:SV6@";
     6393 +        char    *opts_p = "zabcdfiklmopqrstuvABC:DE:H:I:LM:O:PR:SV6@";
6390 6394  #else
6391      -        char    *opts_p = "abcdfiklmoprstuvABC:DE:H:I:LM:O:PR:SV6@";
     6395 +        char    *opts_p = "abcdfiklmopqrstuvABC:DE:H:I:LM:O:PR:SV6@";
6392 6396  #endif  /* WAITAROUND */
6393 6397  #endif  /* _PC_SATTR_ENABLED */
6394 6398  
6395 6399  #else   /* O_XATTR */
6396 6400  #ifdef WAITAROUND
6397      -        char    *opts_p = "zabcdfiklmoprstuvABC:DE:H:I:LM:O:PR:SV6";
     6401 +        char    *opts_p = "zabcdfiklmopqrstuvABC:DE:H:I:LM:O:PR:SV6";
6398 6402  #else
6399      -        char    *opts_p = "abcdfiklmoprstuvABC:DE:H:I:LM:O:PR:SV6";
     6403 +        char    *opts_p = "abcdfiklmopqrstuvABC:DE:H:I:LM:O:PR:SV6";
6400 6404  #endif  /* WAITAROUND */
6401 6405  #endif  /* O_XATTR */
6402 6406  
6403 6407          char   *dupl_p = "Only one occurrence of -%c allowed";
6404 6408          int option;
6405 6409          int blk_cnt, blk_cnt_max;
6406 6410          struct rlimit rlim;
6407 6411  
6408 6412          /* Remember the native page size. */
6409 6413  
↓ open down ↓ 51 lines elided ↑ open up ↑
6461 6465                          Args |= OCm;
6462 6466                          break;
6463 6467                  case 'o':       /* "copy out" */
6464 6468                          Args |= OCo;
6465 6469                          Archive = 1;
6466 6470                          break;
6467 6471                  case 'p':       /* "pass" */
6468 6472                          Max_namesz = APATH;
6469 6473                          Args |= OCp;
6470 6474                          break;
     6475 +                case 'q':       /* "quiet" */
     6476 +                        Args |= OCq;
     6477 +                        break;
6471 6478                  case 'r':       /* rename files interactively */
6472 6479                          Args |= OCr;
6473 6480                          break;
6474 6481                  case 's':       /* swap bytes */
6475 6482                          Args |= OCs;
6476 6483                          break;
6477 6484                  case 't':       /* table of contents */
6478 6485                          Args |= OCt;
6479 6486                          break;
6480 6487                  case 'u':       /* copy unconditionally */
↓ open down ↓ 379 lines elided ↑ open up ↑
6860 6867   * usage: Print the usage message on stderr and exit.
6861 6868   */
6862 6869  
6863 6870  static void
6864 6871  usage(void)
6865 6872  {
6866 6873  
6867 6874          (void) fflush(stdout);
6868 6875  #if defined(O_XATTR)
6869 6876          (void) fprintf(stderr, gettext("USAGE:\n"
6870      -            "\tcpio -i[bcdfkmrstuv@BSV6] [-C size] "
     6877 +            "\tcpio -i[bcdfkmqrstuv@BSV6] [-C size] "
6871 6878              "[-E file] [-H hdr] [-I file [-M msg]] "
6872 6879              "[-R id] [patterns]\n"
6873 6880              "\tcpio -o[acv@ABLV] [-C size] "
6874 6881              "[-H hdr] [-O file [-M msg]]\n"
6875 6882              "\tcpio -p[adlmuv@LV] [-R id] directory\n"));
6876 6883  #else
6877 6884          (void) fprintf(stderr, gettext("USAGE:\n"
6878      -            "\tcpio -i[bcdfkmrstuvBSV6] [-C size] "
     6885 +            "\tcpio -i[bcdfkmqrstuvBSV6] [-C size] "
6879 6886              "[-E file] [-H hdr] [-I file [-M msg]] "
6880 6887              "[-R id] [patterns]\n"
6881 6888              "\tcpio -o[acvABLV] [-C size] "
6882 6889              "[-H hdr] [-O file [-M msg]]\n"
6883 6890              "\tcpio -p[adlmuvLV] [-R id] directory\n"));
6884 6891  #endif
6885 6892          (void) fflush(stderr);
6886 6893          exit(EXIT_CODE);
6887 6894  }
6888 6895  
↓ open down ↓ 2847 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX