comparison usr/src/cmd/tput/tput.c @ 13862:fd9b980efd06

702 tput calls gets() Reviewed by: Dan McDonald <danmcd@nexenta.com> Reviewed by: Gordon Ross <gordon.w.ross@gmail.com> Approved by: Garrett D'Amore <garrett@damore.org>
author Gary Mills <gary_mills@fastmail.fm>
date Wed, 17 Oct 2012 06:40:09 -0700
parents fe7962c08d1d
children
comparison
equal deleted inserted replaced
13861:c6a784e8dbc8 13862:fd9b980efd06
20 */ 20 */
21 21
22 /* 22 /*
23 * Copyright 2009 Sun Microsystems, Inc. All rights reserved. 23 * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
24 * Use is subject to license terms. 24 * Use is subject to license terms.
25 * Copyright (c) 2012 Gary Mills
25 */ 26 */
26 27
27 /* Copyright (c) 1988 AT&T */ 28 /* Copyright (c) 1988 AT&T */
28 /* All Rights Reserved */ 29 /* All Rights Reserved */
29 30
172 /* allocate storage for the 'faked' argv[] array */ 173 /* allocate storage for the 'faked' argv[] array */
173 v = (char **)malloc(10 * sizeof (char *)); 174 v = (char **)malloc(10 * sizeof (char *));
174 for (i = 0; i < 10; i++) 175 for (i = 0; i < 10; i++)
175 v[i] = (char *)malloc(32 * sizeof (char)); 176 v[i] = (char *)malloc(32 * sizeof (char));
176 177
177 while (gets(buff) != NULL) { 178 while (fgets(buff, sizeof (buff), stdin) != NULL) {
178 /* read standard input line; skip over empty lines */ 179 /* read standard input line; skip over empty lines */
179 if ((std_argc = 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 v[0], v[1], v[2], v[3], v[4], v[5], v[6], v[7], 184 v[0], v[1], v[2], v[3], v[4], v[5], v[6], v[7],
182 v[8], v[9])) < 1) { 185 v[8], v[9])) < 1) {
183 continue; 186 continue;
184 } 187 }
185 188