magidoor/MD_Sendfile.c
Andrew Pamment 301c2e9700 Fix bugs!
2019-12-01 14:07:39 +10:00

37 lines
915 B
C

#include <stdio.h>
#include <ctype.h>
#include "MagiDoor.h"
void md_sendfile(const char *filename, int pause) {
FILE *fptr;
char c;
int lines = 0;
fptr = fopen(filename, "r");
if (fptr != NULL) {
c = fgetc(fptr);
while (!feof(fptr) && c != 0x1a) {
if (c == '\n') {
lines++;
md_printf("\r\n");
if (lines == 22 && pause == TRUE) {
md_printf("More (Y/N)");
c = md_getc();
if (tolower(c) == 'n') {
fclose(fptr);
return;
}
md_printf("\r\n");
lines = 0;
}
} else {
md_putchar(c);
}
c = fgetc(fptr);
}
fclose(fptr);
return;
}
return;
}