I'm sorry that a few folks are unhappy with the little utility I
wrote for my own use. I've made some minor cleanups and have
attached a patch for that purpose.
I do not claim that this is portable software. There are no
system-dependent #ifdef's, no configure script, no build time tests
to see how your system works. I have no plans to figure out how to
obtain BSD compatibility from AIX, HP-UX, Solaris, SCO, or any other
systems. If it is useful to you I am happy, if not, perhaps you
should seek another solution. It really is a trivial little bit of
code.
I've addressed two questions outstanding, below.
Thanks,
-- Jeff Hayward
On Thu, 13 May 1999, Troy Morrison wrote:
> | Segmentation fault
> | mail:/usr/local/src#
> | seg faults on me :(
> Try running "taildir <name of dir with cyclog files in it>" instead of
> just taildir.
> Troy
No, not necessary. Taildir uses the current directory if none is
specified. This segfault is due to the fact that on some systems
scandir returns a null pointer as the 'names' array. I've added a
check for that, fixed some little portability things, and some
things to appease 'gcc -pedantic' in the patch file attached here.
The underlying problem with your segfault is that there are no
cyclog logs in the directory.
On Thu, 13 May 1999, Scott D. Yelich wrote:
solaris 2.5.1
security [965]> gcc -L/usr/ucblib -lucb taildir.c -o taildir
security [966]> ./taildir .
./taildir: scandir: : No such file or directory
I also can't seem to get a -static version of this to compile...
and I had to add /usr/ucblib to my LD_LIBRARY_PATH.
but, as you can see, it still doesn't run.
Uh, it ran fine. There were no cyclog logs in ".". That's what 'no
such file..." is intended to convey.
1c1
< /* $Id: taildir.c,v 1.3 1999/05/14 14:54:19 jah Exp $
---
> /* $Id: taildir.c,v 1.5 1999/05/14 15:15:48 jah Exp $
7a8,10
> #include <stdlib.h>
> #include <unistd.h>
> #include <string.h>
10d12
< #include <unistd.h>
19,26d20
< static struct stat
< dirstat,
< filestat;
<
< static time_t
< olddirtime = 1,
< oldfiletime = 0;
<
32,33c26,31
< static int len(char *s) { register char *c = s; while(*c++ != 0); return (c-s-1);}
< static pnout(char *s) {
---
> static int len(char *s) {
> register char *c = s;
> while(*c++ != 0);
> return (c-s-1);
> }
> static void pnout(char *s) {
38c36
< static err_out(int e) {
---
> static void err_out(int e) {
43c41
< static err_die(char *s, int e) { pnout(s); err_out(e); exit(e); }
---
> static void err_die(char *s, int e) { pnout(s); err_out(e); exit(e); }
68c66
< if (names[0] && len(names[0]->d_name)< sl) {
---
> if (names && *names && len(names[0]->d_name)< sl) {
74a73
> exit(ENOENT); /* NOTREACHED */
126c125
< main(const int argc, const char *argv[])
---
> int main(const int argc, const char *argv[])
135c134
<
---
> exit(EINVAL); /* NOTREACHED */