This changes -f to be the parameter for the font. Now -f is -o.

The parameters were reordered according to the alphabet too.
dev
Christoph Lohmann 2012-09-30 20:23:10 +02:00
parent 9cae1eb0de
commit 5dfd5df4fe
2 changed files with 47 additions and 28 deletions

33
st.1
View File

@ -5,15 +5,17 @@ st \- simple terminal
.B st .B st
.RB [ \-c .RB [ \-c
.IR class ] .IR class ]
.RB [ \-f
.IR font ]
.RB [ \-g .RB [ \-g
.IR geometry ] .IR geometry ]
.RB [ \-o
.IR file ]
.RB [ \-t .RB [ \-t
.IR title ] .IR title ]
.RB [ \-w .RB [ \-w
.IR windowid ] .IR windowid ]
.RB [ \-v ] .RB [ \-v ]
.RB [ \-f
.IR file ]
.RB [ \-e .RB [ \-e
.IR command ...] .IR command ...]
.SH DESCRIPTION .SH DESCRIPTION
@ -21,26 +23,33 @@ st \- simple terminal
is a simple terminal emulator. is a simple terminal emulator.
.SH OPTIONS .SH OPTIONS
.TP .TP
.BI \-t " title"
defines the window title (default 'st').
.TP
.BI \-c " class" .BI \-c " class"
defines the window class (default $TERM). defines the window class (default $TERM).
.TP .TP
.BI \-f " font"
defines the
.I font
to use when st is run.
.TP
.BI \-g " geometry"
defines the X11 geometry string, which will fixate the height and width of st.
.TP
.BI \-o " file"
writes all the I/O to
.I file.
This feature is useful when recording st sessions. A value of "-" means
standard output.
.TP
.BI \-t " title"
defines the window title (default 'st').
.TP
.BI \-w " windowid" .BI \-w " windowid"
embeds st within the window identified by embeds st within the window identified by
.I windowid .I windowid
.TP .TP
.B \-g " geometry"
defines the X11 geometry string, which will fixate the height and width of st.
.B \-v .B \-v
prints version information to stderr, then exits. prints version information to stderr, then exits.
.TP .TP
.BI \-f " file"
writes all the I/O to
.I file.
This feature is useful when recording st sessions.
.TP
.BI \-e " program " [ " arguments " "... ]" .BI \-e " program " [ " arguments " "... ]"
st executes st executes
.I program .I program

38
st.c
View File

@ -39,8 +39,8 @@
#define USAGE \ #define USAGE \
"st " VERSION " (c) 2010-2012 st engineers\n" \ "st " VERSION " (c) 2010-2012 st engineers\n" \
"usage: st [-t title] [-c class] [-g geometry]" \ "usage: st [-v] [-c class] [-f font] [-g geometry] [-o file]" \
" [-w windowid] [-v] [-f file] [-e command...]\n" " [-t title] [-w windowid] [-e command ...]\n"
/* XEMBED messages */ /* XEMBED messages */
#define XEMBED_FOCUS_IN 4 #define XEMBED_FOCUS_IN 4
@ -370,6 +370,7 @@ static char *opt_io = NULL;
static char *opt_title = NULL; static char *opt_title = NULL;
static char *opt_embed = NULL; static char *opt_embed = NULL;
static char *opt_class = NULL; static char *opt_class = NULL;
static char *opt_font = NULL;
void * void *
xmalloc(size_t len) { xmalloc(size_t len) {
@ -2087,7 +2088,7 @@ xinit(void) {
xw.vis = XDefaultVisual(xw.dpy, xw.scr); xw.vis = XDefaultVisual(xw.dpy, xw.scr);
/* font */ /* font */
initfonts(FONT); initfonts((opt_font != NULL)? opt_font : FONT);
/* XXX: Assuming same size for bold font */ /* XXX: Assuming same size for bold font */
xw.cw = dc.font.rbearing - dc.font.lbearing; xw.cw = dc.font.rbearing - dc.font.lbearing;
@ -2503,22 +2504,19 @@ main(int argc, char *argv[]) {
for(i = 1; i < argc; i++) { for(i = 1; i < argc; i++) {
switch(argv[i][0] != '-' || argv[i][2] ? -1 : argv[i][1]) { switch(argv[i][0] != '-' || argv[i][2] ? -1 : argv[i][1]) {
case 't':
if(++i < argc) opt_title = argv[i];
break;
case 'c': case 'c':
if(++i < argc) opt_class = argv[i]; if(++i < argc)
break; opt_class = argv[i];
case 'w':
if(++i < argc) opt_embed = argv[i];
break;
case 'f':
if(++i < argc) opt_io = argv[i];
break; break;
case 'e': case 'e':
/* eat every remaining arguments */ /* eat every remaining arguments */
if(++i < argc) opt_cmd = &argv[i]; if(++i < argc)
opt_cmd = &argv[i];
goto run; goto run;
case 'f':
if(++i < argc)
opt_font = argv[i];
break;
case 'g': case 'g':
if(++i >= argc) if(++i >= argc)
break; break;
@ -2540,9 +2538,21 @@ main(int argc, char *argv[]) {
if(xw.fh != 0 && xw.fw != 0) if(xw.fh != 0 && xw.fw != 0)
xw.isfixed = True; xw.isfixed = True;
break; break;
case 'o':
if(++i < argc)
opt_io = argv[i];
break;
case 't':
if(++i < argc)
opt_title = argv[i];
break;
case 'v': case 'v':
default: default:
die(USAGE); die(USAGE);
case 'w':
if(++i < argc)
opt_embed = argv[i];
break;
} }
} }