about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorMarco Peereboom <marco@conformal.com>2010-12-28 19:07:58 +0000
committerMarco Peereboom <marco@conformal.com>2010-12-28 19:07:58 +0000
commitb2a1b2d40cd9a5b0b86c622acf05e2593dd61a14 (patch)
tree3cf88502358607e5287ea87c1f370b325e76f9fb
parent7c76d9a0ff916196752b07d8a0b66d0b561a6f0b (diff)
downloadxombrero-b2a1b2d40cd9a5b0b86c622acf05e2593dd61a14.tar.gz
Allow multiple urls to be selected with -n
-rw-r--r--xxxterm.19
-rw-r--r--xxxterm.c20
2 files changed, 20 insertions, 9 deletions
diff --git a/xxxterm.1 b/xxxterm.1
index 9d71d65..9df7049 100644
--- a/xxxterm.1
+++ b/xxxterm.1
@@ -25,8 +25,8 @@
 .Bk -words
 .Op Fl STtV
 .Op Fl f Ar file
-.Op Fl n Ar url
-.Op Ar uri ...
+.Op Fl n
+.Op Ar url ...
 .Ek
 .Sh DESCRIPTION
 .Nm
@@ -75,9 +75,10 @@ Disable the toolbar.
 Disable visualization of tabs.
 .It Fl t
 Disable tabs.
-.It Fl n Ar url
+.It Fl n
 Open a new tab in a running
-.Nm .
+.Nm
+for each specified url.
 This option requires enable_socket to be enabled.
 .It Fl V
 Display version and exit.
diff --git a/xxxterm.c b/xxxterm.c
index fbf3f67..7a6d415 100644
--- a/xxxterm.c
+++ b/xxxterm.c
@@ -4183,7 +4183,7 @@ void
 usage(void)
 {
 	fprintf(stderr,
-	    "%s [-STVt][-f file][-n url] url ...\n", __progname);
+	    "%s [-nSTVt][-f file] url ...\n", __progname);
 	exit(0);
 }
 
@@ -4191,13 +4191,13 @@ int
 main(int argc, char *argv[])
 {
 	struct stat		sb;
-	int			c, focus = 1, s;
+	int			c, focus = 1, s, optn = 0;
 	char			conf[PATH_MAX] = { '\0' };
 	char			file[PATH_MAX];
 	char			*env_proxy = NULL;
 	FILE			*f = NULL;
 
-	while ((c = getopt(argc, argv, "STVf:tn:")) != -1) {
+	while ((c = getopt(argc, argv, "STVf:tn")) != -1) {
 		switch (c) {
 		case 'S':
 			showurl = 0;
@@ -4215,8 +4215,8 @@ main(int argc, char *argv[])
 			tabless = 1;
 			break;
 		case 'n':
-			send_url_to_socket(optarg);
-			exit(0);
+			optn = 1;
+			break;
 		default:
 			usage();
 			/* NOTREACHED */
@@ -4225,6 +4225,16 @@ main(int argc, char *argv[])
 	argc -= optind;
 	argv += optind;
 
+	if (optn) {
+		while (argc) {
+			send_url_to_socket(argv[0]);
+
+			argc--;
+			argv++;
+		}
+		exit(0);
+	}
+
 	TAILQ_INIT(&tabs);
 	RB_INIT(&hl);
 	RB_INIT(&js_wl);