Print this page
702 tput calls gets()

Split Close
Expand all
Collapse all
          --- old/usr/src/cmd/tput/tput.c
          +++ new/usr/src/cmd/tput/tput.c
↓ open down ↓ 14 lines elided ↑ open up ↑
  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  /*
  23   23   * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
  24   24   * Use is subject to license terms.
       25 + * Copyright (c) 2012 Gary Mills
  25   26   */
  26   27  
  27   28  /*      Copyright (c) 1988 AT&T */
  28   29  /*        All Rights Reserved   */
  29   30  
  30   31  /*
  31   32   *      tput - print terminal attribute
  32   33   *
  33   34   *  return-codes - command line arguments:
  34   35   *      0: ok if boolean capname -> TRUE
↓ open down ↓ 132 lines elided ↑ open up ↑
 167  168                  return (0);
 168  169          } else {                        /* standard input argumets      */
 169  170                  char buff[128];
 170  171                  char **v;
 171  172  
 172  173                  /* allocate storage for the 'faked' argv[] array        */
 173  174                  v = (char **)malloc(10 * sizeof (char *));
 174  175                  for (i = 0; i < 10; i++)
 175  176                          v[i] = (char *)malloc(32 * sizeof (char));
 176  177  
 177      -                while (gets(buff) != NULL) {
      178 +                while (fgets(buff, sizeof (buff), stdin) != NULL) {
 178  179                          /* read standard input line; skip over empty lines */
 179  180                          if ((std_argc =
 180      -                            sscanf(buff, "%s %s %s %s %s %s %s %s %s %s",
      181 +                            sscanf(buff,
      182 +                            "%31s %31s %31s %31s %31s %31s %31s %31s "
      183 +                            "%31s %31s",
 181  184                              v[0], v[1], v[2], v[3], v[4], v[5], v[6], v[7],
 182  185                              v[8], v[9])) < 1) {
 183  186                                  continue;
 184  187                          }
 185  188  
 186  189                          cap = v[0];
 187  190                          optind = 1;
 188  191  
 189  192                          if (strcmp(cap, "init") == 0) {
 190  193                                  initterm();
↓ open down ↓ 562 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX