rename estrtol
This commit is contained in:
parent
61247e3595
commit
954106050f
2
Makefile
2
Makefile
|
@ -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 \
|
||||
|
|
2
chmod.c
2
chmod.c
|
@ -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
2
date.c
|
@ -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
2
fold.c
|
@ -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
2
head.c
|
@ -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
4
kill.c
|
@ -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
2
nl.c
|
@ -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;
|
||||
|
|
2
sleep.c
2
sleep.c
|
@ -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
2
tail.c
|
@ -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;
|
||||
|
|
2
touch.c
2
touch.c
|
@ -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
2
util.h
|
@ -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);
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
#include "../util.h"
|
||||
|
||||
long
|
||||
strnum(const char *s, int base)
|
||||
estrtol(const char *s, int base)
|
||||
{
|
||||
char *end;
|
||||
long n;
|
Loading…
Reference in New Issue
Block a user