commit - 191e59e4389cc0d235c14be5a53554267a81c0a6
commit + 5dd76fab8b4772adb10a0ba37c7bce8d3ca06b7c
blob - 29bdda669de4480333236627ac906b414d964d99
blob + f1f41a7bc30923c8834f8101576f72d540d5d685
--- st.1
+++ st.1
st \- simple terminal
.SH SYNOPSIS
.B st
-.RB [ \-e " <cmd>"]
-.RB [ \-c " <class>"]
-.RB [ \-t " <title>"]
+.RB [ \-c
+.IR class ]
+.RB [ \-t
+.IR title ]
.RB [ \-v ]
+.RB [ \-e
+.IR cmd ]
.SH DESCRIPTION
.B st
is a simple terminal emulator.
.SH OPTIONS
.TP
-.B \-e <cmd>
-Execute cmd instead of the shell
-.TP
-.B \-t <title>
+.B \-t title
Overrides the default title (st)
.TP
-.B \-c <class>
+.B \-c class
Overrides the default class ($TERM)
.TP
-.BI \-v
+.B \-v
Prints version information to standard output, then exits.
+.TP
+.B \-e cmd [arguments]
+Execute cmd instead of the shell. Type your command as you would on your
+shell. If this option is used, it
+.BI "must be the last"
+on the command-line. This is the same behaviour as xterm/rxvt.
+
blob - d43c30c805538b763041ac7b1c1701297e0af13c
blob + 2be6772539647d56b1fb132e38c82d703792821d
--- st.c
+++ st.c
static int cmdfd;
static pid_t pid;
static Selection sel;
-static char *opt_cmd = NULL;
+static char **opt_cmd = NULL;
static char *opt_title = NULL;
static char *opt_class = NULL;
execsh(void) {
char **args;
char *envshell = getenv("SHELL");
+
DEFAULT(envshell, "sh");
-
- if(opt_cmd)
- args = (char*[]){"sh", "-c", opt_cmd, NULL};
- else
- args = (char*[]){envshell, "-i", NULL};
-
putenv("TERM="TNAME);
+ args = opt_cmd ? opt_cmd : (char*[]){envshell, "-i", NULL};
execvp(args[0], args);
+ exit(EXIT_FAILURE);
}
void
if(++i < argc) opt_class = argv[i];
break;
case 'e':
- if(++i < argc) opt_cmd = argv[i];
+ if(++i < argc) opt_cmd = &argv[i];
break;
case 'v':
default:
die(USAGE);
}
+ /* -e eats every remaining arguments */
+ if(opt_cmd)
+ break;
}
setlocale(LC_CTYPE, "");
tnew(80, 24);