diff options
author | agc <agc@pkgsrc.org> | 2002-07-04 13:32:20 +0000 |
---|---|---|
committer | agc <agc@pkgsrc.org> | 2002-07-04 13:32:20 +0000 |
commit | 256ba264771cbf3952d7e052e30f7c876e49ce49 (patch) | |
tree | e39f2202d3e7b0c2b1588b42d2d5d3f06ac64b52 /misc/root-tail | |
parent | 6b43b58e9dde4ecdc719c3ea2818292846a7b00f (diff) | |
download | pkgsrc-256ba264771cbf3952d7e052e30f7c876e49ce49.tar.gz |
Add a test to see if a logfile has been turned over, and, if it has,
start watching the new log file, rather than the old one.
Bump revision to nb1.
Diffstat (limited to 'misc/root-tail')
-rw-r--r-- | misc/root-tail/Makefile | 3 | ||||
-rw-r--r-- | misc/root-tail/distinfo | 3 | ||||
-rw-r--r-- | misc/root-tail/patches/patch-aa | 118 |
3 files changed, 122 insertions, 2 deletions
diff --git a/misc/root-tail/Makefile b/misc/root-tail/Makefile index 3df974b16df..7634f8472c3 100644 --- a/misc/root-tail/Makefile +++ b/misc/root-tail/Makefile @@ -1,6 +1,7 @@ -# $NetBSD: Makefile,v 1.1.1.1 2001/11/20 23:19:16 hubertf Exp $ +# $NetBSD: Makefile,v 1.2 2002/07/04 13:32:20 agc Exp $ DISTNAME= root-tail-0.0.10 +PKGREVISION= 1 CATEGORIES= x11 MASTER_SITES= http://www.goof.com/pcg/marc/data/ diff --git a/misc/root-tail/distinfo b/misc/root-tail/distinfo index ffd9e7b6aa6..42a76d78cae 100644 --- a/misc/root-tail/distinfo +++ b/misc/root-tail/distinfo @@ -1,4 +1,5 @@ -$NetBSD: distinfo,v 1.1.1.1 2001/11/20 23:19:16 hubertf Exp $ +$NetBSD: distinfo,v 1.2 2002/07/04 13:32:20 agc Exp $ SHA1 (root-tail-0.0.10.tar.gz) = 19963087202e6b365f8d9820bdee283ace16caa4 Size (root-tail-0.0.10.tar.gz) = 7816 bytes +SHA1 (patch-aa) = dba9a38b50e538171cf060ad1ef2e035717037c5 diff --git a/misc/root-tail/patches/patch-aa b/misc/root-tail/patches/patch-aa new file mode 100644 index 00000000000..c2396d5d3b8 --- /dev/null +++ b/misc/root-tail/patches/patch-aa @@ -0,0 +1,118 @@ +$NetBSD: patch-aa,v 1.1 2002/07/04 13:32:21 agc Exp $ + +Add a test to see if the log file has been turned over, and to re-open +files if it has. + +--- root-tail.c 2002/07/04 13:05:32 1.1 ++++ root-tail.c 2002/07/04 13:18:38 +@@ -27,14 +27,6 @@ + + #define VERSION "0.0.10" + +-/*---------------- Let's define signals functions -------------*/ +- +-static void reopen (int); +-static void list_files (int); +-static void force_refresh (int); +-static void InstallSigHandler (void); +-FILE *openLog (const char *); +- + /*------------------------ initalize variables -----------------*/ + int geom_mask, noinitial; + int screen, listlen = STD_HEIGHT, width = STD_WIDTH, ScreenWidth, ScreenHeight, +@@ -58,6 +50,7 @@ + char desc[255]; /* alternative description */ + FILE *f; /* FILE struct associated with file */ + Pixel color; /* color to be used for printing */ ++ struct stat st; /* stat buffer from previous */ + struct logfile_entry *next; + }; + +@@ -70,6 +63,14 @@ + Pixel color; + }; + ++/*---------------- Let's define signals functions -------------*/ ++ ++static void reopen (int); ++static void list_files (int); ++static void force_refresh (int); ++static void InstallSigHandler (void); ++FILE *openLog (struct logfile_entry *, const char *); ++ + + /*----------------------------- start code ---------------------*/ + +@@ -83,7 +84,7 @@ + { + printf ("reopenin as %p (%s)\n", e->f, e->fname); + fclose (e->f); +- e->f = openLog (e->fname); ++ e->f = openLog (e, e->fname); + printf ("reopened as %p\n", e->f); + if (e->f == NULL) + { +@@ -226,15 +227,15 @@ + } + + FILE * +-openLog (const char *name) ++openLog (struct logfile_entry *e, const char *name) + { + FILE *f = fopen (name, "r"); +- struct stat statbuf; + off_t size; ++ + if (f == NULL) + return NULL; +- stat (name, &statbuf); +- size = statbuf.st_size; ++ stat (name, &e->st); ++ size = e->st.st_size; + if (size > (listlen+1) * width) + { + char dummy[255]; +@@ -363,8 +364,16 @@ + + for (current = loglist; current != NULL; current = current->next) + { ++ struct stat st; + clearerr (current->f); + ++ if (stat(current->fname, &st) < 0) { ++ continue; ++ } ++ if (st.st_ino != current->st.st_ino) { ++ need_reopen = 1; ++ } ++ + while (!lineinput (temp, width + 2, current->f)) + { + /* +@@ -418,7 +427,7 @@ + if (need_reopen) + reopen (1); + +- /* we ignore possible errors due to windo resizing &c */ ++ /* we ignore possible errors due to window resizing &c */ + while (XPending (disp)) + { + XNextEvent (disp, &xev); +@@ -607,13 +616,14 @@ + } + } + +- if ((f = openLog (fname)) == NULL) ++ e = (struct logfile_entry *) ++ malloc (sizeof (struct logfile_entry)); ++ ++ if ((f = openLog (e, fname)) == NULL) + { + perror (fname); + exit (-1); + } +- e = (struct logfile_entry *) +- malloc (sizeof (struct logfile_entry)); + + strncpy (e->fname, fname, 255); + e->fname[255] = '\0'; /* just in case */ |