/[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.17 by sysadm, Fri May 6 16:37:59 2005 UTC Revision 1.20 by sysadm, Tue Jan 3 12:34:54 2006 UTC
# Line 107  set_input_echo (int echo) Line 107  set_input_echo (int echo)
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_t (60))    while (c = igetch_t (60))
121      {      {
# Line 168  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)  get_data (int row, int col, char *prompt, char *buffer, int buffer_length, int echo_mode)
187  {  {
188    int len;    int len;
# Line 178  get_data (int row, int col, char *prompt Line 193  get_data (int row, int col, char *prompt
193    prints (buffer);    prints (buffer);
194    iflush ();    iflush ();
195    
196    len = str_input (buffer, buffer_length, echo_mode);    len = _str_input (buffer, buffer_length, echo_mode);
197        
198    return len;    return len;
199  }  }
# Line 216  int Line 231  int
231  display_file_ex (const char *filename, int begin_line, int wait)  display_file_ex (const char *filename, int begin_line, int wait)
232  {  {
233    char buffer[260], temp[256];    char buffer[260], temp[256];
234    int i, ch, input_ok;    int i, ch, input_ok, max_lines;
235    long int line, c_line_begin = 0, c_line_total = 0;    long int line, c_line_begin = 0, c_line_total = 0;
236    long int f_line, f_size, f_offset;    long int f_line, f_size, f_offset;
237    FILE *fin;    FILE *fin;
238    struct stat f_stat;    struct stat f_stat;
239    
240      max_lines = screen_lines - 1;
241    clrline (begin_line, screen_lines);    clrline (begin_line, screen_lines);
242    line = begin_line;    line = begin_line;
243    moveto (line, 0);    moveto (line, 0);
# Line 241  display_file_ex (const char *filename, i Line 257  display_file_ex (const char *filename, i
257    
258        while (fgets (buffer, 255, fin))        while (fgets (buffer, 255, fin))
259          {          {
260            if (line >= screen_lines)            if (line >= max_lines)
261              {              {
262                f_offset = ftell (fin);                f_offset = ftell (fin);
263    
# Line 287  display_file_ex (const char *filename, i Line 303  display_file_ex (const char *filename, i
303                      case KEY_PGUP:                      case KEY_PGUP:
304                      case Ctrl ('B'):                      case Ctrl ('B'):
305                        if (c_line_begin > 0)                        if (c_line_begin > 0)
306                          c_line_begin -= (screen_lines - begin_line - 1);                          c_line_begin -= (max_lines - begin_line - 1);
307                        else                        else
308                          goto exit;                          goto exit;
309                        if (c_line_begin < 0)                        if (c_line_begin < 0)
# Line 303  display_file_ex (const char *filename, i Line 319  display_file_ex (const char *filename, i
319                      case KEY_PGDN:                      case KEY_PGDN:
320                      case Ctrl ('F'):                      case Ctrl ('F'):
321                      case KEY_SPACE:                      case KEY_SPACE:
322                        c_line_begin += (screen_lines - begin_line - 1);                        c_line_begin += (max_lines - begin_line - 1);
323                        if (c_line_begin + (screen_lines - begin_line) >                        if (c_line_begin + (max_lines - begin_line) >
324                            c_line_total)                            c_line_total)
325                          c_line_begin =                          c_line_begin =
326                            c_line_total - (screen_lines - begin_line);                            c_line_total - (max_lines - begin_line);
327                        rewind (fin);                        rewind (fin);
328                        for (f_line = 0; f_line < c_line_begin; f_line++)                        for (f_line = 0; f_line < c_line_begin; f_line++)
329                          {                          {


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

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