FreeCalypso > hg > freecalypso-sw
diff rvinterf/etmsync/fsiomain.c @ 276:909f00c15f27
more fc-fsio foundation
author | Michael Spacefalcon <msokolov@ivan.Harhan.ORG> |
---|---|
date | Sun, 23 Feb 2014 21:31:30 +0000 |
parents | cedf09b6b5ac |
children | e23fc1228efd |
line wrap: on
line diff
--- a/rvinterf/etmsync/fsiomain.c Sun Feb 23 20:27:15 2014 +0000 +++ b/rvinterf/etmsync/fsiomain.c Sun Feb 23 21:31:30 2014 +0000 @@ -4,6 +4,8 @@ #include <stdio.h> #include <stdlib.h> +#include <unistd.h> +#include "exitcodes.h" char *socket_pathname = "/tmp/rvinterf_socket"; int sock; @@ -16,6 +18,7 @@ extern int optind; extern char *optarg; int c, sopt = 0; + char command[512]; while ((c = getopt(argc, argv, "B:l:p:s:w:")) != EOF) switch (c) { @@ -39,14 +42,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(); } else { @@ -54,10 +57,18 @@ 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(); } - + for (;;) { + if (isatty(0)) { + fputs("fsio> ", stdout); + fflush(stdout); + } + if (!fgets(command, sizeof command, stdin)) + exit(0); + parse_and_dispatch_cmd(command, 0); + } }