63 lines
1.6 KiB
Plaintext
63 lines
1.6 KiB
Plaintext
$OpenBSD: patch-kanjips_kanjips_c,v 1.3 2010/05/19 14:35:18 espie Exp $
|
|
--- kanjips/kanjips.c.orig Tue Jan 16 18:20:29 1990
|
|
+++ kanjips/kanjips.c Wed May 19 16:33:51 2010
|
|
@@ -18,6 +18,8 @@ unsigned char *zs; /* for state machine zztrans() */
|
|
FILE *infile = stdin,*outfile = stdout;
|
|
|
|
extern Font *openfont();
|
|
+int header_done = 0;
|
|
+static void forgetdef();
|
|
|
|
main(argc,argv) char **argv;
|
|
{
|
|
@@ -39,18 +41,23 @@ main(argc,argv) char **argv;
|
|
}
|
|
zzinit(0); /* reset the state machine */
|
|
for(line = 0; fgets(linebuf,BUFMAX,infile); line++){
|
|
- if(line == 1){
|
|
- outheader();
|
|
+ if (line == 0 && strmatch(linebuf, "%!")){
|
|
+ fprintf(outfile,"%s",linebuf);
|
|
+ continue;
|
|
}
|
|
if(strmatch(linebuf,CDSTR)){
|
|
fprintf(outfile,"%s",linebuf);
|
|
conform(linebuf);
|
|
+ continue;
|
|
}
|
|
- else { /* normal line */
|
|
- for(zs=linebuf; *zs; zs++){
|
|
- zztrans(*zs,0); /* process 1 line */
|
|
- }
|
|
+ if (!header_done){
|
|
+ outheader();
|
|
+ header_done = 1;
|
|
}
|
|
+ /* normal line */
|
|
+ for(zs=linebuf; *zs; zs++){
|
|
+ zztrans(*zs,0); /* process 1 line */
|
|
+ }
|
|
}
|
|
}
|
|
conform(s) unsigned char *s;
|
|
@@ -64,6 +71,10 @@ conform(s) unsigned char *s;
|
|
s += strlen(CDSTR);
|
|
while(isspace(*s)) s++;
|
|
if(strmatch(s,DFSTR)){ /* %%DocumentFonts */
|
|
+ if (!header_done){
|
|
+ outheader();
|
|
+ header_done = 1;
|
|
+ }
|
|
s += strlen(DFSTR);
|
|
forgetfont();
|
|
for(nfonts = 0; *s && nfonts < MAXFONTS; s++){
|
|
@@ -116,7 +127,7 @@ static regist(code) int code;
|
|
fprintf(outfile,"end\n");
|
|
registcodes[ncodes++] = code;
|
|
}
|
|
-static forgetdef()
|
|
+static void forgetdef()
|
|
{
|
|
ncodes = 0; /* forget about sent data */
|
|
}
|