diff options
author | agc <agc> | 1998-02-24 11:18:58 +0000 |
---|---|---|
committer | agc <agc> | 1998-02-24 11:18:58 +0000 |
commit | e25f4cb261a78654055ecd4b6c7ed250e1e6494b (patch) | |
tree | 26d6b40a6b0c1645351861730c8bc53c69713eb8 /shells/rc | |
parent | efd9419cdc7c579e395a05174153303cc8baeaac (diff) | |
download | pkgsrc-e25f4cb261a78654055ecd4b6c7ed250e1e6494b.tar.gz |
Use NetBSD's snprintf to format a quad integer, and pass the buffer to
rc's fprint as a string. Fixes PR pkg/5041 from Sean Doran.
Diffstat (limited to 'shells/rc')
-rw-r--r-- | shells/rc/patches/patch-aa | 96 |
1 files changed, 44 insertions, 52 deletions
diff --git a/shells/rc/patches/patch-aa b/shells/rc/patches/patch-aa index a55b3d73968..3c849bf4d0a 100644 --- a/shells/rc/patches/patch-aa +++ b/shells/rc/patches/patch-aa @@ -41,58 +41,6 @@ # If rc is compiled with READLINE defined, you must supply the correct # arguments to ld on this line. Typically this would be something like: -*** builtins.c.orig Mon Mar 7 03:32:49 1994 ---- builtins.c Wed Aug 20 15:22:52 1997 -*************** -*** 466,477 **** - - #ifndef SYSVR4 - extern int getrlimit(int, struct rlimit *); - extern int setrlimit(int, struct rlimit *); - #endif - - static void printlimit(const Limit *limit, bool hard) { - struct rlimit rlim; -! long lim; - getrlimit(limit->flag, &rlim); - if (hard) - lim = rlim.rlim_max; ---- 466,483 ---- - - #ifndef SYSVR4 - extern int getrlimit(int, struct rlimit *); -+ -+ /* #ifndef __FreeBSD__ */ -+ #include <sys/param.h> -+ #if !(defined(BSD) && BSD >= 199306) - extern int setrlimit(int, struct rlimit *); - #endif - -+ #endif -+ - static void printlimit(const Limit *limit, bool hard) { - struct rlimit rlim; -! u_quad_t lim; - getrlimit(limit->flag, &rlim); - if (hard) - lim = rlim.rlim_max; -*************** -*** 490,496 **** - } - } - -! static long parselimit(const Limit *limit, char *s) { - char *t; - int len = strlen(s); - long lim = 1; ---- 496,502 ---- - } - } - -! static u_quad_t parselimit(const Limit *limit, char *s) { - char *t; - int len = strlen(s); - long lim = 1; *** utils.c.orig Wed Aug 20 15:26:52 1997 --- utils.c Wed Aug 20 15:28:11 1997 *************** @@ -139,3 +87,47 @@ extern int mknod(const char *, int, int); #endif extern int pipe(int *); +--- builtins.c.orig Mon Mar 7 03:32:49 1994 ++++ builtins.c Tue Feb 24 11:04:28 1998 +@@ -466,12 +466,18 @@ + + #ifndef SYSVR4 + extern int getrlimit(int, struct rlimit *); ++ ++/* #ifndef __FreeBSD__ */ ++#include <sys/param.h> ++#if !(defined(BSD) && BSD >= 199306) + extern int setrlimit(int, struct rlimit *); + #endif + ++#endif ++ + static void printlimit(const Limit *limit, bool hard) { + struct rlimit rlim; +- long lim; ++ u_quad_t lim; + getrlimit(limit->flag, &rlim); + if (hard) + lim = rlim.rlim_max; +@@ -481,16 +487,19 @@ + fprint(1, "%s \tunlimited\n", limit->name); + else { + const Suffix *suf; ++ char buf[1024]; + for (suf = limit->suffix; suf != NULL; suf = suf->next) + if (lim % suf->amount == 0 && (lim != 0 || suf->amount > 1)) { + lim /= suf->amount; + break; + } +- fprint(1, "%s \t%d%s\n", limit->name, lim, (suf == NULL || lim == 0) ? "" : suf->name); ++ (void) snprintf(buf, sizeof(buf), "%s \t%qu%s\n", ++ limit->name, lim, (suf == NULL || lim == 0) ? "" : suf->name); ++ fprint(1, "%s", buf); + } + } + +-static long parselimit(const Limit *limit, char *s) { ++static u_quad_t parselimit(const Limit *limit, char *s) { + char *t; + int len = strlen(s); + long lim = 1; |