Mercurial > hg > nnchat
changeset 137:fad8c31e41e6
Move browser code around a bit.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Tue, 02 Nov 2010 21:45:28 +0200 |
parents | 4ec36204d34e |
children | 3e221c16b087 |
files | nnchat.c |
diffstat | 1 files changed, 8 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- a/nnchat.c Tue Nov 02 21:31:11 2010 +0200 +++ b/nnchat.c Tue Nov 02 21:45:28 2010 +0200 @@ -56,7 +56,8 @@ BOOL setPrvMode = FALSE; BOOL ignoreMode = FALSE; -char *setConfigFile = "config"; +char *setConfigFile = NULL, + *setBrowser = NULL; cfgitem_t *cfg = NULL; @@ -582,11 +583,7 @@ return 0; } else if (!strncasecmp(buf, "/w ", 3)) { /* Open given username's profile via firefox in a new tab */ - char *name = trimLeft(buf + 3), - *browser = getenv("BROWSER"); - - if (browser == NULL) - browser = "firefox"; + char *name = trimLeft(buf + 3); printMsg("Opening profile for: '%s'\n", name); @@ -603,7 +600,7 @@ if ((pid = fork()) < 0) { printMsg("Could not create sub-process!\n"); } else if (pid == 0) { - execlp(browser, browser, "-remote", tmpBuf, NULL); + execlp(setBrowser, setBrowser, "-remote", tmpBuf, NULL); _exit(errno); } @@ -809,6 +806,10 @@ th_cfg_read(cfgfile, setConfigFile, cfg); } + setBrowser = getenv("BROWSER"); + if (setBrowser == NULL) + setBrowser = "firefox"; + /* Parse arguments */ argsOK = th_args_process(argc, argv, optList, optListN, argHandleOpt, argHandleFile, FALSE);