aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristoph Lohmann <20h@r-36.net>2012-09-30 20:23:10 +0200
committerChristoph Lohmann <20h@r-36.net>2012-09-30 20:23:10 +0200
commita07db5787a643afaff3925eca27f0df558387846 (patch)
tree57bcf4a15154e9ae1bfdc0097812f9310038b2eb
parent4497d2125c74aef132d0a70128285d6726dce194 (diff)
downloadst-patched-a07db5787a643afaff3925eca27f0df558387846.tar.bz2
st-patched-a07db5787a643afaff3925eca27f0df558387846.tar.xz
st-patched-a07db5787a643afaff3925eca27f0df558387846.zip
This changes -f to be the parameter for the font. Now -f is -o.
The parameters were reordered according to the alphabet too.
-rw-r--r--st.133
-rw-r--r--st.c42
2 files changed, 47 insertions, 28 deletions
diff --git a/st.1 b/st.1
index 8ec0008..1c100c0 100644
--- a/st.1
+++ b/st.1
@@ -5,15 +5,17 @@ st \- simple terminal
5.B st 5.B st
6.RB [ \-c 6.RB [ \-c
7.IR class ] 7.IR class ]
8.RB [ \-f
9.IR font ]
8.RB [ \-g 10.RB [ \-g
9.IR geometry ] 11.IR geometry ]
12.RB [ \-o
13.IR file ]
10.RB [ \-t 14.RB [ \-t
11.IR title ] 15.IR title ]
12.RB [ \-w 16.RB [ \-w
13.IR windowid ] 17.IR windowid ]
14.RB [ \-v ] 18.RB [ \-v ]
15.RB [ \-f
16.IR file ]
17.RB [ \-e 19.RB [ \-e
18.IR command ...] 20.IR command ...]
19.SH DESCRIPTION 21.SH DESCRIPTION
@@ -21,26 +23,33 @@ st \- simple terminal
21is a simple terminal emulator. 23is a simple terminal emulator.
22.SH OPTIONS 24.SH OPTIONS
23.TP 25.TP
24.BI \-t " title"
25defines the window title (default 'st').
26.TP
27.BI \-c " class" 26.BI \-c " class"
28defines the window class (default $TERM). 27defines the window class (default $TERM).
29.TP 28.TP
29.BI \-f " font"
30defines the
31.I font
32to use when st is run.
33.TP
34.BI \-g " geometry"
35defines the X11 geometry string, which will fixate the height and width of st.
36.TP
37.BI \-o " file"
38writes all the I/O to
39.I file.
40This feature is useful when recording st sessions. A value of "-" means
41standard output.
42.TP
43.BI \-t " title"
44defines the window title (default 'st').
45.TP
30.BI \-w " windowid" 46.BI \-w " windowid"
31embeds st within the window identified by 47embeds st within the window identified by
32.I windowid 48.I windowid
33.TP 49.TP
34.B \-g " geometry"
35defines the X11 geometry string, which will fixate the height and width of st.
36.B \-v 50.B \-v
37prints version information to stderr, then exits. 51prints version information to stderr, then exits.
38.TP 52.TP
39.BI \-f " file"
40writes all the I/O to
41.I file.
42This feature is useful when recording st sessions.
43.TP
44.BI \-e " program " [ " arguments " "... ]" 53.BI \-e " program " [ " arguments " "... ]"
45st executes 54st executes
46.I program 55.I program
diff --git a/st.c b/st.c
index 710cf34..59fb06c 100644
--- a/st.c
+++ b/st.c
@@ -39,8 +39,8 @@
39 39
40#define USAGE \ 40#define USAGE \
41 "st " VERSION " (c) 2010-2012 st engineers\n" \ 41 "st " VERSION " (c) 2010-2012 st engineers\n" \
42 "usage: st [-t title] [-c class] [-g geometry]" \ 42 "usage: st [-v] [-c class] [-f font] [-g geometry] [-o file]" \
43 " [-w windowid] [-v] [-f file] [-e command...]\n" 43 " [-t title] [-w windowid] [-e command ...]\n"
44 44
45/* XEMBED messages */ 45/* XEMBED messages */
46#define XEMBED_FOCUS_IN 4 46#define XEMBED_FOCUS_IN 4
@@ -365,11 +365,12 @@ static int cmdfd;
365static pid_t pid; 365static pid_t pid;
366static Selection sel; 366static Selection sel;
367static int iofd = -1; 367static int iofd = -1;
368static char **opt_cmd = NULL; 368static char **opt_cmd = NULL;
369static char *opt_io = NULL; 369static char *opt_io = NULL;
370static char *opt_title = NULL; 370static char *opt_title = NULL;
371static char *opt_embed = NULL; 371static char *opt_embed = NULL;
372static char *opt_class = NULL; 372static char *opt_class = NULL;
373static char *opt_font = NULL;
373 374
374void * 375void *
375xmalloc(size_t len) { 376xmalloc(size_t len) {
@@ -2087,7 +2088,7 @@ xinit(void) {
2087 xw.vis = XDefaultVisual(xw.dpy, xw.scr); 2088 xw.vis = XDefaultVisual(xw.dpy, xw.scr);
2088 2089
2089 /* font */ 2090 /* font */
2090 initfonts(FONT); 2091 initfonts((opt_font != NULL)? opt_font : FONT);
2091 2092
2092 /* XXX: Assuming same size for bold font */ 2093 /* XXX: Assuming same size for bold font */
2093 xw.cw = dc.font.rbearing - dc.font.lbearing; 2094 xw.cw = dc.font.rbearing - dc.font.lbearing;
@@ -2503,22 +2504,19 @@ main(int argc, char *argv[]) {
2503 2504
2504 for(i = 1; i < argc; i++) { 2505 for(i = 1; i < argc; i++) {
2505 switch(argv[i][0] != '-' || argv[i][2] ? -1 : argv[i][1]) { 2506 switch(argv[i][0] != '-' || argv[i][2] ? -1 : argv[i][1]) {
2506 case 't':
2507 if(++i < argc) opt_title = argv[i];
2508 break;
2509 case 'c': 2507 case 'c':
2510 if(++i < argc) opt_class = argv[i]; 2508 if(++i < argc)
2511 break; 2509 opt_class = argv[i];
2512 case 'w':
2513 if(++i < argc) opt_embed = argv[i];
2514 break;
2515 case 'f':
2516 if(++i < argc) opt_io = argv[i];
2517 break; 2510 break;
2518 case 'e': 2511 case 'e':
2519 /* eat every remaining arguments */ 2512 /* eat every remaining arguments */
2520 if(++i < argc) opt_cmd = &argv[i]; 2513 if(++i < argc)
2514 opt_cmd = &argv[i];
2521 goto run; 2515 goto run;
2516 case 'f':
2517 if(++i < argc)
2518 opt_font = argv[i];
2519 break;
2522 case 'g': 2520 case 'g':
2523 if(++i >= argc) 2521 if(++i >= argc)
2524 break; 2522 break;
@@ -2540,9 +2538,21 @@ main(int argc, char *argv[]) {
2540 if(xw.fh != 0 && xw.fw != 0) 2538 if(xw.fh != 0 && xw.fw != 0)
2541 xw.isfixed = True; 2539 xw.isfixed = True;
2542 break; 2540 break;
2541 case 'o':
2542 if(++i < argc)
2543 opt_io = argv[i];
2544 break;
2545 case 't':
2546 if(++i < argc)
2547 opt_title = argv[i];
2548 break;
2543 case 'v': 2549 case 'v':
2544 default: 2550 default:
2545 die(USAGE); 2551 die(USAGE);
2552 case 'w':
2553 if(++i < argc)
2554 opt_embed = argv[i];
2555 break;
2546 } 2556 }
2547 } 2557 }
2548 2558