summaryrefslogtreecommitdiff
path: root/Build/source/texk/dvipsk
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2010-04-11 00:54:05 +0000
committerKarl Berry <karl@freefriends.org>2010-04-11 00:54:05 +0000
commit4b03ba0b3e4f12e432a169961697a7d7776cfb17 (patch)
tree085e541a99e9874db7348ad5c1a1d433a2a5cdc6 /Build/source/texk/dvipsk
parent001b7975ce276ec6e72bf2b317cef8afe92c2948 (diff)
snprintf for afm2tfm; add (very) basic test for it
git-svn-id: svn://tug.org/texlive/trunk@17798 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/texk/dvipsk')
-rw-r--r--Build/source/texk/dvipsk/ChangeLog7
-rw-r--r--Build/source/texk/dvipsk/Makefile.am3
-rw-r--r--Build/source/texk/dvipsk/Makefile.in3
-rwxr-xr-xBuild/source/texk/dvipsk/afm2tfm-test.pl19
-rw-r--r--Build/source/texk/dvipsk/afm2tfm.c112
5 files changed, 87 insertions, 57 deletions
diff --git a/Build/source/texk/dvipsk/ChangeLog b/Build/source/texk/dvipsk/ChangeLog
index 314a2e2b061..4b2a5cf53e4 100644
--- a/Build/source/texk/dvipsk/ChangeLog
+++ b/Build/source/texk/dvipsk/ChangeLog
@@ -1,3 +1,10 @@
+2010-04-11 Karl Berry <karl@tug.org>
+
+ * afm2tfm.c (staticligkern): restore spaces around semicolons,
+ accidentally removed in source cleanup.
+
+ * afm2tfm.c (throughout): use snprintf where needed.
+
2010-03-29 Karl Berry <karl@tug.org>
* loadfont.c,
diff --git a/Build/source/texk/dvipsk/Makefile.am b/Build/source/texk/dvipsk/Makefile.am
index 9affa4a738c..76d6e96664d 100644
--- a/Build/source/texk/dvipsk/Makefile.am
+++ b/Build/source/texk/dvipsk/Makefile.am
@@ -110,7 +110,8 @@ EXTRA_DIST = $(dist_prologues) texc.script
CLEANFILES = $(prologues) texc.lpro
## dvips tests
-TESTS = beginfontk1.test dvips.test pfbincl.test quotecmd-test.pl
+TESTS = afm2tfm-test.pl
+TESTS += beginfontk1.test dvips.test pfbincl.test quotecmd-test.pl
TESTS_ENVIRONMENT = TEXMFCNF=$(srcdir)/../kpathsea TEXCONFIG=$(srcdir)/testdata
TESTS_ENVIRONMENT += TEXFONTS=$(srcdir)/testdata
diff --git a/Build/source/texk/dvipsk/Makefile.in b/Build/source/texk/dvipsk/Makefile.in
index 80a97855af5..14a6bbb0239 100644
--- a/Build/source/texk/dvipsk/Makefile.in
+++ b/Build/source/texk/dvipsk/Makefile.in
@@ -405,7 +405,8 @@ EXTRA_DIST = $(dist_prologues) texc.script NEWS TODO beginfontk1.test \
mvs psfonts.map tex vmcms vms
CLEANFILES = $(prologues) texc.lpro dvipstst.ps missfont.log mtest.ps \
pfbincl.ps
-TESTS = beginfontk1.test dvips.test pfbincl.test quotecmd-test.pl
+TESTS = afm2tfm-test.pl beginfontk1.test dvips.test pfbincl.test \
+ quotecmd-test.pl
TESTS_ENVIRONMENT = TEXMFCNF=$(srcdir)/../kpathsea \
TEXCONFIG=$(srcdir)/testdata TEXFONTS=$(srcdir)/testdata \
TEXPSHEADERS=$(srcdir)/testdata
diff --git a/Build/source/texk/dvipsk/afm2tfm-test.pl b/Build/source/texk/dvipsk/afm2tfm-test.pl
new file mode 100755
index 00000000000..69704ae0f0d
--- /dev/null
+++ b/Build/source/texk/dvipsk/afm2tfm-test.pl
@@ -0,0 +1,19 @@
+#!/usr/bin/env perl
+# $Id$
+# Public domain. Originally written 2010, Karl Berry.
+# Check that afm2tfm functions at all.
+
+BEGIN { chomp ($srcdir = $ENV{"srcdir"} || `dirname $0`); }
+require "$srcdir/../tests/common-test.pl";
+
+exit (&main ());
+
+sub main
+{
+ my $outfile = "afmtest.tfm";
+ my @args = ("afmtest.afm", $outfile); # should be found via kpse
+ my $ret = &test_run ("./afm2tfm", @args);
+
+ my $bad = ! -f $outfile; # tfm should have been created
+ return $bad;
+}
diff --git a/Build/source/texk/dvipsk/afm2tfm.c b/Build/source/texk/dvipsk/afm2tfm.c
index 4c56b0091eb..e0d79f05bb8 100644
--- a/Build/source/texk/dvipsk/afm2tfm.c
+++ b/Build/source/texk/dvipsk/afm2tfm.c
@@ -104,55 +104,55 @@ struct encoding staticencoding = {
* than to build the structures ourselves.
*/
const char *staticligkern[] = {
- "% LIGKERN space l =: lslash; space L =: Lslash;",
- "% LIGKERN question quoteleft =: questiondown;",
- "% LIGKERN exclam quoteleft =: exclamdown;",
- "% LIGKERN hyphen hyphen =: endash; endash hyphen =: emdash;",
- "% LIGKERN quoteleft quoteleft =: quotedblleft;",
- "% LIGKERN quoteright quoteright =: quotedblright;",
- "% LIGKERN space {} *; * {} space; zero {} *; * {} zero;",
- "% LIGKERN one {} *; * {} one; two {} *; * {} two;",
- "% LIGKERN three {} *; * {} three; four {} *; * {} four;",
- "% LIGKERN five {} *; * {} five; six {} *; * {} six;",
- "% LIGKERN seven {} *; * {} seven; eight {} *; * {} eight;",
- "% LIGKERN nine {} *; * {} nine;",
+ "% LIGKERN space l =: lslash ; space L =: Lslash ;",
+ "% LIGKERN question quoteleft =: questiondown ;",
+ "% LIGKERN exclam quoteleft =: exclamdown ;",
+ "% LIGKERN hyphen hyphen =: endash ; endash hyphen =: emdash ;",
+ "% LIGKERN quoteleft quoteleft =: quotedblleft ;",
+ "% LIGKERN quoteright quoteright =: quotedblright ;",
+ "% LIGKERN space {} * ; * {} space ; zero {} * ; * {} zero ;",
+ "% LIGKERN one {} * ; * {} one ; two {} * ; * {} two ;",
+ "% LIGKERN three {} * ; * {} three ; four {} * ; * {} four ;",
+ "% LIGKERN five {} * ; * {} five ; six {} * ; * {} six ;",
+ "% LIGKERN seven {} * ; * {} seven ; eight {} * ; * {} eight ;",
+ "% LIGKERN nine {} * ; * {} nine ;",
/* Kern accented characters the same way as their base. */
- "% LIGKERN Aacute <> A; aacute <> a;",
- "% LIGKERN Acircumflex <> A; acircumflex <> a;",
- "% LIGKERN Adieresis <> A; adieresis <> a;",
- "% LIGKERN Agrave <> A; agrave <> a;",
- "% LIGKERN Aring <> A; aring <> a;",
- "% LIGKERN Atilde <> A; atilde <> a;",
- "% LIGKERN Ccedilla <> C; ccedilla <> c;",
- "% LIGKERN Eacute <> E; eacute <> e;",
- "% LIGKERN Ecircumflex <> E; ecircumflex <> e;",
- "% LIGKERN Edieresis <> E; edieresis <> e;",
- "% LIGKERN Egrave <> E; egrave <> e;",
- "% LIGKERN Iacute <> I; iacute <> i;",
- "% LIGKERN Icircumflex <> I; icircumflex <> i;",
- "% LIGKERN Idieresis <> I; idieresis <> i;",
- "% LIGKERN Igrave <> I; igrave <> i;",
- "% LIGKERN Ntilde <> N; ntilde <> n;",
- "% LIGKERN Oacute <> O; oacute <> o;",
- "% LIGKERN Ocircumflex <> O; ocircumflex <> o;",
- "% LIGKERN Odieresis <> O; odieresis <> o;",
- "% LIGKERN Ograve <> O; ograve <> o;",
- "% LIGKERN Oslash <> O; oslash <> o;",
- "% LIGKERN Otilde <> O; otilde <> o;",
- "% LIGKERN Scaron <> S; scaron <> s;",
- "% LIGKERN Uacute <> U; uacute <> u;",
- "% LIGKERN Ucircumflex <> U; ucircumflex <> u;",
- "% LIGKERN Udieresis <> U; udieresis <> u;",
- "% LIGKERN Ugrave <> U; ugrave <> u;",
- "% LIGKERN Yacute <> Y; yacute <> y;",
- "% LIGKERN Ydieresis <> Y; ydieresis <> y;",
- "% LIGKERN Zcaron <> Z; zcaron <> z;",
+ "% LIGKERN Aacute <> A ; aacute <> a ;",
+ "% LIGKERN Acircumflex <> A ; acircumflex <> a ;",
+ "% LIGKERN Adieresis <> A ; adieresis <> a ;",
+ "% LIGKERN Agrave <> A ; agrave <> a ;",
+ "% LIGKERN Aring <> A ; aring <> a ;",
+ "% LIGKERN Atilde <> A ; atilde <> a ;",
+ "% LIGKERN Ccedilla <> C ; ccedilla <> c ;",
+ "% LIGKERN Eacute <> E ; eacute <> e ;",
+ "% LIGKERN Ecircumflex <> E ; ecircumflex <> e ;",
+ "% LIGKERN Edieresis <> E ; edieresis <> e ;",
+ "% LIGKERN Egrave <> E ; egrave <> e ;",
+ "% LIGKERN Iacute <> I ; iacute <> i ;",
+ "% LIGKERN Icircumflex <> I ; icircumflex <> i ;",
+ "% LIGKERN Idieresis <> I ; idieresis <> i ;",
+ "% LIGKERN Igrave <> I ; igrave <> i ;",
+ "% LIGKERN Ntilde <> N ; ntilde <> n ;",
+ "% LIGKERN Oacute <> O ; oacute <> o ;",
+ "% LIGKERN Ocircumflex <> O ; ocircumflex <> o ;",
+ "% LIGKERN Odieresis <> O ; odieresis <> o ;",
+ "% LIGKERN Ograve <> O ; ograve <> o ;",
+ "% LIGKERN Oslash <> O ; oslash <> o ;",
+ "% LIGKERN Otilde <> O ; otilde <> o ;",
+ "% LIGKERN Scaron <> S ; scaron <> s ;",
+ "% LIGKERN Uacute <> U ; uacute <> u ;",
+ "% LIGKERN Ucircumflex <> U ; ucircumflex <> u ;",
+ "% LIGKERN Udieresis <> U ; udieresis <> u ;",
+ "% LIGKERN Ugrave <> U ; ugrave <> u ;",
+ "% LIGKERN Yacute <> Y ; yacute <> y ;",
+ "% LIGKERN Ydieresis <> Y ; ydieresis <> y ;",
+ "% LIGKERN Zcaron <> Z ; zcaron <> z ;",
/*
* These next are only included for deficient afm files that
* have the lig characters but not the lig commands.
*/
- "% LIGKERN f i =: fi; f l =: fl; f f =: ff; ff i =: ffi;",
- "% LIGKERN ff l =: ffl;",
+ "% LIGKERN f i =: fi ; f l =: fl ; f f =: ff ; ff i =: ffi ;",
+ "% LIGKERN ff l =: ffl ;",
0 };
/*
* The above layout corresponds to TeX Typewriter Type and is compatible
@@ -1262,14 +1262,15 @@ vchar(int c)
return (vcharbuf);
}
-char vnamebuf[100];
+char vnamebuf[1000];
static char *
vname(int c)
{
if (!forceoctal && ISALNUM (c)) {
vnamebuf[0] = 0;
} else if (c >= 0 && c < 256) {
- sprintf (vnamebuf, " (comment %s)", texptrs[c]->adobename);
+ snprintf (vnamebuf, sizeof (vnamebuf),
+ " (comment %s)", texptrs[c]->adobename);
}
return vnamebuf;
}
@@ -1289,7 +1290,7 @@ writevpl(void)
voutln2("(VTITLE Created by %s)", titlebuf);
voutln("(COMMENT Please edit that VTITLE if you edit this file)");
- (void)sprintf(obuffer, "TeX-%s%s%s%s", outname,
+ snprintf(obuffer, sizeof(obuffer), "TeX-%s%s%s%s", outname,
(efactor==1.0? "" : "-E"), (slant==0.0? "" : "-S"),
(makevpl==1? "" : "-CSC"));
if (strlen(obuffer)>19) { /* too long, will retain first 9 and last 10 */
@@ -1309,9 +1310,10 @@ writevpl(void)
#endif
if (strcmp (outencoding->name, base_encoding) == 0) {
- sprintf(tbuf, "%s", outencoding->name);
+ snprintf(tbuf, sizeof(tbuf), "%s", outencoding->name);
} else {
- sprintf(tbuf, "%s + %s", base_encoding, outencoding->name);
+ snprintf(tbuf, sizeof(tbuf), "%s + %s", base_encoding,
+ outencoding->name);
}
if (strlen(tbuf) > 39) {
@@ -1577,13 +1579,13 @@ openfiles(int argc, char **argv)
#if defined(MSDOS) || defined(OS2) || defined(ATARIST)
/* Make VPL file identical to that created under Unix */
- (void)sprintf(titlebuf, "afm2tfm %s", argv[1]);
+ snprintf(titlebuf, sizeof(titlebuf), "afm2tfm %s", argv[1]);
#else
#ifdef VMCMS
/* Make VPL file identical to that created under Unix */
- (void)sprintf(titlebuf, "afm2tfm %s", argv[1]);
+ snprintf(titlebuf, sizeof(titlebuf), "afm2tfm %s", argv[1]);
#else
- (void)sprintf(titlebuf, "%s %s", argv[0], argv[1]);
+ snprintf(titlebuf, sizeof(titlebuf), "%s %s", argv[0], argv[1]);
#endif
#endif
(void)strcpy(inname, argv[1]);
@@ -1669,11 +1671,11 @@ case 'u':
pedantic = 1;
arginc = 1;
break;
-default: (void)fprintf(stderr, "Unknown option %s %s will be ignored.\n",
- argv[2], argv[3]);
+default: fprintf(stderr, "Unknown option %s %s ignored.\n", argv[2], argv[3]);
}
for (i=0; i<arginc; i++) {
- (void)sprintf(titlebuf + strlen(titlebuf), " %s", argv[2]);
+ snprintf(titlebuf + strlen(titlebuf),
+ sizeof(titlebuf) - strlen(titlebuf), " %s", argv[2]);
argv++;
argc--;
}