Index: kit/CHANGELOG
diff -u kit/CHANGELOG:1.9 kit/CHANGELOG:removed
--- kit/CHANGELOG:1.9	Sat Sep  5 00:11:21 1998
+++ kit/CHANGELOG	Mon Sep 13 05:10:04 1999
@@ -1,51 +0,0 @@
-CHANGELOG for magicpoint
-$Id: CHANGELOG,v 1.9 1998/09/04 15:11:21 onoe Exp $
-
-Fri Sep  5 1998  onoe@sm.sony.co.jp
-	* handle key inputs from invoked terminal as pressed on Xserver,
-	  even if the Xserver is running on a remote host.
-
-Mon Aug 26 1998  itojun@iijlab.net
-	* new copyright. (BSDish copyright without clause 3)
-
-Mon Aug 25 1998  itojun@iijlab.net
-	* print.c: better x11/freetype/vflib -> postscript font mapping.
-
-Mon Aug 23 1998  kato@wide.ad.jp
-	* embedded image support (added mgpembed.pl and embed.c)
-
-Mon Aug 22 1998  itojun@iijlab.net
-	* added contrib/xmindpath, MindPath PocketPoint user-level driver.
-
-Fri Jul 10 11:57:59 JST 1998  itojun@iijlab.net
-	* cache gs-generated image file.
-	  Suggested by: luigi@FreeBSD.org
-
-Mon Jul  6 11:38:32 JST 1998  itojun@iijlab.net
-	* capable of handling GB2312 and KSC5601 encoding.
-	  they must be encoded by using iso-2022 like escape sequences.
-	  EUC-cn or EUC-kr does not work.
-	* -x option is added.
-
-Thu Jul  2 18:04:16 JST 1998  itojun@iijlab.net
-	* eliminate gsview.
-	* revamp "xfont" directive. (see SYNTAX for detail)
-
-Thu Jun 25 13:10:28 JST 1998  itojun@iijlab.net
-	* print.c: color postscript support by "mgp2ps -c".
-
-changes between 1.02a and 1.03a:
-	* To allow color name that has space inbetween ("dark blue"), 
-	  color name after directives SHOULD come with doublequote.
-	  Therefore,
-		%fore blue
-	  should be
-		%fore "blue"
-	  At this moment, doublequote can be ommitted for backward
-	  compatibility.  We may require to have doublequote in the future.
-	  Font names and other string parameter obeys the same rule.
-	* %image is now capable of rendering encapsulated postscript files
-	  (*.eps).
-		%image foo.eps
-	  should work fine.
-	  By using -X option, you can specify device name for ghostscript.
Index: kit/configure
diff -u kit/configure:1.62 kit/configure:1.63
--- kit/configure:1.62	Sat Aug 28 04:02:48 1999
+++ kit/configure	Fri Sep 10 16:14:50 1999
@@ -1352,8 +1352,68 @@
 	fi
 fi
 
+for i in /usr/pkg /usr/local; do
+	if test -f $i/include/png.h -a -f $i/lib/libpng.a; then
+		LIBS="$LIBS -L$i/lib"
+		OPTFLAGS="$OPTFLAGS -I$i/include"
+		DEPLIBS="$DEPLIBS $i/lib/libpng.a"
+		echo $ac_n "checking for png_write_init in -lpng""... $ac_c" 1>&6
+echo "configure:1362: checking for png_write_init in -lpng" >&5
+ac_lib_var=`echo png'_'png_write_init | sed 'y%./+-%__p_%'`
+if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  ac_save_LIBS="$LIBS"
+LIBS="-lpng  $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 1370 "configure"
+#include "confdefs.h"
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char png_write_init();
+
+int main() {
+png_write_init()
+; return 0; }
+EOF
+if { (eval echo configure:1381: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=no"
+fi
+rm -f conftest*
+LIBS="$ac_save_LIBS"
+
+fi
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+    ac_tr_lib=HAVE_LIB`echo png | sed -e 's/[^a-zA-Z0-9_]/_/g' \
+    -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'`
+  cat >> confdefs.h <<EOF
+#define $ac_tr_lib 1
+EOF
+
+  LIBS="-lpng $LIBS"
+
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+		cat >> confdefs.h <<\EOF
+#define USE_PNG 1
+EOF
+
+		break
+	fi
+done
+
 echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6
-echo "configure:1357: checking how to run the C preprocessor" >&5
+echo "configure:1417: checking how to run the C preprocessor" >&5
 # On Suns, sometimes $CPP names a directory.
 if test -n "$CPP" && test -d "$CPP"; then
   CPP=
@@ -1368,13 +1428,13 @@
   # On the NeXT, cc -E runs the code through the compiler's parser,
   # not just through cpp.
   cat > conftest.$ac_ext <<EOF
-#line 1372 "configure"
+#line 1432 "configure"
 #include "confdefs.h"
 #include <assert.h>
 Syntax Error
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1378: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:1438: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   :
@@ -1385,13 +1445,13 @@
   rm -rf conftest*
   CPP="${CC-cc} -E -traditional-cpp"
   cat > conftest.$ac_ext <<EOF
-#line 1389 "configure"
+#line 1449 "configure"
 #include "confdefs.h"
 #include <assert.h>
 Syntax Error
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1395: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:1455: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   :
@@ -1402,13 +1462,13 @@
   rm -rf conftest*
   CPP="${CC-cc} -nologo -E"
   cat > conftest.$ac_ext <<EOF
-#line 1406 "configure"
+#line 1466 "configure"
 #include "confdefs.h"
 #include <assert.h>
 Syntax Error
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1412: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:1472: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   :
@@ -1437,7 +1497,7 @@
 # Uses ac_ vars as temps to allow command line to override cache and checks.
 # --without-x overrides everything else, but does not touch the cache.
 echo $ac_n "checking for X""... $ac_c" 1>&6
-echo "configure:1441: checking for X" >&5
+echo "configure:1501: checking for X" >&5
 
 # Check whether --with-x or --without-x was given.
 if test "${with_x+set}" = set; then
@@ -1499,12 +1559,12 @@
 
   # First, try using that file with no special directory specified.
 cat > conftest.$ac_ext <<EOF
-#line 1503 "configure"
+#line 1563 "configure"
 #include "confdefs.h"
 #include <$x_direct_test_include>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1508: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:1568: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -1573,14 +1633,14 @@
   ac_save_LIBS="$LIBS"
   LIBS="-l$x_direct_test_library $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 1577 "configure"
+#line 1637 "configure"
 #include "confdefs.h"
 
 int main() {
 ${x_direct_test_function}()
 ; return 0; }
 EOF
-if { (eval echo configure:1584: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:1644: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   LIBS="$ac_save_LIBS"
 # We can link X programs with no special library path.
@@ -1667,12 +1727,12 @@
 fi
 
 echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6
-echo "configure:1671: checking for ANSI C header files" >&5
+echo "configure:1731: checking for ANSI C header files" >&5
 if eval "test \"`echo '$''{'ac_cv_header_stdc'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 1676 "configure"
+#line 1736 "configure"
 #include "confdefs.h"
 #include <stdlib.h>
 #include <stdarg.h>
@@ -1680,7 +1740,7 @@
 #include <float.h>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1684: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:1744: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -1697,7 +1757,7 @@
 if test $ac_cv_header_stdc = yes; then
   # SunOS 4.x string.h does not declare mem*, contrary to ANSI.
 cat > conftest.$ac_ext <<EOF
-#line 1701 "configure"
+#line 1761 "configure"
 #include "confdefs.h"
 #include <string.h>
 EOF
@@ -1715,7 +1775,7 @@
 if test $ac_cv_header_stdc = yes; then
   # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
 cat > conftest.$ac_ext <<EOF
-#line 1719 "configure"
+#line 1779 "configure"
 #include "confdefs.h"
 #include <stdlib.h>
 EOF
@@ -1736,7 +1796,7 @@
   :
 else
   cat > conftest.$ac_ext <<EOF
-#line 1740 "configure"
+#line 1800 "configure"
 #include "confdefs.h"
 #include <ctype.h>
 #define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
@@ -1747,7 +1807,7 @@
 exit (0); }
 
 EOF
-if { (eval echo configure:1751: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:1811: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
 then
   :
 else
@@ -1771,12 +1831,12 @@
 fi
 
 echo $ac_n "checking for sys/wait.h that is POSIX.1 compatible""... $ac_c" 1>&6
-echo "configure:1775: checking for sys/wait.h that is POSIX.1 compatible" >&5
+echo "configure:1835: checking for sys/wait.h that is POSIX.1 compatible" >&5
 if eval "test \"`echo '$''{'ac_cv_header_sys_wait_h'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 1780 "configure"
+#line 1840 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #include <sys/wait.h>
@@ -1792,7 +1852,7 @@
 s = WIFEXITED (s) ? WEXITSTATUS (s) : 1;
 ; return 0; }
 EOF
-if { (eval echo configure:1796: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:1856: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_header_sys_wait_h=yes
 else
@@ -1816,17 +1876,17 @@
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:1820: checking for $ac_hdr" >&5
+echo "configure:1880: checking for $ac_hdr" >&5
 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 1825 "configure"
+#line 1885 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1830: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:1890: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -1854,12 +1914,12 @@
 
 
 echo $ac_n "checking for working const""... $ac_c" 1>&6
-echo "configure:1858: checking for working const" >&5
+echo "configure:1918: checking for working const" >&5
 if eval "test \"`echo '$''{'ac_cv_c_const'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 1863 "configure"
+#line 1923 "configure"
 #include "confdefs.h"
 
 int main() {
@@ -1908,7 +1968,7 @@
 
 ; return 0; }
 EOF
-if { (eval echo configure:1912: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:1972: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_c_const=yes
 else
@@ -1929,21 +1989,21 @@
 fi
 
 echo $ac_n "checking for inline""... $ac_c" 1>&6
-echo "configure:1933: checking for inline" >&5
+echo "configure:1993: checking for inline" >&5
 if eval "test \"`echo '$''{'ac_cv_c_inline'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   ac_cv_c_inline=no
 for ac_kw in inline __inline__ __inline; do
   cat > conftest.$ac_ext <<EOF
-#line 1940 "configure"
+#line 2000 "configure"
 #include "confdefs.h"
 
 int main() {
 } $ac_kw foo() {
 ; return 0; }
 EOF
-if { (eval echo configure:1947: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:2007: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_c_inline=$ac_kw; break
 else
@@ -1969,12 +2029,12 @@
 esac
 
 echo $ac_n "checking for pid_t""... $ac_c" 1>&6
-echo "configure:1973: checking for pid_t" >&5
+echo "configure:2033: checking for pid_t" >&5
 if eval "test \"`echo '$''{'ac_cv_type_pid_t'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 1978 "configure"
+#line 2038 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #if STDC_HEADERS
@@ -2002,12 +2062,12 @@
 fi
 
 echo $ac_n "checking for size_t""... $ac_c" 1>&6
-echo "configure:2006: checking for size_t" >&5
+echo "configure:2066: checking for size_t" >&5
 if eval "test \"`echo '$''{'ac_cv_type_size_t'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 2011 "configure"
+#line 2071 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #if STDC_HEADERS
@@ -2035,12 +2095,12 @@
 fi
 
 echo $ac_n "checking whether time.h and sys/time.h may both be included""... $ac_c" 1>&6
-echo "configure:2039: checking whether time.h and sys/time.h may both be included" >&5
+echo "configure:2099: checking whether time.h and sys/time.h may both be included" >&5
 if eval "test \"`echo '$''{'ac_cv_header_time'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 2044 "configure"
+#line 2104 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #include <sys/time.h>
@@ -2049,7 +2109,7 @@
 struct tm *tp;
 ; return 0; }
 EOF
-if { (eval echo configure:2053: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:2113: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_header_time=yes
 else
@@ -2070,12 +2130,12 @@
 fi
 
 echo $ac_n "checking for u_int""... $ac_c" 1>&6
-echo "configure:2074: checking for u_int" >&5
+echo "configure:2134: checking for u_int" >&5
 if eval "test \"`echo '$''{'ac_cv_type_u_int'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 2079 "configure"
+#line 2139 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #if STDC_HEADERS
@@ -2103,12 +2163,12 @@
 fi
 
 echo $ac_n "checking for u_char""... $ac_c" 1>&6
-echo "configure:2107: checking for u_char" >&5
+echo "configure:2167: checking for u_char" >&5
 if eval "test \"`echo '$''{'ac_cv_type_u_char'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 2112 "configure"
+#line 2172 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #if STDC_HEADERS
@@ -2137,7 +2197,7 @@
 
 
 echo $ac_n "checking for 8-bit clean memcmp""... $ac_c" 1>&6
-echo "configure:2141: checking for 8-bit clean memcmp" >&5
+echo "configure:2201: checking for 8-bit clean memcmp" >&5
 if eval "test \"`echo '$''{'ac_cv_func_memcmp_clean'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -2145,7 +2205,7 @@
   ac_cv_func_memcmp_clean=no
 else
   cat > conftest.$ac_ext <<EOF
-#line 2149 "configure"
+#line 2209 "configure"
 #include "confdefs.h"
 
 main()
@@ -2155,7 +2215,7 @@
 }
 
 EOF
-if { (eval echo configure:2159: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:2219: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
 then
   ac_cv_func_memcmp_clean=yes
 else
@@ -2173,12 +2233,12 @@
 test $ac_cv_func_memcmp_clean = no && LIBOBJS="$LIBOBJS memcmp.${ac_objext}"
 
 echo $ac_n "checking return type of signal handlers""... $ac_c" 1>&6
-echo "configure:2177: checking return type of signal handlers" >&5
+echo "configure:2237: checking return type of signal handlers" >&5
 if eval "test \"`echo '$''{'ac_cv_type_signal'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 2182 "configure"
+#line 2242 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #include <signal.h>
@@ -2195,7 +2255,7 @@
 int i;
 ; return 0; }
 EOF
-if { (eval echo configure:2199: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:2259: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_type_signal=void
 else
@@ -2216,12 +2276,12 @@
 for ac_func in poll strstr _setbufend
 do
 echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:2220: checking for $ac_func" >&5
+echo "configure:2280: checking for $ac_func" >&5
 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 2225 "configure"
+#line 2285 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $ac_func(); below.  */
@@ -2244,7 +2304,7 @@
 
 ; return 0; }
 EOF
-if { (eval echo configure:2248: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:2308: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_func_$ac_func=yes"
 else
@@ -2271,12 +2331,12 @@
 for ac_func in usleep strsep strdup mkstemp snprintf memcmp
 do
 echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:2275: checking for $ac_func" >&5
+echo "configure:2335: checking for $ac_func" >&5
 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 2280 "configure"
+#line 2340 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $ac_func(); below.  */
@@ -2299,7 +2359,7 @@
 
 ; return 0; }
 EOF
-if { (eval echo configure:2303: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:2363: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_func_$ac_func=yes"
 else
Index: kit/configure.in
diff -u kit/configure.in:1.59 kit/configure.in:1.60
--- kit/configure.in:1.59	Sat Aug 28 04:02:50 1999
+++ kit/configure.in	Fri Sep 10 16:14:51 1999
@@ -3,7 +3,7 @@
 dnl independent (using srcdir), however, xmkmf and Imake.tmpl do not
 dnl allow us to switch compilation directory.
 dnl
-dnl $Id: configure.in,v 1.59 1999/08/27 19:02:50 itojun Exp $
+dnl $Id: configure.in,v 1.60 1999/09/10 07:14:51 itojun Exp $
 AC_INIT(image/imagetypes.c)
 
 dnl Checks for programs.
@@ -227,6 +227,17 @@
 		AC_DEFINE(FREETYPE_CHARSET16)
 	fi
 fi
+
+for i in /usr/pkg /usr/local; do
+	if test -f $i/include/png.h -a -f $i/lib/libpng.a; then
+		LIBS="$LIBS -L$i/lib"
+		OPTFLAGS="$OPTFLAGS -I$i/include"
+		DEPLIBS="$DEPLIBS $i/lib/libpng.a"
+		AC_CHECK_LIB(png, png_write_init)
+		AC_DEFINE(USE_PNG)
+		break
+	fi
+done
 
 dnl Checks for header files.
 AC_PATH_X
Index: kit/ctlwords.pl
diff -u kit/ctlwords.pl:1.2 kit/ctlwords.pl:removed
--- kit/ctlwords.pl:1.2	Sat Sep  5 06:05:08 1998
+++ kit/ctlwords.pl	Mon Sep 13 05:10:09 1999
@@ -1,12 +0,0 @@
-#! /usr/bin/perl
-$counter = 0;	# 0 origin
-print "/* generated by ctlwords.awk. do not edit by hand. */\n";
-
-while (<>) {
-	next if (!/^\/\*CTL\*\//);
-	next if ($_ !~ /(CTL_[A-Z0-9]+)/);
-
-	$word = $1;
-	print "#define $word\t$counter\n";
-	$counter++;
-}
Index: kit/draw.c
diff -u kit/draw.c:1.156 kit/draw.c:1.157
--- kit/draw.c:1.156	Wed Jul 28 18:55:07 1999
+++ kit/draw.c	Fri Sep 10 16:13:51 1999
@@ -26,7 +26,7 @@
  * SUCH DAMAGE.
  */
 /*
- * $Id: draw.c,v 1.156 1999/07/28 09:55:07 nishida Exp $
+ * $Id: draw.c,v 1.157 1999/09/10 07:13:51 itojun Exp $
  */
 
 #include "mgp.h"
@@ -715,6 +715,10 @@
 
 	case CTL_TFONT0:
 		freetypefont0 = cp->ctc_value;
+		break;
+
+	case CTL_TMFONT0:
+		freetypemfont0 = cp->ctc_value;
 		break;
 #endif
 
Index: kit/globals.c
diff -u kit/globals.c:1.39 kit/globals.c:1.40
--- kit/globals.c:1.39	Wed Aug 18 12:13:44 1999
+++ kit/globals.c	Fri Sep 10 16:13:50 1999
@@ -26,7 +26,7 @@
  * SUCH DAMAGE.
  */
 /*
- * $Id: globals.c,v 1.39 1999/08/18 03:13:44 itojun Exp $
+ * $Id: globals.c,v 1.40 1999/09/10 07:13:50 itojun Exp $
  */
 
 #include "mgp.h"
@@ -142,6 +142,7 @@
 /*CTL*/	{ CTL_ENDEMBED,		T_VOID,	"endembed", 8 },
 /*CTL*/	{ CTL_CHARSET,		T_STR,	"charset", 7 },
 /*CTL*/	{ CTL_TMFONT,		T_STR,	"tmfont", 6 },
+/*CTL*/	{ CTL_TMFONT0,		T_STR,	"tmfont0", 7 },
 /*CTL*/	{ CTL_PCACHE,		T_SP,	"pcache", 6 },
 	{ 0, 0, NULL, 0 },
 };
Index: kit/grammar.y
diff -u kit/grammar.y:1.32 kit/grammar.y:1.33
--- kit/grammar.y:1.32	Tue Jun  8 16:08:40 1999
+++ kit/grammar.y	Fri Sep 10 16:13:41 1999
@@ -27,7 +27,7 @@
  * SUCH DAMAGE.
  */
 /*
- * $Id: grammar.y,v 1.32 1999/06/08 07:08:40 nishida Exp $
+ * $Id: grammar.y,v 1.33 1999/09/10 07:13:41 itojun Exp $
  */
 /*
  * partly derived from lbl libpcap source code, which has the following
@@ -664,7 +664,7 @@
 %token KW_LINESTART KW_LINEEND KW_MARK KW_SYSTEM KW_FILTER KW_ENDFILTER
 %token KW_QUALITY KW_ICON KW_LEFTFILL KW_XSYSTEM KW_VFCAP KW_TFONT KW_TFDIR
 %token KW_DEFFONT KW_FONT KW_TFONT0 KW_EMBED KW_ENDEMBED KW_NEWIMAGE
-%token KW_CHARSET KW_TMFONT KW_PCACHE
+%token KW_CHARSET KW_TMFONT KW_PCACHE KW_TMFONT0
 
 %type <ct> toplevel
 %type <ct> line defaultline tabline shellline deffontline
@@ -823,6 +823,15 @@
 #else
 				  $$ = gen_str(CTL_NOOP, $2);
 				  yywarn("directive \"tfont0\" not supported "
+					"in this configuration");
+#endif
+				}
+	| KW_TMFONT0 STRorID	{
+#ifdef FREETYPE_CHARSET16
+				  $$ = gen_str(CTL_TMFONT0, $2);
+#else
+				  $$ = gen_str(CTL_NOOP, $2);
+				  yywarn("directive \"tmfont0\" not supported "
 					"in this configuration");
 #endif
 				}
Index: kit/mgp.c
diff -u kit/mgp.c:1.105 kit/mgp.c:1.106
--- kit/mgp.c:1.105	Sat Aug 28 03:46:21 1999
+++ kit/mgp.c	Fri Sep 10 16:13:46 1999
@@ -26,7 +26,7 @@
  * SUCH DAMAGE.
  */
 /*
- * $Id: mgp.c,v 1.105 1999/08/27 18:46:21 itojun Exp $
+ * $Id: mgp.c,v 1.106 1999/09/10 07:13:46 itojun Exp $
  */
 
 static char *mgp_version = "1.06a (990728)";
@@ -78,9 +78,9 @@
 #ifdef FREETYPE
 char *freetypefontdir = FREETYPEFONTDIR;
 char *freetypefont0 = NULL;	/* font name to be used as a last resort */
+char *freetypemfont0 = NULL;	/* font name to be used as a last resort */
 
 int unicode_map[65536];
-
 #endif
 
 static char *tsfile = NULL;
Index: kit/mgp.h
diff -u kit/mgp.h:1.110 kit/mgp.h:1.111
--- kit/mgp.h:1.110	Wed Aug 18 12:13:46 1999
+++ kit/mgp.h	Fri Sep 10 16:13:48 1999
@@ -26,7 +26,7 @@
  * SUCH DAMAGE.
  */
 /*
- * $Id: mgp.h,v 1.110 1999/08/18 03:13:46 itojun Exp $
+ * $Id: mgp.h,v 1.111 1999/09/10 07:13:48 itojun Exp $
  */
 
 #include <stdio.h>
@@ -595,6 +595,7 @@
 #ifdef FREETYPE
 extern char *freetypefontdir;
 extern char *freetypefont0;	/* font name to be used as a last resort */
+extern char *freetypemfont0;	/* font name to be used as a last resort */
 extern int unicode_map[65536];
 #endif
 #ifdef TTY_KEYINPUT
Index: kit/parse.c
diff -u kit/parse.c:1.78 kit/parse.c:1.80
--- kit/parse.c:1.78	Wed Aug 18 12:18:24 1999
+++ kit/parse.c	Fri Sep 10 16:13:44 1999
@@ -26,7 +26,7 @@
  * SUCH DAMAGE.
  */
 /*
- * $Id: parse.c,v 1.78 1999/08/18 03:18:24 itojun Exp $
+ * $Id: parse.c,v 1.80 1999/09/10 07:13:44 itojun Exp $
  */
 
 #include "mgp.h"
@@ -101,10 +101,14 @@
 	u_int page;
 
 	for (line = 0; line < MAXLINE; line ++) {
-		if (!default_control[line])
-			continue;
-		ctlfree(default_control[line]);
-		default_control[line] = NULL;
+		if (default_control[line]) {
+			ctlfree(default_control[line]);
+			default_control[line] = NULL;
+		}
+		if (init_control[line]) {
+			ctlfree(init_control[line]);
+			init_control[line] = NULL;
+		}
 	}
 	for (page = 0; page < MAXPAGE; page ++) {
 		for (line = 0; line < MAXLINE; line ++) {
@@ -113,6 +117,7 @@
 			ctlfree(page_control[page][line]);
 			page_control[page][line] = NULL;
 		}
+		memset(&page_attribute[page], 0, sizeof(page_attribute[page]));
 	}
 	for (line = 0; line < MAXTAB + MAXSTYLE; line++) {
 		if (!tab_control[line])
@@ -230,6 +235,9 @@
 		case CTL_TFONT0:
 			freetypefont0 = root->ctc_value;
 			break;
+		case CTL_TMFONT0:
+			freetypemfont0 = root->ctc_value;
+			break;
 #endif
 		case CTL_NOOP:
 			/* done in grammar.y */
@@ -783,8 +791,23 @@
 	tmpstr[2] = ctlalloc1(CTL_XFONT2);
 	tmpstr[2]->ctc2_value1 = strdup(DEFAULT_X_FONT);
 	tmpstr[2]->ctc2_value2 = strdup("iso8859-1");
+#ifdef FREETYPE
+	tmpstr[3] = ctlalloc1(CTL_TFONT);
+	tmpstr[3]->ctc_value = strdup(freetypefont0 ? freetypefont0 : "arial.ttf");
+#else
 	tmpstr[3] = ctlalloc1(CTL_NOOP);	/* CTL_TFONT */
 	tmpstr[3]->ctc_value = strdup("");
+#endif
+#ifdef FREETYPE_CHARSET16
+	tmpstr[4] = ctlalloc1(CTL_TMFONT);	/* CTL_TMFONT */
+	tmpstr[4]->ctc_value = strdup("wadalab-gothic.ttf");
+#else
+	tmpstr[4] = ctlalloc1(CTL_NOOP);	/* CTL_TMFONT */
+	tmpstr[4]->ctc_value = strdup("");
+#endif
+	tmpstr[5] = ctlalloc1(CTL_XFONT2);
+	tmpstr[5]->ctc2_value1 = strdup("k14");
+	tmpstr[5]->ctc2_value2 = strdup("jisx0208.1983-*");
 	tmplong[0] = ctlalloc1(CTL_FORE);
 	get_color(DEFAULT_FORE, &tmplong[0]->ctl_value);
 	tmplong[1] = ctlalloc1(CTL_BACK);
@@ -861,6 +884,9 @@
 				case CTL_PREFIX: tmpstr[0] = cp; break;
 				case CTL_VFONT: tmpstr[1] = cp; break;
 				case CTL_TFONT: tmpstr[3] = cp; break;
+#ifdef FREETYPE_CHARSET16
+				case CTL_TMFONT: tmpstr[4] = cp; break;
+#endif
 				case CTL_XFONT2:
 					if (strcmp(cp->ctc2_value2,
 							"iso8859-1") == 0) {
Index: kit/print.c
diff -u kit/print.c:1.81 kit/print.c:1.82
--- kit/print.c:1.81	Tue May 25 18:44:30 1999
+++ kit/print.c	Fri Sep 10 16:13:43 1999
@@ -26,7 +26,7 @@
  * SUCH DAMAGE.
  */
 /*
- * $Id: print.c,v 1.81 1999/05/25 09:44:30 nishida Exp $
+ * $Id: print.c,v 1.82 1999/09/10 07:13:43 itojun Exp $
  */
 /*
  * Paper size selection code is based on psutil.c by Angus J. C. Duggan
@@ -84,6 +84,7 @@
 #ifdef FREETYPE
 char *freetypefontdir = NULL;	/*dummy*/
 char *freetypefont0 = NULL;	/*dummy*/
+char *freetypemfont0 = NULL;	/*dummy*/
 #endif
 
 /* lang code */
@@ -251,7 +252,7 @@
 static void print_eps __P((FILE *, char *, int, int, int, int, int));
 static struct fontmap *findfont __P((int, int, char *));
 static char *fontstring __P((struct fontmap *));
-static void loadfont __P((struct fontmap *));
+static void loadfont __P((struct fontmap *, char *));
 
 /* image/ *.[ch] */
 extern char *Paths[];
@@ -294,8 +295,9 @@
 		fp = stdout;
 
 	print_init();
-	for (i = 1; i <= maxpage; i ++)
+	for (i = 1; i <= maxpage; i ++) {
 		scan_font(i);
+	}
 	for (i = 1; i <= maxpage; i ++)
 		print_page(i);
 
@@ -373,9 +375,24 @@
 
 			case CTL_TEXT:
 				if (strstr(cp->ctc_value, "\033$B")
-				 || strstr(cp->ctc_value, "\033$@"))
-					loadfont(curfont[KANJI]);
-				loadfont(curfont[ASCII]);
+				 || strstr(cp->ctc_value, "\033$@")) {
+					if (curfont[KANJI]) {
+						loadfont(curfont[KANJI],
+							curfont[KANJI]->font);
+					} else {
+						fprintf(stderr,
+"unable to find proper font for %s\n", "kanji");
+						exit(1);
+					}
+				}
+				if (curfont[ASCII]) {
+					loadfont(curfont[ASCII],
+						curfont[ASCII]->font);
+				} else {
+					fprintf(stderr,
+"unable to find proper font for %s\n", "ascii");
+					exit(1);
+				}
 				break;
 			default:
 				break;
@@ -784,7 +801,7 @@
 			continue;
 		}
 #if 0
-		loadfont(textpool[i].font);
+		loadfont(textpool[i].font, textpool[i].charset);
 #endif
 		fprintf(fp, "%d setcharsize %d %s %s "
 			"1 copy stringwidth pop 3 2 roll add\n",
@@ -817,7 +834,7 @@
 	for (i = 0; i < ntextpool; i++) {
 		if (textpool[i].text) {
 #if 0
-			loadfont(textpool[i].font);
+			loadfont(textpool[i].font, textpool[i].charset);
 #endif
 			fprintf(fp, "%d %s 1 copy stringwidth pop ",
 				textpool[i].size,
@@ -1774,7 +1791,7 @@
 	/* set default paper size */
 	paper = findpaper(DEFAULT_PAPER_SIZE);
 
-	while ((opt = getopt(argc, argv, "ciVrf:x:y:p:e:")) != -1) {
+	while ((opt = getopt(argc, argv, "ciVrf:x:y:p:e:P")) != -1) {
 		switch (opt) {
 		case 'c':
 			colorps++;
@@ -1827,6 +1844,10 @@
 			}
 			break;
 
+		case 'P':
+			parse_debug++;
+			break;
+
 		default:
 			print_usage(progname);
 			/*NOTREACHED*/
@@ -1938,11 +1959,12 @@
 }
 
 static void
-loadfont(font)
+loadfont(font, name)
 	struct fontmap *font;
+	char *name;
 {
 	if (!font) {
-		fprintf(fp, "unable to find proper font\n");
+		fprintf(stderr, "unable to find proper font for %s\n", name);
 		exit(1);
 	}
 
Index: kit/scanner.l
diff -u kit/scanner.l:1.18 kit/scanner.l:1.19
--- kit/scanner.l:1.18	Mon Jun  7 02:55:19 1999
+++ kit/scanner.l	Fri Sep 10 16:13:39 1999
@@ -27,7 +27,7 @@
  * SUCH DAMAGE.
  */
 /*
- * $Id: scanner.l,v 1.18 1999/06/06 17:55:19 nishida Exp $
+ * $Id: scanner.l,v 1.19 1999/09/10 07:13:39 itojun Exp $
  */
 /*
  * partly derived from lbl libpcap source code, which has the following
@@ -156,6 +156,7 @@
 (TFDIR|tfdir)		return KW_TFDIR;
 (DEFFONT|deffont)	return KW_DEFFONT;
 (TFONT0|tfont0)		return KW_TFONT0;
+(TMFONT0|tmfont0)	return KW_TMFONT0;
 (FONT|font)		return KW_FONT;
 (EMBED|embed)		return KW_EMBED;
 (ENDEMBED|endembed)	return KW_ENDEMBED;
Index: kit/image/Imakefile.in
diff -u kit/image/Imakefile.in:1.7 kit/image/Imakefile.in:1.8
--- kit/image/Imakefile.in:1.7	Sat Aug 28 04:02:54 1999
+++ kit/image/Imakefile.in	Fri Sep 10 16:12:02 1999
@@ -13,12 +13,14 @@
 	img.o mc_tables.o window.o
 
 DEFS=	@DEFS@
+OPTFLAGS=@OPTFLAGS@
 
 AllTarget($(TARGET))
 DependTarget()
 SpecialObjectRule(window.o,window.c,$(DEFS))
 SpecialObjectRule(gif.o,gif.c,$(DEFS))
 SpecialObjectRule(imagetypes.o,imagetypes.c,$(DEFS))
+#SpecialObjectRule(png.o,png.c,$(DEFS) $(OPTFLAGS))
 
 #ifndef NullParameter
 #define  NullParameter 
Index: kit/image/compress.c
diff -u kit/image/compress.c:1.2 kit/image/compress.c:1.3
--- kit/image/compress.c:1.2	Fri Feb 13 16:48:43 1998
+++ kit/image/compress.c	Fri Sep 10 16:12:04 1999
@@ -30,7 +30,7 @@
 
 #define NIL_PIXEL 0xffffffff
 
-void compress(image, verbose)
+void compress_colormap(image, verbose)
      Image        *image;
      unsigned int  verbose;
 { Pixel         hash_table[32768];
Index: kit/image/image.h
diff -u kit/image/image.h:1.5 kit/image/image.h:1.6
--- kit/image/image.h:1.5	Mon Dec 28 17:23:05 1998
+++ kit/image/image.h	Fri Sep 10 16:12:05 1999
@@ -132,7 +132,7 @@
 void gray();
 Image *normalize();
 
-void compress(); /* compress.c */
+void compress_colormap(); /* compress.c */
 
 Image *dither(); /* dither.c */
 
Index: kit/image/misc.c
diff -u kit/image/misc.c:1.5 kit/image/misc.c:1.6
--- kit/image/misc.c:1.5	Mon Dec 28 17:23:12 1998
+++ kit/image/misc.c	Fri Sep 10 16:12:06 1999
@@ -160,7 +160,7 @@
 	((!options->xzoom && (options->yzoom > 100)) || /* be blown up, */
 	 (!options->yzoom && (options->xzoom > 100)) || /* compress before */
 	 (options->xzoom + options->yzoom > 200))) {    /* doing it */
-      compress(image, verbose);
+      compress_colormap(image, verbose);
       compressed= 1;
     }
     tmpimage= zoom(image, options->xzoom, options->yzoom, verbose);
@@ -207,7 +207,7 @@
     image= tmpimage;
   }
   else if (!compressed)       /* make sure colormap is minimized */
-    compress(image, verbose);
+    compress_colormap(image, verbose);
 
   if (options->smooth > 0) { /* image is to be smoothed */
     tmpimage= smooth(image, options->smooth, verbose);
Index: kit/sample/cloud.gif
Index: kit/sample/dad.gif
Index: kit/sample/mgp-old1.gif
Index: kit/sample/mgp-old2.gif
Index: kit/sample/mgp-old3.gif
Index: kit/sample/mgp1.gif
Index: kit/sample/mgp2.gif
Index: kit/sample/mgp3.gif
Index: kit/sample/v6header.gif
