[hackers] [st] Use as command arguments the remaining parameters || noname_AT_inventati.org

From: <git_AT_suckless.org>
Date: Tue, 14 Apr 2015 09:56:43 +0200 (CEST)

commit aff35af275cb82eb876630c9256298ea1d1b2b57
Author: noname_AT_inventati.org <noname_AT_inventati.org>
Date: Tue Apr 14 09:53:24 2015 +0200

    Use as command arguments the remaining parameters
    
    This change allows execute st as 'st mutt' while it keeps the
    compability with xterm and urxt.

diff --git a/st.c b/st.c
index 40840ce..b1d3791 100644
--- a/st.c
+++ b/st.c
_AT_@ -4008,7 +4008,8 @@ void
 usage(void) {
         die("%s " VERSION " (c) 2010-2015 st engineers\n" \
         "usage: st [-a] [-v] [-c class] [-f font] [-g geometry] [-o file]\n"
- " [-i] [-t title] [-w windowid] [-e command ...]\n", argv0);
+ " [-i] [-t title] [-w windowid] [-e command ...] [command ...]\n",
+ argv0);
 }
 
 int
_AT_@ -4027,12 +4028,8 @@ main(int argc, char *argv[]) {
                 opt_class = EARGF(usage());
                 break;
         case 'e':
- /* eat all remaining arguments */
- if(argc > 1) {
- opt_cmd = &argv[1];
- if(argv[1] != NULL && opt_title == NULL)
- opt_title = basename(xstrdup(argv[1]));
- }
+ if(argc > 1)
+ --argc, ++argv;
                 goto run;
         case 'f':
                 opt_font = EARGF(usage());
_AT_@ -4059,6 +4056,12 @@ main(int argc, char *argv[]) {
         } ARGEND;
 
 run:
+ if(argc > 0) {
+ /* eat all remaining arguments */
+ opt_cmd = argv;
+ if(!opt_title)
+ opt_title = basename(xstrdup(argv[0]));
+ }
         setlocale(LC_CTYPE, "");
         XSetLocaleModifiers("");
         tnew(MAX(cols, 1), MAX(rows, 1));
Received on Tue Apr 14 2015 - 09:56:43 CEST

This archive was generated by hypermail 2.3.0 : Tue Apr 14 2015 - 10:00:37 CEST