From e1c8dda0bdf048e120f8bf1a2cbd3a849ebf21a9 Mon Sep 17 00:00:00 2001 From: Garrett D'Amore Date: Thu, 17 Feb 2011 16:46:50 -0800 Subject: Backed out changeset 0a79ebc0f4b3 - needs more work. --- usr/src/cmd/spell/hashmake.c | 5 +++-- usr/src/cmd/tput/tput.c | 20 +++++--------------- 2 files changed, 8 insertions(+), 17 deletions(-) (limited to 'usr/src') diff --git a/usr/src/cmd/spell/hashmake.c b/usr/src/cmd/spell/hashmake.c index 844f205841..3b7d3f5356 100644 --- a/usr/src/cmd/spell/hashmake.c +++ b/usr/src/cmd/spell/hashmake.c @@ -26,7 +26,8 @@ /* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */ /* All Rights Reserved */ -/* Copyright 2011 Nexenta Systems, Inc. All rights reserved. */ + +#pragma ident "%Z%%M% %I% %E% SMI" #include #include @@ -50,7 +51,7 @@ main(int argc, char **argv) (void) textdomain(TEXT_DOMAIN); hashinit(); - while (fgets(word, sizeof (word), stdin)) { + while (gets(word)) { (void) printf("%.*lo\n", (HASHWIDTH+2)/3, hash(word)); } return (0); 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 #include #include -#include /* 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", -- cgit v1.2.3