--- mgp-1.11b.orig/contrib/mgp2html.pl.in +++ mgp-1.11b/contrib/mgp2html.pl.in @@ -79,10 +79,18 @@ &prologue; while (<>) { - s/\n$//; + s/[\n\r]*$//; # trim CR and LF + s/; # concatenate next line + s/[\n\r]*$//; # trim CR and LF + } + if ($_ eq '' || $_ =~ /^[^%]/) { $line++; $cont = 0 if ($cont == 2); @@ -103,6 +111,8 @@ next; } + $cont = 0 if ($cont == 2); + $cont = 2 if ($cont == 1); &cmds($_); } &pageepilogue; @@ -152,14 +162,15 @@ if (!$doimage) { # don't use images } elsif (scalar(@dir) == 2 || scalar(@dir) == 3) { - print "\"$dir[1]\"\n"; + &output("\"$dir[1]\"\n"); } elsif (scalar(@dir) == 4) { # interpretation wrong - print "\"$dir[1]\"\n"; + &output("\"$dir[1]\"\n"); } elsif (scalar(@dir) >= 5) { # interpretation wrong - print "\"$dir[1]\"\n"; + &output("\"$dir[1]\"\n"); } + $endline = "
\n"; } elsif ($dir[0] eq 'nodefault') { $nodefault++; } elsif ($dir[0] =~ /^(left|leftfill|right|center)$/) { --- mgp-1.11b.orig/contrib/mgpnet.in +++ mgp-1.11b/contrib/mgpnet.in @@ -32,7 +32,7 @@ # configurations $tmpdir = '/tmp'; -$httpdatestr = "date '+\%a, \%d \%b \%Y \%H:\%M:\%S \%Z'"; +$httpdatestr = "env LC_ALL=C date '+\%a, \%d \%b \%Y \%H:\%M:\%S \%Z'"; $seltimeout = 1; $refreshtimeout = 10; $debug = 0; @@ -53,6 +53,7 @@ } while ($hostname =~ /^127\./); close(IN); }; + $hostname =~ s/^addr://; # for GNU/Linux, by ukai print "http://$hostname:$port/\n"; exit 0; } @@ -150,19 +151,19 @@ vec($rin, fileno(S), 1) = 1; vec($win, fileno(S), 1) = 1; $ewin = $rin | $win; - print STDERR "waiting for connetion...\n" if ($debug); + print STDERR "waiting for connection...\n" if ($debug); ($nfound, $timeleft) = select($rout = $rin, $wout = $win, $eout = $ein, $seltimeout); next if ($nfound <= 0); if (vec($rout, fileno(S), 1)) { - print STDERR "accepting connetion...\n" if ($debug); + print STDERR "accepting connection...\n" if ($debug); accept(NS, S) || do { print STDERR "server: accept fail\n" if ($debug); next; }; $acceptstat++; - print STDERR "connetion accepted...\n" if ($debug); + print STDERR "connection accepted...\n" if ($debug); $pid = fork; if ($pid < 0) { @@ -185,7 +186,7 @@ } } print STDERR "leaving MagicPoint Netserver...\n"; -print STDERR "accepted $acceptstat connetions so far.\n"; +print STDERR "accepted $acceptstat connections so far.\n"; close(NS); close(S); unlink($imagefile); @@ -256,7 +257,7 @@ $httpmethod = $httppath = $httpver = ''; ($httpmethod, $httppath, $httpver) = split(/\s+/, $httpreq); $httppath =~ s/http:\/\/[^:\/]+(:\d+)\//\//; - if ($httpver eq '' || $httpver eq 'HTTP/1.0') { + if ($httpver eq '' || $httpver =~ m'HTTP/1.[01]') { ; # ok } else { &httpheader(501, $cthtml) if ($httpver); @@ -350,7 +351,7 @@ File Not found

File Not found

The requested URL $httppath was not found on this server.

-Looks like a mitake in configuration. +Looks like a mistake in configuration. Contact the administrator.

EOF @@ -415,7 +416,7 @@ 'XXX4', 'SO_REUSEPORT', 'XXX5', 'SOCK_STREAM', 'XXX6', 'WNOHANG', ); $tmpnam = &tmpname; - open(CPP, "| @CPP@ >$tmpnam") || return; + open(CPP, "| @CPP@ - >$tmpnam") || return; print CPP "#include \n"; print CPP "#include \n"; foreach $tmp (keys %varnames) { @@ -439,12 +440,19 @@ $havesinlen = 0; $sockaddr = 'S n a4 x8'; } + use Socket; foreach $i (keys %varnames) { if (@tmp2 = grep($_ =~ /^$i/, @tmp1)) { $tmp = (split(/\s+/, @tmp2[0]))[1]; $tmp = oct($tmp) if ($tmp =~ /^0/); - next if ($tmp !~ /^[0-9]+$/); - eval "\$$varnames{$i} = \$tmp;"; + if ($tmp =~ /^[0-9]+$/) { + eval "\$$varnames{$i} = \$tmp;"; + } else { + # some constant defined by enum, so we can not + # always use cpp as above. I believe use Socket + # is more reliable in these days. + eval "\$$varnames{$i} = &$varnames{$i};"; + } } } } --- mgp-1.11b.orig/README.lang +++ mgp-1.11b/README.lang @@ -16,6 +16,9 @@ %charset "iso8859-1" +Note that this directive can be used after %page directive, that is, +you can't use %charset directive in preamble. + In the future, we will add more encodings to charset directive, like "iso2022-jp", or "euc-jp" --- mgp-1.11b.orig/mgpembed.pl.in +++ mgp-1.11b/mgpembed.pl.in @@ -85,12 +85,20 @@ print OUT; next; } - if (/^%(.*)image\s+/i) { - $prefix = $1; $postfix = $'; - if ($postfix =~ /\"([^"]*)\"/) { - # "]*)\"/) { # (workaround for bug in Emacs Perl-syntax) + if (/^%(.*)image\s+([^,]+)/i) { + $a = $1; $fname0 = $fname = $2; $b = $'; + if ($a =~ /new$/) { + if ($fname =~ /\"([^"]*)\"$/) { $fname = $1; - } elsif ($b =~ /^(\S+)/) { + } + } else { + if ($fname =~ /\s.*/) { + $b = $' . $b; + } + } + if ($fname =~ /^\"([^"]*)\"/) { + $fname = $1; + } elsif ($fname =~ /^(\S+)/) { $fname = $1; } $base = $fname; @@ -106,10 +114,11 @@ } $files{$base} = $fname; $embfn = "EMBEDDIR/" . $base; - $postfix =~ s/\"$fname\"/\"$embfn\"/; + $fname0 =~ s/$fname/$embfn/; print OUT '%'; - print OUT "$prefix"; - print OUT "image $postfix"; + print OUT "$a"; + print OUT "image $fname0"; + print OUT "$b"; } elsif (/^%(.*)include\s+(\S+)(.*)$/i) { $incfname = $2; if ($incfname =~ /^\"(.+)\"$/) { --- mgp-1.11b.orig/parse.c +++ mgp-1.11b/parse.c @@ -782,6 +782,10 @@ } } } else { +#if 1 /* escape % by backslash */ + if (buf[0] == 0x5c) + memcpy(&buf[0], &buf[1], strlen(buf)); +#endif /* this is data */ /* @@ -1091,6 +1099,7 @@ case CTL_TMFONT: tmpstr[4] = cp; break; #endif case CTL_XFONT2: + define_font (cp); if (strcmp(cp->ctc2_value2, "iso8859-1") == 0) { tmpstr[2] = cp; @@ -1913,7 +1922,7 @@ int i; /* find duplicated def */ - for (i = 0; i < MAXFONTDEF; i++) { + for (i = 0; cp->ct_op != CTL_XFONT2 && i < MAXFONTDEF; i++) { if (!fontdef_control[i]) continue; if (strcmp(fontdef_control[i]->ctc_value, @@ -1949,8 +1958,10 @@ for (i = 0; i < MAXFONTDEF; i++) { if (!fontdef_control[i]) continue; - if (strcmp(fontdef_control[i]->ctc_value, font) == 0) + if (fontdef_control[i]->ct_op != CTL_XFONT2 + && strcmp(fontdef_control[i]->ctc_value, font) == 0) { return fontdef_control[i]; + } } return NULL; } --- mgp-1.11b.orig/sample/sample-fr.mgp +++ mgp-1.11b/sample/sample-fr.mgp @@ -182,6 +182,8 @@ this is test %endfilter + Pour voir cette feature (et les 2 slides prochains) il faut utiliser -U parce que c'est dangereux. + %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %PAGE --- mgp-1.11b.orig/sample/sample-jp.mgp +++ mgp-1.11b/sample/sample-jp.mgp @@ -312,6 +312,9 @@ %filter "rev" this is test %endfilter + + このフィーチャーは危いですから -U が必要です(次の2スライドも) + %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %PAGE --- mgp-1.11b.orig/sample/sample.mgp +++ mgp-1.11b/sample/sample.mgp @@ -229,6 +229,8 @@ this is test %endfilter + Note the -U command line option is required to make this (un-secure) feature and the next two slides work. + %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %PAGE %bgrad 0 0 256 0 0 "white" "blue"