/* skip.c - by Daniel Rice, 11/91.
   Permission is granted for any use of this code. */

#include <stdio.h>

/* Print only selected letters from the source text.  This is where you
   will actually see any 'codes.' Non-Hebrew text is simply copied
   (i.e., chapter and verse numbering and spacing). */

main (argc, argv)
char **argv;

{
	int c;
	int prev_was_letter = 0;
	int letter_count = 0;

	int offset, skip;

	if (argc < 3) {
		fprintf(stderr, "usage: %s offset skipsize\n", argv[0]);
		exit(0);
	}

	offset = atoi (argv[1]);
	skip = atoi (argv[2]);

	while ((c = getchar()) != EOF) {
		if (c >= 0200 && c <= 0232) {
			if (letter_count >= offset && !((letter_count - offset) % skip)) {
				putc(c, stdout);
			}
			++letter_count;
		} else if (letter_count >= offset) {
			putc (c, stdout);
		}
	}
}
