/[LeafOK_CVS]/lbbs/src/io.c
ViewVC logotype

Diff of /lbbs/src/io.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 1.2 by sysadm, Sat Oct 23 18:41:41 2004 UTC Revision 1.3 by sysadm, Tue Nov 30 07:10:32 2004 UTC
# Line 25  outc(char c) Line 25  outc(char c)
25  {  {
26    int retval;    int retval;
27    
28    retval = printf("%c",c);    retval = fprintf(stdout, "%c", c);
29    
30    return retval;    return retval;
31  }  }
# Line 56  iflush() Line 56  iflush()
56  int  int
57  igetch ()  igetch ()
58  {  {
   char c, tmp[256];  
59    static char buf[256];    static char buf[256];
60    int out = 0, loop = 1, in_esc = 0, in_ascii = 0, i = 0, j;    unsigned char c, tmp[256];
61    static int len =0 , pos = 0;    int out = 0, loop = 1, in_esc = 0, in_ascii = 0, in_control = 0, i = 0, j;
62      static int len = 0 , pos = 0;
63    
64    if (pos >= len)    if (pos >= len)
65    {    {
# Line 68  igetch () Line 68  igetch ()
68    
69      //For debug      //For debug
70      //for (j = 0; j < len; j++)      //for (j = 0; j < len; j++)
71      //  log_std ("[%d]\n", buf[j]);      //  log_std ("<--[%u]\n", (buf[j] + 256) % 256);
72    }    }
73    
74    while (pos < len)    while (pos < len)
# Line 81  igetch () Line 81  igetch ()
81          break;          break;
82        }        }
83    
84          if (c == KEY_CONTROL)
85            {
86              if (in_control == 0)
87                {
88                  in_control = 1;
89                  i = 0;
90                  continue;
91                }
92            }
93          
94          if (in_control)
95          {
96            tmp[i++] = c;
97            if (i >= 2)
98            {
99              out = (int)tmp[0] * 256 + tmp[1];
100              in_control = 0;
101              break;
102            }
103            continue;
104          }
105    
106        if (c == ESC_KEY)        if (c == ESC_KEY)
107          {          {
108            if (in_esc == 0)            if (in_esc == 0)
# Line 156  igetch () Line 178  igetch ()
178      }      }
179    
180    //for debug    //for debug
181    //log_std ("[%d]\n", out);    //log_std ("-->[%u]\n", out);
182    
183    return out;    return out;
184  }  }


Legend:
Removed lines/characters  
Changed lines/characters
  Added lines/characters

webmaster@leafok.com
ViewVC Help
Powered by ViewVC 1.3.0-beta1