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

Diff of /lbbs/src/screen.c

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

Revision 1.12 by sysadm, Mon Mar 21 17:08:21 2005 UTC Revision 1.18 by sysadm, Fri May 6 16:57:58 2005 UTC
# Line 62  clrline (int line_begin, int line_end) Line 62  clrline (int line_begin, int line_end)
62  }  }
63    
64  void  void
65    clrtobot (int line_begin)
66    {
67      clrline (line_begin, screen_lines);
68      moveto (line_begin, 0);
69    }
70    
71    void
72  clearscr ()  clearscr ()
73  {  {
74    prints ("\33[2J");    prints ("\33[2J");
# Line 78  press_any_key () Line 85  press_any_key ()
85    prints ("                           \033[1;33m按任意键继续...\033[0;37m");    prints ("                           \033[1;33m按任意键继续...\033[0;37m");
86    iflush ();    iflush ();
87    
88    return igetch ();    return igetch_t (60);
89  }  }
90    
91  void  void
92  set_input_echo (int echo)  set_input_echo (int echo)
93  {  {
   char temp[256];  
   
94    if (echo)    if (echo)
95      {      {
96        outc ('\x83');            // ASCII code 131        outc ('\x83');            // ASCII code 131
# Line 96  set_input_echo (int echo) Line 101  set_input_echo (int echo)
101  //    outc ('\x85'); // ASCII code 133  //    outc ('\x85'); // ASCII code 133
102        prints ("\xff\xfb\x01\xff\xfb\x03");        prints ("\xff\xfb\x01\xff\xfb\x03");
103        iflush ();        iflush ();
104        igetch ();        igetch_t (60);
105        igetch ();        igetch_t (60);
106      }      }
107  }  }
108    
109  int  int
110  str_input (char *buffer, int buffer_length, int echo_mode)  _str_input (char *buffer, int buffer_length, int echo_mode)
111  {  {
112    char buf[256], ch;    char buf[256], ch;
113    int c, offset = 0, len, loop = 1, i, hz = 0;    int c, offset = 0, len, loop = 1, i, hz = 0;
114    
115    memset (buffer, '\0', buffer_length);    for (i=0; i<buffer_length && buffer[i] != '\0'; i++)
116        {
117              offset++;
118        }
119    
120    while (c = igetch ())    while (c = igetch_t (60))
121      {      {
122        if (c == CR)        if (c == KEY_NULL || c == KEY_TIMEOUT || c == CR)
123          break;          break;
124        if (c == LF)        if (c == LF)
125          continue;          continue;
# Line 143  str_input (char *buffer, int buffer_leng Line 151  str_input (char *buffer, int buffer_leng
151        buffer[offset] = '\0';        buffer[offset] = '\0';
152        switch (echo_mode)        switch (echo_mode)
153          {          {
154          case 0:          case DOECHO:
155            outc ((char) c);            outc ((char) c);
156            break;            break;
157          case 1:          case NOECHO:
158            outc ('*');            outc ('*');
159            break;            break;
160          }          }
# Line 163  str_input (char *buffer, int buffer_leng Line 171  str_input (char *buffer, int buffer_leng
171  }  }
172    
173  int  int
174    str_input (char *buffer, int buffer_length, int echo_mode)
175    {
176      int offset;
177      
178      memset (buffer, '\0', buffer_length);
179      
180      offset = str_input (buffer, buffer_length, echo_mode);
181      
182      return offset;
183    };
184    
185    int
186    get_data (int row, int col, char *prompt, char *buffer, int buffer_length, int echo_mode)
187    {
188      int len;
189    
190      moveto (row, col);
191      iflush ();
192      prints (prompt);
193      prints (buffer);
194      iflush ();
195    
196      len = _str_input (buffer, buffer_length, echo_mode);
197      
198      return len;
199    }
200    
201    int
202  display_file (const char *filename)  display_file (const char *filename)
203  {  {
204    char buffer[260];    char buffer[260];
# Line 233  display_file_ex (const char *filename, i Line 269  display_file_ex (const char *filename, i
269                input_ok = 0;                input_ok = 0;
270                while (!input_ok)                while (!input_ok)
271                  {                  {
272                    ch = igetch ();                    ch = igetch_t (MAX_DELAY_TIME);
273                    input_ok = 1;                    input_ok = 1;
274                    switch (ch)                    switch (ch)
275                      {                      {
# Line 294  display_file_ex (const char *filename, i Line 330  display_file_ex (const char *filename, i
330                              goto exit;                              goto exit;
331                          }                          }
332                        break;                        break;
333                        case KEY_NULL:
334                        case KEY_TIMEOUT:
335                      case KEY_LEFT:                      case KEY_LEFT:
336                      case 'q':                      case 'q':
337                      case 'Q':                      case 'Q':


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

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