diff options
Diffstat (limited to '')
| -rw-r--r-- | st.1 | 33 | ||||
| -rw-r--r-- | st.c | 42 |
2 files changed, 47 insertions, 28 deletions
| @@ -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 | |||
| 21 | is a simple terminal emulator. | 23 | is a simple terminal emulator. |
| 22 | .SH OPTIONS | 24 | .SH OPTIONS |
| 23 | .TP | 25 | .TP |
| 24 | .BI \-t " title" | ||
| 25 | defines the window title (default 'st'). | ||
| 26 | .TP | ||
| 27 | .BI \-c " class" | 26 | .BI \-c " class" |
| 28 | defines the window class (default $TERM). | 27 | defines the window class (default $TERM). |
| 29 | .TP | 28 | .TP |
| 29 | .BI \-f " font" | ||
| 30 | defines the | ||
| 31 | .I font | ||
| 32 | to use when st is run. | ||
| 33 | .TP | ||
| 34 | .BI \-g " geometry" | ||
| 35 | defines the X11 geometry string, which will fixate the height and width of st. | ||
| 36 | .TP | ||
| 37 | .BI \-o " file" | ||
| 38 | writes all the I/O to | ||
| 39 | .I file. | ||
| 40 | This feature is useful when recording st sessions. A value of "-" means | ||
| 41 | standard output. | ||
| 42 | .TP | ||
| 43 | .BI \-t " title" | ||
| 44 | defines the window title (default 'st'). | ||
| 45 | .TP | ||
| 30 | .BI \-w " windowid" | 46 | .BI \-w " windowid" |
| 31 | embeds st within the window identified by | 47 | embeds st within the window identified by |
| 32 | .I windowid | 48 | .I windowid |
| 33 | .TP | 49 | .TP |
| 34 | .B \-g " geometry" | ||
| 35 | defines the X11 geometry string, which will fixate the height and width of st. | ||
| 36 | .B \-v | 50 | .B \-v |
| 37 | prints version information to stderr, then exits. | 51 | prints version information to stderr, then exits. |
| 38 | .TP | 52 | .TP |
| 39 | .BI \-f " file" | ||
| 40 | writes all the I/O to | ||
| 41 | .I file. | ||
| 42 | This feature is useful when recording st sessions. | ||
| 43 | .TP | ||
| 44 | .BI \-e " program " [ " arguments " "... ]" | 53 | .BI \-e " program " [ " arguments " "... ]" |
| 45 | st executes | 54 | st executes |
| 46 | .I program | 55 | .I program |
| @@ -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; | |||
| 365 | static pid_t pid; | 365 | static pid_t pid; |
| 366 | static Selection sel; | 366 | static Selection sel; |
| 367 | static int iofd = -1; | 367 | static int iofd = -1; |
| 368 | static char **opt_cmd = NULL; | 368 | static char **opt_cmd = NULL; |
| 369 | static char *opt_io = NULL; | 369 | static char *opt_io = NULL; |
| 370 | static char *opt_title = NULL; | 370 | static char *opt_title = NULL; |
| 371 | static char *opt_embed = NULL; | 371 | static char *opt_embed = NULL; |
| 372 | static char *opt_class = NULL; | 372 | static char *opt_class = NULL; |
| 373 | static char *opt_font = NULL; | ||
| 373 | 374 | ||
| 374 | void * | 375 | void * |
| 375 | xmalloc(size_t len) { | 376 | xmalloc(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 | ||
