From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 12834 invoked from network); 3 Jan 1997 15:15:24 -0000 Received: from euclid.skiles.gatech.edu (list@130.207.146.50) by coral.primenet.com.au with SMTP; 3 Jan 1997 15:15:24 -0000 Received: (from list@localhost) by euclid.skiles.gatech.edu (8.7.3/8.7.3) id KAA20518; Fri, 3 Jan 1997 10:14:34 -0500 (EST) Resent-Date: Fri, 3 Jan 1997 10:14:34 -0500 (EST) Message-Id: <199701031514.QAA15096@hydra.ifh.de> To: zsh-workers@math.gatech.edu (Zsh hackers list) Subject: rlimits update Date: Fri, 03 Jan 1997 16:14:22 +0100 From: Peter Stephenson Resent-Message-ID: <"80Fvs3.0.W05.Q9Ipo"@euclid> Resent-From: zsh-workers@math.gatech.edu X-Mailing-List: archive/latest/2716 X-Loop: zsh-workers@math.gatech.edu Precedence: list Resent-Sender: zsh-workers-request@math.gatech.edu I wrote the configure test for the RLIM_* macros so that if they weren't found in any of the expected files the shell would still compile. However, I didn't provide anything showing the actual size of the `recs' array containing the limit names: it's normally (RLIM_NLIMITS+1) but in this case it should just be 1, and the builtin.c code should know about this. (Actually, as written it would be the right size, but full of NULL's, which are likely to cause problems.) This patch introduces the ZSH_NLIMITS macro which is defined to the number of limits actually found. If everything's going well with configuration this patch has no effect. Was there any good reason for having printf's in awk with %s's rather than the literal text? If so this may need altering. *** Src/builtin.c.nl Fri Jan 3 15:27:50 1997 --- Src/builtin.c Fri Jan 3 15:30:58 1997 *************** *** 3645,3651 **** /* Search for the appropriate resource name. When a name matches (i.e. * * starts with) the argument, the lim variable changes from -1 to the * * number of the resource. If another match is found, lim goes to -2. */ ! for (lim = -1, limnum = 0; limnum < RLIM_NLIMITS; limnum++) if (!strncmp(recs[limnum], s, strlen(s))) { if (lim != -1) lim = -2; --- 3645,3651 ---- /* Search for the appropriate resource name. When a name matches (i.e. * * starts with) the argument, the lim variable changes from -1 to the * * number of the resource. If another match is found, lim goes to -2. */ ! for (lim = -1, limnum = 0; limnum < ZSH_NLIMITS; limnum++) if (!strncmp(recs[limnum], s, strlen(s))) { if (lim != -1) lim = -2; *************** *** 3770,3776 **** * matches (i.e. starts with) the argument, the lim variable * * changes from -1 to the number of the resource. If another * * match is found, lim goes to -2. */ ! for (lim = -1, limnum = 0; limnum < RLIM_NLIMITS; limnum++) if (!strncmp(recs[limnum], *argv, strlen(*argv))) { if (lim != -1) lim = -2; --- 3770,3776 ---- * matches (i.e. starts with) the argument, the lim variable * * changes from -1 to the number of the resource. If another * * match is found, lim goes to -2. */ ! for (lim = -1, limnum = 0; limnum < ZSH_NLIMITS; limnum++) if (!strncmp(recs[limnum], *argv, strlen(*argv))) { if (lim != -1) lim = -2; *************** *** 3993,3999 **** RLIM_T val; /* main loop over resource types */ ! for (rt = 0; rt != RLIM_NLIMITS; rt++) if (rt == lim || lim == -1) { /* display limit for resource number rt */ printf("%-16s", recs[rt]); --- 3993,3999 ---- RLIM_T val; /* main loop over resource types */ ! for (rt = 0; rt != ZSH_NLIMITS; rt++) if (rt == lim || lim == -1) { /* display limit for resource number rt */ printf("%-16s", recs[rt]); *** Src/rlimits.awk.nl Fri Jan 3 15:25:51 1997 --- Src/rlimits.awk Fri Jan 3 15:36:11 1997 *************** *** 46,52 **** } ps = "%s" ! printf("%s\n%s\n\n%s\n", "/** rlimits.h **/", "/** architecture-customized limits for zsh **/", "static char *recs[RLIM_NLIMITS+1] = {") for (i = 0; i < 0 + nlimits; i++) if (msg[i] == "") { --- 46,53 ---- } ps = "%s" ! printf("%s\n%s\n\n", "/** rlimits.h **/", "/** architecture-customized limits for zsh **/") ! printf("#define ZSH_NLIMITS %d\n\nstatic char *recs[ZSH_NLIMITS+1] = {\n", 0 + nlimits) for (i = 0; i < 0 + nlimits; i++) if (msg[i] == "") { -- Peter Stephenson Tel: +49 33762 77366 WWW: http://www.ifh.de/~pws/ Fax: +49 33762 77413 Deutsches Elektronen-Synchrotron --- Institut fuer Hochenergiephysik Zeuthen DESY-IfH, 15735 Zeuthen, Germany.