> Is there a command to search for an owner in the lists? We have
> several people who must have set up their lists with an incorrect
> address for themselves as owner. We get error messages, but the
> errors don't tell me which list the owner is on.
This may not be useful to you unless you're running unix, but I'll
post it in case it helps anyone.
I built the following crude C program to find subscriptions, but it
also lists stuff in the header which matches. Taking the output of
this utility and looking for lines which contain "owner=" (e.g. under
unix, by using grep) would find the information you're looking for.
The program ran through our ~300 list files in a few seconds on
an RS/6000-43P.
A few customizations may be needed, including specifically at least
the directory where LISTSERV resides. I built this for AIX, then
ported it to Linux. There's a comment which shows the needed values
for the only thing I had to change in that port.
Dennis Boone
H-Net
/* findsub.c, Boone, 06/05/98
Find subscriptions */
/* Modifications:
06/05/98 Boone Initial coding
End Modifications */
#include <stdio.h>
#include <sys/types.h>
#include <dirent.h>
#include <sys/mman.h>
#include <sys/errno.h>
#define MAXSTR 1024
#define LSVHOME "/h-net/listserv/listserv/home"
char xlate[256] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16,
17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52,
53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70,
71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88,
89, 90, 91, 92, 93, 94, 95, 96, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74,
75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 123, 124,
125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138,
139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152,
153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166,
167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180,
181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194,
195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208,
209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222,
223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236,
237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250,
251, 252, 253, 254, 255 };
int isearch(char *buf, char *string, int size)
{
char *b;
char *s;
int match;
b = buf;
s = string;
while ((b - buf) < size)
{
if (xlate[*b] == xlate[*s])
{
match = 1;
s = string;
while ((s - string) < strlen(string))
{
if (xlate[*b] != xlate[*s])
{
match = 0;
break;
}
*b++;
*s++;
}
if (match)
return(1);
else
s = string;
}
*b++;
}
return(0);
}
int main(int argc, char *argv[])
{
int i;
int searchflag = 0;
char searchstring[MAXSTR+1];
DIR *dirhandle;
struct dirent *de;
int ld;
off_t fsize;
unsigned char *buf;
off_t pos;
/* Parse command line */
for (i = 1; i < argc; i++)
{
if (! searchflag)
{
strncpy(searchstring, argv[i], MAXSTR);
searchflag = 1;
continue;
}
fprintf(stderr, "%s: unrecognized argument %s\n",
argv[0], argv[i]);
exit(1);
}
if (! searchflag)
{
fprintf(stderr, "%s: must supply search string\n", argv[0]);
exit(1);
}
/* Iterate over files */
chdir(LSVHOME);
dirhandle = opendir(LSVHOME);
while ((de = readdir(dirhandle)) != NULL)
{
if (strstr(de -> d_name, ".list") == NULL)
continue;
ld = open(de -> d_name, 0, 0);
fsize = lseek(ld, 0L, SEEK_END);
if ((buf = (unsigned char *)malloc(fsize+1)) == NULL)
{
fprintf(stderr, "unable to allocation %ld bytes\n", fsize);
exit(2);
}
/* mmap parm 4 - AIX wants MAP_FILE|MAP_VARIABLE; Linux wants MAP_PRIVATE */
buf = mmap(NULL, fsize, PROT_READ, MAP_PRIVATE, ld, 0l);
if (buf == (char *)-1)
{
fprintf(stderr, "mmap returned %d\n", errno);
exit(2);
}
for (pos = 11; pos < fsize; pos += 100)
if (isearch(&(buf[pos]), searchstring, 80))
printf("%s\t%-80.80s\n", de -> d_name, &(buf[pos]));
close(ld);
}
closedir(dirhandle);
munmap(buf, fsize);
/* Done */
exit(0);
}
|