diff rvinterf/etm/main.c @ 197:fa7174faa9aa

fc-tmsh: option to invoke rvinterf "behind the scenes"
author Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
date Sun, 15 Dec 2013 07:31:52 +0000
parents 13a0348ffce4
children 2847b6cbd915
line wrap: on
line diff
--- a/rvinterf/etm/main.c	Sat Dec 14 07:55:22 2013 +0000
+++ b/rvinterf/etm/main.c	Sun Dec 15 07:31:52 2013 +0000
@@ -13,6 +13,8 @@
 
 int sock;
 
+extern char *rvinterf_lopt, *rvinterf_wopt;
+
 main(argc, argv)
 	char **argv;
 {
@@ -20,18 +22,42 @@
 	int c;
 	fd_set fds;
 
-	while ((c = getopt(argc, argv, "ds:")) != EOF)
+	while ((c = getopt(argc, argv, "dl:s:w:")) != EOF)
 		switch (c) {
 		case 'd':
 			dflag++;
 			continue;
+		case 'l':
+			rvinterf_lopt = optarg;
+			continue;
 		case 's':
 			socket_pathname = optarg;
 			continue;
+		case 'w':
+			rvinterf_wopt = optarg;
+			continue;
 		case '?':
 		default:
+usage:			fprintf(stderr,
+				"usage: %s [options] [ttyport]\n", argv[0]);
 			exit(1);
 		}
+	switch (argc - optind) {
+	case 0:
+		if (rvinterf_lopt || rvinterf_wopt) {
+			fprintf(stderr,
+	"%s: -l and -w options are meaningful only when launching rvinterf\n",
+				argv[0]);
+			exit(1);
+		}
+		break;
+	case 1:
+		launch_rvinterf(argv[optind]);
+		break;
+	default:
+		goto usage;
+	}
+
 	ttyhacks = isatty(0) && !dflag;
 	init();
 	tty_init();