Added pause to bulletins

This commit is contained in:
Andrew Pamment 2017-09-09 13:28:49 +10:00
parent 052904df8d
commit 9dcd515b12
3 changed files with 23 additions and 17 deletions

30
bbs.c
View File

@ -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() {

5
bbs.h
View File

@ -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

View File

@ -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++;