Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

rlimits update



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 <pws@xxxxxx>       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.



Messages sorted by: Reverse Date, Date, Thread, Author