From 35952ad3237da1796f2353f274d2e5221f16c024 Mon Sep 17 00:00:00 2001 From: agc Date: Tue, 24 Feb 1998 11:18:58 +0000 Subject: 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. --- plan9/rc/patches/patch-aa | 96 ++++++++++++++++++++++------------------------- 1 file changed, 44 insertions(+), 52 deletions(-) (limited to 'plan9') diff --git a/plan9/rc/patches/patch-aa b/plan9/rc/patches/patch-aa index a55b3d73968..3c849bf4d0a 100644 --- a/plan9/rc/patches/patch-aa +++ b/plan9/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 -+ #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 ++#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; -- cgit v1.2.3