9 Commits

Author SHA1 Message Date
29a1add6f0 Updates to the news and todo list. 2023-02-23 12:59:33 +01:00
0be2cf9fda Deleting the old ChangeLog.
The git commit logs are now the source of truth about changes in the source
tree.

The contents of the ChangeLog file have been preserved as a comment to
commit 0649ac9.
2023-02-23 12:54:25 +01:00
a7920dedf3 Markdown conversion, email address obfuscation. 2023-02-17 23:37:35 +01:00
5cc84ca1bd Implement a debug mode ("--debug"). 2023-02-17 22:19:36 +01:00
af7c6c8ced Minor code cleanup and indentation. 2023-02-17 20:55:52 +01:00
7dd6f3d69d Merge branch 'documentation' 2023-02-12 21:52:03 +01:00
10a9440e57 New task - add a debug function. 2023-02-12 21:03:03 +01:00
994cb03fe5 Merge branch 'documentation' 2023-02-12 18:35:35 +01:00
c527aff34b Markdown conversion. 2023-02-12 18:30:27 +01:00
12 changed files with 253 additions and 625 deletions

384
ChangeLog
View File

@@ -1,384 +0,0 @@
Mon Oct 23 01:29:07 CEST 2006 Daniel Spiljar <dspiljar@panix.com>
* src/mboxgrep.h, src/main.c, src/mbox.c, src/mbox.h, src/scan.c:
temporary mbox file (used for deleting messages) is now created
by tmpmbox_create(), tmpp global pointer is killed; portions of
code in scan.c are replaced by single call of mbox_write_message();
scan.c no longer includes zlib.h and bzlib.h
Thu Oct 19 03:50:38 CEST 2006 Daniel Spiljar <dspiljar@panix.com>
* src/mboxgrep.h, src/main.c, src/maildir.c, src/scan.c:
got rid off tmpp and maildir_count global variables (code
cleanup)
Thu Oct 19 03:38:24 CEST 2006 Daniel Spiljar <dspiljar@panix.com>
* src/mboxgrep.h, src/main.c, src/scan.c:
introduction of the global runtime_t structure; mailbox counter,
MD5 hash and other global variables are now part of it (code
cleanup)
Fri Jul 7 06:10:51 CEST 2006 Daniel Spiljar <dspiljar@panix.com>
* src/mboxgrep.h, src/re.c, src/re.h, src/scan.c:
portions of scan_mailbox() have been moved to new functions,
pcre_match() and regex_match() (code cleanup)
Thu Jul 6 13:54:23 CEST 2006 Daniel Spiljar <dspiljar@panix.com>
* src/main.c, src/mboxgrep.h, src/re.c, src/re.h, src/scan.c:
main() has been partially uncluttered by moving portions of the
code to functions pcre_init() and regex_init()
Thu Jul 6 12:49:59 CEST 2006 Daniel Spiljar <dspiljar@panix.com>
* src/main.c, src/mboxgrep.h, src/misc.c, src/misc.h:
variables regex_s and haveregex are now part of the option_t
structure (code cleanup)
Thu Jul 6 10:26:57 CEST 2006 Daniel Spiljar <dspiljar@panix.com>
* src/main.c, src/misc.c, src/misc.h:
parts of main() have been moved to set_default_options() and
get_runtime_options() (code cleanup)
Sat Jul 1 13:06:37 CEST 2006 Daniel Spiljar <dspiljar@panix.com>
* src/mbox.c, src/mbox.h:
file mode and ownership-altering code has been moved to a separate
function, tmpfile_mod_own (code cleanup)
Tue Jun 27 18:48:00 CEST 2006 Daniel Spiljar <dspiljar@panix.com>
* src/mbox.c, src/mbox.h:
portions of the code from tmpfile_open moved to a new function,
tmpfile_name (code cleanup)
Mon Feb 20 18:09:59 CET 2006 Daniel Spiljar <dspiljar@panix.com>
* src/maildir.c, src/mh.c:
removed some unused variables (have_return_path)
Mon Jan 30 01:35:30 CET 2006 Daniel Spiljar <dspiljar@panix.com>
* src/mboxgrep.h, src/maildir.c, src/mh.c, src/mbox.c, src/scan.c, src/main.c:
boxname, outboxname, pipecmd and tmpfilename are now a part of
the config_t structure and no longer global variables
Sat Jan 21 08:18:29 CET 2006 Daniel Spiljar <dspiljar@panix.com>
* src/scan.c, src/misc.c, src/misc.h:
created postmark_print() to unclutter scan_mailbox()
Fri Jan 20 05:36:44 CET 2006 Daniel Spiljar <dspiljar@panix.com>
* src/misc.c, src/misc.h, src/mbox.c, src/maildir.c, src/mh.c:
some repetitive code moved to malloc_message()
Fri Jan 20 05:13:06 CET 2006 Daniel Spiljar <dspiljar@panix.com>
* src/mbox.c:
cleanup of mbox_write_message(); use of gzwrite_loop() and
bzwrite_loop()
Fri Jan 20 03:57:28 CET 2006 Daniel Spiljar <dspiljar@panix.com>
* src/scan.c, src/wrap.h, src/wrap.c:
wrote gzwrite_loop() and bzwrite_loop() to remove some repetitive
code from scan.c
Fri Jan 20 02:11:50 CET 2006 Daniel Spiljar <dspiljar@panix.com>
* src/scan.c:
md5_check_message(): array b and cast in strncmp are no longer
unsigned
Wed Jan 18 01:48:56 CET 2006 Daniel Spiljar <dspiljar@panix.com>
* src/info.c, src/mboxgrep.h:
updated copyright information, changed author's email address
to the one at Panix
Mon Apr 12 19:30:52 CEST 2004 Daniel Spiljar <dspiljar@world.std.com>
* src/info.c:
updated copyright information
Sun Apr 11 23:45:08 CEST 2004 Daniel Spiljar <dspiljar@world.std.com>
* src/mbox.h, src/mbox.c, src/scan.c, src/main.c:
mbox_write_message(); further fixes of message deletion code
Thu Sep 18 00:10:13 CEST 2003 Daniel Spiljar <dspiljar@world.std.com>
* src/scan.c:
fixed deleting messages from mbox folders compressed with
bzip2
Thu Sep 18 00:08:36 CEST 2003 Daniel Spiljar <dspiljar@world.std.com>
* src/main.c, src/mbox.c:
moved James P. Dugal's ownership-preserving code from main()
to tmpfile_open()
Sat Aug 30 23:13:01 CEST 2003 Vid Strpic <vms@bofhlet.net>
* src/info.c:
If bzip2 support is compiled in, `--help' command should list
`bz2mbox' as a valid option to `--mailbox-format='.
Sun Aug 24 21:49:52 CEST 2003 Daniel Spiljar <dspiljar@world.std.com>
* doc/mboxgrep.1, doc/mboxgrep.texi:
small updates
Sat Aug 23 20:56:39 CEST 2003 James P. Dugal <jpd@louisiana.edu>
* src/main.c, src/mbox.h, src/mbox.c
If we are to use rename() to move a temp file (resulting from
deletions done in a mailbox) back over the original mailbox, we
must be sure the temp file is on the same file system. Also,
we should try to preserve the same ownership and permissions.
Mon Aug 11 00:39:14 CEST 2003 Daniel Spiljar <dspiljar@world.std.com>
* configure.ac:
look for pcre-config(1) script; this effectively fixes a
compilation bug on recent RedHat Linux systems
Sun Apr 13 21:16:25 CEST 2003 Daniel Spiljar <dspiljar@world.std.com>
* src/info.c, src/info.h:
print_wrap(); list of compile-time options is now printed wrapped
Mon Apr 7 01:24:20 CEST 2003 Daniel Spiljar <dspiljar@world.std.com>
* src/mbox.c, src/wrap.c, src/wrap.h:
m_gzdopen()
Sun Apr 6 23:04:19 CEST 2003 Daniel Spiljar <dspiljar@world.std.com>
* src/mbox.c, src/mbox.h, src/mboxgrep.h, src/misc.c, src/scan.c:
support for bzip2 compressed mailboxes
Fri Apr 4 00:14:01 CEST 2003 Daniel Spiljar <dspiljar@world.std.com>
* configure.ac:
check for libbz2
Sun Oct 27 23:57:31 CET 2002 Daniel Spiljar <dspiljar@world.std.com>
* src/mbox.c:
mbox_open() should now complain if called with an unknown argument
mode. Shouldn't normally happen, but...
Sun Aug 25 22:43:38 CEST 2002 Daniel Spiljar <dspiljar@bofhlet.net>
* src/main.c, src/mbox.c, src/mbox.h, src/scan.c:
removed the gzmbox* functions in order to avoid code duplication;
as a side effect, mboxgrep can now read compressed mbox folders
from standard input
Sun Aug 11 01:36:02 CEST 2002 Daniel Spiljar <dspiljar@bofhlet.net>
* configure.ac:
AC_HEADER_STDC, which fixed another compiler warning
Sat Aug 10 22:03:31 CEST 2002 Daniel Spiljar <dspiljar@bofhlet.net>
* src/main.c, src/mbox.c, src/mh.c, src/scan.c, src/misc.c, src/maildir.c, src/mboxgrep.h:
made various code cleanups: got rid of a couple of global variables,
fixed compiler warnings and things like that
Sat Aug 10 00:35:21 CEST 2002 Daniel Spiljar <dspiljar@bofhlet.net>
* src/mh.h, src/wrap.h, src/mboxgrep.h:
removed some unnecessary #defines that have been causing compiler
errors
Sun Aug 4 20:11:29 CEST 2002 Daniel Spiljar <dspiljar@bofhlet.net>
* src/main.c, src/scan.c, src/scan.h:
code clean up: moved recursive scan code from main()
to recursive_scan()
Wed Jul 24 00:20:59 CEST 2002 Daniel Spiljar <dspiljar@bofhlet.net>
* src/maildir.c:
same thing with maildir as with MH below
Sat Jul 6 22:51:45 CEST 2002 Daniel Spiljar <dspiljar@bofhlet.net>
* src/mh.c:
MH module doesn't read files which aren't RFC 2822 messages anymore
Sat Jun 29 01:43:36 CEST 2002 Daniel Spiljar <dspiljar@bofhlet.net>
* configure.in, src/maildir.c, src/main.c, src/mbox.c, src/mh.c, src/scan.c:
added debugging with dmalloc library
Sat Jun 29 01:39:21 CEST 2002 Daniel Spiljar <dspiljar@bofhlet.net>
* src/mbox.c, src/maildir.c:
fixed potential problem as with MH folders (below)
Sat Jun 29 01:28:30 CEST 2002 Daniel Spiljar <dspiljar@bofhlet.net>
* src/mh.c, src/scan.c:
(hopefully) fixed crashes on MH folders
Sat Feb 23 22:22:12 CET 2002 Daniel Spiljar <dspiljar@bofhlet.net>
* src/mbox.c, src/maildir.c, src/mh.c, src/misc.c:
removed useless code that required strptime ()
Sat Feb 23 15:43:05 CET 2002 Daniel Spiljar <dspiljar@bofhlet.net>
* src/main.c, src/mbox.h, src/mbox.c, src/scan.c:
mboxgrep can now read mbox folders from standard input
Fri Feb 8 02:15:36 CET 2002 Daniel Spiljar <dspiljar@bofhlet.net>
* src/main.c:
fixed a bug which prevented mboxgrep from being compiled;
this happened because I've put some assignments *before*
declarations
Wed Feb 6 23:11:50 CET 2002 Daniel Spiljar <dspiljar@bofhlet.net>
* src/maildir.c, src/main.c, src/mbox.c, src/mboxgrep.h, src/mh.c, src/mh.h, src/misc.c, src/scan.c, src/wrap.c
code cleanups; many global variables have been replaced with
a single option_t structure
Fri Feb 1 00:31:05 CET 2002 Daniel Spiljar <dspiljar@bofhlet.net>
* src/maildir.c:
fixed a bug which occured on recursive search of maildirs
Wed Jan 2 00:32:37 CET 2002 Daniel Spiljar <dspiljar@bofhlet.net>
* src/main.c, src/misc.c, src/wrap.h:
applied a patch (kindly submitted by John R. Daily
<jdaily@progeny.com>), which fixes missing prototypes that might
cause mboxgrep to coredump on IA64 platform
Sat Dec 15 20:12:40 CET 2001 Daniel Spiljar <dspiljar@bofhlet.net>
* src/main.c, src/scan.c, src/scan.h:
recursive search through directories has been reimplemented
Sat Dec 8 22:13:54 CET 2001 Daniel Spiljar <dspiljar@bofhlet.net>
* src/main.c, src/maildir.c:
replaced remaining occurences of malloc() with xmalloc()
Sat Dec 8 21:21:58 CET 2001 Daniel Spiljar <dspiljar@bofhlet.net>
* src/maildir.c, src/main.c, src/mbox.c, src/mh.c, src/misc.c, src/scan.c, src/wrap.c, src/wrap.h:
wrote xstrdup(), an error-checking wrapper around strdup() and
replaced all occurences of strdup() with xstrdup()
Sun Dec 2 18:05:57 CET 2001 Daniel Spiljar <dspiljar@bofhlet.net>
* src/Makefile.in, src/info.c, src/main.c, src/mboxgrep.h, src/md5.c, src/md5.h, src/scan.c, src/scan.h, doc/mboxgrep.texi:
mboxgrep can now ignore duplicate messages, thanks to the MD5
algorithm
* src/maildir.c, src/main.c, src/scan.c, src/wrap.c, src/wrap.h:
wrote xcalloc() and renamed m_realloc() to xrealloc()
Sat Nov 17 22:57:57 CET 2001 Daniel Spiljar <dspiljar@bofhlet.net>
* src/mbox.c, src/mh.c, src/maildir.c
message->headers and message->body pointers are now initially malloc'd
to size of one character in order to prevent NULL pointers from being
passed to regexec()
Wed Nov 7 22:47:34 CET 2001 Daniel Spiljar <dspiljar@bofhlet.net>
* configure.ac, src/mboxgrep.h, src/main.c, src/misc.h, src/misc.c, src/info.c, src/config.h, src/mbox.c:
file locking method can now be selected at run time
* src/info.c, src/maildir.c, src/main.c, src/mbox.h, src/misc.c, src/scan.c, src/Makefile.in
changed `#include "config.h"' to `#include <config.h>', and fixed
other bugs with #including
Sat Nov 3 16:08:22 CET 2001 Daniel Spiljar <dspiljar@bofhlet.net>
* configure.ac, src/config.h.in, src/info.c, src/mbox.c
files can be locked with flock() instead of fcntl(), if
enabled at compile time
Sun Oct 28 19:01:44 CET 2001 Daniel Spiljar <dspiljar@bofhlet.net>
* src/Makefile.in:
forgot to mention getopt.c and getopt1.c
Sun Oct 28 16:06:28 CET 2001 Daniel Spiljar <dspiljar@bofhlet.net>
* src/mh.c, src/main.c, src/scan.c:
#included certain neccessary files
Sun Oct 28 14:43:21 CET 2001 Daniel Spiljar <dspiljar@bofhlet.net>
* src/maildir.c, src/maildir.h, src/scan.c:
wrote functions maildir_check and maildir_create;
if the target maildir doesn't exist, mboxgrep creates one;
if it does exist, mboxgrep checks its consistency and refuses to
write to it unless `tmp', `new' and `cur' subdirectories exist
Sun Oct 28 13:02:10 CET 2001 Daniel Spiljar <dspiljar@bofhlet.net>
* src/info.c, doc/mboxgrep.texi, doc/mboxgrep.1
the "--regexp" command was implemented in version 0.7.0, but I
forgot to document it
Sat Oct 27 21:48:36 CEST 2001 Daniel Spiljar <dspiljar@bofhlet.net>
* src/scan.c:
if the input is a non-mbox folder, a proper postmark line (with
date) is put on top of each message written to stdout
Mon Oct 8 22:53:34 CEST 2001 Daniel Spiljar <dspiljar@bofhlet.net>
* src/*:
source code now completely rewritten
Sun May 27 00:19:52 CEST 2001 Daniel Spiljar <dspiljar@public.srce.hr>
* doc/mboxgrep.1:
updated the manual page -- it now refers to RFC 2822, instead
of the obsoleted 822
Tue May 1 15:06:03 CEST 2001 Daniel Spiljar <dspiljar@public.srce.hr>
* configure.in, doc/Makefile.in, src/Makefile.in, Makefile.in:
moved manpage to the `doc' subdirectory; changed files above
accordingly
Sun Apr 15 23:00:08 CEST 2001 Daniel Spiljar <dspiljar@public.srce.hr>
* src/mboxgrep.h, src/main.c, src/file.c, src/scan.c, src/info.c:
added support for writing messages to another mail folder
Mon Apr 9 21:55:15 CEST 2001 Daniel Spiljar <dspiljar@public.srce.hr>
* src/file.c, src/scan.c: all calls of malloc() are now checked
and mboxgrep exits with code 2 if it fails to allocate memory
Sun Apr 8 19:40:33 CEST 2001 Daniel Spiljar <dspiljar@public.srce.hr>
* src/mboxgrep.h, src/main.c: wrote mboxgrep_stat()
Sun Apr 8 16:58:36 CEST 2001 Daniel Spiljar <dspiljar@public.srce.hr>
* src/mboxgrep.h, src/main.c: wrote mboxgrep_error()
Tue Mar 27 01:26:22 CEST 2001 Daniel Spiljar <dspiljar@public.srce.hr>
* configure.in: check for gethostname()
$Id: ChangeLog,v 1.59 2006-10-22 23:34:47 dspiljar Exp $

View File

@@ -1,110 +1,129 @@
Changes of mboxgrep
===================
# Changes of mboxgrep
Changes since 0.7.9
## Changes since 0.7.9
- development has been restarted after a longer hiatus
- moved the source tree to git
- fixed compile bug on FreeBSD and other systems
- fixed deleting messages mbox folders compressed with bzip2
- fixed multiple compilation errors and warnings on Linux and FreeBSD
- started implementing a debug mode
## Changes since 0.7.8
Changes since 0.7.8
- implemented support for mbox folders compressed with bzip2 algorithm
- improved detection of PCRE library; this also fixes a compilation bug
on recent RedHat Linux systems
- fixed a problem with message deletion, which used to occur if an mbox
folder and temporary directory were on different filesystems;
thanks to James P. Dugal <jpd@louisiana.edu> for providing a patch
thanks to James P. Dugal <jpd AT louisiana.edu> for providing a patch
## Changes since 0.7.7
Changes since 0.7.7
- fixed crashes on MH folders, as well as a potential problem with mbox
and maildir folders with the same cause
- debugging with dmalloc library
- debugging with the dmalloc library
- MH and maildir functions no longer read files which aren't RFC 2822 messages
- mboxgrep can now read gzip compressed mbox folders from standard input
(which is a side effect of a code cleanup!)
Changes since 0.7.6a
## Changes since 0.7.6a
- mboxgrep can now read mbox folders from standard input
Changes since 0.7.6
## Changes since 0.7.6
- fixed a bug which prevented mboxgrep from being compiled
Changes since 0.7.5
## Changes since 0.7.5
- fixed a bug which caused mboxgrep to coredump on recursive search of
maildirs
- code cleanups
Changes since 0.7.4
## Changes since 0.7.4
- recursive search through directories has been reimplemented
Changes since 0.7.3
## Changes since 0.7.3
- mboxgrep can now ignore messages with identical bodies
Changes since 0.7.2
## Changes since 0.7.2
- file locking method can be selected at runtime
- mboxgrep used to coredump on messages with empty headers; the problem is
now hopefully fixed
- mboxgrep now compiles on FreeBSD
Changes since 0.7.1
- file locking with flock() instead of fcntl() is now supported
- mboxgrep should now compile on systems which don't have getopt_long()
## Changes since 0.7.1
- file locking with `flock()` instead of `fcntl()` is now supported
- mboxgrep should now compile on systems which don't have `getopt_long()`
- other minor bugfixes
Changes since 0.7.0
## Changes since 0.7.0
- bugfixes
Changes since 0.5.3
## Changes since 0.5.3
- NOTE: there was no stable version between 0.5.x and 0.7.x
- mboxgrep is almost completely rewritten
- implemented message deleting feature (--delete)
- implemented piping messages to a command (--pipe) (using this option,
- implemented message deleting feature (`--delete`)
- implemented piping messages to a command (`--pipe`) (using this option,
each selected message is piped to a separate instance of the specified
command)
- added support for compressed mbox folders
Changes since 0.5.2
## Changes since 0.5.2
- implemented ability to write found messages to another folder (instead
of stdout)
- started writing *real* changelog (while this file has been renamed to
of standard output)
- started writing a *real* changelog (while this file has been renamed to
"NEWS")
- wrote a manual in Texinfo format
Changes since 0.5.1
- implemented message counting (-c, --count)
- fixed manual page installation target in src/Makefile.in -- manual page
is now installed in $(manpath)/man1/ rather than in $(prefix)/man/man1/
- added `--without-sense-of-humor' switch to the configure script, which
disables checking whether Garfield still hates Mondays
- short version of `--version' switch is now `-V' instead of `-v',
because `-v' will be used for inverted matching
- implemented inverted matching (-v, --invert-match)
- implemented recursive search through directories (-r, --recursive)
- config.h[.in] is now wrapped (#ifndef CONFIG_H and stuff)
## Changes since 0.5.1
- implemented message counting (`-c, --count`)
- fixed manual page installation target in src/Makefile.in -- manual page
is now installed in `$(manpath)/man1/` rather than `$(prefix)/man/man1/`
- added `--without-sense-of-humor` switch to the configure script, which
disables checking whether Garfield still hates Mondays
- short version of `--version` switch is now `-V` instead of `-v`,
because `-v` will be used for inverted matching
- implemented inverted matching (`-v, --invert-match`)
- implemented recursive search through directories (`-r, --recursive`)
- config.h[.in] is now wrapped (`#ifndef CONFIG_H` and stuff)
## Changes since 0.5.0
Changes since 0.5.0
- added support for qmail-style maildir folders
Changes since 0.4.0
- source of getopt_long() is now included, so long options are also available
## Changes since 0.4.0
- the source of `getopt_long()` is now included, so long options are also available
on platforms that don't use GNU libc
- file locking is now performed on mbox folders only
Changes since 0.2.0
- added support for MH mailboxes
- added scope selection switches `-B' (or `--body') and `-H' (or `--headers')
- getopt() (or getopt_long(), if available) is now used to parse command line
arguments, instead of my own lousy routine
- configure script now looks for PCRE by default, unless `--with-pcre=no' or
`--without-pcre' is specified
- the feature of reading from standard input is gone
- added `-v' (or `--version') switch
## Changes since 0.2.0
- added support for MH mailboxes
- added scope selection switches `-B` (or `--body`) and `-H` (or `--headers`)
- `getopt()` (or `getopt_long()`, if available) is now used to parse command line
arguments, instead of my own lousy routine
- the configure script now looks for PCRE by default, unless `--with-pcre=no` or
`--without-pcre` is specified
- the feature of reading from standard input is gone
- added `-v` (or `--version`) switch
## Changes since 0.1.1
Changes since 0.1.1
- mboxgrep now puts a shared lock on a mailbox before reading it
- various code cleanups
Changes since 0.1.0
- fixed install target in Makefile (`install' is now used instead of `cp')
## Changes since 0.1.0
- fixed install target in Makefile (`install` is now used instead of `cp`)
- added support for mailboxes generated by Gnus
$Id: NEWS,v 1.23 2004-04-11 21:48:53 dspiljar Exp $

View File

@@ -13,6 +13,7 @@
- [ ] literal date matching
- [x] reading messages from standard input
- [x] run-time selection of file locking method
- [x] add a debug function
## File formats, encodings and standards

View File

@@ -1,5 +0,0 @@
This directory is intended to hold third-party contributions.
- mboxgrep.spec is an RPM spec file, kindly contributed by
Vaclav Slavik <v.slavik@volny.cz>

3
contrib/README.md Normal file
View File

@@ -0,0 +1,3 @@
This directory is intended to hold third-party contributions.
- mboxgrep.spec is an RPM spec file, kindly contributed by Vaclav Slavik <v.slavik AT volny.cz>

View File

@@ -1,5 +1,4 @@
.Id $Id: mboxgrep.1,v 1.16 2006-01-18 00:09:58 dspiljar Exp $
.TH MBOXGREP 1 "26 Jan 2023"
.TH MBOXGREP 1 "17 Feb 2023"
.SH NAME
mboxgrep \- displays email messages matching a pattern
.SH SYNOPSIS
@@ -86,6 +85,10 @@ Ignore duplicate messages.
Select input and output mailbox TYPE. TYPE can be either `mbox' (default),
`zmbox' (gzip compressed mbox), `bz2mbox' (bzip2 compressed mbox), `mh', `nnml',
`nnmh' or `maildir'.
.IP "-s, --no-messages"
Suppress most error messages.
.IP "--debug"
Print messages useful for debugging.
.SH EXAMPLES
.TP
\(bu

View File

@@ -169,6 +169,9 @@ options below change such behavior.
'-s'
Suppress error messages.
'--debug'
Print messages useful for debugging.

File: mboxgrep.info, Node: Search scope selection, Next: Mailbox type selection, Prev: Output control, Up: Invoking
@@ -253,11 +256,11 @@ Node: Miscellaneous1827
Node: File locking2112
Node: Regexp selection2749
Node: Output control3301
Node: Search scope selection4292
Node: Mailbox type selection4533
Node: Examples4854
Node: Bugs5678
Node: To Vicky6096
Node: Search scope selection4345
Node: Mailbox type selection4586
Node: Examples4907
Node: Bugs5731
Node: To Vicky6149

End Tag Table

View File

@@ -6,7 +6,7 @@
@set EDITION 0.7
@set VERSION 0.7.10
@set UPDATED 26 Jan 2023
@set UPDATED 17 Feb 2023
@dircategory Mail
@direntry
@@ -188,6 +188,9 @@ instance of COMMAND.
@itemx -s
Suppress error messages.
@item --debug
Print messages useful for debugging.
@end table
@node Search scope selection, Mailbox type selection, Output control, Invoking

View File

@@ -120,7 +120,8 @@ help (void)
" -nd, --no-duplicates\t\tIgnore duplicate messages\n"
" -o, --output=MAILBOX\t\tWrite messages to MAILBOX\n"
" -p, --pipe=COMMAND\t\tPipe each found message to COMMAND\n"
" -s, --no-messages\t\tSuppress most error messages\n\n"
" -s, --no-messages\t\tSuppress most error messages\n"
" --debug\t\t\tPrint messages useful for debugging\n\n"
"Matching criteria:\n\n"
" -E, --extended-regexp\tPATTERN is an extended regular expression\n"
" -G, --basic-regexp\t\tPATTERN is a basic regular expression\n");

View File

@@ -48,8 +48,6 @@ runtime_t runtime;
int
main (int argc, char **argv)
/* {{{ */
{
int havemailbox = 0;
int singlefile = 0;
@@ -57,8 +55,6 @@ main (int argc, char **argv)
runtime.maildir_count = 0;
static struct option long_options[] =
/* {{{ */
{
{"count", 0, 0, 'c'},
{"delete", 0, 0, 'd'},
@@ -80,13 +76,12 @@ main (int argc, char **argv)
{"output", 1, 0, 'o'},
{"no-duplicates", 0, 0, 200},
{"no-file-lock", 0, 0, 201},
{"debug", 0, 0, 202},
{"file-lock", 1, 0, 'l'},
{"recursive", 0, 0, 'r'},
{0, 0, 0, 0}
};
/* }}} */
set_default_options ();
get_runtime_options (&argc, argv, long_options);
@@ -112,17 +107,17 @@ main (int argc, char **argv)
config.regex_s = xstrdup (argv[optind]);
config.haveregex = 1;
++optind;
} /* if */
}
if (config.haveregex)
{
#ifdef HAVE_LIBPCRE
if (config.perl)
pcre_init ();
pcre_init ();
else
#endif /* HAVE_LIBPCRE */
regex_init ();
} /* if */
regex_init ();
}
else
usage ();
@@ -130,56 +125,49 @@ main (int argc, char **argv)
singlefile = 1;
while (optind < argc)
/* {{{ */
{
if (config.action == DELETE) {
tmpmbox_create (argv[optind]);
runtime.tmp_mbox = (mbox_t *) mbox_open (config.tmpfilename, "w");
}
if (config.action == DELETE)
{
tmpmbox_create (argv[optind]);
runtime.tmp_mbox = (mbox_t *) mbox_open (config.tmpfilename, "w");
}
config.boxname = xstrdup (argv[optind]);
if (config.recursive)
recursive_scan (argv[optind]);
recursive_scan (argv[optind]);
else
scan_mailbox (argv[optind]);
havemailbox = 1;
if (config.action == COUNT)
{
if (singlefile)
fprintf (stdout, "%i\n", runtime.count);
else
{
if (0 == strcmp ("-", argv[optind]))
fprintf (stdout, "(standard input):%i\n", runtime.count);
else
fprintf (stdout, "%s:%i\n", argv[optind], runtime.count);
}
}
if (config.action == DELETE)
{
mbox_close (runtime.tmp_mbox);
rename (config.tmpfilename, argv[optind]);
}
++optind;
} /* while */
scan_mailbox (argv[optind]);
/* }}} */
havemailbox = 1;
if (config.action == COUNT)
{
if (singlefile)
fprintf (stdout, "%i\n", runtime.count);
else
{
if (0 == strcmp ("-", argv[optind]))
fprintf (stdout, "(standard input):%i\n", runtime.count);
else
fprintf (stdout, "%s:%i\n", argv[optind], runtime.count);
}
}
if (config.action == DELETE)
{
mbox_close (runtime.tmp_mbox);
rename (config.tmpfilename, argv[optind]);
}
++optind;
}
if (! havemailbox)
/* {{{ */
{
config.format = MBOX;
scan_mailbox ("-");
if (config.action == COUNT)
fprintf (stdout, "%i\n", runtime.count);
fprintf (stdout, "%i\n", runtime.count);
}
/* }}} */
return 0;
} /* main */
/* }}} */
}

View File

@@ -107,6 +107,7 @@ typedef struct
int merr;
int pid;
int haveregex;
int debug;
char hostname[HOST_NAME_SIZE];
char *boxname, *outboxname, *pipecmd, *tmpfilename, *regex_s;

View File

@@ -1,6 +1,6 @@
/* -*- C -*-
/*
mboxgrep - scan mailbox for messages matching a regular expression
Copyright (C) 2000, 2001, 2002, 2003, 2006 Daniel Spiljar
Copyright (C) 2000 - 2004, 2006, 2023 Daniel Spiljar
Mboxgrep is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
@@ -15,8 +15,7 @@
You should have received a copy of the GNU General Public License
along with mboxgrep; if not, write to the Free Software Foundation,
Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
$Id: misc.c,v 1.17 2006-07-06 10:53:49 dspiljar Exp $ */
*/
#define _XOPEN_SOURCE /* Pull in strptime(3) from time.h */
#define _BSD_SOURCE /* Compensate for _XOPEN_SOURCE to pull in strdup(3)
@@ -38,7 +37,6 @@
format_t
folder_format (const char *name)
/* {{{ */
{
format_t f;
@@ -63,16 +61,14 @@ folder_format (const char *name)
else
{
if (config.merr)
fprintf (stderr, "mboxgrep: %s: unknown folder type\n", name);
fprintf (stderr, "%s: %s: unknown folder type\n", APPNAME, name);
exit (2);
}
return f;
}
/* }}} */
lockmethod_t lock_method (const char *name)
/* {{{ */
{
lockmethod_t l;
@@ -97,38 +93,36 @@ lockmethod_t lock_method (const char *name)
return l;
}
/* }}} */
/* time_t parse_date(char *datestr) */
/* {{{ */
/* { */
/* time_t t; */
/* const char *fmt = "%d%n%b%n%Y%n%T"; */
/* int h, m; */
/* struct tm tm; */
/* char *str2, str1[BUFSIZ]; */
/*
time_t parse_date(char *datestr)
{
time_t t;
const char *fmt = "%d%n%b%n%Y%n%T";
int h, m;
struct tm tm;
char *str2, str1[BUFSIZ];
/* sscanf (datestr, "Date: %[^\r\n]", str1); */
sscanf (datestr, "Date: %[^\r\n]", str1);
/* str2 = (char *) strptime (str1, "%d%n%b%n%Y%n%T", &tm); */
/* if (str2 == NULL) */
/* str2 = (char *) strptime (str1, "%a, %d%n%b%n%Y%n%T", &tm); */
/* if (str2 == NULL) */
/* return (time_t) 0; */
/* if (sscanf (str2, "%3d%2d", &h, &m) == 2) */
/* { */
/* tm.tm_hour -= h; */
/* tm.tm_min -= (h >= 0 ? m : -m); */
/* t = (time_t) mktime (&tm); */
/* } */
str2 = (char *) strptime (str1, "%d%n%b%n%Y%n%T", &tm);
if (str2 == NULL)
str2 = (char *) strptime (str1, "%a, %d%n%b%n%Y%n%T", &tm);
if (str2 == NULL)
return (time_t) 0;
/* return t; */
/* } */
/* }}} */
if (sscanf (str2, "%3d%2d", &h, &m) == 2)
{
tm.tm_hour -= h;
tm.tm_min -= (h >= 0 ? m : -m);
t = (time_t) mktime (&tm);
}
return t;
}
*/
char * parse_return_path(char *rpath)
/* {{{ */
{
char *blah1, blah2[BUFSIZ];
@@ -137,7 +131,6 @@ char * parse_return_path(char *rpath)
return blah1;
}
/* }}} */
void * allocate_message (void)
{
@@ -188,6 +181,7 @@ set_default_options (void)
config.format = MBOX; /* default mailbox format */
config.lock = FCNTL; /* default file locking method */
config.merr = 1; /* report errors by default */
config.debug = 0;
}
void
@@ -201,103 +195,104 @@ get_runtime_options (int *argc, char **argv, struct option *long_options)
&option_index);
if (c == -1)
break;
break;
switch (c)
/* {{{ */
{
case '?':
usage();
case 'c':
config.action = COUNT;
break;
case 'd':
config.action = DELETE;
break;
case 'e':
config.regex_s = xstrdup (optarg);
config.haveregex = 1;
break;
case 'o':
config.outboxname = xstrdup (optarg);
config.action = WRITE;
break;
case 'E':
config.extended = 1;
break;
case 'G':
config.extended = 0;
break;
case 'P':
{
case '?':
usage();
case 'c':
config.action = COUNT;
break;
case 'd':
config.action = DELETE;
break;
case 'e':
config.regex_s = xstrdup (optarg);
config.haveregex = 1;
break;
case 'o':
config.outboxname = xstrdup (optarg);
config.action = WRITE;
break;
case 'E':
config.extended = 1;
break;
case 'G':
config.extended = 0;
break;
case 'P':
#ifdef HAVE_LIBPCRE
config.extended = 0;
config.perl = 1;
config.extended = 0;
config.perl = 1;
#else
fprintf(stderr,
"%s: Support for Perl regular expressions not "
"compiled in\n");
exit(2);
fprintf(stderr,
"%s: Support for Perl regular expressions not "
"compiled in\n", APPNAME);
exit(2);
#endif /* HAVE_LIBPCRE */
break;
case 'h':
help ();
break;
case 'i':
config.ignorecase = 1;
break;
case 'm':
config.format = folder_format (optarg);
break;
case 'l':
config.lock = lock_method (optarg);
break;
case 'p':
config.action = PIPE;
config.pipecmd = xstrdup (optarg);
break;
case 'V':
version ();
break;
case 'v':
config.invert = 1;
break;
case 'H':
config.headers = 1;
break;
case 'B':
config.body = 1;
break;
case 's':
config.merr = 0;
break;
case 201:
config.lock = 0;
break;
case 'r':
config.recursive = 1;
break;
case 200:
config.dedup = 1;
break;
case 'n':
{
switch (optarg[0])
{
case 'd':
config.dedup = 1;
break;
case 'l':
config.lock = 0;
break;
default:
fprintf(stderr, "%s: invalid option -- n%c\n",
APPNAME, optarg[0]);
exit(2);
}
}
} /* switch */
/* }}} */
break;
case 'h':
help ();
break;
case 'i':
config.ignorecase = 1;
break;
case 'm':
config.format = folder_format (optarg);
break;
case 'l':
config.lock = lock_method (optarg);
break;
case 'p':
config.action = PIPE;
config.pipecmd = xstrdup (optarg);
break;
case 'V':
version ();
break;
case 'v':
config.invert = 1;
break;
case 'H':
config.headers = 1;
break;
case 'B':
config.body = 1;
break;
case 's':
config.merr = 0;
break;
case 201:
config.lock = 0;
break;
case 202:
config.debug = 1;
fprintf (stderr, "%s: %s, line %d: enable debugging\n",
APPNAME, __FILE__, __LINE__);
break;
case 'r':
config.recursive = 1;
break;
case 200:
config.dedup = 1;
break;
case 'n':
{
switch (optarg[0])
{
case 'd':
config.dedup = 1;
break;
case 'l':
config.lock = 0;
break;
default:
fprintf(stderr, "%s: invalid option -- n%c\n",
APPNAME, optarg[0]);
exit(2);
}
}
} /* switch */
} /* while */
}