"\n -E 0,1 Enable/disable expanding tabs to spaces"
"\n -N 0,1 Enable/disable dos line ending style"
"\n -T str String to use for the tags region"
- "\n -C str Set the shell to use for command execution\n",
+ "\n -C str Set the shell to use for command execution\n"
+ "\n -c cmd Runs command interactively in the window\n",
ARGV0);
exit(1);
}
int main(int argc, char** argv)
{
+ char* termcmd = NULL;
long int line_num = 0;
#define BOOLARG() (EOPTARG(usage()), optarg_[0] == '0' ? 0 : 1)
#define STRARG() (EOPTARG(usage()))
case 'N': DosLineFeed = BOOLARG(); break;
case 'T': TagString = STRARG(); break;
case 'C': ShellCmd[0] = STRARG(); break;
+ case 'c': termcmd = STRARG(); break;
case 'l': line_num = NUMARG(); break;
default: usage(); break;
}
}
/* set host name property */
- char host[8192];
- if (!gethostname(host, sizeof(host)))
- win_prop_set("HOST", "host", host);
+ char buf[8192];
+ if (!gethostname(buf, sizeof(buf)))
+ win_prop_set("HOST", "host", buf);
+
+ /* exit */
+ if (termcmd)
+ {
+ termcmd = strmcat("&", termcmd, 0);
+ cmd_exec(termcmd);
+ free(termcmd);
+ }
/* now create the window and start the event loop */
#ifndef TEST