X-Git-Url: https://git.subgeniuskitty.com/unix-history/.git/blobdiff_plain/e7755df33050884ff92d67b9e473014596e4ae9a..bc258617f323d737755d6043c64ffea2c59b69d4:/usr/src/usr.bin/more/os.c diff --git a/usr/src/usr.bin/more/os.c b/usr/src/usr.bin/more/os.c index 24528bb14a..b014e8fc5b 100644 --- a/usr/src/usr.bin/more/os.c +++ b/usr/src/usr.bin/more/os.c @@ -3,15 +3,13 @@ * Copyright (c) 1988 Regents of the University of California. * All rights reserved. * - * This code is derived from software contributed to Berkeley by - * Mark Nudleman. - * * Redistribution and use in source and binary forms are permitted * provided that the above copyright notice and this paragraph are * duplicated in all such forms and that any documentation, * advertising materials, and other materials related to such * distribution and use acknowledge that the software was developed - * by the University of California, Berkeley. The name of the + * by Mark Nudleman and the University of California, Berkeley. The + * name of Mark Nudleman or the * University may not be used to endorse or promote products derived * from this software without specific prior written permission. * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR @@ -20,7 +18,7 @@ */ #ifndef lint -static char sccsid[] = "@(#)os.c 5.3 (Berkeley) %G%"; +static char sccsid[] = "@(#)os.c 5.8 (Berkeley) %G%"; #endif /* not lint */ /* @@ -108,7 +106,7 @@ lsystem(cmd) cmd = shell; else { - sprintf(cmdbuf, "%s -c \"%s\"", shell, cmd); + (void)sprintf(cmdbuf, "%s -c \"%s\"", shell, cmd); cmd = cmdbuf; } } @@ -168,30 +166,23 @@ iread(fd, buf, len) public void intread() { -#if SIGSETMASK - sigsetmask(0); -#endif + sigsetmask(0L); longjmp(read_label, 1); } -#if GET_TIME public long get_time() { - long t; + time_t time(); - time(&t); - return (t); + return(time((long *)NULL)); } -#endif /* * Expand a filename, substituting any environment variables, etc. * The implementation of this is necessarily very operating system * dependent. This implementation is unabashedly only for Unix systems. */ -#if GLOB - FILE *popen(); public char * @@ -201,7 +192,7 @@ glob(filename) FILE *f; char *p; int ch; - char *cmd; + char *cmd, *malloc(); static char buffer[FILENAME]; if (filename[0] == '#') @@ -217,19 +208,19 @@ glob(filename) /* * Read the output of . */ - cmd = calloc(strlen(filename)+8, sizeof(char)); + cmd = malloc((u_int)(strlen(filename)+8)); if (cmd == NULL) return (filename); - sprintf(cmd, "echo \"%s\"", filename); + (void)sprintf(cmd, "echo \"%s\"", filename); } else { /* * Read the output of <$SHELL -c "echo filename">. */ - cmd = calloc(strlen(p)+12); + cmd = malloc((u_int)(strlen(p)+12)); if (cmd == NULL) return (filename); - sprintf(cmd, "%s -c \"echo %s\"", p, filename); + (void)sprintf(cmd, "%s -c \"echo %s\"", p, filename); } if ((f = popen(cmd, "r")) == NULL) @@ -247,18 +238,6 @@ glob(filename) return (buffer); } -#else - - public char * -glob(filename) - char *filename; -{ - return (filename); -} - -#endif - - /* * Returns NULL if the file can be opened and * is an ordinary file, otherwise an error message @@ -275,6 +254,7 @@ bad_file(filename, message, len) unsigned int len; { struct stat statbuf; + char *strcat(); if (stat(filename, &statbuf) < 0) return (errno_message(filename, message, len)); @@ -283,14 +263,14 @@ bad_file(filename, message, len) { static char is_dir[] = " is a directory"; strtcpy(message, filename, len-sizeof(is_dir)-1); - strcat(message, is_dir); + (void)strcat(message, is_dir); return (message); } if ((statbuf.st_mode & S_IFMT) != S_IFREG) { static char not_reg[] = " is not a regular file"; strtcpy(message, filename, len-sizeof(not_reg)-1); - strcat(message, not_reg); + (void)strcat(message, not_reg); return (message); } return (NULL); @@ -319,11 +299,11 @@ errno_message(filename, message, len) p = sys_errlist[errno]; else { - sprintf(msg, "Error %d", errno); + (void)sprintf(msg, "Error %d", errno); p = msg; } strtcpy(message, filename, len-strlen(p)-3); - strcat(message, ": "); - strcat(message, p); + (void)strcat(message, ": "); + (void)strcat(message, p); return (message); }