Wed Sep 24 16:29:49 2008 UTC ()
Merge in changes between wrstuden-revivesa-base-2 and
wrstuden-revivesa-base-3.


(wrstuden)
diff -r1.15.32.2 -r1.15.32.3 src/bin/echo/echo.c
diff -r1.8 -r1.8.18.1 src/bin/ksh/c_ulimit.c
diff -r1.34.6.1 -r1.34.6.2 src/bin/test/test.c

cvs diff -r1.15.32.2 -r1.15.32.3 src/bin/echo/echo.c (expand / switch to unified diff)

--- src/bin/echo/echo.c 2008/09/18 04:27:40 1.15.32.2
+++ src/bin/echo/echo.c 2008/09/24 16:29:49 1.15.32.3
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: echo.c,v 1.15.32.2 2008/09/18 04:27:40 wrstuden Exp $ */ 1/* $NetBSD: echo.c,v 1.15.32.3 2008/09/24 16:29:49 wrstuden Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 1989, 1993 4 * Copyright (c) 1989, 1993
5 * The Regents of the University of California. All rights reserved. 5 * The Regents of the University of California. All rights reserved.
6 * 6 *
7 * Redistribution and use in source and binary forms, with or without 7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions 8 * modification, are permitted provided that the following conditions
9 * are met: 9 * are met:
10 * 1. Redistributions of source code must retain the above copyright 10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer. 11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright 12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the 13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution. 14 * documentation and/or other materials provided with the distribution.
@@ -30,27 +30,27 @@ @@ -30,27 +30,27 @@
30 */ 30 */
31 31
32#include <sys/cdefs.h> 32#include <sys/cdefs.h>
33#ifndef lint 33#ifndef lint
34__COPYRIGHT( 34__COPYRIGHT(
35"@(#) Copyright (c) 1989, 1993\ 35"@(#) Copyright (c) 1989, 1993\
36 The Regents of the University of California. All rights reserved."); 36 The Regents of the University of California. All rights reserved.");
37#endif /* not lint */ 37#endif /* not lint */
38 38
39#ifndef lint 39#ifndef lint
40#if 0 40#if 0
41static char sccsid[] = "@(#)echo.c 8.1 (Berkeley) 5/31/93"; 41static char sccsid[] = "@(#)echo.c 8.1 (Berkeley) 5/31/93";
42#else 42#else
43__RCSID("$NetBSD: echo.c,v 1.15.32.2 2008/09/18 04:27:40 wrstuden Exp $"); 43__RCSID("$NetBSD: echo.c,v 1.15.32.3 2008/09/24 16:29:49 wrstuden Exp $");
44#endif 44#endif
45#endif /* not lint */ 45#endif /* not lint */
46 46
47#include <locale.h> 47#include <locale.h>
48#include <stdio.h> 48#include <stdio.h>
49#include <stdlib.h> 49#include <stdlib.h>
50#include <string.h> 50#include <string.h>
51 51
52int main(int, char *[]); 52int main(int, char *[]);
53 53
54/* ARGSUSED */ 54/* ARGSUSED */
55int 55int
56main(int argc, char *argv[]) 56main(int argc, char *argv[])
@@ -65,16 +65,19 @@ main(int argc, char *argv[]) @@ -65,16 +65,19 @@ main(int argc, char *argv[])
65 ++argv; 65 ++argv;
66 nflag = 1; 66 nflag = 1;
67 } 67 }
68 else 68 else
69 nflag = 0; 69 nflag = 0;
70 70
71 while (*argv) { 71 while (*argv) {
72 (void)printf("%s", *argv); 72 (void)printf("%s", *argv);
73 if (*++argv) 73 if (*++argv)
74 (void)putchar(' '); 74 (void)putchar(' ');
75 } 75 }
76 if (nflag == 0) 76 if (nflag == 0)
77 (void)putchar('\n'); 77 (void)putchar('\n');
 78 fflush(stdout);
 79 if (ferror(stdout))
 80 exit(1);
78 exit(0); 81 exit(0);
79 /* NOTREACHED */ 82 /* NOTREACHED */
80} 83}

cvs diff -r1.8 -r1.8.18.1 src/bin/ksh/c_ulimit.c (expand / switch to unified diff)

--- src/bin/ksh/c_ulimit.c 2006/10/16 00:07:32 1.8
+++ src/bin/ksh/c_ulimit.c 2008/09/24 16:29:49 1.8.18.1
@@ -1,36 +1,36 @@ @@ -1,36 +1,36 @@
1/* $NetBSD: c_ulimit.c,v 1.8 2006/10/16 00:07:32 christos Exp $ */ 1/* $NetBSD: c_ulimit.c,v 1.8.18.1 2008/09/24 16:29:49 wrstuden Exp $ */
2 2
3/* 3/*
4 ulimit -- handle "ulimit" builtin 4 ulimit -- handle "ulimit" builtin
5 5
6 Reworked to use getrusage() and ulimit() at once (as needed on 6 Reworked to use getrusage() and ulimit() at once (as needed on
7 some schizophrenic systems, eg, HP-UX 9.01), made argument parsing 7 some schizophrenic systems, eg, HP-UX 9.01), made argument parsing
8 conform to at&t ksh, added autoconf support. Michael Rendell, May, '94 8 conform to at&t ksh, added autoconf support. Michael Rendell, May, '94
9 9
10 Eric Gisin, September 1988 10 Eric Gisin, September 1988
11 Adapted to PD KornShell. Removed AT&T code. 11 Adapted to PD KornShell. Removed AT&T code.
12 12
13 last edit: 06-Jun-1987 D A Gwyn 13 last edit: 06-Jun-1987 D A Gwyn
14 14
15 This started out as the BRL UNIX System V system call emulation 15 This started out as the BRL UNIX System V system call emulation
16 for 4.nBSD, and was later extended by Doug Kingston to handle 16 for 4.nBSD, and was later extended by Doug Kingston to handle
17 the extended 4.nBSD resource limits. It now includes the code 17 the extended 4.nBSD resource limits. It now includes the code
18 that was originally under case SYSULIMIT in source file "xec.c". 18 that was originally under case SYSULIMIT in source file "xec.c".
19*/ 19*/
20#include <sys/cdefs.h> 20#include <sys/cdefs.h>
21 21
22#ifndef lint 22#ifndef lint
23__RCSID("$NetBSD: c_ulimit.c,v 1.8 2006/10/16 00:07:32 christos Exp $"); 23__RCSID("$NetBSD: c_ulimit.c,v 1.8.18.1 2008/09/24 16:29:49 wrstuden Exp $");
24#endif 24#endif
25 25
26 26
27#include "sh.h" 27#include "sh.h"
28#include "ksh_time.h" 28#include "ksh_time.h"
29#ifdef HAVE_SYS_RESOURCE_H 29#ifdef HAVE_SYS_RESOURCE_H
30# include <sys/resource.h> 30# include <sys/resource.h>
31#endif /* HAVE_SYS_RESOURCE_H */ 31#endif /* HAVE_SYS_RESOURCE_H */
32#ifdef HAVE_ULIMIT_H 32#ifdef HAVE_ULIMIT_H
33# include <ulimit.h> 33# include <ulimit.h>
34#else /* HAVE_ULIMIT_H */ 34#else /* HAVE_ULIMIT_H */
35# ifdef HAVE_ULIMIT 35# ifdef HAVE_ULIMIT
36extern long ulimit(); 36extern long ulimit();
@@ -183,27 +183,27 @@ c_ulimit(wp) @@ -183,27 +183,27 @@ c_ulimit(wp)
183 if (!evaluate(wp[0], &rval, KSH_RETURN_ERROR)) 183 if (!evaluate(wp[0], &rval, KSH_RETURN_ERROR))
184 return 1; 184 return 1;
185 /* Avoid problems caused by typos that 185 /* Avoid problems caused by typos that
186 * evaluate misses due to evaluating unset 186 * evaluate misses due to evaluating unset
187 * parameters to 0... 187 * parameters to 0...
188 * If this causes problems, will have to 188 * If this causes problems, will have to
189 * add parameter to evaluate() to control 189 * add parameter to evaluate() to control
190 * if unset params are 0 or an error. 190 * if unset params are 0 or an error.
191 */ 191 */
192 if (!rval && !digit(wp[0][0])) { 192 if (!rval && !digit(wp[0][0])) {
193 bi_errorf("invalid limit: %s", wp[0]); 193 bi_errorf("invalid limit: %s", wp[0]);
194 return 1; 194 return 1;
195 } 195 }
196 val = rval * l->factor; 196 val = (u_long)rval * l->factor;
197 } 197 }
198 } 198 }
199 if (all) { 199 if (all) {
200 for (l = limits; l->name; l++) { 200 for (l = limits; l->name; l++) {
201#ifdef HAVE_SETRLIMIT 201#ifdef HAVE_SETRLIMIT
202 if (l->which == RLIMIT) { 202 if (l->which == RLIMIT) {
203 getrlimit(l->gcmd, &limit); 203 getrlimit(l->gcmd, &limit);
204 if (how & SOFT) 204 if (how & SOFT)
205 val = limit.rlim_cur; 205 val = limit.rlim_cur;
206 else if (how & HARD) 206 else if (how & HARD)
207 val = limit.rlim_max; 207 val = limit.rlim_max;
208 } else 208 } else
209#endif /* HAVE_SETRLIMIT */ 209#endif /* HAVE_SETRLIMIT */

cvs diff -r1.34.6.1 -r1.34.6.2 src/bin/test/test.c (expand / switch to unified diff)

--- src/bin/test/test.c 2008/06/23 04:26:44 1.34.6.1
+++ src/bin/test/test.c 2008/09/24 16:29:49 1.34.6.2
@@ -1,28 +1,28 @@ @@ -1,28 +1,28 @@
1/* $NetBSD: test.c,v 1.34.6.1 2008/06/23 04:26:44 wrstuden Exp $ */ 1/* $NetBSD: test.c,v 1.34.6.2 2008/09/24 16:29:49 wrstuden Exp $ */
2 2
3/* 3/*
4 * test(1); version 7-like -- author Erik Baalbergen 4 * test(1); version 7-like -- author Erik Baalbergen
5 * modified by Eric Gisin to be used as built-in. 5 * modified by Eric Gisin to be used as built-in.
6 * modified by Arnold Robbins to add SVR3 compatibility 6 * modified by Arnold Robbins to add SVR3 compatibility
7 * (-x -c -b -p -u -g -k) plus Korn's -L -nt -ot -ef and new -S (socket). 7 * (-x -c -b -p -u -g -k) plus Korn's -L -nt -ot -ef and new -S (socket).
8 * modified by J.T. Conklin for NetBSD. 8 * modified by J.T. Conklin for NetBSD.
9 * 9 *
10 * This program is in the Public Domain. 10 * This program is in the Public Domain.
11 */ 11 */
12 12
13#include <sys/cdefs.h> 13#include <sys/cdefs.h>
14#ifndef lint 14#ifndef lint
15__RCSID("$NetBSD: test.c,v 1.34.6.1 2008/06/23 04:26:44 wrstuden Exp $"); 15__RCSID("$NetBSD: test.c,v 1.34.6.2 2008/09/24 16:29:49 wrstuden Exp $");
16#endif 16#endif
17 17
18#include <sys/stat.h> 18#include <sys/stat.h>
19#include <sys/types.h> 19#include <sys/types.h>
20 20
21#include <ctype.h> 21#include <ctype.h>
22#include <err.h> 22#include <err.h>
23#include <errno.h> 23#include <errno.h>
24#include <limits.h> 24#include <limits.h>
25#include <locale.h> 25#include <locale.h>
26#include <stdio.h> 26#include <stdio.h>
27#include <stdlib.h> 27#include <stdlib.h>
28#include <string.h> 28#include <string.h>
@@ -671,27 +671,27 @@ getn(const char *s) @@ -671,27 +671,27 @@ getn(const char *s)
671 char *p; 671 char *p;
672 long long r; 672 long long r;
673 673
674 errno = 0; 674 errno = 0;
675 r = strtoll(s, &p, 10); 675 r = strtoll(s, &p, 10);
676 676
677 if (errno != 0) 677 if (errno != 0)
678 if (errno == ERANGE && (r == LLONG_MAX || r == LLONG_MIN)) 678 if (errno == ERANGE && (r == LLONG_MAX || r == LLONG_MIN))
679 error("%s: out of range", s); 679 error("%s: out of range", s);
680 680
681 while (isspace((unsigned char)*p)) 681 while (isspace((unsigned char)*p))
682 p++; 682 p++;
683  683
684 if (*p) 684 if (*p || p == s)
685 error("%s: bad number", s); 685 error("%s: bad number", s);
686 686
687 return r; 687 return r;
688} 688}
689 689
690static int 690static int
691newerf(const char *f1, const char *f2) 691newerf(const char *f1, const char *f2)
692{ 692{
693 struct stat b1, b2; 693 struct stat b1, b2;
694 694
695 return (stat(f1, &b1) == 0 && 695 return (stat(f1, &b1) == 0 &&
696 stat(f2, &b2) == 0 && 696 stat(f2, &b2) == 0 &&
697 b1.st_mtime > b2.st_mtime); 697 b1.st_mtime > b2.st_mtime);