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

feh: update bdeps
author Pascal Bellard <pascal.bellard@slitaz.org>
date Sun Oct 29 13:59:00 2017 +0100 (2017-10-29)
parents
children
rev   line source
al@19793 1 Index: magicpoint-1.13a/contrib/mgpnet.in
al@19793 2 ===================================================================
al@19793 3 --- magicpoint-1.13a.orig/contrib/mgpnet.in 2008-12-24 10:52:03.000000000 -0500
al@19793 4 +++ magicpoint-1.13a/contrib/mgpnet.in 2008-12-24 11:00:47.000000000 -0500
al@19793 5 @@ -32,7 +32,7 @@
al@19793 6
al@19793 7 # configurations
al@19793 8 $tmpdir = '/tmp';
al@19793 9 -$httpdatestr = "date '+\%a, \%d \%b \%Y \%H:\%M:\%S \%Z'";
al@19793 10 +$httpdatestr = "env LC_ALL=C date '+\%a, \%d \%b \%Y \%H:\%M:\%S \%Z'";
al@19793 11 $seltimeout = 1;
al@19793 12 $refreshtimeout = 10;
al@19793 13 $debug = 0;
al@19793 14 @@ -53,6 +53,7 @@
al@19793 15 } while ($hostname =~ /^127\./);
al@19793 16 close(IN);
al@19793 17 };
al@19793 18 + $hostname =~ s/^addr://; # for GNU/Linux, by ukai
al@19793 19 print "http://$hostname:$port/\n";
al@19793 20 exit 0;
al@19793 21 }
al@19793 22 @@ -214,7 +215,7 @@
al@19793 23 $imgtmp = &tmpname;
al@19793 24 $errout = ($debug ? '' : '2>&-');
al@19793 25 system "xwintoppm -silent -name MagicPoint | ".
al@19793 26 - "ppmquant 256 $errout | ppmtogif $errout > $imgtmp";
al@19793 27 + "ppmquant 256 $errout | ppmtopng $errout > $imgtmp";
al@19793 28 if (-z $imgtmp) {
al@19793 29 unlink $imgtmp;
al@19793 30 $checkcontent = '';
al@19793 31 @@ -245,10 +246,10 @@
al@19793 32 local($httpreq, $httpmethod, $httppath, $httpver, $httphost);
al@19793 33 local($httpagent);
al@19793 34 local($imgplace, $imgwidth, $imgheight, $buf, $imglen);
al@19793 35 - local($cthtml, $ctgif);
al@19793 36 + local($cthtml, $ctpng);
al@19793 37
al@19793 38 $cthtml = ($usecharset ? 'text/html; charset=us-ascii' : 'text/html');
al@19793 39 - $ctgif = 'image/gif';
al@19793 40 + $ctgif = 'image/png';
al@19793 41
al@19793 42 $httpreq = <NS>;
al@19793 43 print STDERR 'HTTP in> ' . $httpreq if ($debug);
al@19793 44 @@ -256,7 +257,7 @@
al@19793 45 $httpmethod = $httppath = $httpver = '';
al@19793 46 ($httpmethod, $httppath, $httpver) = split(/\s+/, $httpreq);
al@19793 47 $httppath =~ s/http:\/\/[^:\/]+(:\d+)\//\//;
al@19793 48 - if ($httpver eq '' || $httpver eq 'HTTP/1.0') {
al@19793 49 + if ($httpver eq '' || $httpver =~ m'HTTP/1.0') {
al@19793 50 ; # ok
al@19793 51 } else {
al@19793 52 &httpheader(501, $cthtml) if ($httpver);
al@19793 53 @@ -318,7 +319,7 @@
al@19793 54 print <<EOF;
al@19793 55 <HEAD><TITLE>MagicPoint Netserver</TITLE></HEAD>
al@19793 56 <BODY>
al@19793 57 -<IMG SRC=\"/presentation.gif\" ALT=\"presentation image\"
al@19793 58 +<IMG SRC=\"/presentation.png\" ALT=\"presentation image\"
al@19793 59 $imgplace ALIGN=left><BR>
al@19793 60 <TABLE border=0>
al@19793 61 <TR><TD NOWRAP><A HREF=/index.html>normal</A>
al@19793 62 @@ -340,7 +341,7 @@
al@19793 63 </TABLE>
al@19793 64 </BODY></HTML>
al@19793 65 EOF
al@19793 66 - } elsif ($httppath eq '/presentation.gif') {
al@19793 67 + } elsif ($httppath eq '/presentation.png') {
al@19793 68 open(IMG, "< $imagefile") || do {
al@19793 69 $checkcontent = ''; # invalidate
al@19793 70 &httpheader(404, $cthtml) if ($httpver);
al@19793 71 @@ -350,13 +351,13 @@
al@19793 72 <HEAD><TITLE>File Not found</TITLE></HEAD>
al@19793 73 <BODY><H1>File Not found</H1>
al@19793 74 The requested URL $httppath was not found on this server.<P>
al@19793 75 -Looks like a mitake in configuration.
al@19793 76 +Looks like a mistake in configuration.
al@19793 77 Contact the administrator.<P>
al@19793 78 </BODY>
al@19793 79 EOF
al@19793 80 return;
al@19793 81 };
al@19793 82 - &httpheader(200, $ctgif) if ($httpver);
al@19793 83 + &httpheader(200, $ctpng) if ($httpver);
al@19793 84 return if ($httpmethod ne 'GET');
al@19793 85
al@19793 86 while (0 < ($imglen = sysread(IMG, $buf, 4096))) {
al@19793 87 @@ -415,7 +416,7 @@
al@19793 88 'XXX4', 'SO_REUSEPORT', 'XXX5', 'SOCK_STREAM', 'XXX6', 'WNOHANG',
al@19793 89 );
al@19793 90 $tmpnam = &tmpname;
al@19793 91 - open(CPP, "| @CPP@ >$tmpnam") || return;
al@19793 92 + open(CPP, "| @CPP@ - >$tmpnam") || return;
al@19793 93 print CPP "#include <sys/socket.h>\n";
al@19793 94 print CPP "#include <sys/wait.h>\n";
al@19793 95 foreach $tmp (keys %varnames) {
al@19793 96 @@ -439,12 +440,19 @@
al@19793 97 $havesinlen = 0; $sockaddr = 'S n a4 x8';
al@19793 98 }
al@19793 99
al@19793 100 + use Socket;
al@19793 101 foreach $i (keys %varnames) {
al@19793 102 if (@tmp2 = grep($_ =~ /^$i/, @tmp1)) {
al@19793 103 $tmp = (split(/\s+/, @tmp2[0]))[1];
al@19793 104 $tmp = oct($tmp) if ($tmp =~ /^0/);
al@19793 105 - next if ($tmp !~ /^[0-9]+$/);
al@19793 106 - eval "\$$varnames{$i} = \$tmp;";
al@19793 107 + if ($tmp =~ /^[0-9]+$/) {
al@19793 108 + eval "\$$varnames{$i} = \$tmp;";
al@19793 109 + } else {
al@19793 110 + # some constant defined by enum, so we can not
al@19793 111 + # always use cpp as above. I believe use Socket
al@19793 112 + # is more reliable in these days.
al@19793 113 + eval "\$$varnames{$i} = &$varnames{$i};";
al@19793 114 + }
al@19793 115 }
al@19793 116 }
al@19793 117 }