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