File: fungetch.c

package info (click to toggle)
icmake 6.21-4
  • links: PTS
  • area: main
  • in suites: hamm, potato, slink
  • size: 1,964 kB
  • ctags: 1,053
  • sloc: ansic: 9,245; makefile: 1,139; sh: 141; asm: 126
file content (31 lines) | stat: -rw-r--r-- 498 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
/*
\funcref{fun\_getch}{void fun\_getch ()}
    {}
    {}
    {}
    {fun\_gets()}
    {fungetch.c}
    {

        This function reads in one key and returns it in the {\em reg} return
        register as an {\em e\_str} value.

    }
*/

#include "icm-exec.h"

void fun_getch ()
{
    static char
        buf [200];
#ifdef MSDOS
    buf [0] = (char) getch ();
#else
    fgets (buf, sizeof(buf), stdin);
    buf [1] = '\0';
#endif

    reg = newvar (e_str);
    reg.vu.i->ls.str = xstrdup (buf);
}