aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/upas/nfs
diff options
context:
space:
mode:
authorrsc <devnull@localhost>2006-02-23 11:51:18 +0000
committerrsc <devnull@localhost>2006-02-23 11:51:18 +0000
commit6a8add52d368483524f08d36e132184b36198bc1 (patch)
tree41ab4f35775f86d7803ffe2e4aab7c3f52b85470 /src/cmd/upas/nfs
parentabb0a67b83321cb06c9760c78c8e87309fe458d6 (diff)
downloadplan9port-6a8add52d368483524f08d36e132184b36198bc1.tar.gz
plan9port-6a8add52d368483524f08d36e132184b36198bc1.tar.bz2
plan9port-6a8add52d368483524f08d36e132184b36198bc1.zip
fix quoted-printable (_ means space only in rfc2047)
Diffstat (limited to 'src/cmd/upas/nfs')
-rw-r--r--src/cmd/upas/nfs/a.h1
-rw-r--r--src/cmd/upas/nfs/decode.c17
2 files changed, 13 insertions, 5 deletions
diff --git a/src/cmd/upas/nfs/a.h b/src/cmd/upas/nfs/a.h
index d565b028..3c81deb0 100644
--- a/src/cmd/upas/nfs/a.h
+++ b/src/cmd/upas/nfs/a.h
@@ -31,6 +31,7 @@ enum
{
NoEncoding,
QuotedPrintable,
+ QuotedPrintableU,
Base64,
};
diff --git a/src/cmd/upas/nfs/decode.c b/src/cmd/upas/nfs/decode.c
index 0e46dbff..a98ad8a2 100644
--- a/src/cmd/upas/nfs/decode.c
+++ b/src/cmd/upas/nfs/decode.c
@@ -21,7 +21,7 @@ unhex(char *s)
}
int
-decqp(uchar *out, int lim, char *in, int n)
+_decqp(uchar *out, int lim, char *in, int n, int underscores)
{
char *p, *ep;
uchar *eout, *out0;
@@ -29,7 +29,7 @@ decqp(uchar *out, int lim, char *in, int n)
out0 = out;
eout = out+lim;
for(p=in, ep=in+n; p<ep && out<eout; ){
- if(*p == '_'){
+ if(underscores && *p == '_'){
*out++ = ' ';
p++;
}
@@ -50,6 +50,12 @@ decqp(uchar *out, int lim, char *in, int n)
return out-out0;
}
+int
+decqp(uchar *out, int lim, char *in, int n)
+{
+ return _decqp(out, lim, in, n, 0);
+}
+
char*
decode(int kind, char *s, int *len)
{
@@ -59,10 +65,11 @@ decode(int kind, char *s, int *len)
if(s == nil)
return s;
switch(kind){
- case QuotedPrintable:
+ case QuotedPrintable
+ case QuotedPrintableU:
l = strlen(s)+1;
t = emalloc(l);
- l = decqp((uchar*)t, l, s, l-1);
+ l = decqp((uchar*)t, l, s, l-1, kind==QuotedPrintableU);
*len = l;
t[l] = 0;
return t;
@@ -202,7 +209,7 @@ unrfc2047(char *s)
case 'q':
case 'Q':
*u = 0;
- v = decode(QuotedPrintable, t, &len);
+ v = decode(QuotedPrintableU, t, &len);
break;
case 'b':
case 'B':