# HG changeset patch # User Mychaela Falconia # Date 1477520718 0 # Node ID d43d82cbfb85aa3b54366433fb154474764286d1 # Parent 09b4fd9b3827477cc74449f9de248752a1a081cc fc-shell: use the newly adopted exit code convention diff -r 09b4fd9b3827 -r d43d82cbfb85 rvinterf/asyncshell/at.c --- a/rvinterf/asyncshell/at.c Wed Oct 26 22:00:39 2016 +0000 +++ b/rvinterf/asyncshell/at.c Wed Oct 26 22:25:18 2016 +0000 @@ -10,6 +10,7 @@ #include #include "pktmux.h" #include "limits.h" +#include "exitcodes.h" send_string_to_ati(str) char *str; @@ -20,7 +21,7 @@ len = strlen(str); if (len + 1 > MAX_PKT_TO_TARGET) { printf("error: max pkt to target limit exceeded\n"); - return(1); + return(ERROR_USAGE); } /* fill out the packet */ sendpkt[0] = RVT_AT_HEADER; diff -r 09b4fd9b3827 -r d43d82cbfb85 rvinterf/asyncshell/main.c --- a/rvinterf/asyncshell/main.c Wed Oct 26 22:00:39 2016 +0000 +++ b/rvinterf/asyncshell/main.c Wed Oct 26 22:25:18 2016 +0000 @@ -7,6 +7,7 @@ #include #include #include +#include "exitcodes.h" char *socket_pathname = "/tmp/rvinterf_socket"; char *rvinterf_ttyport; @@ -49,14 +50,14 @@ default: usage: fprintf(stderr, "usage: %s [options] [command]\n", argv[0]); - exit(1); + exit(ERROR_USAGE); } if (rvinterf_ttyport) { if (sopt) { fprintf(stderr, "%s error: -p and -s options are mutually exclusive\n", argv[0]); - exit(1); + exit(ERROR_USAGE); } launch_rvinterf(rvinterf_ttyport); } else { @@ -64,7 +65,7 @@ fprintf(stderr, "%s error: -B, -l and -w options are meaningful only when launching rvinterf\n", argv[0]); - exit(1); + exit(ERROR_USAGE); } connect_local_socket(); } @@ -85,7 +86,7 @@ continue; tty_cleanup(); perror("select"); - exit(1); + exit(ERROR_UNIX); } if (FD_ISSET(0, &fds)) handle_tty_input(); diff -r 09b4fd9b3827 -r d43d82cbfb85 rvinterf/asyncshell/oneshot.c --- a/rvinterf/asyncshell/oneshot.c Wed Oct 26 22:00:39 2016 +0000 +++ b/rvinterf/asyncshell/oneshot.c Wed Oct 26 22:25:18 2016 +0000 @@ -7,6 +7,7 @@ #include #include #include "limits.h" +#include "exitcodes.h" extern int cmd_poweroff(); extern int cmd_send_oneshot(); @@ -40,15 +41,15 @@ fprintf(stderr, "error: \"%s\" is not a valid one-shot command\n", argv[0]); - exit(1); + exit(ERROR_USAGE); } if (argc - 1 > tp->maxargs) { fprintf(stderr, "%s: too many arguments\n", tp->cmd); - exit(1); + exit(ERROR_USAGE); } if (argc - 1 < tp->minargs) { fprintf(stderr, "%s: too few arguments\n", tp->cmd); - exit(1); + exit(ERROR_USAGE); } return tp->func(argc, argv); } diff -r 09b4fd9b3827 -r d43d82cbfb85 rvinterf/asyncshell/pktsort.c --- a/rvinterf/asyncshell/pktsort.c Wed Oct 26 22:00:39 2016 +0000 +++ b/rvinterf/asyncshell/pktsort.c Wed Oct 26 22:25:18 2016 +0000 @@ -11,6 +11,7 @@ #include "limits.h" #include "localsock.h" #include "localtypes.h" +#include "exitcodes.h" extern u_char rvi_msg[]; extern int rvi_msg_len; @@ -23,7 +24,7 @@ if (rvi_msg_len < 7) { tty_cleanup(); fprintf(stderr, "Error: rvinterf sent us an invalid RVT msg\n"); - exit(1); + exit(ERROR_RVINTERF); } useid = rvi_msg[2] << 24 | rvi_msg[3] << 16 | rvi_msg[4] << 8 | rvi_msg[5]; @@ -35,7 +36,7 @@ tty_cleanup(); fprintf(stderr, "unexpected fwd of USEID %08X from rvinterf\n", useid); - exit(1); + exit(ERROR_RVINTERF); } } @@ -78,6 +79,6 @@ tty_cleanup(); fprintf(stderr, "unexpected fwd of MUX %02X from rvinterf\n", rvi_msg[1]); - exit(1); + exit(ERROR_RVINTERF); } } diff -r 09b4fd9b3827 -r d43d82cbfb85 rvinterf/asyncshell/sendarb.c --- a/rvinterf/asyncshell/sendarb.c Wed Oct 26 22:00:39 2016 +0000 +++ b/rvinterf/asyncshell/sendarb.c Wed Oct 26 22:25:18 2016 +0000 @@ -9,6 +9,7 @@ #include #include #include "limits.h" +#include "exitcodes.h" cmd_send_common(argc, argv) char **argv; @@ -22,7 +23,7 @@ if (*endp) { printf( "error: all arguments to send command must be hex bytes\n"); - return(1); + return(ERROR_USAGE); } } /* send it! */ diff -r 09b4fd9b3827 -r d43d82cbfb85 rvinterf/asyncshell/sendsp.c --- a/rvinterf/asyncshell/sendsp.c Wed Oct 26 22:00:39 2016 +0000 +++ b/rvinterf/asyncshell/sendsp.c Wed Oct 26 22:25:18 2016 +0000 @@ -10,6 +10,7 @@ #include #include "pktmux.h" #include "limits.h" +#include "exitcodes.h" send_gpf_sysprim(stackdest, primstr) char *stackdest, *primstr; @@ -21,13 +22,13 @@ if (strlen(stackdest) > 4) { printf( "error: stack destination arg may not exceed 4 characters\n"); - return(1); + return(ERROR_USAGE); } intlen = 12 + strlen(primstr); pktlen = intlen + 4; if (pktlen > MAX_PKT_TO_TARGET) { printf("error: max pkt to target limit exceeded\n"); - return(1); + return(ERROR_USAGE); } /* fill out the packet */ sendpkt[0] = RVT_L23_HEADER; diff -r 09b4fd9b3827 -r d43d82cbfb85 rvinterf/asyncshell/tchcmd.c --- a/rvinterf/asyncshell/tchcmd.c Wed Oct 26 22:00:39 2016 +0000 +++ b/rvinterf/asyncshell/tchcmd.c Wed Oct 26 22:25:18 2016 +0000 @@ -11,6 +11,7 @@ #include "pktmux.h" #include "limits.h" #include "tch_feature.h" +#include "exitcodes.h" extern u_char rvi_msg[]; extern int rvi_msg_len; @@ -42,7 +43,7 @@ config = 0; else { printf("error: boolean argument required\n"); - return(1); + return(ERROR_USAGE); } return send_tch_config_req(config); }