comparison rvinterf/asyncshell/oneshot.c @ 64:d43d82cbfb85

fc-shell: use the newly adopted exit code convention
author Mychaela Falconia <falcon@freecalypso.org>
date Wed, 26 Oct 2016 22:25:18 +0000
parents e7502631a0f9
children bbc41034f14c
comparison
equal deleted inserted replaced
63:09b4fd9b3827 64:d43d82cbfb85
5 #include <stdio.h> 5 #include <stdio.h>
6 #include <string.h> 6 #include <string.h>
7 #include <strings.h> 7 #include <strings.h>
8 #include <stdlib.h> 8 #include <stdlib.h>
9 #include "limits.h" 9 #include "limits.h"
10 #include "exitcodes.h"
10 11
11 extern int cmd_poweroff(); 12 extern int cmd_poweroff();
12 extern int cmd_send_oneshot(); 13 extern int cmd_send_oneshot();
13 extern int cmd_sp_oneshot(); 14 extern int cmd_sp_oneshot();
14 extern int cmd_tchdl_oneshot(); 15 extern int cmd_tchdl_oneshot();
38 break; 39 break;
39 if (!tp->func) { 40 if (!tp->func) {
40 fprintf(stderr, 41 fprintf(stderr,
41 "error: \"%s\" is not a valid one-shot command\n", 42 "error: \"%s\" is not a valid one-shot command\n",
42 argv[0]); 43 argv[0]);
43 exit(1); 44 exit(ERROR_USAGE);
44 } 45 }
45 if (argc - 1 > tp->maxargs) { 46 if (argc - 1 > tp->maxargs) {
46 fprintf(stderr, "%s: too many arguments\n", tp->cmd); 47 fprintf(stderr, "%s: too many arguments\n", tp->cmd);
47 exit(1); 48 exit(ERROR_USAGE);
48 } 49 }
49 if (argc - 1 < tp->minargs) { 50 if (argc - 1 < tp->minargs) {
50 fprintf(stderr, "%s: too few arguments\n", tp->cmd); 51 fprintf(stderr, "%s: too few arguments\n", tp->cmd);
51 exit(1); 52 exit(ERROR_USAGE);
52 } 53 }
53 return tp->func(argc, argv); 54 return tp->func(argc, argv);
54 } 55 }