5 #include <libchimara/glk.h>
10 winid_t mainwin = glk_window_open(0, 0, 0, wintype_TextGrid, 0);
14 glk_set_window(mainwin);
15 glui32 width, height, x, y;
16 glk_window_get_size(mainwin, &width, &height);
17 if(height < 4 || width < 22)
19 glk_put_string("Window not big enough");
25 char *buffer = calloc(256, sizeof(char));
28 glk_window_move_cursor(mainwin, x, y - 1);
29 glk_put_string("Enter text, or 'quit'");
30 glk_window_move_cursor(mainwin, x, y);
31 glk_request_line_event(mainwin, buffer, 21, 0);
32 while(strncmp(buffer, "quit", 4))
35 if(ev.type == evtype_LineInput)
37 glk_window_move_cursor(mainwin, x, y + 1);
39 glk_window_move_cursor(mainwin, x, y + 1);
40 glk_put_buffer(buffer, ev.val1);
41 glk_window_move_cursor(mainwin, x, y);
42 glk_request_line_event(mainwin, buffer, 21, 0);
45 glk_cancel_line_event(mainwin, NULL);
46 glk_window_clear(mainwin);