Mercurial > illumos > illumos-gate
changeset 13292:fe7962c08d1d
Backed out changeset 0a79ebc0f4b3 - needs more work.
author | Garrett D'Amore <garrett@nexenta.com> |
---|---|
date | Thu, 17 Feb 2011 16:46:50 -0800 |
parents | d5c7e34a4e3f |
children | b91ea3ba02d2 |
files | usr/src/cmd/spell/hashmake.c usr/src/cmd/tput/tput.c |
diffstat | 2 files changed, 8 insertions(+), 17 deletions(-) [+] |
line wrap: on
line diff
--- a/usr/src/cmd/spell/hashmake.c Thu Feb 17 16:07:03 2011 -0800 +++ b/usr/src/cmd/spell/hashmake.c Thu Feb 17 16:46:50 2011 -0800 @@ -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 <stdlib.h> #include <unistd.h> @@ -50,7 +51,7 @@ (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);
--- a/usr/src/cmd/tput/tput.c Thu Feb 17 16:07:03 2011 -0800 +++ b/usr/src/cmd/tput/tput.c Thu Feb 17 16:46:50 2011 -0800 @@ -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 @@ 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",