aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/dumbsh.c
diff options
context:
space:
mode:
Diffstat (limited to 'dumbsh.c')
-rw-r--r--dumbsh.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/dumbsh.c b/dumbsh.c
index f0051c9..a282caf 100644
--- a/dumbsh.c
+++ b/dumbsh.c
@@ -2,7 +2,7 @@
2 * 2 *
3 * Copyright 2014 David Seikel <won_fang@yahoo.com.au> 3 * Copyright 2014 David Seikel <won_fang@yahoo.com.au>
4 * 4 *
5 * Not a real shell, so doesn't follow any standards, 5 * Not a real shell, so doesn't follow any standards,
6 * coz it wont implement them anyway. 6 * coz it wont implement them anyway.
7 7
8USE_DUMBSH(NEWTOY(dumbsh, "", TOYFLAG_USR|TOYFLAG_BIN)) 8USE_DUMBSH(NEWTOY(dumbsh, "", TOYFLAG_USR|TOYFLAG_BIN))
@@ -48,7 +48,8 @@ static void updateLine()
48 fflush(stdout); 48 fflush(stdout);
49 TT.y = TT.h; 49 TT.y = TT.h;
50 } 50 }
51 printf("\x1B[%d;0H%-*s\x1B[%d;%dH", TT.y + 1, TT.w, toybuf, TT.y + 1, TT.x + 1); 51 printf("\x1B[%d;0H%-*s\x1B[%d;%dH",
52 TT.y + 1, TT.w, toybuf, TT.y + 1, TT.x + 1);
52 fflush(stdout); 53 fflush(stdout);
53} 54}
54 55
@@ -58,11 +59,14 @@ static void handleCSI(long extra, char *command, int *params, int count)
58 // Is it a cursor location report? 59 // Is it a cursor location report?
59 if (strcmp("R", command) == 0) 60 if (strcmp("R", command) == 0)
60 { 61 {
61 // Parameters are cursor line and column. Note this may be sent at other times, not just during terminal resize. 62 // Parameters are cursor line and column.
63 // NOTE - This may be sent at other times, not just during terminal resize.
64 // We are assuming here that it's a resize.
62 // The defaults are 1, which get ignored by the heuristic below. 65 // The defaults are 1, which get ignored by the heuristic below.
63 int r = params[0], c = params[1]; 66 int r = params[0], c = params[1];
64 67
65 // Check it's not an F3 key variation, coz some of them use the same CSI function code. 68 // Check it's not an F3 key variation, coz some of them use
69 // the same CSI function command.
66 // This is a heuristic, we are checking against an unusable terminal size. 70 // This is a heuristic, we are checking against an unusable terminal size.
67 if ((2 == count) && (8 < r) && (8 < c)) 71 if ((2 == count) && (8 < r) && (8 < c))
68 { 72 {
@@ -96,8 +100,8 @@ static void backSpaceChar()
96 } 100 }
97} 101}
98 102
99// This is where we would actually deal with what ever command the user had typed in. 103// This is where we would actually deal with
100// For now we just move on. 104// what ever command the user had typed in.
101// For now we just move on to the next line. 105// For now we just move on to the next line.
102// TODO - We would want to redirect I/O, capture some keys (^C), 106// TODO - We would want to redirect I/O, capture some keys (^C),
103// but pass the rest on. 107// but pass the rest on.