From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from euclid.skiles.gatech.edu (list@euclid.skiles.gatech.edu [130.207.146.50]) by melb.werple.net.au (8.7.5/8.7.3/2) with ESMTP id EAA21918 for ; Sat, 29 Jun 1996 04:36:33 +1000 (EST) Received: (from list@localhost) by euclid.skiles.gatech.edu (8.7.3/8.7.3) id OAA13672; Fri, 28 Jun 1996 14:24:02 -0400 (EDT) Resent-Date: Fri, 28 Jun 1996 14:24:02 -0400 (EDT) From: Geoff Wing Message-Id: <199606281823.SAA21741@werple.net.au> Subject: RLIM_T more fixes To: zsh-workers@math.gatech.edu (zsh-list) Date: Sat, 29 Jun 1996 04:23:24 +1000 (EST) X-Mailer: ELM [version 2.4 PL25] MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Resent-Message-ID: <"-gR_w2.0.YL3.1D2rn"@euclid> Resent-From: zsh-workers@math.gatech.edu X-Mailing-List: archive/latest/1471 X-Loop: zsh-workers@math.gatech.edu Precedence: list Resent-Sender: zsh-workers-request@math.gatech.edu Heyla, this goes on top of article 1444 (though this is diff'd on 3.0-pre1) The previous patch will patch clean with 3.0-pre1 (just line offsets). This cleans up the types in the rest of the rlimit stuff. I'm still looking for a bug somewhere which is causing me problems with this. limits[] stuff is getting corrupted somehow, but I'm not certain zsh's causing it (might be a gcc bug (gcc used to have bugs with "long long"s)). *** builtin.c.~2~ Sat Jun 29 02:48:27 1996 --- builtin.c Sat Jun 29 02:48:29 1996 *************** *** 3534,3539 **** --- 3534,3546 ---- * appear in this array in numerical order of the RLIMIT_* macros. */ #ifdef HAVE_GETRLIMIT + + #ifdef RLIM_T_IS_QUAD_T + # define ZSTRTORLIMT(a, b, c) zstrtoq((a), (b), (c)) + #else + # define ZSTRTORLIMT(a, b, c) zstrtol((a), (b), (c)) + #endif + static char *recs[] = { "cputime", "filesize", "datasize", "stacksize", "coredumpsize", *************** *** 3608,3614 **** #else char *s; int hard, limnum, lim; ! long val; hard = ops['h']; if (ops['s']) { --- 3615,3621 ---- #else char *s; int hard, limnum, lim; ! RLIM_T val; hard = ops['h']; if (ops['s']) { *************** *** 3653,3666 **** * hours with the `m' and `h' modifiers, and `:' may be used to add * * together more than one of these. It's easier to understand from * * the code: */ ! val = zstrtol(s, &s, 10); if (*s) if ((*s == 'h' || *s == 'H') && !s[1]) val *= 3600L; else if ((*s == 'm' || *s == 'M') && !s[1]) val *= 60L; else if (*s == ':') ! val = val * 60 + zstrtol(s + 1, &s, 10); else { zwarnnam("limit", "unknown scaling factor: %s", s, 0); return 1; --- 3660,3673 ---- * hours with the `m' and `h' modifiers, and `:' may be used to add * * together more than one of these. It's easier to understand from * * the code: */ ! val = ZSTRTORLIMT(s, &s, 10); if (*s) if ((*s == 'h' || *s == 'H') && !s[1]) val *= 3600L; else if ((*s == 'm' || *s == 'M') && !s[1]) val *= 60L; else if (*s == ':') ! val = val * 60 + ZSTRTORLIMT(s + 1, &s, 10); else { zwarnnam("limit", "unknown scaling factor: %s", s, 0); return 1; *************** *** 3670,3687 **** else if (lim == RLIMIT_NPROC) /* pure numeric resource -- only a straight decimal number is permitted. */ ! val = zstrtol(s, &s, 10); # endif /* RLIMIT_NPROC */ # ifdef RLIMIT_NOFILE else if (lim == RLIMIT_NOFILE) /* pure numeric resource -- only a straight decimal number is permitted. */ ! val = zstrtol(s, &s, 10); # endif /* RLIMIT_NOFILE */ else { /* memory-type resource -- `k' and `M' modifiers are permitted, meaning (respectively) 2^10 and 2^20. */ ! val = zstrtol(s, &s, 10); if (!*s || ((*s == 'k' || *s == 'K') && !s[1])) val *= 1024L; else if ((*s == 'M' || *s == 'm') && !s[1]) --- 3677,3694 ---- else if (lim == RLIMIT_NPROC) /* pure numeric resource -- only a straight decimal number is permitted. */ ! val = ZSTRTORLIMT(s, &s, 10); # endif /* RLIMIT_NPROC */ # ifdef RLIMIT_NOFILE else if (lim == RLIMIT_NOFILE) /* pure numeric resource -- only a straight decimal number is permitted. */ ! val = ZSTRTORLIMT(s, &s, 10); # endif /* RLIMIT_NOFILE */ else { /* memory-type resource -- `k' and `M' modifiers are permitted, meaning (respectively) 2^10 and 2^20. */ ! val = ZSTRTORLIMT(s, &s, 10); if (!*s || ((*s == 'k' || *s == 'K') && !s[1])) val *= 1024L; else if ((*s == 'M' || *s == 'm') && !s[1]) *************** *** 3839,3849 **** /* set limit to specified value */ RLIM_T limit; ! #ifdef RLIM_T_IS_QUAD_T ! limit = (RLIM_T) zstrtoq(*argv, NULL, 10); ! #else ! limit = (RLIM_T) zstrtol(*argv, NULL, 10); ! #endif /* scale appropriately */ switch (res) { case RLIMIT_FSIZE: --- 3846,3852 ---- /* set limit to specified value */ RLIM_T limit; ! limit = ZSTRTORLIMT(*argv, NULL, 10); /* scale appropriately */ switch (res) { case RLIMIT_FSIZE: -- Mason [G.C.W] mason@werple.mira.net.au "Hurt...Agony...Pain...LOVE-IT"