Index: texk/gsftopk/gsftopk.c
--- texk/gsftopk/gsftopk.c.orig	2005-03-15 13:05:16.817449597 +0100
+++ texk/gsftopk/gsftopk.c	2005-03-15 13:06:07.241499293 +0100
@@ -417,7 +417,7 @@
 Boolean		dosnames	= False;
 Boolean		quiet		= False;
 
-struct option {
+struct option_loc {
 	const char	*longname;
 	short		shortname;
 	Boolean		has_arg;
@@ -425,7 +425,7 @@
 	int		value;
 };
 
-static	const struct option	options[]	= {
+static	const struct option_loc	options[]	= {
 		{"test",	't',	False,	&test,	True},
 		{"mapline",	0,	True,	&mapline, 0},
 		{"mapfile",	0,	True,	&mapfile, 0},
@@ -2099,8 +2099,8 @@
 
 	argp = argv;
 	while (++argp < argv + argc && (*argp)[0] == '-') {
-	    const struct option *opt_ptr;
-	    const struct option *opt;
+	    const struct option_loc *opt_ptr;
+	    const struct option_loc *opt;
 	    char *arg = *argp + 1;
 
 	    if (*arg == '\0') --arg;	/* this will flag an error later */

Index: texk/dvipsk/texc.script
--- texk/dvipsk/texc.script.orig	2005-09-25 22:05:56 +0200
+++ texk/dvipsk/texc.script	2005-09-25 22:05:56 +0200
@@ -4,9 +4,7 @@
 # To use it, say
 #       texc.script tex.lpro texc.lpro
 #
-ed $1 <<edscriptend
-/% begin code for uncompressed fonts only/d
-.,/% end code for uncompressed fonts only/d
-.,/% end of code for unpacking compressed fonts/s/% //
-w $2
-edscriptend
+sed <$1 \
+-e '/% end code for uncompressed fonts only/,/% end of code for unpacking compressed fonts/s/% //' \
+-e '/% begin code for uncompressed fonts only/,/end code for uncompressed fonts only/d' \
+>$2

Index: texk/web2c/omegafonts/pl.l
--- texk/web2c/omegafonts/pl.l.orig	2003-05-06 10:30:52 +0200
+++ texk/web2c/omegafonts/pl.l	2007-12-22 12:11:05 +0100
@@ -63,12 +63,6 @@
 
 %}
 
-/* For Solaris's lex, to increase tables sizes --RP */
-/* Space before number keeps ancient flex happy. */
-%e 4000
-%p 7000
-%n 1000
-
 ws		[ \t]+
 hexnumber       H{ws}[A-F0-9]+
 octnumber       O{ws}[0-7]+
Index: libs/ncurses/ncurses/tinfo/lib_baudrate.c
--- libs/ncurses/ncurses/tinfo/lib_baudrate.c.orig	2002-01-20 00:07:53 +0100
+++ libs/ncurses/ncurses/tinfo/lib_baudrate.c	2010-01-08 10:40:05 +0100
@@ -46,7 +46,7 @@
  * of the indices up to B115200 fit nicely in a 'short', allowing us to retain
  * ospeed's type for compatibility.
  */
-#if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__)
+#if defined(__NetBSD__) || defined(__OpenBSD__)
 #undef B0
 #undef B50
 #undef B75
Index: libs/gd/gd_png.c
--- libs/gd/gd_png.c.orig	2004-10-28 20:09:52 +0200
+++ libs/gd/gd_png.c	2010-01-08 10:57:27 +0100
@@ -143,7 +143,7 @@
   /* first do a quick check that the file really is a PNG image; could
    * have used slightly more general png_sig_cmp() function instead */
   gdGetBuf (sig, 8, infile);
-  if (!png_check_sig (sig, 8))
+  if (png_sig_cmp (sig, 0, 8) > 0)
     return NULL;		/* bad signature */
 
 #ifndef PNG_SETJMP_NOT_SUPPORTED
Index: texk/dvipdfm/pngimage.c
--- texk/dvipdfm/pngimage.c.orig	2002-12-25 18:51:16 +0100
+++ texk/dvipdfm/pngimage.c	2010-01-08 10:58:28 +0100
@@ -42,7 +42,7 @@
   rewind (png_file);
   if (fread (sigbytes, 1, sizeof(sigbytes), png_file) !=
       sizeof(sigbytes) ||
-      (!png_check_sig (sigbytes, sizeof(sigbytes))))
+      (png_sig_cmp (sigbytes, 0, sizeof(sigbytes)) > 0))
     return 0;
   else
     return 1;
Index: texk/dvipdfm/thumbnail.c
--- texk/dvipdfm/thumbnail.c.orig	2002-12-25 18:51:16 +0100
+++ texk/dvipdfm/thumbnail.c	2010-01-08 10:58:39 +0100
@@ -79,7 +79,7 @@
   }
   if (fread (sigbytes, 1, sizeof(sigbytes), thumb_file) !=
       sizeof(sigbytes) ||
-      (!png_check_sig (sigbytes, sizeof(sigbytes)))) {
+      (png_sig_cmp (sigbytes, 0, sizeof(sigbytes)) > 0)) {
     fprintf (stderr, "\nThumbnail not a png file! Skipping\n");
     return NULL;
   }
Index: texk/dvipsk/afm2tfm.c
--- texk/dvipsk/afm2tfm.c.orig	2005-01-30 14:17:09.000000000 +0100
+++ texk/dvipsk/afm2tfm.c	2012-08-10 13:51:16.204770293 +0200
@@ -40,6 +40,9 @@
 #endif
 #endif /* KPATHSEA */
 
+/* Definitions to accommodate flawed or defective code.  */
+#define getline local_getline
+
 /* JLH: added these to make the code easier to read and remove some
    ascii<->ebcdic dependencies */
 #define ASCII_A 65
Index: texk/web2c/cpascal.h
--- texk/web2c/cpascal.h.orig	2004-08-28 22:49:59.000000000 +0200
+++ texk/web2c/cpascal.h	2012-08-10 13:50:28.634075696 +0200
@@ -241,6 +241,10 @@
 #define getname vms_getname
 #endif
 
+/* Definitions to accommodate flawed or defective code.  */
+
+#define getline local_getline
+
 /* Declarations for the routines we provide ourselves in lib/.  */
 
 extern string basenamechangesuffix P3H(const_string,const_string,const_string);
