rename estrtol

This commit is contained in:
Connor Lane Smith 2011-06-10 14:55:01 +01:00
parent 61247e3595
commit 954106050f
12 changed files with 13 additions and 13 deletions

View File

@ -7,9 +7,9 @@ LIB = \
util/concat.o \
util/enmasse.o \
util/eprintf.o \
util/estrtol.o \
util/putword.o \
util/recurse.o \
util/strnum.o \
SRC = \
basename.c \

View File

@ -28,7 +28,7 @@ main(int argc, char *argv[])
}
if(optind == argc)
eprintf("usage: %s [-Rr] mode [file...]\n", argv[0]);
octal = strnum(argv[optind++], 8);
octal = estrtol(argv[optind++], 8);
/* posix doesn't specify modal bits */
if(octal & 04000) mode |= S_ISUID;

2
date.c
View File

@ -17,7 +17,7 @@ main(int argc, char *argv[])
while((c = getopt(argc, argv, "d:")) != -1)
switch(c) {
case 'd':
t = strnum(optarg, 0);
t = estrtol(optarg, 0);
break;
default:
exit(EXIT_FAILURE);

2
fold.c
View File

@ -29,7 +29,7 @@ main(int argc, char *argv[])
sflag = true;
break;
case 'w':
width = strnum(optarg, 0);
width = estrtol(optarg, 0);
break;
default:
exit(EXIT_FAILURE);

2
head.c
View File

@ -17,7 +17,7 @@ main(int argc, char *argv[])
while((c = getopt(argc, argv, "n:")) != -1)
switch(c) {
case 'n':
n = strnum(optarg, 0);
n = estrtol(optarg, 0);
break;
default:
exit(EXIT_FAILURE);

4
kill.c
View File

@ -53,14 +53,14 @@ main(int argc, char *argv[])
eprintf("usage: %s [-s signal] [pid...]\n"
" %s -l [signum]\n", argv[0], argv[0]);
sig = (optind == argc) ? 0 : strnum(argv[optind], 0);
sig = (optind == argc) ? 0 : estrtol(argv[optind], 0);
for(i = 0; i < LEN(sigs); i++)
if(sigs[i].sig == sig || sig == 0)
putword(sigs[i].name);
putchar('\n');
}
else for(; optind < argc; optind++) {
pid = strnum(argv[optind], 0);
pid = estrtol(argv[optind], 0);
if(kill(pid, sig) == -1)
eprintf("kill %d:", pid);
}

2
nl.c
View File

@ -30,7 +30,7 @@ main(int argc, char *argv[])
eprintf("usage: %s [-b mode] [-i increment] [-s separator] [file...]\n", argv[0]);
break;
case 'i':
incr = strnum(optarg, 0);
incr = estrtol(optarg, 0);
break;
case 's':
sep = optarg;

View File

@ -13,7 +13,7 @@ main(int argc, char *argv[])
if(optind != argc-1)
eprintf("usage: %s seconds\n", argv[0]);
seconds = strnum(argv[optind], 0);
seconds = estrtol(argv[optind], 0);
while((seconds = sleep(seconds)) > 0)
;
return EXIT_SUCCESS;

2
tail.c
View File

@ -20,7 +20,7 @@ main(int argc, char *argv[])
while((c = getopt(argc, argv, "n:")) != -1)
switch(c) {
case 'n':
n = abs(strnum(optarg, 0));
n = abs(estrtol(optarg, 0));
if(optarg[0] == '+')
tail = dropinit;
break;

View File

@ -26,7 +26,7 @@ main(int argc, char *argv[])
cflag = true;
break;
case 't':
t = strnum(optarg, 0);
t = estrtol(optarg, 0);
break;
default:
exit(EXIT_FAILURE);

2
util.h
View File

@ -5,6 +5,6 @@
char *agetcwd(void);
void enmasse(int, char **, int (*)(const char *, const char *));
void eprintf(const char *, ...);
long estrtol(const char *, int);
void putword(const char *);
void recurse(const char *, void (*)(const char *));
long strnum(const char *, int);

View File

@ -4,7 +4,7 @@
#include "../util.h"
long
strnum(const char *s, int base)
estrtol(const char *s, int base)
{
char *end;
long n;