diff options
author | B. Watson <yalhcru@gmail.com> | 2019-03-13 02:50:42 -0400 |
---|---|---|
committer | B. Watson <yalhcru@gmail.com> | 2019-03-13 02:50:42 -0400 |
commit | 2973d0c78e9b8eed3c5af239927c6bd36af64604 (patch) | |
tree | a0fdfe7201303edd11c6d86015ef4f79796fcf0f /src/about.c | |
download | fujichat-2973d0c78e9b8eed3c5af239927c6bd36af64604.tar.gz |
initial commit
Diffstat (limited to 'src/about.c')
-rw-r--r-- | src/about.c | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/src/about.c b/src/about.c new file mode 100644 index 0000000..01d6fcb --- /dev/null +++ b/src/about.c @@ -0,0 +1,53 @@ +#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 7K of object code. */ + +void more(char *file) { + char c, line = 0; + char buf[200]; + FILE *f = fopen(file, "r"); + + putchar(0x7d); + + if(!f) { + printf("%s not found\n", file); + cgetc(); + return; + } + + while(fgets(buf, 200, f)) { + if(*buf == '#') continue; + + line += (strlen(buf) / 40 + 1); + if(line > 23) { + 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); +} |