FreeCalypso > hg > freecalypso-tools
comparison rvinterf/tmsh/main.c @ 65:21a79f465d6a
fc-tmsh: use the newly adopted exit code convention
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Wed, 26 Oct 2016 22:46:23 +0000 |
parents | e7502631a0f9 |
children | 2c6dca514a20 |
comparison
equal
deleted
inserted
replaced
64:d43d82cbfb85 | 65:21a79f465d6a |
---|---|
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 int ttyhacks, dflag; | 13 int ttyhacks, dflag; |
13 | 14 |
14 int sock; | 15 int sock; |
42 continue; | 43 continue; |
43 case '?': | 44 case '?': |
44 default: | 45 default: |
45 usage: fprintf(stderr, | 46 usage: fprintf(stderr, |
46 "usage: %s [options] [ttyport]\n", argv[0]); | 47 "usage: %s [options] [ttyport]\n", argv[0]); |
47 exit(1); | 48 exit(ERROR_USAGE); |
48 } | 49 } |
49 switch (argc - optind) { | 50 switch (argc - optind) { |
50 case 0: | 51 case 0: |
51 if (rvinterf_Bopt || rvinterf_lopt || rvinterf_wopt) { | 52 if (rvinterf_Bopt || rvinterf_lopt || rvinterf_wopt) { |
52 fprintf(stderr, | 53 fprintf(stderr, |
53 "%s: -B, -l and -w options are meaningful only when launching rvinterf\n", | 54 "%s: -B, -l and -w options are meaningful only when launching rvinterf\n", |
54 argv[0]); | 55 argv[0]); |
55 exit(1); | 56 exit(ERROR_USAGE); |
56 } | 57 } |
57 break; | 58 break; |
58 case 1: | 59 case 1: |
59 launch_rvinterf(argv[optind]); | 60 launch_rvinterf(argv[optind]); |
60 break; | 61 break; |
73 if (c < 0) { | 74 if (c < 0) { |
74 if (errno == EINTR) | 75 if (errno == EINTR) |
75 continue; | 76 continue; |
76 tty_cleanup(); | 77 tty_cleanup(); |
77 perror("select"); | 78 perror("select"); |
78 exit(1); | 79 exit(ERROR_UNIX); |
79 } | 80 } |
80 if (FD_ISSET(0, &fds)) | 81 if (FD_ISSET(0, &fds)) |
81 handle_tty_input(); | 82 handle_tty_input(); |
82 if (FD_ISSET(sock, &fds)) | 83 if (FD_ISSET(sock, &fds)) |
83 handle_rvinterf_input(); | 84 handle_rvinterf_input(); |