Fossil SCM

Implement "fossil sys stty size"

drh 2025-11-25 15:50 trunk
Commit 4dd0affa175ee691f88f9ae2d7fd9baa9c2d915acd3e1080eb72142d4a4aa110
1 file changed +15
--- src/xsystem.c
+++ src/xsystem.c
@@ -46,10 +46,21 @@
4646
/* Present working diretory */
4747
void xsystem_pwd(int argc, char **argv){
4848
char *zPwd = file_getcwd(0, 0);
4949
fossil_print("%z\n", zPwd);
5050
}
51
+
52
+/* Implement "stty size" */
53
+void xsystem_stty(int argc, char **argv){
54
+ TerminalSize ts;
55
+ if( argc!=2 || strcmp(argv[1],"size")!=0 ){
56
+ fossil_print("ERROR: only \"stty size\" is supported\n");
57
+ }else{
58
+ terminal_get_size(&ts);
59
+ fossil_print("%d %d\n", ts.nLines, ts.nColumns);
60
+ }
61
+}
5162
5263
/* Show where an executable is located on PATH */
5364
void xsystem_which(int argc, char **argv){
5465
int ePrint = 1;
5566
int i;
@@ -371,10 +382,14 @@
371382
},
372383
{ "pwd", xsystem_pwd,
373384
"\n"
374385
"Show the Present Working Directory name\n"
375386
},
387
+ { "stty", xsystem_stty,
388
+ "\n"
389
+ "Show the size of the TTY\n"
390
+ },
376391
{ "which", xsystem_which,
377392
"EXE ...\n"
378393
"Show the location on PATH of executables EXE\n"
379394
"Options:\n"
380395
" -a Show all path locations rather than just the first\n"
381396
--- src/xsystem.c
+++ src/xsystem.c
@@ -46,10 +46,21 @@
46 /* Present working diretory */
47 void xsystem_pwd(int argc, char **argv){
48 char *zPwd = file_getcwd(0, 0);
49 fossil_print("%z\n", zPwd);
50 }
 
 
 
 
 
 
 
 
 
 
 
51
52 /* Show where an executable is located on PATH */
53 void xsystem_which(int argc, char **argv){
54 int ePrint = 1;
55 int i;
@@ -371,10 +382,14 @@
371 },
372 { "pwd", xsystem_pwd,
373 "\n"
374 "Show the Present Working Directory name\n"
375 },
 
 
 
 
376 { "which", xsystem_which,
377 "EXE ...\n"
378 "Show the location on PATH of executables EXE\n"
379 "Options:\n"
380 " -a Show all path locations rather than just the first\n"
381
--- src/xsystem.c
+++ src/xsystem.c
@@ -46,10 +46,21 @@
46 /* Present working diretory */
47 void xsystem_pwd(int argc, char **argv){
48 char *zPwd = file_getcwd(0, 0);
49 fossil_print("%z\n", zPwd);
50 }
51
52 /* Implement "stty size" */
53 void xsystem_stty(int argc, char **argv){
54 TerminalSize ts;
55 if( argc!=2 || strcmp(argv[1],"size")!=0 ){
56 fossil_print("ERROR: only \"stty size\" is supported\n");
57 }else{
58 terminal_get_size(&ts);
59 fossil_print("%d %d\n", ts.nLines, ts.nColumns);
60 }
61 }
62
63 /* Show where an executable is located on PATH */
64 void xsystem_which(int argc, char **argv){
65 int ePrint = 1;
66 int i;
@@ -371,10 +382,14 @@
382 },
383 { "pwd", xsystem_pwd,
384 "\n"
385 "Show the Present Working Directory name\n"
386 },
387 { "stty", xsystem_stty,
388 "\n"
389 "Show the size of the TTY\n"
390 },
391 { "which", xsystem_which,
392 "EXE ...\n"
393 "Show the location on PATH of executables EXE\n"
394 "Options:\n"
395 " -a Show all path locations rather than just the first\n"
396

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button