|
29 | 29 | #include "keyboard.h" |
30 | 30 | #include "vt100.h" |
31 | 31 |
|
32 | | -#define USAGE "Simple Terminal\nusage: simple-terminal [-h] [-scale 2.0] [-font font.ttf] [-fontsize 14] [-fontshade 0|1|2] [-rotate 0|90|180|270] [-o file] [-q] [-r command ...]\n" |
| 32 | +#define USAGE "Simple Terminal\nusage: simple-terminal [-h] [-scale 2.0] [-font font.ttf] [-fontsize 14] [-fontshade 0|1|2] [-rotate 0|90|180|270] [-term xterm-256color|xterm|linux|vt100...] [-o file] [-q] [-r command ...]\n" |
33 | 33 |
|
34 | 34 | /* Arbitrary sizes */ |
35 | 35 | #define DRAW_BUF_SIZ 20 * 1024 |
@@ -147,6 +147,7 @@ SDL_Thread *thread = NULL; |
147 | 147 | char **opt_cmd = NULL; |
148 | 148 | int opt_cmd_size = 0; |
149 | 149 | char *opt_io = NULL; |
| 150 | +char *opt_term = NULL; /* override TERM environment variable */ |
150 | 151 |
|
151 | 152 | static int embedded_font_name = 1; // 1 or 2 |
152 | 153 | static volatile int thread_should_exit = 0; |
@@ -1282,6 +1283,15 @@ int main(int argc, char *argv[]) { |
1282 | 1283 | } |
1283 | 1284 | continue; |
1284 | 1285 | } |
| 1286 | + if (strcmp(argv[i], "-term") == 0) { |
| 1287 | + if (++i < argc) { |
| 1288 | + opt_term = argv[i]; |
| 1289 | + } else { |
| 1290 | + fprintf(stderr, "Missing argument for -term\n"); |
| 1291 | + die(USAGE); |
| 1292 | + } |
| 1293 | + continue; |
| 1294 | + } |
1285 | 1295 | if (strcmp(argv[i], "-useEmbeddedFontForKeyboard") == 0) { |
1286 | 1296 | if (++i < argc) { |
1287 | 1297 | opt_use_embedded_font_for_keyboard = atoi(argv[i]); |
@@ -1327,6 +1337,13 @@ int main(int argc, char *argv[]) { |
1327 | 1337 | int content_h = main_window.surface ? main_window.surface->h : main_window.height; |
1328 | 1338 | t_new((content_w - borderpx) / main_window.char_width, (content_h - borderpx) / main_window.char_height); |
1329 | 1339 | } |
| 1340 | + |
| 1341 | + if (opt_term != NULL) { |
| 1342 | + termname = opt_term; /* User-specified override */ |
| 1343 | + } else { |
| 1344 | + termname = "xterm-256color"; /* Default: 256-color support */ |
| 1345 | + } |
| 1346 | + |
1330 | 1347 | tty_new(); |
1331 | 1348 | create_tty_thread(); |
1332 | 1349 | scale_to_size((int)(main_window.width / opt_scale), (int)(main_window.height / opt_scale)); |
|
0 commit comments