about summary refs log tree commit diff stats
path: root/src/chrtrans
diff options
context:
space:
mode:
Diffstat (limited to 'src/chrtrans')
-rw-r--r--src/chrtrans/UCkd.h7
-rw-r--r--src/chrtrans/makefile.in116
-rw-r--r--src/chrtrans/makeuctb.c41
3 files changed, 75 insertions, 89 deletions
diff --git a/src/chrtrans/UCkd.h b/src/chrtrans/UCkd.h
index a6020696..4a5a4513 100644
--- a/src/chrtrans/UCkd.h
+++ b/src/chrtrans/UCkd.h
@@ -15,13 +15,6 @@
 #define u8 unsigned char
 #endif /* u8 */
 
-#ifdef NOTDEFINED
-struct consolefontdesc {
-	u_short charcount;	/* characters in font (256 or 512) */
-	u_short charheight;	/* scan lines per character (1-32) */
-	char *chardata;		/* font data in expanded form */
-};
-#endif /* NOTDEFINED */
 typedef char scrnmap_t;
 #define		E_TABSZ		256
 
diff --git a/src/chrtrans/makefile.in b/src/chrtrans/makefile.in
index 3db427e3..59bc269f 100644
--- a/src/chrtrans/makefile.in
+++ b/src/chrtrans/makefile.in
@@ -14,8 +14,8 @@ VPATH		= $(srcdir)
 
 top_builddir	= ../..
 
-LIBS		= @LIBS@ $(SITE_LIBS)
-LDFLAGS		= @LDFLAGS@
+BUILD_LIBS	= @BUILD_LIBS@ #$(SITE_LIBS)
+BUILD_LDFLAGS	= @BUILD_LDFLAGS@
 
 INTLLIB		= @INTLDIR_MAKE@@INTLLIBS@
 
@@ -24,21 +24,23 @@ INTLDIR_CPPFLAGS= @INTLDIR_CPPFLAGS@-I$(top_srcdir)/intl
 
 SITE_DEFS	= # FIXME: set in parent makefile
 
-CC		= @CC@
-CPP		= @CPP@
-CFLAGS		= @CFLAGS@
+BUILD_CC	= @BUILD_CC@
+BUILD_CPP	= @BUILD_CPP@
+BUILD_CFLAGS	= @BUILD_CFLAGS@
+BUILD_CPPFLAGS	= @BUILD_CPPFLAGS@ @DEFS@
 
 x		= @EXEEXT@
-o		= .@OBJEXT@
+o		= .@BUILD_OBJEXT@
+BUILD_EXEEXT	= @BUILD_EXEEXT@
 
-CPP_OPTS	= @DEFS@ @CPPFLAGS@ \
+CPP_OPTS	= $(BUILD_CPPFLAGS) \
 		-I$(top_builddir) \
 		-I$(top_srcdir)/src \
 		-I$(top_srcdir)/src/chrtrans \
 		-I$(top_srcdir)/$(WWWINC) \
 		-I$(top_srcdir)/ \
 		$(INTLDIR_CPPFLAGS) $(SITE_DEFS)
-CC_OPTS		= $(CPP_OPTS) $(CFLAGS)
+CC_OPTS		= $(CPP_OPTS) $(BUILD_CFLAGS)
 
 #
 # This file contains the font map for the default (hardware) font
@@ -48,6 +50,8 @@ FONTMAP_INC = iso01_uni.h# default, if not set by recursive call
 
 ### fastdep: $(FONTMAP_INC)
 
+MAKEUCTB = makeuctb$(BUILD_EXEEXT)
+
 TABLES= \
  cp1250_uni.h \
  cp1251_uni.h \
@@ -96,70 +100,70 @@ default: $(FONTMAP_INC)
 
 tables: $(TABLES)
 
-makeuctb$x: makeuctb$o
-	$(CC) $(CC_OPTS) $(LDFLAGS) -o $@ makeuctb$o $(INTLLIB) $(LIBS)
+$(MAKEUCTB) : makeuctb$o
+	$(BUILD_CC) $(CC_OPTS) $(BUILD_LDFLAGS) -o $@ makeuctb$o $(INTLLIB) $(BUILD_LIBS)
 
-makeuctb$o: $(srcdir)/UCkd.h $(srcdir)/makeuctb.c
+makeuctb$o : $(srcdir)/UCkd.h $(srcdir)/makeuctb.c
 
 .SUFFIXES : $o .tbl .i
 
 .c$o:
 @RULE_CC@
-	@ECHO_CC@$(CC) $(CC_OPTS) -c $(srcdir)/$*.c
+	@ECHO_CC@$(BUILD_CC) $(CC_OPTS) -c $(srcdir)/$*.c
 
 .c.i:
 @RULE_CC@
-	@ECHO_CC@$(CPP) -C $(CPP_OPTS) $(srcdir)/$*.c >$@
+	@ECHO_CC@$(BUILD_CPP) -C $(CPP_OPTS) $(srcdir)/$*.c >$@
 
 .tbl.h:
-	./makeuctb$x $(srcdir)/$*.tbl $*.h
+	./$(MAKEUCTB) $(srcdir)/$*.tbl $*.h
 
 # table files listed here once again to get the make dependencies
 # right, in case makeuctb was recompiled.
-cp1250_uni.h:		$(srcdir)/cp1250_uni.tbl	makeuctb$x
-cp1251_uni.h:		$(srcdir)/cp1251_uni.tbl	makeuctb$x
-cp1252_uni.h:		$(srcdir)/cp1252_uni.tbl	makeuctb$x
-cp1253_uni.h:		$(srcdir)/cp1253_uni.tbl	makeuctb$x
-cp1255_uni.h:		$(srcdir)/cp1255_uni.tbl	makeuctb$x
-cp1256_uni.h:		$(srcdir)/cp1256_uni.tbl	makeuctb$x
-cp1257_uni.h:		$(srcdir)/cp1257_uni.tbl	makeuctb$x
-cp437_uni.h:		$(srcdir)/cp437_uni.tbl		makeuctb$x
-cp737_uni.h:		$(srcdir)/cp737_uni.tbl		makeuctb$x
-cp775_uni.h:		$(srcdir)/cp775_uni.tbl		makeuctb$x
-cp850_uni.h:		$(srcdir)/cp850_uni.tbl		makeuctb$x
-cp852_uni.h:		$(srcdir)/cp852_uni.tbl		makeuctb$x
-cp862_uni.h:		$(srcdir)/cp862_uni.tbl		makeuctb$x
-cp864_uni.h:		$(srcdir)/cp864_uni.tbl		makeuctb$x
-cp866_uni.h:		$(srcdir)/cp866_uni.tbl		makeuctb$x
-cp866u_uni.h:		$(srcdir)/cp866u_uni.tbl	makeuctb$x
-cp869_uni.h:		$(srcdir)/cp869_uni.tbl		makeuctb$x
-def7_uni.h:		$(srcdir)/def7_uni.tbl		makeuctb$x
-dmcs_uni.h:		$(srcdir)/dmcs_uni.tbl		makeuctb$x
-hp_uni.h:		$(srcdir)/hp_uni.tbl		makeuctb$x
-iso01_uni.h:		$(srcdir)/iso01_uni.tbl		makeuctb$x
-iso02_uni.h:		$(srcdir)/iso02_uni.tbl		makeuctb$x
-iso03_uni.h:		$(srcdir)/iso03_uni.tbl		makeuctb$x
-iso04_uni.h:		$(srcdir)/iso04_uni.tbl		makeuctb$x
-iso05_uni.h:		$(srcdir)/iso05_uni.tbl		makeuctb$x
-iso06_uni.h:		$(srcdir)/iso06_uni.tbl		makeuctb$x
-iso07_uni.h:		$(srcdir)/iso07_uni.tbl		makeuctb$x
-iso08_uni.h:		$(srcdir)/iso08_uni.tbl		makeuctb$x
-iso09_uni.h:		$(srcdir)/iso09_uni.tbl		makeuctb$x
-iso10_uni.h:		$(srcdir)/iso10_uni.tbl		makeuctb$x
-iso15_uni.h:		$(srcdir)/iso15_uni.tbl		makeuctb$x
-koi8r_uni.h:		$(srcdir)/koi8r_uni.tbl		makeuctb$x
-koi8u_uni.h:		$(srcdir)/koi8u_uni.tbl		makeuctb$x
-mac_uni.h:		$(srcdir)/mac_uni.tbl		makeuctb$x
-mnem2_suni.h:		$(srcdir)/mnem2_suni.tbl	makeuctb$x
-mnem_suni.h:		$(srcdir)/mnem_suni.tbl		makeuctb$x
-next_uni.h:		$(srcdir)/next_uni.tbl		makeuctb$x
-pt154_uni.h:		$(srcdir)/pt154_uni.tbl 	makeuctb$x
-rfc_suni.h:		$(srcdir)/rfc_suni.tbl		makeuctb$x
-utf8_uni.h:		$(srcdir)/utf8_uni.tbl		makeuctb$x
-viscii_uni.h:		$(srcdir)/viscii_uni.tbl	makeuctb$x
+cp1250_uni.h:		$(srcdir)/cp1250_uni.tbl	$(MAKEUCTB)
+cp1251_uni.h:		$(srcdir)/cp1251_uni.tbl	$(MAKEUCTB)
+cp1252_uni.h:		$(srcdir)/cp1252_uni.tbl	$(MAKEUCTB)
+cp1253_uni.h:		$(srcdir)/cp1253_uni.tbl	$(MAKEUCTB)
+cp1255_uni.h:		$(srcdir)/cp1255_uni.tbl	$(MAKEUCTB)
+cp1256_uni.h:		$(srcdir)/cp1256_uni.tbl	$(MAKEUCTB)
+cp1257_uni.h:		$(srcdir)/cp1257_uni.tbl	$(MAKEUCTB)
+cp437_uni.h:		$(srcdir)/cp437_uni.tbl		$(MAKEUCTB)
+cp737_uni.h:		$(srcdir)/cp737_uni.tbl		$(MAKEUCTB)
+cp775_uni.h:		$(srcdir)/cp775_uni.tbl		$(MAKEUCTB)
+cp850_uni.h:		$(srcdir)/cp850_uni.tbl		$(MAKEUCTB)
+cp852_uni.h:		$(srcdir)/cp852_uni.tbl		$(MAKEUCTB)
+cp862_uni.h:		$(srcdir)/cp862_uni.tbl		$(MAKEUCTB)
+cp864_uni.h:		$(srcdir)/cp864_uni.tbl		$(MAKEUCTB)
+cp866_uni.h:		$(srcdir)/cp866_uni.tbl		$(MAKEUCTB)
+cp866u_uni.h:		$(srcdir)/cp866u_uni.tbl	$(MAKEUCTB)
+cp869_uni.h:		$(srcdir)/cp869_uni.tbl		$(MAKEUCTB)
+def7_uni.h:		$(srcdir)/def7_uni.tbl		$(MAKEUCTB)
+dmcs_uni.h:		$(srcdir)/dmcs_uni.tbl		$(MAKEUCTB)
+hp_uni.h:		$(srcdir)/hp_uni.tbl		$(MAKEUCTB)
+iso01_uni.h:		$(srcdir)/iso01_uni.tbl		$(MAKEUCTB)
+iso02_uni.h:		$(srcdir)/iso02_uni.tbl		$(MAKEUCTB)
+iso03_uni.h:		$(srcdir)/iso03_uni.tbl		$(MAKEUCTB)
+iso04_uni.h:		$(srcdir)/iso04_uni.tbl		$(MAKEUCTB)
+iso05_uni.h:		$(srcdir)/iso05_uni.tbl		$(MAKEUCTB)
+iso06_uni.h:		$(srcdir)/iso06_uni.tbl		$(MAKEUCTB)
+iso07_uni.h:		$(srcdir)/iso07_uni.tbl		$(MAKEUCTB)
+iso08_uni.h:		$(srcdir)/iso08_uni.tbl		$(MAKEUCTB)
+iso09_uni.h:		$(srcdir)/iso09_uni.tbl		$(MAKEUCTB)
+iso10_uni.h:		$(srcdir)/iso10_uni.tbl		$(MAKEUCTB)
+iso15_uni.h:		$(srcdir)/iso15_uni.tbl		$(MAKEUCTB)
+koi8r_uni.h:		$(srcdir)/koi8r_uni.tbl		$(MAKEUCTB)
+koi8u_uni.h:		$(srcdir)/koi8u_uni.tbl		$(MAKEUCTB)
+mac_uni.h:		$(srcdir)/mac_uni.tbl		$(MAKEUCTB)
+mnem2_suni.h:		$(srcdir)/mnem2_suni.tbl	$(MAKEUCTB)
+mnem_suni.h:		$(srcdir)/mnem_suni.tbl		$(MAKEUCTB)
+next_uni.h:		$(srcdir)/next_uni.tbl		$(MAKEUCTB)
+pt154_uni.h:		$(srcdir)/pt154_uni.tbl 	$(MAKEUCTB)
+rfc_suni.h:		$(srcdir)/rfc_suni.tbl		$(MAKEUCTB)
+utf8_uni.h:		$(srcdir)/utf8_uni.tbl		$(MAKEUCTB)
+viscii_uni.h:		$(srcdir)/viscii_uni.tbl	$(MAKEUCTB)
 
 clean:
-	rm -f makeuctb$x *$o *uni.h *uni2.h *.i
+	rm -f $(MAKEUCTB) *$o *uni.h *uni2.h *.i
 
 distclean: clean
 	-rm -rf obsolete
diff --git a/src/chrtrans/makeuctb.c b/src/chrtrans/makeuctb.c
index d8003cb8..7448c554 100644
--- a/src/chrtrans/makeuctb.c
+++ b/src/chrtrans/makeuctb.c
@@ -16,19 +16,23 @@
  *  version 2, or at your option any later version.
  */
 
+#ifndef HAVE_CONFIG_H
+/* override HTUtils.h fallbacks for cross-compiling */
+#define HAVE_LSTAT
+#define NO_FILIO_H
+#endif
+
 #define DONT_USE_SOCKS5
-#include <HTUtils.h>
+#include <UCDefs.h>
+#include <UCkd.h>
 
 /*
- *  Don't try to use LYexit().
+ *  Don't try to use LYexit() since this is a standalone file.
  */
 #ifdef exit
 #undef exit
 #endif /* exit */
 
-#include <UCkd.h>
-#include <UCDefs.h>
-
 #define MAX_FONTLEN 256
 
 /*
@@ -41,13 +45,15 @@ static FILE *chdr = 0;
 /*
  * Since we may be writing the formatted file to stdout, ensure that we flush
  * everything before leaving, since some old (and a few not-so-old) platforms
- * that do not implement POSIX 'exit()'.
+ * do not properly implement POSIX 'exit()'.
  */
 PRIVATE void done PARAMS((int code)) GCC_NORETURN;
 PRIVATE void done ARGS1(int, code)
 {
-    fflush(chdr);
-    fclose(chdr);
+    if (chdr != 0) {
+	fflush(chdr);
+	fclose(chdr);
+    }
     fflush(stderr);
     exit(code);
 }
@@ -568,9 +574,6 @@ PUBLIC int main ARGS2(
 		    if (UCH(ch) < 32 || ch == '\\' || ch == '\"' ||
 			UCH(ch) >= 127) {
 			sprintf(p1, "\\%.3o", UCH(ch));
-#ifdef NOTDEFINED
-			fprintf(stderr, "%s\n", tbuf);
-#endif /* NOTDEFINED */
 			p1 += 3;
 		    } else {
 			*p1 = ch;
@@ -579,9 +582,6 @@ PUBLIC int main ARGS2(
 	    }
 	    *p1 = '\0';
 	    for (i = un0; i <= un1; i++) {
-#ifdef NOTDEFINED
-		fprintf(chdr, "U+0x%x:%s\n", i, tbuf); */
-#endif /* NOTDEFINED */
 		addpair_str(tbuf,i);
 	    }
 	    continue;
@@ -745,18 +745,7 @@ PUBLIC int main ARGS2(
     } else if (this_LYNXcharset[0] == '\0') {
 	strncpy(this_LYNXcharset,this_MIMEcharset,UC_MAXLEN_LYNXCSNAME);
     }
-/***** DO NOT produce trailing spaces!
-    if ((i = strlen(this_LYNXcharset)) < UC_LEN_LYNXCSNAME) {
-	for (; i < UC_LEN_LYNXCSNAME; i++) {
-	    this_LYNXcharset[i] = ' ';
-	}
-	this_LYNXcharset[i] = '\0';
-    }
-*******/
-#ifdef NOTDEFINED
-    fprintf(stderr,"this_MIMEcharset: %s.\n",this_MIMEcharset);
-    fprintf(stderr,"this_LYNXcharset: %s.\n",this_LYNXcharset);
-#endif /* NOTDEFINED */
+
     if (this_isDefaultMap == -1) {
 	this_isDefaultMap = !strncmp(this_MIMEcharset,"iso-8859-1", 10);
     }