diff rvinterf/asyncshell/main.c @ 75:bbc41034f14c

fc-shell: added support for AT commands in one-shot mode
author Mychaela Falconia <falcon@freecalypso.org>
date Thu, 27 Oct 2016 02:13:38 +0000
parents 84920d3d97c6
children c1aadfcd185f
line wrap: on
line diff
--- a/rvinterf/asyncshell/main.c	Thu Oct 27 00:18:49 2016 +0000
+++ b/rvinterf/asyncshell/main.c	Thu Oct 27 02:13:38 2016 +0000
@@ -12,6 +12,7 @@
 char *socket_pathname = "/tmp/rvinterf_socket";
 char *rvinterf_ttyport;
 int ttyhacks, dflag;
+int oneshot_mode, oneshot_nowait;
 
 int sock;
 
@@ -25,7 +26,7 @@
 	int c, sopt = 0;
 	fd_set fds;
 
-	while ((c = getopt(argc, argv, "B:dl:p:s:w:")) != EOF)
+	while ((c = getopt(argc, argv, "B:dl:np:s:w:")) != EOF)
 		switch (c) {
 		case 'B':
 			rvinterf_Bopt = optarg;
@@ -36,6 +37,9 @@
 		case 'l':
 			rvinterf_lopt = optarg;
 			continue;
+		case 'n':
+			oneshot_nowait++;
+			continue;
 		case 'p':
 			rvinterf_ttyport = optarg;
 			continue;
@@ -69,8 +73,10 @@
 		connect_local_socket();
 	}
 
-	if (argv[optind])
+	if (argv[optind]) {
+		oneshot_mode = 1;
 		return oneshot_command(argc - optind, argv + optind);
+	}
 
 	ttyhacks = isatty(0) && !dflag;
 	init();