head	1.2;
access;
symbols
	RELEASE_8_3_0:1.2
	RELEASE_9_0_0:1.2
	RELEASE_7_4_0:1.2
	RELEASE_8_2_0:1.2
	RELEASE_6_EOL:1.2
	RELEASE_8_1_0:1.2
	RELEASE_7_3_0:1.2
	RELEASE_8_0_0:1.2
	RELEASE_7_2_0:1.2
	RELEASE_7_1_0:1.2
	RELEASE_6_4_0:1.2
	RELEASE_5_EOL:1.2
	RELEASE_7_0_0:1.2
	RELEASE_6_3_0:1.2
	PRE_XORG_7:1.2
	RELEASE_4_EOL:1.2
	RELEASE_6_2_0:1.2
	RELEASE_6_1_0:1.2
	RELEASE_5_5_0:1.2
	RELEASE_6_0_0:1.2
	RELEASE_5_4_0:1.2
	RELEASE_4_11_0:1.2
	RELEASE_5_3_0:1.2
	RELEASE_4_10_0:1.2
	RELEASE_5_2_1:1.2
	RELEASE_5_2_0:1.2
	RELEASE_4_9_0:1.2
	RELEASE_5_1_0:1.2
	RELEASE_4_8_0:1.2
	RELEASE_5_0_0:1.2
	RELEASE_4_7_0:1.2
	RELEASE_4_6_2:1.2
	RELEASE_4_6_1:1.2
	RELEASE_4_6_0:1.2
	RELEASE_5_0_DP1:1.2
	RELEASE_4_5_0:1.2
	RELEASE_4_4_0:1.2
	RELEASE_4_3_0:1.2
	RELEASE_4_2_0:1.2
	RELEASE_4_1_1:1.2
	RELEASE_4_1_0:1.1
	RELEASE_3_5_0:1.1;
locks; strict;
comment	@# @;


1.2
date	2000.08.15.19.05.10;	author green;	state Exp;
branches;
next	1.1;

1.1
date	2000.04.25.08.04.55;	author kris;	state Exp;
branches;
next	;


desc
@@


1.2
log
@l0pht-watch is much more useful if you can see more than 20 characters
of the pathname.  Use the magic of TIOCGWINSZ to let it scale with the
terminal.
@
text
@--- list_utils.c.orig	Thu Dec 24 00:00:44 1998
+++ list_utils.c	Sun Aug 13 23:55:23 2000
@@@@ -102,9 +102,11 @@@@
   char filemodes[11];
   char outputStr[(MAXNAMLEN * 2) + 256];
   char linkbuf[MAXNAMLEN + 1];
+  struct winsize winsize;
   struct passwd *pwent;
   struct group *groupent;
   int ret;
+  unsigned short width;
 
   switch(action){
     case ADDITION:
@@@@ -143,11 +145,16 @@@@
 
   getfilemodes(&list->statbuf, filemodes);
 
+  if (ioctl(1, TIOCGWINSZ, &winsize) == 0)
+    width = winsize.ws_col;
+  else
+    width = 80;
+
   sprintf(outputStr,"%.2s %-11.20s %-2d %-8.20s %-8.20s %-6ld %-10.20s "
-                    "%.20s",
+                    "%.*s",
           (action == ADDITION) ? "+ " : "- ", filemodes, 
           (int)list->statbuf.st_nlink, username, groupname,
-          (long)list->statbuf.st_size, timehold, list->filename);
+          (long)list->statbuf.st_size, timehold, width - 60, list->filename);
 
   if (S_ISLNK(list->statbuf.st_mode) ){
     ret = readlink(list->filename, linkbuf, sizeof(linkbuf));
@@@@ -168,7 +175,7 @@@@
 
   
 
-#ifdef 0
+#if 0
   printf("%-11s %-2d %-8s %-8s %-6ld %-10s %-10s\n", filemodes,
           (int)list->statbuf.st_nlink, username, groupname, 
           list->statbuf.st_size, timehold, list->filename);
@


1.1
log
@On FreeBSD 5.0, use the new kqueue() notification system to monitor
for directory changes. This cuts CPU usage from 100% down to about 0.1%
as well as improving the reliability of change monitoring.
@
text
@d1 34
a34 3
--- list_utils.c.orig	Tue Apr 25 00:58:27 2000
+++ list_utils.c	Tue Apr 25 00:58:33 2000
@@@@ -168,7 +168,7 @@@@
@

