From 9dcd515b12135c0603466ddf69c0927f0b129ce4 Mon Sep 17 00:00:00 2001 From: Andrew Pamment Date: Sat, 9 Sep 2017 13:28:49 +1000 Subject: [PATCH] Added pause to bulletins --- bbs.c | 30 +++++++++++++++++++----------- bbs.h | 5 ++--- main_menu.c | 5 ++--- 3 files changed, 23 insertions(+), 17 deletions(-) diff --git a/bbs.c b/bbs.c index c1d86e2..dd0d391 100644 --- a/bbs.c +++ b/bbs.c @@ -290,10 +290,12 @@ void s_putstring(char *c) { } } -void s_displayansi_p(char *file) { +void s_displayansi_pause(char *file, int pause) { FILE *fptr; char c; + int lines = 0; + fptr = fopen(file, "r"); if (!fptr) { return; @@ -301,11 +303,26 @@ void s_displayansi_p(char *file) { c = fgetc(fptr); while (!feof(fptr) && c != 0x1a) { s_putchar(c); + + if (pause) { + if (c == '\n') { + lines++; + if (lines == 24) { + s_printf(get_string(6)); + s_getchar(); + lines = 0; + } + } + } c = fgetc(fptr); } fclose(fptr); } +void s_displayansi_p(char *file) { + s_displayansi_pause(file, 0); +} + void s_displayansi(char *file) { FILE *fptr; @@ -315,16 +332,7 @@ void s_displayansi(char *file) { sprintf(buffer, "%s/%s.ans", conf.ansi_path, file); - fptr = fopen(buffer, "r"); - if (!fptr) { - return; - } - c = fgetc(fptr); - while (!feof(fptr) && c != 0x1a) { - s_putchar(c); - c = fgetc(fptr); - } - fclose(fptr); + s_displayansi_pause(buffer, 0); } char s_getchar() { diff --git a/bbs.h b/bbs.h index 07e14d0..1400dbf 100644 --- a/bbs.h +++ b/bbs.h @@ -232,6 +232,7 @@ extern struct fido_addr *parse_fido_addr(const char *str); extern void s_putchar(char c); extern void s_printf(char *fmt, ...); extern void s_putstring(char *c); +extern void s_displayansi_pause(char *file, int pause); extern void s_displayansi_p(char *file); extern void s_displayansi(char *file); extern char s_getchar(); @@ -330,8 +331,6 @@ extern char *www_msgs_messageview(struct user_record *user, int conference, int extern int www_send_msg(struct user_record *user, char *to, char *subj, int conference, int area, char *replyid, char *body); extern char *www_new_msg(struct user_record *user, int conference, int area); extern char *www_last10(); - +#endif extern int menu_system(char *menufile); #endif - -#endif diff --git a/main_menu.c b/main_menu.c index 6654fd7..2c7e64a 100644 --- a/main_menu.c +++ b/main_menu.c @@ -21,8 +21,7 @@ void display_bulletins() { sprintf(buffer, "%s/bulletin%d.ans", conf.ansi_path, i); while (stat(buffer, &s) == 0) { - sprintf(buffer, "bulletin%d", i); - s_displayansi(buffer); + s_displayansi_pause(buffer, 1); s_printf(get_string(6)); s_getc(); i++; @@ -119,4 +118,4 @@ void display_textfiles() { s_printf(get_string(6)); s_getc(); } -} \ No newline at end of file +}