2023-09-14 07:47:24 -06:00
|
|
|
#include <errno.h> /* errno */
|
2023-08-19 07:25:33 -06:00
|
|
|
#include <stdio.h> /* fprintf(3), stderr */
|
2023-09-14 07:47:24 -06:00
|
|
|
#include <stdlib.h> /* strtol(3) */
|
2022-08-23 10:49:42 -06:00
|
|
|
#include <sysexits.h> /* EX_USAGE */
|
2022-05-14 18:55:12 -06:00
|
|
|
|
2022-08-23 10:49:42 -06:00
|
|
|
static char *program_name = "retval";
|
2022-05-14 18:55:12 -06:00
|
|
|
|
2022-08-23 10:49:42 -06:00
|
|
|
int main(int argc, char *argv[]){
|
|
|
|
unsigned int s;
|
2022-05-14 18:55:12 -06:00
|
|
|
|
2023-11-18 14:56:17 -07:00
|
|
|
if(argc < 2)
|
|
|
|
goto usage;
|
2022-05-14 18:55:12 -06:00
|
|
|
|
2023-09-14 07:47:24 -06:00
|
|
|
errno = 0;
|
|
|
|
s = strtol(argv[1], &argv[1], 10);
|
2023-11-18 14:56:17 -07:00
|
|
|
if(*argv[1] != '\0' || errno != 0){
|
|
|
|
usage: fprintf(stderr, "Usage: %s [status]\n",
|
|
|
|
argv[0] == NULL ? program_name : argv[0]);
|
|
|
|
return EX_USAGE;
|
|
|
|
}
|
2022-05-14 18:55:12 -06:00
|
|
|
|
2022-08-23 10:49:42 -06:00
|
|
|
return s;
|
2022-05-14 18:55:12 -06:00
|
|
|
}
|