sbase

suckless unix tools
git clone git://git.2f30.org/sbase.git
Log | Files | Refs | README | LICENSE

commit ba456787cbaf1c90cdda268c86ee1b26a774eeff
parent 7c251bcd4fe460d8c6a5bfddeca11db9296d3c7d
Author: Connor Lane Smith <cls@lubutu.com>
Date:   Fri Jun 10 05:44:00 +0100

chmod: strnum
Diffstat:
chmod.c | 6++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/chmod.c b/chmod.c @@ -14,7 +14,7 @@ static mode_t mode = 0; int main(int argc, char *argv[]) { - char c, *end; + char c; int octal; while((c = getopt(argc, argv, "Rr")) != -1) @@ -28,9 +28,7 @@ main(int argc, char *argv[]) } if(optind == argc) eprintf("usage: %s [-Rr] mode [file...]\n", argv[0]); - octal = strtol(argv[optind++], &end, 8); - if(*end != '\0') - eprintf("%s: not an octal number\n", argv[optind-1]); + octal = strnum(argv[optind++], 8); /* posix doesn't specify modal bits */ if(octal & 04000) mode |= S_ISUID;