FreeCalypso > hg > freecalypso-tools
comparison rvinterf/asyncshell/main.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 | 84920d3d97c6 |
comparison
equal
deleted
inserted
replaced
63:09b4fd9b3827 | 64:d43d82cbfb85 |
---|---|
5 #include <sys/types.h> | 5 #include <sys/types.h> |
6 #include <sys/errno.h> | 6 #include <sys/errno.h> |
7 #include <stdio.h> | 7 #include <stdio.h> |
8 #include <stdlib.h> | 8 #include <stdlib.h> |
9 #include <unistd.h> | 9 #include <unistd.h> |
10 #include "exitcodes.h" | |
10 | 11 |
11 char *socket_pathname = "/tmp/rvinterf_socket"; | 12 char *socket_pathname = "/tmp/rvinterf_socket"; |
12 char *rvinterf_ttyport; | 13 char *rvinterf_ttyport; |
13 int ttyhacks, dflag; | 14 int ttyhacks, dflag; |
14 | 15 |
47 continue; | 48 continue; |
48 case '?': | 49 case '?': |
49 default: | 50 default: |
50 usage: fprintf(stderr, | 51 usage: fprintf(stderr, |
51 "usage: %s [options] [command]\n", argv[0]); | 52 "usage: %s [options] [command]\n", argv[0]); |
52 exit(1); | 53 exit(ERROR_USAGE); |
53 } | 54 } |
54 if (rvinterf_ttyport) { | 55 if (rvinterf_ttyport) { |
55 if (sopt) { | 56 if (sopt) { |
56 fprintf(stderr, | 57 fprintf(stderr, |
57 "%s error: -p and -s options are mutually exclusive\n", | 58 "%s error: -p and -s options are mutually exclusive\n", |
58 argv[0]); | 59 argv[0]); |
59 exit(1); | 60 exit(ERROR_USAGE); |
60 } | 61 } |
61 launch_rvinterf(rvinterf_ttyport); | 62 launch_rvinterf(rvinterf_ttyport); |
62 } else { | 63 } else { |
63 if (rvinterf_Bopt || rvinterf_lopt || rvinterf_wopt) { | 64 if (rvinterf_Bopt || rvinterf_lopt || rvinterf_wopt) { |
64 fprintf(stderr, | 65 fprintf(stderr, |
65 "%s error: -B, -l and -w options are meaningful only when launching rvinterf\n", | 66 "%s error: -B, -l and -w options are meaningful only when launching rvinterf\n", |
66 argv[0]); | 67 argv[0]); |
67 exit(1); | 68 exit(ERROR_USAGE); |
68 } | 69 } |
69 connect_local_socket(); | 70 connect_local_socket(); |
70 } | 71 } |
71 | 72 |
72 if (argv[optind]) | 73 if (argv[optind]) |
83 if (c < 0) { | 84 if (c < 0) { |
84 if (errno == EINTR) | 85 if (errno == EINTR) |
85 continue; | 86 continue; |
86 tty_cleanup(); | 87 tty_cleanup(); |
87 perror("select"); | 88 perror("select"); |
88 exit(1); | 89 exit(ERROR_UNIX); |
89 } | 90 } |
90 if (FD_ISSET(0, &fds)) | 91 if (FD_ISSET(0, &fds)) |
91 handle_tty_input(); | 92 handle_tty_input(); |
92 if (FD_ISSET(sock, &fds)) | 93 if (FD_ISSET(sock, &fds)) |
93 handle_rvinterf_input(); | 94 handle_rvinterf_input(); |