1
0

more cleaning

This commit is contained in:
dtb
2022-09-18 00:34:03 -04:00
parent fbdaf55d1c
commit 05c3fad56e
8 changed files with 0 additions and 0 deletions

25
retval/retval.c Normal file
View File

@@ -0,0 +1,25 @@
#include <ctype.h> /* isdigit(3) */
#include <sysexits.h> /* EX_USAGE */
#include <unistd.h> /* write(2) */
#include "libio.h" /* fdprint(3), parse_uint(3) */
static char *program_name = "retval";
int main(int argc, char *argv[]){
unsigned int s;
if(argc < 2){
usage: write(2, "Usage: ", 7);
fdprint(2, argv[0] == NULL ? program_name : argv[0]);
write(2, " [status]\n", 10);
return EX_USAGE;
}
for(s = 0; argv[1][s] != '\0'; ++s)
if(!isdigit(argv[1][s]))
goto usage;
s = parse_uint(argv[1]);
return s;
}