summaryrefslogblamecommitdiffstats
path: root/hp48g20230307/prog.c
blob: b29f73680ce9bdecb0651384c0052e843fec87e3 (plain) (tree)
























                                                                          
#include <stdio.h>
int main (void) {
	puts("%%HP: T(1)A(D)F(.);");
	putchar(0xab);
	char c = '\0';
	unsigned paren = 0;
	while (!feof(stdin) && !ferror(stdin)) {
		char prevchar = c;
		c = getchar();
		if (prevchar == '-' && c == '>') {
			putchar(0x8d);
			c = '\0';
			continue;
		}
		if (prevchar == '"')
			paren++;
		if (prevchar == '\0')
			continue;
		if (!(paren % 2) && (prevchar == ' ' || prevchar == '\t'))
			putchar('\n');
		else
			putchar(prevchar);
	}
	puts("\n\xbb");
}