aboutsummaryrefslogtreecommitdiff
path: root/troff/libhnj/test.c
blob: 3e3c8602e5fcd934a9291677c899ecf26543600d (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#include "hyphen.h"
#include <stdio.h>
#include <string.h>
#include "global.h"

int
main(int argc __unused, char **argv)
{
	HyphenDict	*hd;
	char	buf[512], hbuf[512];
	int	i, j;

	hd = hnj_hyphen_load(argv[1]);
	while (fgets(buf, sizeof buf, stdin) != NULL) {
		j = strlen(buf);
		buf[--j] = '\0';
		hnj_hyphen_hyphenate(hd, buf, j, hbuf);
		for (i = 0; i < j; i++)
			if ((hbuf[i] - '0') & 1)
				printf("%c %.*s-%s\n", hbuf[i],
						i+1, buf, &buf[i+1]);
	}
	return 0;
}