59a4c817075e08c0f83a8dabb7df08b6e8011715
[unifont.git] / src / unidup.c
1 /*
2    unidup - check for duplicate code points in sorted unifont.hex file.
3
4    Synopsis: unidup < unifont_file.hex
5
6              [Hopefully there won't be any output!]
7
8    Author: Paul Hardy, unifoundry <at> unifoundry.com, December 2007
9
10    Copyright (C) 2007, 2008, 2013 Paul Hardy
11
12    LICENSE:
13
14       This program is free software: you can redistribute it and/or modify
15       it under the terms of the GNU General Public License as published by
16       the Free Software Foundation, either version 2 of the License, or
17       (at your option) any later version.
18
19       This program is distributed in the hope that it will be useful,
20       but WITHOUT ANY WARRANTY; without even the implied warranty of
21       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
22       GNU General Public License for more details.
23
24       You should have received a copy of the GNU General Public License
25       along with this program.  If not, see <http://www.gnu.org/licenses/>.
26 */
27
28 #include <stdio.h>
29 #include <stdlib.h>
30
31 #define MAXBUF 256
32
33
34 int main () {
35
36    int ix, iy;
37    char inbuf[MAXBUF];
38
39    ix = -1;
40
41    while (fgets(inbuf, MAXBUF-1, stdin) != NULL) {
42       sscanf(inbuf, "%X", &iy);
43       if (ix == iy) fprintf(stderr, "Duplicate code point: %04X\n", ix);
44       else ix = iy;
45    }
46    exit(0);
47 }