15 Commits

Author SHA1 Message Date
3c96a4bd4e Merge branch 'master' of github.com:dspiljar/mboxgrep 2025-07-29 21:57:09 +02:00
103e532c02 Merge pull request #6 from PPN-SD/fix_build
fix build c23
2025-07-29 21:56:22 +02:00
4ada8db692 Merge pull request #6 from PPN-SD/fix_build
fix build c23
2025-07-29 21:52:30 +02:00
Nicolas PARLANT
ad59739005 drop really old ifdef and fix C23
Signed-off-by: Nicolas PARLANT <nicolas.parlant@parhuet.fr>
2025-07-28 19:14:01 +02:00
Nicolas PARLANT
ba1513796b missing include
>getopt.c:386:30: error: call to undeclared library function 'strcmp' with type 'int (const char *, const char *)';
>      ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
>  386 |       if (optind != argc && !strcmp (argv[optind], "--"))
>      |                              ^

Signed-off-by: Nicolas PARLANT <nicolas.parlant@parhuet.fr>
2025-07-28 18:09:41 +02:00
b93a60572b Remove an obsolete macro. 2024-09-28 12:36:22 +02:00
1938d25ced Update the copyright statement. 2024-09-28 12:35:18 +02:00
7b7bafd5f8 Re-arrange the TODO list for readability. 2024-09-27 23:42:13 +02:00
eec14b33ff Fix a typo. 2024-09-27 23:41:15 +02:00
fdab5e8c5e Automake settings
Omit the contrib subdirectory from the distribution tarball.
2024-09-27 11:11:11 +02:00
66dd5fed23 Git settings
- Clean up the .gitignore file.
- Treat Info pages as binary files.
2024-09-27 10:46:40 +02:00
4cb77488bc Bump the version to 0.7.13. 2024-09-23 21:34:04 +02:00
6f8e688a46 Merge branch 'master' of github.com:dspiljar/mboxgrep 2024-09-23 16:04:20 +02:00
d8f44235f5 Fix Automake to include AUTHORS.md. 2024-09-23 14:37:53 +02:00
6e9600426a Minor update to the man and info pages
Sync the examples section, refer to RFC 4155 for the mbox mailbox
format, and add URLs to Gitea and Github.
2024-09-23 13:15:05 +02:00
14 changed files with 56 additions and 90 deletions

1
.gitattributes vendored Normal file
View File

@@ -0,0 +1 @@
*.info binary

6
.gitignore vendored
View File

@@ -4,8 +4,7 @@ config.h.in
config.log config.log
config.status config.status
src/*.o src/*.o
src/*.c~ src/*.exe
src/*.h~
src/mboxgrep src/mboxgrep
src/.deps/ src/.deps/
src/stamp-h1 src/stamp-h1
@@ -17,7 +16,6 @@ compile
depcomp depcomp
install-sh install-sh
missing missing
src/mboxgrep.exe
configure~
.gitignore .gitignore
.vscode/* .vscode/*
*~

View File

@@ -1,2 +1,2 @@
SUBDIRS = doc src SUBDIRS = doc src
EXTRA_DIST = contrib COPYING.md INSTALL.md NEWS.md README.md TODO.md EXTRA_DIST = COPYING.md INSTALL.md NEWS.md README.md TODO.md AUTHORS.md

View File

@@ -1,5 +1,12 @@
# Changes of mboxgrep # Changes of mboxgrep
## Changes in 0.7.13
- Improve the readability of this file.
- Failure to lock a file (mbox) is now a fatal error.
- Fix Autoconf on Windows.
- Code refactoring, mostly of mbox-related functions.
## Changes in 0.7.12a ## Changes in 0.7.12a
- Fix Automake macros to include the license file and others. - Fix Automake macros to include the license file and others.

12
TODO.md
View File

@@ -4,27 +4,27 @@
- [x] use cryptographic hashes for detecting duplicate messages - [x] use cryptographic hashes for detecting duplicate messages
- [x] add checking for conflicting command-line options - [x] add checking for conflicting command-line options
- [ ] support for deletion of messages after being matched and displayed
- [x] ignore .overview when grepping Gnus folders - [x] ignore .overview when grepping Gnus folders
- [x] inverted matching - [x] inverted matching
- [x] recursive search through directories - [x] recursive search through directories
- [x] writing selected messages to a new folder - [x] writing selected messages to a new folder
- [x] deleting selected messages - [x] deleting selected messages
- [ ] basic time and date matching
- [ ] more advanced time and date matching, with strings such as "yesterday"
- [x] reading messages from standard input - [x] reading messages from standard input
- [x] run-time selection of file locking method - [x] run-time selection of file locking method
- [x] add a debug function - [x] add a debug function
- [ ] support for deletion of messages after being matched and displayed
- [ ] basic time and date matching
- [ ] more advanced time and date matching, with strings such as "yesterday"
- [ ] Remove the option to recursively traverse directories and instruct the users to run mboxgrep in conjuction with find(1) instead. - [ ] Remove the option to recursively traverse directories and instruct the users to run mboxgrep in conjuction with find(1) instead.
## File formats, encodings and standards ## File formats, encodings and standards
- [x] migrate to pcre2, as pcre is obsolete - [x] migrate to pcre2, as pcre is obsolete
- [x] support for compressed mbox folders
- [x] support for bzip2 compression
- [ ] use a more modern hash function than MD5 - [ ] use a more modern hash function than MD5
- [ ] MIME support - [ ] MIME support
- [ ] support for GnuPG - [ ] support for GnuPG
- [x] support for compressed mbox folders
- [x] support for bzip2 compression
- [ ] support for XZ-format compression - [ ] support for XZ-format compression
- [ ] support for mail folder conversion - [ ] support for mail folder conversion
- [ ] improve error detection when a directory is not a Maildir or MH folder - [ ] improve error detection when a directory is not a Maildir or MH folder
@@ -34,8 +34,8 @@
## Miscellaneous ## Miscellaneous
- [x] write Texinfo documentation - [x] write Texinfo documentation
- [x] provide possibility to use flock() instead of fcntl()
- [ ] configuration files - [ ] configuration files
- [ ] make use of lockfile library - [ ] make use of lockfile library
- [ ] make use of Solaris' maillock library - [ ] make use of Solaris' maillock library
- [x] provide possibility to use flock() instead of fcntl()
- [ ] provide national language support with gettext() - [ ] provide national language support with gettext()

View File

@@ -1,5 +1,5 @@
# mboxgrep - scan mailbox for messages matching a regular expression # mboxgrep - scan mailbox for messages matching a regular expression
# Copyright (C) 2000 - 2003, 2023 Daniel Spiljar # Copyright (C) 2000 - 2003, 2023 - 2024 Daniel Spiljar
# #
# Mboxgrep is free software; you can redistribute it and/or modify it # Mboxgrep is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by # under the terms of the GNU General Public License as published by
@@ -18,18 +18,16 @@
# Process this file with autoconf to produce a configure script. # Process this file with autoconf to produce a configure script.
# Yawn. # Yawn.
AC_INIT([mboxgrep], [0.7.12a], [dspiljar@datatipp.se], [mboxgrep], [https://www.mboxgrep.org/]) AC_INIT([mboxgrep],[0.7.13],[dspiljar@datatipp.se],[mboxgrep],[https://www.mboxgrep.org/])
#AM_INIT_AUTOMAKE #AM_INIT_AUTOMAKE
AM_INIT_AUTOMAKE([foreign]) AM_INIT_AUTOMAKE([foreign])
AC_LANG([C]) AC_LANG([C])
AC_CONFIG_HEADER([src/config.h]) AC_CONFIG_HEADERS([src/config.h])
# Checks for programs. # Checks for programs.
AC_PROG_CC AC_PROG_CC
AC_PROG_INSTALL AC_PROG_INSTALL
# Checks for standard (sp?) header files
AC_HEADER_STDC
AC_HEADER_DIRENT AC_HEADER_DIRENT
# Checks for libraries. # Checks for libraries.

View File

@@ -1,4 +1,4 @@
.TH MBOXGREP 1 "23 September 2024" .TH MBOXGREP 1 "27 September 2024"
.SH NAME .SH NAME
mboxgrep \- displays email messages matching a pattern mboxgrep \- displays email messages matching a pattern
.SH SYNOPSIS .SH SYNOPSIS
@@ -10,7 +10,7 @@ mboxgrep \- displays email messages matching a pattern
This manual page refers to This manual page refers to
.B mboxgrep .B mboxgrep
version version
.BR 0.7.12a . .BR 0.7.13 .
.PP .PP
.B mboxgrep .B mboxgrep
scans a scans a
@@ -18,7 +18,7 @@ scans a
and displays messages matching and displays messages matching
.I PATTERN. .I PATTERN.
.PP .PP
If a mailbox name is ommited, or a single dash (-) is given instead, If a mailbox name is omitted, or a single dash (-) is given instead,
it reads from standard input. it reads from standard input.
It can read mbox folders or output from another It can read mbox folders or output from another
.B mboxgrep .B mboxgrep

View File

@@ -9,10 +9,10 @@ END-INFO-DIR-ENTRY
 
File: mboxgrep.info, Node: Top, Up: (dir) File: mboxgrep.info, Node: Top, Up: (dir)
This file documents 'mboxgrep' (version 0.7.12a), a mailbox scanning This file documents 'mboxgrep' (version 0.7.13), a mailbox scanning
utility. utility.
Copyright (C) 2000, 2001, 2002, 2003 Daniel Spiljar Copyright (C) 2000 - 2003, 2024 Daniel Spiljar
* Menu: * Menu:
@@ -250,17 +250,17 @@ Sleep well, little friend.
 
Tag Table: Tag Table:
Node: Top197 Node: Top197
Node: Introduction597 Node: Introduction591
Node: Invoking1466 Node: Invoking1460
Node: Miscellaneous1828 Node: Miscellaneous1822
Node: File locking2113 Node: File locking2107
Node: Regexp selection2750 Node: Regexp selection2744
Node: Output control3302 Node: Output control3296
Node: Search scope selection4342 Node: Search scope selection4336
Node: Mailbox type selection4583 Node: Mailbox type selection4577
Node: Examples4904 Node: Examples4898
Node: Bugs5728 Node: Bugs5722
Node: To Vicky6146 Node: To Vicky6140
 
End Tag Table End Tag Table

View File

@@ -5,7 +5,7 @@
@setchapternewpage odd @setchapternewpage odd
@set EDITION 0.7 @set EDITION 0.7
@set VERSION 0.7.12a @set VERSION 0.7.13
@set UPDATED 23 September 2024 @set UPDATED 23 September 2024
@dircategory Mail @dircategory Mail

View File

@@ -52,6 +52,7 @@ char *alloca ();
#endif #endif
#include <stdio.h> #include <stdio.h>
#include <string.h>
/* Comment out all this code if we are using the GNU C Library, and are not /* Comment out all this code if we are using the GNU C Library, and are not
actually compiling the library itself. This code is part of the GNU C actually compiling the library itself. This code is part of the GNU C

View File

@@ -1,6 +1,6 @@
/* /*
mboxgrep - scan mailbox for messages matching a regular expression mboxgrep - scan mailbox for messages matching a regular expression
Copyright (C) 2000 - 2004, 2006, 2010, 2023 Daniel Spiljar Copyright (C) 2000 - 2004, 2006, 2010, 2023 - 2024 Daniel Spiljar
Mboxgrep is free software; you can redistribute it and/or modify it Mboxgrep is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by under the terms of the GNU General Public License as published by
@@ -47,7 +47,7 @@ void
version (void) version (void)
{ {
fprintf (stdout, "%s %s\n\n" fprintf (stdout, "%s %s\n\n"
"Copyright (C) 2000 - 2004, 2006, 2010, 2023 Daniel Spiljar\n" "Copyright (C) 2000 - 2004, 2006, 2010, 2023 - 2024 Daniel Spiljar\n"
"This program is free software; you can redistribute it and/or " "This program is free software; you can redistribute it and/or "
"modify\nit under the terms of the GNU General Public License " "modify\nit under the terms of the GNU General Public License "
"as published by\nthe Free Software Foundation; either version " "as published by\nthe Free Software Foundation; either version "

View File

@@ -1,6 +1,6 @@
/* /*
mboxgrep - scan mailbox for messages matching a regular expression mboxgrep - scan mailbox for messages matching a regular expression
Copyright (C) 2000 - 2003, 2006, 2023 Daniel Spiljar Copyright (C) 2000 - 2003, 2006, 2023 - 2024 Daniel Spiljar
Mboxgrep is free software; you can redistribute it and/or modify it Mboxgrep is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by under the terms of the GNU General Public License as published by
@@ -21,8 +21,8 @@
#define MBOXGREP_H #define MBOXGREP_H
#define APPNAME "mboxgrep" #define APPNAME "mboxgrep"
#define VERSION "0.7.12a" #define VERSION "0.7.13"
#define BUGREPORT_ADDR "dspiljar AT datatipp.se" #define BUGREPORT_ADDR "dspiljar@datatipp.se"
#define HOST_NAME_SIZE 256 #define HOST_NAME_SIZE 256

View File

@@ -24,19 +24,12 @@
# include <config.h> # include <config.h>
#endif #endif
#include <sys/types.h>
#if STDC_HEADERS || defined _LIBC
# include <stdlib.h>
# include <string.h>
#else
# ifndef HAVE_MEMCPY
# define memcpy(d, s, n) bcopy ((s), (d), (n))
# endif
#endif
#include "md5.h" #include "md5.h"
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
#ifdef _LIBC #ifdef _LIBC
# include <endian.h> # include <endian.h>
# if __BYTE_ORDER == __BIG_ENDIAN # if __BYTE_ORDER == __BIG_ENDIAN
@@ -69,8 +62,7 @@ static const unsigned char fillbuf[64] = { 0x80, 0 /* , 0, 0, ... */ };
/* Initialize structure containing state of computation. /* Initialize structure containing state of computation.
(RFC 1321, 3.3: Step 3) */ (RFC 1321, 3.3: Step 3) */
void void
md5_init_ctx (ctx) md5_init_ctx (struct md5_ctx *ctx)
struct md5_ctx *ctx;
{ {
ctx->A = 0x67452301; ctx->A = 0x67452301;
ctx->B = 0xefcdab89; ctx->B = 0xefcdab89;
@@ -87,9 +79,7 @@ md5_init_ctx (ctx)
IMPORTANT: On some systems it is required that RESBUF is correctly IMPORTANT: On some systems it is required that RESBUF is correctly
aligned for a 32 bits value. */ aligned for a 32 bits value. */
void * void *
md5_read_ctx (ctx, resbuf) md5_read_ctx (const struct md5_ctx *ctx, void *resbuf)
const struct md5_ctx *ctx;
void *resbuf;
{ {
((md5_uint32 *) resbuf)[0] = SWAP (ctx->A); ((md5_uint32 *) resbuf)[0] = SWAP (ctx->A);
((md5_uint32 *) resbuf)[1] = SWAP (ctx->B); ((md5_uint32 *) resbuf)[1] = SWAP (ctx->B);
@@ -105,9 +95,7 @@ md5_read_ctx (ctx, resbuf)
IMPORTANT: On some systems it is required that RESBUF is correctly IMPORTANT: On some systems it is required that RESBUF is correctly
aligned for a 32 bits value. */ aligned for a 32 bits value. */
void * void *
md5_finish_ctx (ctx, resbuf) md5_finish_ctx (struct md5_ctx *ctx, void *resbuf)
struct md5_ctx *ctx;
void *resbuf;
{ {
/* Take yet unprocessed bytes into account. */ /* Take yet unprocessed bytes into account. */
md5_uint32 bytes = ctx->buflen; md5_uint32 bytes = ctx->buflen;
@@ -136,9 +124,7 @@ md5_finish_ctx (ctx, resbuf)
resulting message digest number will be written into the 16 bytes resulting message digest number will be written into the 16 bytes
beginning at RESBLOCK. */ beginning at RESBLOCK. */
int int
md5_stream (stream, resblock) md5_stream (FILE *stream, void *resblock)
FILE *stream;
void *resblock;
{ {
/* Important: BLOCKSIZE must be a multiple of 64. */ /* Important: BLOCKSIZE must be a multiple of 64. */
#define BLOCKSIZE 4096 #define BLOCKSIZE 4096
@@ -193,10 +179,7 @@ md5_stream (stream, resblock)
output yields to the wanted ASCII representation of the message output yields to the wanted ASCII representation of the message
digest. */ digest. */
void * void *
md5_buffer (buffer, len, resblock) md5_buffer (const char *buffer, size_t len, void *resblock)
const char *buffer;
size_t len;
void *resblock;
{ {
struct md5_ctx ctx; struct md5_ctx ctx;
@@ -212,10 +195,7 @@ md5_buffer (buffer, len, resblock)
void void
md5_process_bytes (buffer, len, ctx) md5_process_bytes (const void *buffer, size_t len, struct md5_ctx *ctx)
const void *buffer;
size_t len;
struct md5_ctx *ctx;
{ {
//const void aligned_buffer = buffer; //const void aligned_buffer = buffer;
@@ -285,10 +265,7 @@ md5_process_bytes (buffer, len, ctx)
It is assumed that LEN % 64 == 0. */ It is assumed that LEN % 64 == 0. */
void void
md5_process_block (buffer, len, ctx) md5_process_block (const void *buffer, size_t len, struct md5_ctx *ctx)
const void *buffer;
size_t len;
struct md5_ctx *ctx;
{ {
md5_uint32 correct_words[16]; md5_uint32 correct_words[16];
const md5_uint32 *words = buffer; const md5_uint32 *words = buffer;

View File

@@ -22,10 +22,7 @@
#define _MD5_H 1 #define _MD5_H 1
#include <stdio.h> #include <stdio.h>
#include <limits.h>
#if defined HAVE_LIMITS_H || _LIBC
# include <limits.h>
#endif
/* The following contortions are an attempt to use the C preprocessor /* The following contortions are an attempt to use the C preprocessor
to determine an unsigned integral type that is 32 bits wide. An to determine an unsigned integral type that is 32 bits wide. An
@@ -38,20 +35,7 @@
# include <sys/types.h> # include <sys/types.h>
typedef u_int32_t md5_uint32; typedef u_int32_t md5_uint32;
#else #else
# if defined __STDC__ && __STDC__ #define UINT_MAX_32_BITS 4294967295U
# define UINT_MAX_32_BITS 4294967295U
# else
# define UINT_MAX_32_BITS 0xFFFFFFFF
# endif
/* If UINT_MAX isn't defined, assume it's a 32-bit type.
This should be valid for all systems GNU cares about because
that doesn't include 16-bit systems, and only modern systems
(that certainly have <limits.h>) have 64+-bit integral types. */
# ifndef UINT_MAX
# define UINT_MAX UINT_MAX_32_BITS
# endif
# if UINT_MAX == UINT_MAX_32_BITS # if UINT_MAX == UINT_MAX_32_BITS
typedef unsigned int md5_uint32; typedef unsigned int md5_uint32;