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 VAA06433 for ; Wed, 26 Jun 1996 21:57:23 +1000 (EST) Received: (from list@localhost) by euclid.skiles.gatech.edu (8.7.3/8.7.3) id HAA07243; Wed, 26 Jun 1996 07:28:52 -0400 (EDT) Resent-Date: Wed, 26 Jun 1996 07:28:52 -0400 (EDT) From: Geoff Wing Message-Id: <199606261128.LAA05753@werple.net.au> Subject: RLIM_T fix, also atol To: zsh-workers@math.gatech.edu Date: Wed, 26 Jun 1996 21:28:14 +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: <"ROSwx1.0.2n1.qxHqn"@euclid> Resent-From: zsh-workers@math.gatech.edu X-Mailing-List: archive/latest/1444 X-Loop: zsh-workers@math.gatech.edu Precedence: list Resent-Sender: zsh-workers-request@math.gatech.edu Heyla, this fixes some small things in rlimit stuff. Also changes atol() to zstrtol() - atol() is not used anymore. Diffs on beta21. *** Src/builtin.c.~1~ Thu Jun 20 06:40:54 1996 --- Src/builtin.c Wed Jun 26 19:40:53 1996 *************** *** 3798,3804 **** /* set limit to specified value */ RLIM_T limit; ! limit = (RLIM_T) atol(*argv); /* scale appropriately */ switch (res) { case RLIMIT_FSIZE: --- 3798,3808 ---- /* 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: *************** *** 3925,3954 **** break; case RLIMIT_FSIZE: printf("file size (blocks) "); ! limit /= 512; break; case RLIMIT_DATA: printf("data seg size (kbytes) "); ! limit /= 1024; break; case RLIMIT_STACK: printf("stack size (kbytes) "); ! limit /= 1024; break; case RLIMIT_CORE: printf("core file size (blocks) "); ! limit /= 512; break; # ifdef RLIMIT_RSS case RLIMIT_RSS: printf("resident set size (kbytes) "); ! limit /= 1024; break; # endif /* RLIMIT_RSS */ # ifdef RLIMIT_MEMLOCK case RLIMIT_MEMLOCK: printf("locked-in-memory size (kb) "); ! limit /= 1024; break; # endif /* RLIMIT_MEMLOCK */ # ifdef RLIMIT_NPROC --- 3929,3964 ---- break; case RLIMIT_FSIZE: printf("file size (blocks) "); ! if (limit != RLIM_INFINITY) ! limit /= 512; break; case RLIMIT_DATA: printf("data seg size (kbytes) "); ! if (limit != RLIM_INFINITY) ! limit /= 1024; break; case RLIMIT_STACK: printf("stack size (kbytes) "); ! if (limit != RLIM_INFINITY) ! limit /= 1024; break; case RLIMIT_CORE: printf("core file size (blocks) "); ! if (limit != RLIM_INFINITY) ! limit /= 512; break; # ifdef RLIMIT_RSS case RLIMIT_RSS: printf("resident set size (kbytes) "); ! if (limit != RLIM_INFINITY) ! limit /= 1024; break; # endif /* RLIMIT_RSS */ # ifdef RLIMIT_MEMLOCK case RLIMIT_MEMLOCK: printf("locked-in-memory size (kb) "); ! if (limit != RLIM_INFINITY) ! limit /= 1024; break; # endif /* RLIMIT_MEMLOCK */ # ifdef RLIMIT_NPROC *************** *** 3964,3976 **** # ifdef RLIMIT_VMEM case RLIMIT_VMEM: printf("virtual memory size (kb) "); ! limit /= 1024; break; # endif /* RLIMIT_VMEM */ # if defined RLIMIT_AS && RLIMIT_AS != RLIMIT_VMEM case RLIMIT_AS: printf("address space (kb) "); ! limit /= 1024; break; # endif /* RLIMIT_AS */ } --- 3974,3988 ---- # ifdef RLIMIT_VMEM case RLIMIT_VMEM: printf("virtual memory size (kb) "); ! if (limit != RLIM_INFINITY) ! limit /= 1024; break; # endif /* RLIMIT_VMEM */ # if defined RLIMIT_AS && RLIMIT_AS != RLIMIT_VMEM case RLIMIT_AS: printf("address space (kb) "); ! if (limit != RLIM_INFINITY) ! limit /= 1024; break; # endif /* RLIMIT_AS */ } *** Src/hist.c.~1~ Sat May 11 06:22:30 1996 --- Src/hist.c Wed Jun 26 19:14:03 1996 *************** *** 1353,1363 **** pt = buf; if (*pt == ':') { pt++; ! ent->stim = atol(pt); for (; *pt != ':' && *pt; pt++); if (*pt) { pt++; ! ent->ftim = atol(pt); for (; *pt != ';' && *pt; pt++); if (*pt) pt++; --- 1353,1363 ---- pt = buf; if (*pt == ':') { pt++; ! ent->stim = zstrtol(pt, NULL, 0); for (; *pt != ':' && *pt; pt++); if (*pt) { pt++; ! ent->ftim = zstrtol(pt, NULL, 0); for (; *pt != ';' && *pt; pt++); if (*pt) pt++; *** Src/utils.c.~1~ Thu Jun 20 06:01:40 1996 --- Src/utils.c Wed Jun 26 19:11:38 1996 *************** *** 1055,1060 **** --- 1055,1090 ---- return ret; } + /* Convert string to quad_t. */ + + #ifdef RLIM_T_IS_QUAD_T + /**/ + quad_t + zstrtoq(const char *s, char **t, int base) + { + quad_t ret = 0; + + if (!base) + if (*s != '0') + base = 10; + else if (*++s == 'x' || *s == 'X') + base = 16, s++; + else + base = 8; + + if (base <= 10) + for (; *s >= '0' && *s < ('0' + base); s++) + ret = ret * base + *s - '0'; + else + for (; idigit(*s) || (*s >= 'a' && *s < ('a' + base - 10)) + || (*s >= 'A' && *s < ('A' + base - 10)); s++) + ret = ret * base + (idigit(*s) ? (*s - '0') : (*s & 0x1f) + 9); + if (t) + *t = (char *)s; + return ret; + } + #endif + /**/ int checkrmall(char *s) -- Mason [G.C.W] mason@werple.mira.net.au "Hurt...Agony...Pain...LOVE-IT"