change -e behaviour and update man page.
parent
732b9601ed
commit
86c5cb6de6
25
st.1
25
st.1
|
@ -3,23 +3,30 @@
|
||||||
st \- simple terminal
|
st \- simple terminal
|
||||||
.SH SYNOPSIS
|
.SH SYNOPSIS
|
||||||
.B st
|
.B st
|
||||||
.RB [ \-e " <cmd>"]
|
.RB [ \-c
|
||||||
.RB [ \-c " <class>"]
|
.IR class ]
|
||||||
.RB [ \-t " <title>"]
|
.RB [ \-t
|
||||||
|
.IR title ]
|
||||||
.RB [ \-v ]
|
.RB [ \-v ]
|
||||||
|
.RB [ \-e
|
||||||
|
.IR cmd ]
|
||||||
.SH DESCRIPTION
|
.SH DESCRIPTION
|
||||||
.B st
|
.B st
|
||||||
is a simple terminal emulator.
|
is a simple terminal emulator.
|
||||||
.SH OPTIONS
|
.SH OPTIONS
|
||||||
.TP
|
.TP
|
||||||
.B \-e <cmd>
|
.B \-t title
|
||||||
Execute cmd instead of the shell
|
|
||||||
.TP
|
|
||||||
.B \-t <title>
|
|
||||||
Overrides the default title (st)
|
Overrides the default title (st)
|
||||||
.TP
|
.TP
|
||||||
.B \-c <class>
|
.B \-c class
|
||||||
Overrides the default class ($TERM)
|
Overrides the default class ($TERM)
|
||||||
.TP
|
.TP
|
||||||
.BI \-v
|
.B \-v
|
||||||
Prints version information to standard output, then exits.
|
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.
|
||||||
|
|
||||||
|
|
16
st.c
16
st.c
|
@ -247,7 +247,7 @@ static CSIEscape escseq;
|
||||||
static int cmdfd;
|
static int cmdfd;
|
||||||
static pid_t pid;
|
static pid_t pid;
|
||||||
static Selection sel;
|
static Selection sel;
|
||||||
static char *opt_cmd = NULL;
|
static char **opt_cmd = NULL;
|
||||||
static char *opt_title = NULL;
|
static char *opt_title = NULL;
|
||||||
static char *opt_class = NULL;
|
static char *opt_class = NULL;
|
||||||
|
|
||||||
|
@ -547,15 +547,12 @@ void
|
||||||
execsh(void) {
|
execsh(void) {
|
||||||
char **args;
|
char **args;
|
||||||
char *envshell = getenv("SHELL");
|
char *envshell = getenv("SHELL");
|
||||||
DEFAULT(envshell, "sh");
|
|
||||||
|
|
||||||
if(opt_cmd)
|
DEFAULT(envshell, "sh");
|
||||||
args = (char*[]){"sh", "-c", opt_cmd, NULL};
|
|
||||||
else
|
|
||||||
args = (char*[]){envshell, "-i", NULL};
|
|
||||||
|
|
||||||
putenv("TERM="TNAME);
|
putenv("TERM="TNAME);
|
||||||
|
args = opt_cmd ? opt_cmd : (char*[]){envshell, "-i", NULL};
|
||||||
execvp(args[0], args);
|
execvp(args[0], args);
|
||||||
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -1855,12 +1852,15 @@ main(int argc, char *argv[]) {
|
||||||
if(++i < argc) opt_class = argv[i];
|
if(++i < argc) opt_class = argv[i];
|
||||||
break;
|
break;
|
||||||
case 'e':
|
case 'e':
|
||||||
if(++i < argc) opt_cmd = argv[i];
|
if(++i < argc) opt_cmd = &argv[i];
|
||||||
break;
|
break;
|
||||||
case 'v':
|
case 'v':
|
||||||
default:
|
default:
|
||||||
die(USAGE);
|
die(USAGE);
|
||||||
}
|
}
|
||||||
|
/* -e eats every remaining arguments */
|
||||||
|
if(opt_cmd)
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
setlocale(LC_CTYPE, "");
|
setlocale(LC_CTYPE, "");
|
||||||
tnew(80, 24);
|
tnew(80, 24);
|
||||||
|
|
Loading…
Reference in New Issue