GNU Unifont 15.0.02 Pan-Unicode font with complete Unicode Plane 0 coverage and partial coverage of higher planes

Macros | Functions
unidup.c File Reference

unidup - Check for duplicate code points in sorted unifont.hex file More...

`#include <stdio.h>`
`#include <stdlib.h>`
Include dependency graph for unidup.c:

Go to the source code of this file.

## Macros
#define | MAXBUF 256
| Maximum input line length - 1. More...

## Functions
int | main (int argc, char **argv)
| The main function. More...

## Detailed Description

unidup - Check for duplicate code points in sorted unifont.hex file

Author
  Paul Hardy, unifoundry <at> unifoundry.com, December 2007

Copyright
  Copyright (C) 2007, 2008, 2013 Paul Hardy

This program reads a sorted list of glyphs in Unifont .hex format and prints duplicate code points on stderr if any were detected.

Synopsis: unidup < unifont_file.hex

          [Hopefully there won't be any output!]

Definition in file unidup.c.

## Macro Definition Documentation

## ◆ MAXBUF

#define MAXBUF 256

Maximum input line length - 1.

Definition at line 37 of file unidup.c.

## Function Documentation

## ◆ main()

int main | ( | int | argc,
|  | char ** | argv
| ) |  |

The main function.

Parameters

  [in] | argc | The count of command line arguments.
  [in] | argv | Pointer to array of command line arguments.

Returns
  This program exits with status 0.

Definition at line 48 of file unidup.c.

49{
50
51 int ix, iy;
52 char inbuf[MAXBUF];
53 char *infile; /* the input file name */
54 FILE *infilefp; /* file pointer to input file */
55
56 if (argc > 1) {
57 infile = argv[1];
58 if ((infilefp = fopen (infile, "r")) == NULL) {
59 fprintf (stderr, "\nERROR: Can't open file %s\n\n", infile);
60 exit (EXIT_FAILURE);
61 }
62 }
63 else {
64 infilefp = stdin;
65 }
66
67 ix = -1;
68
69 while (fgets (inbuf, MAXBUF-1, infilefp) != NULL) {
70 sscanf (inbuf, "%X", &iy);
71 if (ix == iy) fprintf (stderr, "Duplicate code point: %04X\n", ix);
72 else ix = iy;
73 }
74 exit (0);
75}
MAXBUF
#define MAXBUF
Maximum input line length - 1.
Definition: unidup.c:37