summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
Diffstat (limited to 'tools')
-rw-r--r--tools/mail-scan.c20
1 files changed, 16 insertions, 4 deletions
diff --git a/tools/mail-scan.c b/tools/mail-scan.c
index c70a1de..3749945 100644
--- a/tools/mail-scan.c
+++ b/tools/mail-scan.c
@@ -40,6 +40,9 @@ void usage(const int sts){
" Options\n"
" -help print this msg (and exit immediately).\n"
" -maxsize ii msg size in bytes; anything bigger will be rejected.\n"
+" -vert invert: print only if *no* match.\n"
+" -l print filename only, not matching text.\n"
+" -group print a blank line after every match.\n"
"\n"
" Messages containing the string '-please-bounce-this-' will be rejected.\n"
" Messages with no date will be rejected.\n"
@@ -182,6 +185,7 @@ int main(int _argc, const char** _argv){
list<watcher> watchword;
list<string> dofile;
int vflag(0);
+ int group_flag(0);
int multi(0);
int fname_only(0);
@@ -191,9 +195,12 @@ int main(int _argc, const char** _argv){
if (prefix(arg, "-help")) {
usage(0);
}
- if (prefix(arg, "-verify")){
+ if (prefix(arg, "-vert")){
vflag++;
continue;
+ } if (prefix(arg, "-group")){
+ group_flag++;
+ continue;
} else if (prefix(arg, "-l")){
fname_only++;
continue;
@@ -212,9 +219,10 @@ int main(int _argc, const char** _argv){
}
}
+// loop over all files
for (list<string>::const_iterator file = dofile.begin();
file != dofile.end(); file++) {
-
+ int didprint(0);
struct stat filestatus;
stat(file->c_str(), &filestatus );
if (S_ISDIR(filestatus.st_mode)) {
@@ -283,18 +291,22 @@ int main(int _argc, const char** _argv){
cout << *file;
if (!fname_only) cout << " :: " << header;
cout << endl;
+ didprint++;
}
}
}
}
}
-// cout << header << endl;
} else {
// not in header
break;
}
}
- if (vflag && !foundsome_infile) cout << foundsome_infile
+ if (vflag && !foundsome_infile) {
+ cout << foundsome_infile
<< " ... " << *file << endl;
+ didprint++;
+ }
+ if (group_flag && didprint) cout << endl;
}
}