.100: conmakehash diff

System Operator (root@wildsau.idv.uni-linz.ac.at)
Sat, 11 May 1996 22:47:13 +0200 (MET DST)


hi,

I got errors from conmakehash (conmakehash cp437.uni > uni_hash.tbl)
still don't know why, but it aint that important since I generated
the .tbl on a different machine then.

however, here's a (very small) addition to conmakehash.c, which will
print out the line number of the line conmakehash doesn't like.

--- conmakehash.c.orig Sat May 11 22:34:51 1996
+++ conmakehash.c Sat May 11 22:38:31 1996
@@ -86,7 +86,7 @@
int i, nuni, nent;
int fp0, fp1, un0, un1;
char *p, *p1;
-
+ int lno=0;
if ( argc < 2 || argc > 5 )
usage(argv[0]);

@@ -117,10 +117,11 @@

while ( fgets(buffer, sizeof(buffer), ctbl) != NULL )
{
+ lno++;
if ( (p = strchr(buffer, '\n')) != NULL )
*p = '\0';
else
- fprintf(stderr, "%s: Warning: line too long\n", tblname);
+ fprintf(stderr, "%s, line %d: Warning: line too long\n", lno, tblname);

p = buffer;

@@ -143,7 +144,7 @@
fp0 = strtol(p, &p1, 0);
if (p1 == p)
{
- fprintf(stderr, "Bad input line: %s\n", buffer);
+ fprintf(stderr, "Bad input line %d: %s\n", lno, buffer);
exit(EX_DATAERR);
}
p = p1;
@@ -156,7 +157,7 @@
fp1 = strtol(p, &p1, 0);
if (p1 == p)
{
- fprintf(stderr, "Bad input line: %s\n", buffer);
+ fprintf(stderr, "Bad input line %d: %s\n", lno, buffer);
exit(EX_DATAERR);
}
p = p1;
@@ -167,15 +168,15 @@
if ( fp0 < 0 || fp0 >= fontlen )
{
fprintf(stderr,
- "%s: Glyph number (0x%x) larger than font length\n",
- tblname, fp0);
+ "%s, line %d: Glyph number (0x%x) larger than font length\n",
+ tblname, lno, fp0);
exit(EX_DATAERR);
}
if ( fp1 && (fp1 < fp0 || fp1 >= fontlen) )
{
fprintf(stderr,
- "%s: Bad end of range (0x%x)\n",
- tblname, fp1);
+ "%s, line %d: Bad end of range (0x%x)\n",
+ tblname, lno, fp1);
exit(EX_DATAERR);
}

@@ -199,8 +200,8 @@
if (*p != '-')
{
fprintf(stderr,
-"%s: Corresponding to a range of font positions, there should be a Unicode range\n",
- tblname);
+"%s, line %d: Corresponding to a range of font positions, there should be a Unicode range\n",
+ tblname, lno);
exit(EX_DATAERR);
}
p++;
@@ -208,15 +209,15 @@
if (un0 < 0 || un1 < 0)
{
fprintf(stderr,
-"%s: Bad Unicode range corresponding to font position range 0x%x-0x%x\n",
- tblname, fp0, fp1);
+"%s, line %d: Bad Unicode range corresponding to font position range 0x%x-0x%x\n",
+ tblname, lno, fp0, fp1);
exit(EX_DATAERR);
}
if (un1 - un0 != fp1 - fp0)
{
fprintf(stderr,
-"%s: Unicode range U+%x-U+%x not of the same length as font position range 0x%x-0x%x\n",
- tblname, un0, un1, fp0, fp1);
+"%s, line %d: Unicode range U+%x-U+%x not of the same length as font position range 0x%x-0x%x\n",
+ tblname, lno, un0, un1, fp0, fp1);
exit(EX_DATAERR);
}
for(i=fp0; i<=fp1; i++)
@@ -233,7 +234,7 @@
while (*p == ' ' || *p == '\t')
p++;
if (*p && *p != '#')
- fprintf(stderr, "%s: trailing junk (%s) ignored\n", tblname, p);
+ fprintf(stderr, "%s, line %d: trailing junk (%s) ignored\n", tblname, lno, p);
}

/* Okay, we hit EOF, now output hash table */

--------------------------------------------

regards, herbert rosmanith
herp@wildsau.idv.uni-linz.ac.at
rosmanith@edvz.uni-linz.ac.at