From b2a1b2d40cd9a5b0b86c622acf05e2593dd61a14 Mon Sep 17 00:00:00 2001 From: Marco Peereboom Date: Tue, 28 Dec 2010 19:07:58 +0000 Subject: Allow multiple urls to be selected with -n --- xxxterm.1 | 9 +++++---- xxxterm.c | 20 +++++++++++++++----- 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); -- cgit 1.4.1-2-gfad0 n' name='h' value='hlt'/>
path: root/002test.cc
blob: 13398bb5769888e712fa0e99ab34ff92c95c7099 (plain) (tree)
1
2
3
4
5
6
7
8
9