summaryrefslogtreecommitdiff
path: root/usr/src/cmd/tput/tput.c
diff options
context:
space:
mode:
Diffstat (limited to 'usr/src/cmd/tput/tput.c')
-rw-r--r--usr/src/cmd/tput/tput.c20
1 files changed, 5 insertions, 15 deletions
diff --git a/usr/src/cmd/tput/tput.c b/usr/src/cmd/tput/tput.c
index 34e8ab120d..18dce8d6cb 100644
--- a/usr/src/cmd/tput/tput.c
+++ b/usr/src/cmd/tput/tput.c
@@ -23,7 +23,6 @@
* Copyright 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
-/* Copyright 2011 Nexenta Systems, Inc. All rights reserved. */
/* Copyright (c) 1988 AT&T */
/* All Rights Reserved */
@@ -59,7 +58,6 @@
#include <sys/types.h>
#include <unistd.h>
#include <locale.h>
-#include <err.h>
/* externs from libcurses */
extern int tigetnum();
@@ -168,23 +166,15 @@ main(int argc, char **argv)
exit(outputcap(cap, argc, argv));
return (0);
} else { /* standard input argumets */
- char buff[256];
+ char buff[128];
char **v;
- /*
- * allocate storage for the 'faked' argv[] array
- *
- * fixme: The algorithm here is botched. Who or what defines
- * that only 10 arguments with 32 bytes each are passed?
- */
+ /* allocate storage for the 'faked' argv[] array */
v = (char **)malloc(10 * sizeof (char *));
- for (i = 0; i < 10; i++) {
- v[i] = (char *)malloc(32);
- if (!v[i])
- err(EXIT_FAILURE, "no memory for argv[] array");
- }
+ for (i = 0; i < 10; i++)
+ v[i] = (char *)malloc(32 * sizeof (char));
- while (fgets(buff, sizeof (buff), stdin) != NULL) {
+ while (gets(buff) != NULL) {
/* read standard input line; skip over empty lines */
if ((std_argc =
sscanf(buff, "%s %s %s %s %s %s %s %s %s %s",