#include /* isdigit(3) */ #include /* EX_USAGE */ #include /* 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; }