aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/upas/scanmail
diff options
context:
space:
mode:
authorrsc <devnull@localhost>2006-02-11 23:38:55 +0000
committerrsc <devnull@localhost>2006-02-11 23:38:55 +0000
commitb5f65921f346e6b4335f77e457ac5bcae0ab9d67 (patch)
treed85d6da9def0b62b51537bf6348b43252ad69f5f /src/cmd/upas/scanmail
parente4d832222ba5519db94c7512c1fb82bd32491120 (diff)
downloadplan9port-b5f65921f346e6b4335f77e457ac5bcae0ab9d67.tar.gz
plan9port-b5f65921f346e6b4335f77e457ac5bcae0ab9d67.tar.bz2
plan9port-b5f65921f346e6b4335f77e457ac5bcae0ab9d67.zip
various cleanup
Diffstat (limited to 'src/cmd/upas/scanmail')
-rw-r--r--src/cmd/upas/scanmail/common.c14
-rw-r--r--src/cmd/upas/scanmail/mkfile16
-rw-r--r--src/cmd/upas/scanmail/scanmail.c12
-rw-r--r--src/cmd/upas/scanmail/testscan.c4
4 files changed, 20 insertions, 26 deletions
diff --git a/src/cmd/upas/scanmail/common.c b/src/cmd/upas/scanmail/common.c
index b6ea720d..eab9e2fc 100644
--- a/src/cmd/upas/scanmail/common.c
+++ b/src/cmd/upas/scanmail/common.c
@@ -585,15 +585,15 @@ matchpat(Pattern *p, char *message, Resub *m)
if(c1 == spat->c1)
if(memcmp(s, spat->string, spat->len) == 0)
if(!isalt(message, spat->alt)){
- m->sp = s;
- m->ep = s + spat->len;
+ m->s.sp = s;
+ m->e.ep = s + spat->len;
return 1;
}
}
}
return 0;
}
- m->sp = m->ep = 0;
+ m->s.sp = m->e.ep = 0;
if(regexec(p->pat, message, m, 1) == 0)
return 0;
if(isalt(message, p->alt))
@@ -608,23 +608,23 @@ xprint(int fd, char *type, Resub *m)
char *p, *q;
int i;
- if(m->sp == 0 || m->ep == 0)
+ if(m->s.sp == 0 || m->e.ep == 0)
return;
/* back up approx 30 characters to whitespace */
- for(p = m->sp, i = 0; *p && i < 30; i++, p--)
+ for(p = m->s.sp, i = 0; *p && i < 30; i++, p--)
;
while(*p && *p != ' ')
p--;
p++;
/* grab about 30 more chars beyond the end of the match */
- for(q = m->ep, i = 0; *q && i < 30; i++, q++)
+ for(q = m->e.ep, i = 0; *q && i < 30; i++, q++)
;
while(*q && *q != ' ')
q++;
- fprint(fd, "%s %.*s~%.*s~%.*s\n", type, (int)(m->sp-p), p, (int)(m->ep-m->sp), m->sp, (int)(q-m->ep), m->ep);
+ fprint(fd, "%s %.*s~%.*s~%.*s\n", type, (int)(m->s.sp-p), p, (int)(m->e.ep-m->s.sp), m->s.sp, (int)(q-m->e.ep), m->e.ep);
}
enum {
diff --git a/src/cmd/upas/scanmail/mkfile b/src/cmd/upas/scanmail/mkfile
index 5f0db855..630150e6 100644
--- a/src/cmd/upas/scanmail/mkfile
+++ b/src/cmd/upas/scanmail/mkfile
@@ -1,4 +1,4 @@
-</$objtype/mkfile
+<$PLAN9/src/mkhdr
TARG=scanmail\
testscan
@@ -8,17 +8,11 @@ OFILES= common.$O
HFILES= spam.h\
../common/sys.h\
-LIB= ../common/libcommon.a$O\
+LIB= ../common/libcommon.a
-BIN=/$objtype/bin/upas
-UPDATE=\
- mkfile\
- $HFILES\
- ${OFILES:%.$O=%.c}\
- ${TARG:%=%.c}\
-
-</sys/src/cmd/mkmany
+BIN=$BIN/upas
+<$PLAN9/src/mkmany
CFLAGS=$CFLAGS -I../common
scanmail.$O: scanmail.c
- $CC $CFLAGS -D'SPOOL="/mail"' scanmail.c
+ $CC $CFLAGS -D'SPOOL="'$PLAN9'/mail"' scanmail.c
diff --git a/src/cmd/upas/scanmail/scanmail.c b/src/cmd/upas/scanmail/scanmail.c
index 444bbcdd..b99d9485 100644
--- a/src/cmd/upas/scanmail/scanmail.c
+++ b/src/cmd/upas/scanmail/scanmail.c
@@ -313,7 +313,7 @@ matcher(char *action, Pattern *p, char *message, Resub *m)
char *cp;
String *s;
- for(cp = message; matchpat(p, cp, m); cp = m->ep){
+ for(cp = message; matchpat(p, cp, m); cp = m->e.ep){
switch(p->action){
case SaveLine:
if(vflag)
@@ -340,12 +340,12 @@ matcher(char *action, Pattern *p, char *message, Resub *m)
case Dump:
if(vflag)
xprint(2, action, m);
- *(m->ep) = 0;
+ *m->e.ep = 0;
if(!tflag){
s = s_new();
s_append(s, sender);
s = unescapespecial(s);
- syslog(0, "smtpd", "Dumped %s [%s] to %s", s_to_c(s), m->sp,
+ syslog(0, "smtpd", "Dumped %s [%s] to %s", s_to_c(s), m->s.sp,
s_to_c(s_restart(recips)));
s_free(s);
}
@@ -367,17 +367,17 @@ saveline(char *file, char *sender, Resub *rp)
int i, c;
Biobuf *bp;
- if(rp->sp == 0 || rp->ep == 0)
+ if(rp->s.sp == 0 || rp->e.ep == 0)
return;
/* back up approx 20 characters to whitespace */
- for(p = rp->sp, i = 0; *p && i < 20; i++, p--)
+ for(p = rp->s.sp, i = 0; *p && i < 20; i++, p--)
;
while(*p && *p != ' ')
p--;
p++;
/* grab about 20 more chars beyond the end of the match */
- for(q = rp->ep, i = 0; *q && i < 20; i++, q++)
+ for(q = rp->e.ep, i = 0; *q && i < 20; i++, q++)
;
while(*q && *q != ' ')
q++;
diff --git a/src/cmd/upas/scanmail/testscan.c b/src/cmd/upas/scanmail/testscan.c
index e5ea59ad..48cd4bbf 100644
--- a/src/cmd/upas/scanmail/testscan.c
+++ b/src/cmd/upas/scanmail/testscan.c
@@ -191,11 +191,11 @@ matchaction(Patterns *pp, char *message)
p = pp->strings;
ret = 0;
if(p)
- for(cp = message; matcher(name, p, cp, m); cp = m[0].ep)
+ for(cp = message; matcher(name, p, cp, m); cp = m[0].e.ep)
ret++;
for(p = pp->regexps; p; p = p->next)
- for(cp = message; matcher(name, p, cp, m); cp = m[0].ep)
+ for(cp = message; matcher(name, p, cp, m); cp = m[0].e.ep)
ret++;
return ret;
}