aboutsummaryrefslogtreecommitdiff
path: root/src/about.c
blob: fc158cdb7ef9829bef1e62ce314c6778a3113d60 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#include <stdio.h>
#include <conio.h>
#include <string.h>
#include "fujichat.h"
#include "common.h"

/* TODO: rewrite in asm. This does NOT need to
	be 5K of object code. */

void more(char *file) {
	char c, line = 0;
	char buf[200];
	FILE *f = fopen(file, "r");

	putchar(0x7d);

	if(!f) {
		fputs("Error reading ", stdout);
		puts(file);
		cgetc();
		return;
	}

	while(fgets(buf, 200, f)) {
		if(*buf == '#') continue;

		line += (strlen(buf) / 40 + 1);
		if(line > 22) {
			fputs("--more--", stdout);
			fflush(stdout);

			c = cgetc();
			if(c == 27)
				break;

			putchar(A_DEL);
			line = 0;
		}

		fputs(buf, stdout);
	}

	fclose(f);

	fputs("--any key--", stdout);
	fflush(stdout);

	c = cgetc();
}

int main(int, char **) {
	more("D:ABOUT.TXT");
	atari_exec(MENU_FILENAME);
	return 0;
}