aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornoname@inventati.org <noname@inventati.org>2015-04-14 09:53:24 +0200
committerRoberto E. Vargas Caballero <k0ga@shike2.com>2015-04-14 09:55:15 +0200
commitaff35af275cb82eb876630c9256298ea1d1b2b57 (patch)
tree015e7ee6a630be0537c8f4ddf0f1a40a126df156
parent83e73c6242fc309a3859c12b996ab88d36c7e838 (diff)
downloadst-aff35af275cb82eb876630c9256298ea1d1b2b57.tar.gz
st-aff35af275cb82eb876630c9256298ea1d1b2b57.zip
Use as command arguments the remaining parameters
This change allows execute st as 'st mutt' while it keeps the compability with xterm and urxt.
-rw-r--r--st.c17
1 files changed, 10 insertions, 7 deletions
diff --git a/st.c b/st.c
index 40840ce..b1d3791 100644
--- a/st.c
+++ b/st.c
@@ -4008,7 +4008,8 @@ void
4008usage(void) { 4008usage(void) {
4009 die("%s " VERSION " (c) 2010-2015 st engineers\n" \ 4009 die("%s " VERSION " (c) 2010-2015 st engineers\n" \
4010 "usage: st [-a] [-v] [-c class] [-f font] [-g geometry] [-o file]\n" 4010 "usage: st [-a] [-v] [-c class] [-f font] [-g geometry] [-o file]\n"
4011 " [-i] [-t title] [-w windowid] [-e command ...]\n", argv0); 4011 " [-i] [-t title] [-w windowid] [-e command ...] [command ...]\n",
4012 argv0);
4012} 4013}
4013 4014
4014int 4015int
@@ -4027,12 +4028,8 @@ main(int argc, char *argv[]) {
4027 opt_class = EARGF(usage()); 4028 opt_class = EARGF(usage());
4028 break; 4029 break;
4029 case 'e': 4030 case 'e':
4030 /* eat all remaining arguments */ 4031 if(argc > 1)
4031 if(argc > 1) { 4032 --argc, ++argv;
4032 opt_cmd = &argv[1];
4033 if(argv[1] != NULL && opt_title == NULL)
4034 opt_title = basename(xstrdup(argv[1]));
4035 }
4036 goto run; 4033 goto run;
4037 case 'f': 4034 case 'f':
4038 opt_font = EARGF(usage()); 4035 opt_font = EARGF(usage());
@@ -4059,6 +4056,12 @@ main(int argc, char *argv[]) {
4059 } ARGEND; 4056 } ARGEND;
4060 4057
4061run: 4058run:
4059 if(argc > 0) {
4060 /* eat all remaining arguments */
4061 opt_cmd = argv;
4062 if(!opt_title)
4063 opt_title = basename(xstrdup(argv[0]));
4064 }
4062 setlocale(LC_CTYPE, ""); 4065 setlocale(LC_CTYPE, "");
4063 XSetLocaleModifiers(""); 4066 XSetLocaleModifiers("");
4064 tnew(MAX(cols, 1), MAX(rows, 1)); 4067 tnew(MAX(cols, 1), MAX(rows, 1));