| 1 |
--- mgp-1.11b.orig/contrib/mgp2html.pl.in
|
| 2 |
+++ mgp-1.11b/contrib/mgp2html.pl.in
|
| 3 |
@@ -79,10 +79,18 @@
|
| 4 |
|
| 5 |
&prologue;
|
| 6 |
while (<>) {
|
| 7 |
- s/\n$//;
|
| 8 |
+ s/[\n\r]*$//; # trim CR and LF
|
| 9 |
+ s/</</g; # escape < as <
|
| 10 |
|
| 11 |
$_ = '' if (/^#/o);
|
| 12 |
|
| 13 |
+ # multiline processing (lines ending with '\')
|
| 14 |
+ while ((/\\$/) && (not eof())) {
|
| 15 |
+ $_=substr($_,0,-1); # cuts last char (should be '\')
|
| 16 |
+ $_=$_.<>; # concatenate next line
|
| 17 |
+ s/[\n\r]*$//; # trim CR and LF
|
| 18 |
+ }
|
| 19 |
+
|
| 20 |
if ($_ eq '' || $_ =~ /^[^%]/) {
|
| 21 |
$line++;
|
| 22 |
$cont = 0 if ($cont == 2);
|
| 23 |
@@ -103,6 +111,8 @@
|
| 24 |
next;
|
| 25 |
}
|
| 26 |
|
| 27 |
+ $cont = 0 if ($cont == 2);
|
| 28 |
+ $cont = 2 if ($cont == 1);
|
| 29 |
&cmds($_);
|
| 30 |
}
|
| 31 |
&pageepilogue;
|
| 32 |
@@ -152,14 +162,15 @@
|
| 33 |
if (!$doimage) {
|
| 34 |
# don't use images
|
| 35 |
} elsif (scalar(@dir) == 2 || scalar(@dir) == 3) {
|
| 36 |
- print "<IMG SRC=\"$dir[1]\" ALT=\"$dir[1]\">\n";
|
| 37 |
+ &output("<IMG SRC=\"$dir[1]\" ALT=\"$dir[1]\">\n");
|
| 38 |
} elsif (scalar(@dir) == 4) {
|
| 39 |
# interpretation wrong
|
| 40 |
- print "<IMG SRC=\"$dir[1]\" WIDTH=$dir[3]% HEIGHT=$dir[3]% ALT=\"$dir[1]\">\n";
|
| 41 |
+ &output("<IMG SRC=\"$dir[1]\" WIDTH=$dir[3]% HEIGHT=$dir[3]% ALT=\"$dir[1]\">\n");
|
| 42 |
} elsif (scalar(@dir) >= 5) {
|
| 43 |
# interpretation wrong
|
| 44 |
- print "<IMG SRC=\"$dir[1]\" WIDTH=$dir[3]% HEIGHT=$dir[4]% ALT=\"$dir[1]\">\n";
|
| 45 |
+ &output("<IMG SRC=\"$dir[1]\" WIDTH=$dir[3]% HEIGHT=$dir[4]% ALT=\"$dir[1]\">\n");
|
| 46 |
}
|
| 47 |
+ $endline = "<BR>\n";
|
| 48 |
} elsif ($dir[0] eq 'nodefault') {
|
| 49 |
$nodefault++;
|
| 50 |
} elsif ($dir[0] =~ /^(left|leftfill|right|center)$/) {
|
| 51 |
--- mgp-1.11b.orig/contrib/mgpnet.in
|
| 52 |
+++ mgp-1.11b/contrib/mgpnet.in
|
| 53 |
@@ -32,7 +32,7 @@
|
| 54 |
|
| 55 |
# configurations
|
| 56 |
$tmpdir = '/tmp';
|
| 57 |
-$httpdatestr = "date '+\%a, \%d \%b \%Y \%H:\%M:\%S \%Z'";
|
| 58 |
+$httpdatestr = "env LC_ALL=C date '+\%a, \%d \%b \%Y \%H:\%M:\%S \%Z'";
|
| 59 |
$seltimeout = 1;
|
| 60 |
$refreshtimeout = 10;
|
| 61 |
$debug = 0;
|
| 62 |
@@ -53,6 +53,7 @@
|
| 63 |
} while ($hostname =~ /^127\./);
|
| 64 |
close(IN);
|
| 65 |
};
|
| 66 |
+ $hostname =~ s/^addr://; # for GNU/Linux, by ukai
|
| 67 |
print "http://$hostname:$port/\n";
|
| 68 |
exit 0;
|
| 69 |
}
|
| 70 |
@@ -150,19 +151,19 @@
|
| 71 |
vec($rin, fileno(S), 1) = 1;
|
| 72 |
vec($win, fileno(S), 1) = 1;
|
| 73 |
$ewin = $rin | $win;
|
| 74 |
- print STDERR "waiting for connetion...\n" if ($debug);
|
| 75 |
+ print STDERR "waiting for connection...\n" if ($debug);
|
| 76 |
($nfound, $timeleft) =
|
| 77 |
select($rout = $rin, $wout = $win, $eout = $ein, $seltimeout);
|
| 78 |
next if ($nfound <= 0);
|
| 79 |
if (vec($rout, fileno(S), 1)) {
|
| 80 |
- print STDERR "accepting connetion...\n" if ($debug);
|
| 81 |
+ print STDERR "accepting connection...\n" if ($debug);
|
| 82 |
accept(NS, S) || do {
|
| 83 |
print STDERR "server: accept fail\n" if ($debug);
|
| 84 |
next;
|
| 85 |
};
|
| 86 |
|
| 87 |
$acceptstat++;
|
| 88 |
- print STDERR "connetion accepted...\n" if ($debug);
|
| 89 |
+ print STDERR "connection accepted...\n" if ($debug);
|
| 90 |
|
| 91 |
$pid = fork;
|
| 92 |
if ($pid < 0) {
|
| 93 |
@@ -185,7 +186,7 @@
|
| 94 |
}
|
| 95 |
}
|
| 96 |
print STDERR "leaving MagicPoint Netserver...\n";
|
| 97 |
-print STDERR "accepted $acceptstat connetions so far.\n";
|
| 98 |
+print STDERR "accepted $acceptstat connections so far.\n";
|
| 99 |
close(NS);
|
| 100 |
close(S);
|
| 101 |
unlink($imagefile);
|
| 102 |
@@ -256,7 +257,7 @@
|
| 103 |
$httpmethod = $httppath = $httpver = '';
|
| 104 |
($httpmethod, $httppath, $httpver) = split(/\s+/, $httpreq);
|
| 105 |
$httppath =~ s/http:\/\/[^:\/]+(:\d+)\//\//;
|
| 106 |
- if ($httpver eq '' || $httpver eq 'HTTP/1.0') {
|
| 107 |
+ if ($httpver eq '' || $httpver =~ m'HTTP/1.[01]') {
|
| 108 |
; # ok
|
| 109 |
} else {
|
| 110 |
&httpheader(501, $cthtml) if ($httpver);
|
| 111 |
@@ -350,7 +351,7 @@
|
| 112 |
<HEAD><TITLE>File Not found</TITLE></HEAD>
|
| 113 |
<BODY><H1>File Not found</H1>
|
| 114 |
The requested URL $httppath was not found on this server.<P>
|
| 115 |
-Looks like a mitake in configuration.
|
| 116 |
+Looks like a mistake in configuration.
|
| 117 |
Contact the administrator.<P>
|
| 118 |
</BODY>
|
| 119 |
EOF
|
| 120 |
@@ -415,7 +416,7 @@
|
| 121 |
'XXX4', 'SO_REUSEPORT', 'XXX5', 'SOCK_STREAM', 'XXX6', 'WNOHANG',
|
| 122 |
);
|
| 123 |
$tmpnam = &tmpname;
|
| 124 |
- open(CPP, "| @CPP@ >$tmpnam") || return;
|
| 125 |
+ open(CPP, "| @CPP@ - >$tmpnam") || return;
|
| 126 |
print CPP "#include <sys/socket.h>\n";
|
| 127 |
print CPP "#include <sys/wait.h>\n";
|
| 128 |
foreach $tmp (keys %varnames) {
|
| 129 |
@@ -439,12 +440,19 @@
|
| 130 |
$havesinlen = 0; $sockaddr = 'S n a4 x8';
|
| 131 |
}
|
| 132 |
|
| 133 |
+ use Socket;
|
| 134 |
foreach $i (keys %varnames) {
|
| 135 |
if (@tmp2 = grep($_ =~ /^$i/, @tmp1)) {
|
| 136 |
$tmp = (split(/\s+/, @tmp2[0]))[1];
|
| 137 |
$tmp = oct($tmp) if ($tmp =~ /^0/);
|
| 138 |
- next if ($tmp !~ /^[0-9]+$/);
|
| 139 |
- eval "\$$varnames{$i} = \$tmp;";
|
| 140 |
+ if ($tmp =~ /^[0-9]+$/) {
|
| 141 |
+ eval "\$$varnames{$i} = \$tmp;";
|
| 142 |
+ } else {
|
| 143 |
+ # some constant defined by enum, so we can not
|
| 144 |
+ # always use cpp as above. I believe use Socket
|
| 145 |
+ # is more reliable in these days.
|
| 146 |
+ eval "\$$varnames{$i} = &$varnames{$i};";
|
| 147 |
+ }
|
| 148 |
}
|
| 149 |
}
|
| 150 |
}
|
| 151 |
--- mgp-1.11b.orig/README.lang
|
| 152 |
+++ mgp-1.11b/README.lang
|
| 153 |
@@ -16,6 +16,9 @@
|
| 154 |
|
| 155 |
%charset "iso8859-1"
|
| 156 |
|
| 157 |
+Note that this directive can be used after %page directive, that is,
|
| 158 |
+you can't use %charset directive in preamble.
|
| 159 |
+
|
| 160 |
In the future, we will add more encodings to charset directive, like
|
| 161 |
"iso2022-jp", or "euc-jp"
|
| 162 |
|
| 163 |
--- mgp-1.11b.orig/mgpembed.pl.in
|
| 164 |
+++ mgp-1.11b/mgpembed.pl.in
|
| 165 |
@@ -85,12 +85,20 @@
|
| 166 |
print OUT;
|
| 167 |
next;
|
| 168 |
}
|
| 169 |
- if (/^%(.*)image\s+/i) {
|
| 170 |
- $prefix = $1; $postfix = $';
|
| 171 |
- if ($postfix =~ /\"([^"]*)\"/) {
|
| 172 |
- # "]*)\"/) { # (workaround for bug in Emacs Perl-syntax)
|
| 173 |
+ if (/^%(.*)image\s+([^,]+)/i) {
|
| 174 |
+ $a = $1; $fname0 = $fname = $2; $b = $';
|
| 175 |
+ if ($a =~ /new$/) {
|
| 176 |
+ if ($fname =~ /\"([^"]*)\"$/) {
|
| 177 |
$fname = $1;
|
| 178 |
- } elsif ($b =~ /^(\S+)/) {
|
| 179 |
+ }
|
| 180 |
+ } else {
|
| 181 |
+ if ($fname =~ /\s.*/) {
|
| 182 |
+ $b = $' . $b;
|
| 183 |
+ }
|
| 184 |
+ }
|
| 185 |
+ if ($fname =~ /^\"([^"]*)\"/) {
|
| 186 |
+ $fname = $1;
|
| 187 |
+ } elsif ($fname =~ /^(\S+)/) {
|
| 188 |
$fname = $1;
|
| 189 |
}
|
| 190 |
$base = $fname;
|
| 191 |
@@ -106,10 +114,11 @@
|
| 192 |
}
|
| 193 |
$files{$base} = $fname;
|
| 194 |
$embfn = "EMBEDDIR/" . $base;
|
| 195 |
- $postfix =~ s/\"$fname\"/\"$embfn\"/;
|
| 196 |
+ $fname0 =~ s/$fname/$embfn/;
|
| 197 |
print OUT '%';
|
| 198 |
- print OUT "$prefix";
|
| 199 |
- print OUT "image $postfix";
|
| 200 |
+ print OUT "$a";
|
| 201 |
+ print OUT "image $fname0";
|
| 202 |
+ print OUT "$b";
|
| 203 |
} elsif (/^%(.*)include\s+(\S+)(.*)$/i) {
|
| 204 |
$incfname = $2;
|
| 205 |
if ($incfname =~ /^\"(.+)\"$/) {
|
| 206 |
--- mgp-1.11b.orig/parse.c
|
| 207 |
+++ mgp-1.11b/parse.c
|
| 208 |
@@ -782,6 +782,10 @@
|
| 209 |
}
|
| 210 |
}
|
| 211 |
} else {
|
| 212 |
+#if 1 /* escape % by backslash */
|
| 213 |
+ if (buf[0] == 0x5c)
|
| 214 |
+ memcpy(&buf[0], &buf[1], strlen(buf));
|
| 215 |
+#endif
|
| 216 |
/* this is data */
|
| 217 |
|
| 218 |
/*
|
| 219 |
@@ -1091,6 +1099,7 @@
|
| 220 |
case CTL_TMFONT: tmpstr[4] = cp; break;
|
| 221 |
#endif
|
| 222 |
case CTL_XFONT2:
|
| 223 |
+ define_font (cp);
|
| 224 |
if (strcmp(cp->ctc2_value2,
|
| 225 |
"iso8859-1") == 0) {
|
| 226 |
tmpstr[2] = cp;
|
| 227 |
@@ -1913,7 +1922,7 @@
|
| 228 |
int i;
|
| 229 |
|
| 230 |
/* find duplicated def */
|
| 231 |
- for (i = 0; i < MAXFONTDEF; i++) {
|
| 232 |
+ for (i = 0; cp->ct_op != CTL_XFONT2 && i < MAXFONTDEF; i++) {
|
| 233 |
if (!fontdef_control[i])
|
| 234 |
continue;
|
| 235 |
if (strcmp(fontdef_control[i]->ctc_value,
|
| 236 |
@@ -1949,8 +1958,10 @@
|
| 237 |
for (i = 0; i < MAXFONTDEF; i++) {
|
| 238 |
if (!fontdef_control[i])
|
| 239 |
continue;
|
| 240 |
- if (strcmp(fontdef_control[i]->ctc_value, font) == 0)
|
| 241 |
+ if (fontdef_control[i]->ct_op != CTL_XFONT2
|
| 242 |
+ && strcmp(fontdef_control[i]->ctc_value, font) == 0) {
|
| 243 |
return fontdef_control[i];
|
| 244 |
+ }
|
| 245 |
}
|
| 246 |
return NULL;
|
| 247 |
}
|
| 248 |
--- mgp-1.11b.orig/sample/sample-fr.mgp
|
| 249 |
+++ mgp-1.11b/sample/sample-fr.mgp
|
| 250 |
@@ -182,6 +182,8 @@
|
| 251 |
this is test
|
| 252 |
%endfilter
|
| 253 |
|
| 254 |
+ Pour voir cette feature (et les 2 slides prochains) il faut utiliser -U parce que c'est dangereux.
|
| 255 |
+
|
| 256 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
| 257 |
%PAGE
|
| 258 |
|
| 259 |
--- mgp-1.11b.orig/sample/sample-jp.mgp
|
| 260 |
+++ mgp-1.11b/sample/sample-jp.mgp
|
| 261 |
@@ -312,6 +312,9 @@
|
| 262 |
%filter "rev"
|
| 263 |
this is test
|
| 264 |
%endfilter
|
| 265 |
+
|
| 266 |
+ $B$3$N%U%#!<%A%c!<$O4m$$$G$9$+$i(B -U $B$,I,MW$G$9!J<!$N#2%9%i%$%I$b!K(B
|
| 267 |
+
|
| 268 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
| 269 |
%PAGE
|
| 270 |
|
| 271 |
--- mgp-1.11b.orig/sample/sample.mgp
|
| 272 |
+++ mgp-1.11b/sample/sample.mgp
|
| 273 |
@@ -229,6 +229,8 @@
|
| 274 |
this is test
|
| 275 |
%endfilter
|
| 276 |
|
| 277 |
+ Note the -U command line option is required to make this (un-secure) feature and the next two slides work.
|
| 278 |
+
|
| 279 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
| 280 |
%PAGE
|
| 281 |
%bgrad 0 0 256 0 0 "white" "blue"
|