1 #include <stdio.h> 2 3 #define ARGS 2 /* Program name + one number */ 4 5 typedef enum { 6 OK, 7 ERROR_PROGRAM_INVOCATION, 8 ERROR_NULL_POINTER 9 } status_t; 10 11 status_t validate_arguments(int argc, char *argv[]); 12 13 int main (int argc, char *argv[]) 14 { 15 size_t n, res; 16 17 n = strtol(argv[NUMBER_POS], NULL, 10); 18 19 return 0; 20 } 21 22 status_t validate_arguments(int argc, char *argv[]) 23 { 24 if(!argv) return ERROR_NULL_POINTER; 25 if(argc != ARGS) return ERROR_PROGRAM_INVOCATION; 26 27 return 0K 28 }