FreeCalypso > hg > freecalypso-tools
changeset 63:09b4fd9b3827
rvinterf/libasync: use the newly adopted exit code convention
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Wed, 26 Oct 2016 22:00:39 +0000 |
parents | 2dd9dbe3f4a7 |
children | d43d82cbfb85 |
files | rvinterf/libasync/init.c rvinterf/libasync/interf.c rvinterf/libasync/launchrvif.c rvinterf/libasync/ttymagic.c |
diffstat | 4 files changed, 14 insertions(+), 11 deletions(-) [+] |
line wrap: on
line diff
--- a/rvinterf/libasync/init.c Wed Oct 26 21:36:07 2016 +0000 +++ b/rvinterf/libasync/init.c Wed Oct 26 22:00:39 2016 +0000 @@ -1,5 +1,5 @@ /* - * This module contains the common initialization code for fc-tmsh and g23sh. + * This module contains the common initialization code for fc-shell and fc-tmsh. */ #include <sys/types.h> @@ -12,6 +12,7 @@ #include <unistd.h> #include "pktmux.h" #include "localsock.h" +#include "exitcodes.h" extern char *socket_pathname; extern int sock; @@ -26,7 +27,7 @@ sock = socket(AF_UNIX, SOCK_STREAM, 0); if (sock < 0) { perror("socket(AF_UNIX, SOCK_STREAM, 0)"); - exit(1); + exit(ERROR_UNIX); } local.sun_family = AF_UNIX; @@ -48,7 +49,7 @@ rc = connect(sock, (struct sockaddr *) &local, namelen); if (rc != 0) { perror(socket_pathname); - exit(1); + exit(ERROR_RVINTERF); } return(0);
--- a/rvinterf/libasync/interf.c Wed Oct 26 21:36:07 2016 +0000 +++ b/rvinterf/libasync/interf.c Wed Oct 26 22:00:39 2016 +0000 @@ -7,6 +7,7 @@ #include <stdlib.h> #include <unistd.h> #include "localsock.h" +#include "exitcodes.h" extern int sock; @@ -47,14 +48,14 @@ tty_cleanup(); fprintf(stderr, "Error from rvinterf: %.*s\n", rvi_msg_len - 1, rvi_msg + 1); - exit(1); + exit(ERROR_RVINTERF); default: bad: tty_cleanup(); fprintf(stderr, "Error: unexpected message type %02X from rvinterf\n", rvi_msg[0]); - exit(1); + exit(ERROR_RVINTERF); } } @@ -67,7 +68,7 @@ if (cc <= 0) { tty_cleanup(); perror("read from rvinterf socket"); - exit(1); + exit(ERROR_RVINTERF); } rx_ptr += cc; rx_left -= cc; @@ -84,7 +85,7 @@ fprintf(stderr, "Invalid length from rvinterf: %02X%02X\n", rvi_msg[0], rvi_msg[1]); - exit(1); + exit(ERROR_RVINTERF); } prep_for_message_rx(); }
--- a/rvinterf/libasync/launchrvif.c Wed Oct 26 21:36:07 2016 +0000 +++ b/rvinterf/libasync/launchrvif.c Wed Oct 26 22:00:39 2016 +0000 @@ -1,6 +1,6 @@ /* * This module implements the optional "behind the scenes" invokation - * of rvinterf from fc-tmsh. + * of rvinterf from fc-shell or fc-tmsh. */ #include <sys/types.h> @@ -8,6 +8,7 @@ #include <stdio.h> #include <stdlib.h> #include <unistd.h> +#include "exitcodes.h" static char rvinterf_pathname[] = "/opt/freecalypso/bin/rvinterf"; @@ -24,7 +25,7 @@ rc = socketpair(AF_UNIX, SOCK_STREAM, 0, sp); if (rc < 0) { perror("socketpair"); - exit(1); + exit(ERROR_UNIX); } sock = sp[0]; sprintf(Sarg, "-S%d", sp[1]); @@ -49,7 +50,7 @@ rc = vfork(); if (rc < 0) { perror("vfork for launching rvinterf"); - exit(1); + exit(ERROR_UNIX); } if (!rc) { /* we are in the child - do the exec */
--- a/rvinterf/libasync/ttymagic.c Wed Oct 26 21:36:07 2016 +0000 +++ b/rvinterf/libasync/ttymagic.c Wed Oct 26 22:00:39 2016 +0000 @@ -1,5 +1,5 @@ /* - * This module contains the tty "magic" code for fc-tmsh. + * This module contains the tty "magic" code for fc-shell and fc-tmsh. */ #include <sys/types.h>