--- lbbs/src/screen.c 2005/03/20 17:23:17 1.10 +++ lbbs/src/screen.c 2005/03/21 17:08:21 1.12 @@ -82,23 +82,23 @@ press_any_key () } void -set_input_echo(int echo) +set_input_echo (int echo) { char temp[256]; if (echo) - { - outc ('\x83'); // ASCII code 131 - iflush (); - } + { + outc ('\x83'); // ASCII code 131 + iflush (); + } else - { + { // outc ('\x85'); // ASCII code 133 - prints ("\xff\xfb\x01\xff\xfb\x03"); - iflush (); - igetch (); - igetch (); - } + prints ("\xff\xfb\x01\xff\xfb\x03"); + iflush (); + igetch (); + igetch (); + } } int @@ -114,7 +114,7 @@ str_input (char *buffer, int buffer_leng if (c == CR) break; if (c == LF) - continue; + continue; if (c == BACKSPACE) { if (offset > 0) @@ -170,15 +170,15 @@ display_file (const char *filename) int i; if ((fin = fopen (filename, "r")) == NULL) - { - return -1; - } + { + return -1; + } while (fgets (buffer, 255, fin)) { i = strlen (buffer); if (buffer[i - 1] == '\n' && buffer[i - 2] != '\r') - { + { buffer[i - 1] = '\r'; buffer[i] = '\n'; buffer[i + 1] = '\0'; @@ -186,7 +186,7 @@ display_file (const char *filename) prints (buffer); iflush (); } - fclose(fin); + fclose (fin); return 0; } @@ -196,7 +196,7 @@ display_file_ex (const char *filename, i { char buffer[260], temp[256]; int i, ch, input_ok; - long int line, c_line_begin = 0, c_line_total=0; + long int line, c_line_begin = 0, c_line_total = 0; long int f_line, f_size, f_offset; FILE *fin; struct stat f_stat; @@ -215,7 +215,7 @@ display_file_ex (const char *filename, i f_size = f_stat.st_size; while (fgets (buffer, 255, fin)) - c_line_total ++; + c_line_total++; rewind (fin); while (fgets (buffer, 255, fin)) @@ -227,7 +227,7 @@ display_file_ex (const char *filename, i moveto (screen_lines, 0); prints ("\033[1;44;32m下面还有喔 (%d%%)\033[33m │ 结束 ← │ ↑/↓/PgUp/PgDn 移动 │ ? 辅助说明 │ \033[m", - (f_offset-strlen(buffer)) * 100 / f_size); + (f_offset - strlen (buffer)) * 100 / f_size); iflush (); input_ok = 0; @@ -279,12 +279,14 @@ display_file_ex (const char *filename, i } break; case KEY_RIGHT: - case KEY_PGDOWN: + case KEY_PGDN: case Ctrl ('F'): case KEY_SPACE: c_line_begin += (screen_lines - begin_line - 1); - if (c_line_begin + (screen_lines - begin_line) > c_line_total) - c_line_begin = c_line_total - (screen_lines - begin_line); + if (c_line_begin + (screen_lines - begin_line) > + c_line_total) + c_line_begin = + c_line_total - (screen_lines - begin_line); rewind (fin); for (f_line = 0; f_line < c_line_begin; f_line++) { @@ -339,9 +341,9 @@ display_file_ex (const char *filename, i line++; } if (wait) - ch = press_any_key(); + ch = press_any_key (); else - ch = 0; + ch = 0; exit: fclose (fin);