wok-next diff magicpoint/stuff/patches/01_mgpnet_in.diff @ rev 19793

Up giflib, imlib2, libsndfile, xorg-cf-files; switch icewm and magicpoint from imlib to imlib2; remove imlib - no one need it anymore.
author Aleksej Bobylev <al.bobylev@gmail.com>
date Fri Jun 23 12:00:00 2017 +0300 (2017-06-23)
parents
children
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/magicpoint/stuff/patches/01_mgpnet_in.diff	Fri Jun 23 12:00:00 2017 +0300
     1.3 @@ -0,0 +1,117 @@
     1.4 +Index: magicpoint-1.13a/contrib/mgpnet.in
     1.5 +===================================================================
     1.6 +--- magicpoint-1.13a.orig/contrib/mgpnet.in	2008-12-24 10:52:03.000000000 -0500
     1.7 ++++ magicpoint-1.13a/contrib/mgpnet.in	2008-12-24 11:00:47.000000000 -0500
     1.8 +@@ -32,7 +32,7 @@
     1.9 + 
    1.10 + # configurations
    1.11 + $tmpdir = '/tmp';
    1.12 +-$httpdatestr = "date '+\%a, \%d \%b \%Y \%H:\%M:\%S \%Z'";
    1.13 ++$httpdatestr = "env LC_ALL=C date '+\%a, \%d \%b \%Y \%H:\%M:\%S \%Z'";
    1.14 + $seltimeout = 1;
    1.15 + $refreshtimeout = 10;
    1.16 + $debug = 0;
    1.17 +@@ -53,6 +53,7 @@
    1.18 + 		} while ($hostname =~ /^127\./);
    1.19 + 		close(IN);
    1.20 + 	};
    1.21 ++	$hostname =~ s/^addr://; # for GNU/Linux, by ukai
    1.22 + 	print "http://$hostname:$port/\n";
    1.23 + 	exit 0;
    1.24 + }
    1.25 +@@ -214,7 +215,7 @@
    1.26 + 		$imgtmp = &tmpname;
    1.27 + 		$errout = ($debug ? '' : '2>&-');
    1.28 + 		system "xwintoppm -silent -name MagicPoint | ".
    1.29 +-			"ppmquant 256 $errout | ppmtogif $errout > $imgtmp";
    1.30 ++			"ppmquant 256 $errout | ppmtopng $errout > $imgtmp";
    1.31 + 		if (-z $imgtmp) {
    1.32 + 			unlink $imgtmp;
    1.33 + 			$checkcontent = '';
    1.34 +@@ -245,10 +246,10 @@
    1.35 + 	local($httpreq, $httpmethod, $httppath, $httpver, $httphost);
    1.36 + 	local($httpagent);
    1.37 + 	local($imgplace, $imgwidth, $imgheight, $buf, $imglen);
    1.38 +-	local($cthtml, $ctgif);
    1.39 ++	local($cthtml, $ctpng);
    1.40 + 
    1.41 + 	$cthtml = ($usecharset ? 'text/html; charset=us-ascii' : 'text/html');
    1.42 +-	$ctgif = 'image/gif';
    1.43 ++	$ctgif = 'image/png';
    1.44 + 
    1.45 + 	$httpreq = <NS>;
    1.46 + 	print STDERR 'HTTP in> ' . $httpreq if ($debug);
    1.47 +@@ -256,7 +257,7 @@
    1.48 + 	$httpmethod = $httppath = $httpver = '';
    1.49 + 	($httpmethod, $httppath, $httpver) = split(/\s+/, $httpreq);
    1.50 + 	$httppath =~ s/http:\/\/[^:\/]+(:\d+)\//\//;
    1.51 +-	if ($httpver eq '' || $httpver eq 'HTTP/1.0') {
    1.52 ++	if ($httpver eq '' || $httpver =~ m'HTTP/1.0') {
    1.53 + 		;	# ok
    1.54 + 	} else {
    1.55 + 		&httpheader(501, $cthtml) if ($httpver);
    1.56 +@@ -318,7 +319,7 @@
    1.57 + 		print <<EOF;
    1.58 + <HEAD><TITLE>MagicPoint Netserver</TITLE></HEAD>
    1.59 + <BODY>
    1.60 +-<IMG SRC=\"/presentation.gif\" ALT=\"presentation image\"
    1.61 ++<IMG SRC=\"/presentation.png\" ALT=\"presentation image\"
    1.62 + $imgplace ALIGN=left><BR>
    1.63 + <TABLE border=0>
    1.64 + <TR><TD NOWRAP><A HREF=/index.html>normal</A>
    1.65 +@@ -340,7 +341,7 @@
    1.66 + </TABLE>
    1.67 + </BODY></HTML>
    1.68 + EOF
    1.69 +-	} elsif ($httppath eq '/presentation.gif') {
    1.70 ++	} elsif ($httppath eq '/presentation.png') {
    1.71 + 		open(IMG, "< $imagefile") || do {
    1.72 + 			$checkcontent = '';	# invalidate
    1.73 + 			&httpheader(404, $cthtml) if ($httpver);
    1.74 +@@ -350,13 +351,13 @@
    1.75 + <HEAD><TITLE>File Not found</TITLE></HEAD>
    1.76 + <BODY><H1>File Not found</H1>
    1.77 + The requested URL $httppath was not found on this server.<P>
    1.78 +-Looks like a mitake in configuration.
    1.79 ++Looks like a mistake in configuration.
    1.80 + Contact the administrator.<P>
    1.81 + </BODY>
    1.82 + EOF
    1.83 + 			return;
    1.84 + 		};
    1.85 +-		&httpheader(200, $ctgif) if ($httpver);
    1.86 ++		&httpheader(200, $ctpng) if ($httpver);
    1.87 + 		return if ($httpmethod ne 'GET');
    1.88 + 
    1.89 + 		while (0 < ($imglen = sysread(IMG, $buf, 4096))) {
    1.90 +@@ -415,7 +416,7 @@
    1.91 + 'XXX4', 'SO_REUSEPORT',	'XXX5', 'SOCK_STREAM',	'XXX6', 'WNOHANG',
    1.92 + );
    1.93 + 	$tmpnam = &tmpname;
    1.94 +-	open(CPP, "| @CPP@ >$tmpnam") || return;
    1.95 ++	open(CPP, "| @CPP@ - >$tmpnam") || return;
    1.96 + 	print CPP "#include <sys/socket.h>\n";
    1.97 + 	print CPP "#include <sys/wait.h>\n";
    1.98 + 	foreach $tmp (keys %varnames) {
    1.99 +@@ -439,12 +440,19 @@
   1.100 + 		$havesinlen = 0; $sockaddr = 'S n a4 x8';
   1.101 + 	}
   1.102 + 
   1.103 ++	use Socket;
   1.104 + 	foreach $i (keys %varnames) {
   1.105 + 		if (@tmp2 = grep($_ =~ /^$i/, @tmp1)) {
   1.106 + 			$tmp = (split(/\s+/, @tmp2[0]))[1];
   1.107 + 			$tmp = oct($tmp) if ($tmp =~ /^0/);
   1.108 +-			next if ($tmp !~ /^[0-9]+$/);
   1.109 +-			eval "\$$varnames{$i} = \$tmp;";
   1.110 ++			if ($tmp =~ /^[0-9]+$/) {
   1.111 ++			    eval "\$$varnames{$i} = \$tmp;";
   1.112 ++			} else {
   1.113 ++			    # some constant defined by enum, so we can not
   1.114 ++			    # always use cpp as above. I believe use Socket
   1.115 ++			    # is more reliable in these days.
   1.116 ++			    eval "\$$varnames{$i} = &$varnames{$i};";
   1.117 ++			}
   1.118 + 		}
   1.119 + 	}
   1.120 + }