projects
/
apps
/
madtty.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
take the wxh from the command line
[apps/madtty.git]
/
demo
/
boxshell.c
diff --git
a/demo/boxshell.c
b/demo/boxshell.c
index
63780e3
..
4a53642
100644
(file)
--- a/
demo/boxshell.c
+++ b/
demo/boxshell.c
@@
-54,13
+54,22
@@
int my_custom_handler(RoteTerm *rt __attribute__((unused)), const char *es)
return ROTE_HANDLERESULT_OK;
}
return ROTE_HANDLERESULT_OK;
}
-int main()
+int main(
int argc, char *argv[]
)
{
RoteTerm *rt;
{
RoteTerm *rt;
- int i, j, ch;
+ int i, j, ch
, w, h
;
signal(SIGCHLD, sigchld);
signal(SIGCHLD, sigchld);
+ w = 80;
+ h = 50;
+ if (argc > 1) {
+ char *p = argv[1];
+ w = strtol(p, &p, 10);
+ if (*p++ == 'x')
+ h = strtol(p, &p, 10);
+ }
+
initscr();
noecho();
start_color();
initscr();
noecho();
start_color();
@@
-88,18
+97,20
@@
int main()
/* paint the screen blue */
attrset(COLOR_PAIR(32));
/* paint the screen blue */
attrset(COLOR_PAIR(32));
- for (i = 0; i < screen_h; i++) for (j = 0; j < screen_w; j++) addch(' ');
+ for (i = 0; i < screen_h; i++)
+ for (j = 0; j < screen_w; j++)
+ addch(' ');
refresh();
/* create a window with a frame */
refresh();
/* create a window with a frame */
- term_win = newwin(
50, 82, 2, 4
);
+ term_win = newwin(
h + 2, w + 2, 1, 2
);
wattrset(term_win, COLOR_PAIR(7*8+7-0)); /* black over white */
wattrset(term_win, COLOR_PAIR(7*8+7-0)); /* black over white */
- wborder(term_win,
0, 0, 0, 0, 0, 0, 0, 0
);
+ wborder(term_win,
' ', ' ', ' ', ' ', ' ', ' ', ' ', ' '
);
mvwprintw(term_win, 0, 27, " Term In a Box ");
wrefresh(term_win);
/* create the terminal and have it run bash */
mvwprintw(term_win, 0, 27, " Term In a Box ");
wrefresh(term_win);
/* create the terminal and have it run bash */
- rt = rote_vt_create(
48, 80
);
+ rt = rote_vt_create(
h, w
);
rote_vt_forkpty(rt, "/bin/bash --login");
/* add a sample custom escape sequence handler... say we want to handle
rote_vt_forkpty(rt, "/bin/bash --login");
/* add a sample custom escape sequence handler... say we want to handle