diff options
author | dwcjr <dwcjr@FreeBSD.org> | 2001-09-14 03:38:36 +0000 |
---|---|---|
committer | dwcjr <dwcjr@FreeBSD.org> | 2001-09-14 03:38:36 +0000 |
commit | 9997a011e698a38c3357dbba4ef3ae6111f666c7 (patch) | |
tree | 6ce2f1b0b0ac5d5fe14779fbbb8bd009110e3520 /sysutils | |
parent | 69feacd8d5cb290eb5fa20bf9e9e2859d7f81707 (diff) | |
download | FreeBSD-ports-9997a011e698a38c3357dbba4ef3ae6111f666c7.zip FreeBSD-ports-9997a011e698a38c3357dbba4ef3ae6111f666c7.tar.gz |
Update to 2.0.3
PR: 29775
Submitted by: pat@databits.net
Approved by: maintainer
Diffstat (limited to 'sysutils')
-rw-r--r-- | sysutils/wminet/Makefile | 9 | ||||
-rw-r--r-- | sysutils/wminet/distinfo | 2 | ||||
-rw-r--r-- | sysutils/wminet/files/patch-aa | 111 | ||||
-rw-r--r-- | sysutils/wminet/files/patch-ab | 1147 | ||||
-rw-r--r-- | sysutils/wminet/files/patch-wminetrc | 25 | ||||
-rw-r--r-- | sysutils/wminet/pkg-descr | 7 | ||||
-rw-r--r-- | sysutils/wminet/pkg-plist | 4 |
7 files changed, 547 insertions, 758 deletions
diff --git a/sysutils/wminet/Makefile b/sysutils/wminet/Makefile index 5f40e9c..449078c 100644 --- a/sysutils/wminet/Makefile +++ b/sysutils/wminet/Makefile @@ -6,10 +6,9 @@ # PORTNAME= wminet -PORTVERSION= 2.0.2 +PORTVERSION= 2.0.3 CATEGORIES= sysutils windowmaker -MASTER_SITES= ${MASTER_SITE_LOCAL} -MASTER_SITE_SUBDIR= kevlo +MASTER_SITES= http://www.neotokyo.org/illusion/downloads/ MAINTAINER= sk-ports@vegamuse.org @@ -20,8 +19,8 @@ USE_XPM= yes post-install: .if !defined(NOPORTDOCS) - @${MKDIR} ${PREFIX}/share/doc/wminet - ${INSTALL_MAN} ${WRKSRC}/../HINTS ${PREFIX}/share/doc/wminet + @${MKDIR} ${DOCSDIR} + @${INSTALL_DATA} ${WRKSRC}/../HINTS ${DOCSDIR} .endif .include <bsd.port.mk> diff --git a/sysutils/wminet/distinfo b/sysutils/wminet/distinfo index 43502e5..9767470 100644 --- a/sysutils/wminet/distinfo +++ b/sysutils/wminet/distinfo @@ -1 +1 @@ -MD5 (wminet-2.0.2.tar.gz) = 984642aea8421d4e640ff7e255cfa893 +MD5 (wminet-2.0.3.tar.gz) = 4836d8c2e8b8a13b9fc2200c24da2f63 diff --git a/sysutils/wminet/files/patch-aa b/sysutils/wminet/files/patch-aa index 8155284..fb302a6 100644 --- a/sysutils/wminet/files/patch-aa +++ b/sysutils/wminet/files/patch-aa @@ -1,66 +1,45 @@ -*** Makefile.orig Sat Dec 12 12:15:44 1998 ---- Makefile Sat Aug 12 00:34:24 2000 -*************** -*** 1,19 **** -! LIBDIR = -L/usr/X11R6/lib -! LIBS = -lXpm -lXext -lX11 -! FLAGS = -O2 - OBJS = wminet.o \ - ../wmgeneral/wmgeneral.o \ - ../wmgeneral/misc.o \ - ../wmgeneral/list.o - - - .c.o: -! cc -I/usr/X11R6/share/include $(FLAGS) -c -Wall $< -o $*.o - -! wminet: $(OBJS) -! cc $(FLAGS) -o wminet $^ -lXext $(LIBDIR) $(LIBS) - -! all:: wminet - - clean:: - for i in $(OBJS) ; do \ ---- 1,22 ---- -! LIBDIR = -L${X11BASE}/lib -! LIBS = -lXpm -lXext -lX11 -lkvm -! CFLAGS ?= -O2 -! CFLAGS += -I${X11BASE}/include -! CFLAGS += -DDEFAULT_WMINETRC="\"${PREFIX}/etc/wminetrc\"" - OBJS = wminet.o \ - ../wmgeneral/wmgeneral.o \ - ../wmgeneral/misc.o \ - ../wmgeneral/list.o -+ PROG = wminet - - - .c.o: -! ${CC} $(CFLAGS) -c $< -o $@ - -! $(PROG): $(OBJS) -! ${CC} $(CFLAGS) -o $@ $(OBJS) $(LIBDIR) $(LIBS) - -! all:: $(PROG) - - clean:: - for i in $(OBJS) ; do \ -*************** -*** 23,33 **** - rm -f *~ - - install:: wminet -! cp -f wminet /usr/local/bin/ -! chmod 755 /usr/local/bin/wminet -! chown root:root /usr/local/bin/wminet -! cp wminetrc $(HOME)/.wminetrc -! chmod 600 $(HOME)/.wminetrc -! cp wminetrc /etc/wminetrc -! chmod 644 /etc/wminetrc -! @echo "WMiNET Installation finished..." ---- 26,31 ---- - rm -f *~ - - install:: wminet -! ${INSTALL} -c -g kmem -m 2755 -o root $(PROG) ${PREFIX}/bin -! ${INSTALL} -c -g wheel -m 644 -o root wminetrc ${PREFIX}/etc/wminetrc -! +--- Makefile.orig Fri Dec 11 22:15:44 1998 ++++ Makefile Thu Aug 16 10:06:13 2001 +@@ -1,19 +1,21 @@ +-LIBDIR = -L/usr/X11R6/lib +-LIBS = -lXpm -lXext -lX11 +-FLAGS = -O2 ++LIBDIR = -L${X11BASE}/lib ++LIBS = -lXpm -lXext -lX11 -lkvm ++CFLAGS += -I${X11BASE}/include ++CFLAGS += -DDEFAULT_WMINETRC="\"${PREFIX}/etc/wminetrc\"" + OBJS = wminet.o \ + ../wmgeneral/wmgeneral.o \ + ../wmgeneral/misc.o \ + ../wmgeneral/list.o ++PROG = wminet + + + .c.o: +- cc -I/usr/X11R6/share/include $(FLAGS) -c -Wall $< -o $*.o ++ ${CC} $(CFLAGS) -c $< -o $@ + +-wminet: $(OBJS) +- cc $(FLAGS) -o wminet $^ -lXext $(LIBDIR) $(LIBS) ++$(PROG): $(OBJS) ++ ${CC} $(CFLAGS) -o $@ $(OBJS) $(LIBDIR) $(LIBS) + +-all:: wminet ++all:: $(PROG) + + clean:: + for i in $(OBJS) ; do \ +@@ -23,11 +25,5 @@ + rm -f *~ + + install:: wminet +- cp -f wminet /usr/local/bin/ +- chmod 755 /usr/local/bin/wminet +- chown root:root /usr/local/bin/wminet +- cp wminetrc $(HOME)/.wminetrc +- chmod 600 $(HOME)/.wminetrc +- cp wminetrc /etc/wminetrc +- chmod 644 /etc/wminetrc +- @echo "WMiNET Installation finished..." ++ ${INSTALL} -c -s -g kmem -m 2755 -o root $(PROG) ${PREFIX}/bin ++ ${INSTALL} -c -g wheel -m 644 -o root wminetrc ${PREFIX}/etc/wminetrc diff --git a/sysutils/wminet/files/patch-ab b/sysutils/wminet/files/patch-ab index d895fba..e602986 100644 --- a/sysutils/wminet/files/patch-ab +++ b/sysutils/wminet/files/patch-ab @@ -1,689 +1,474 @@ -*** ../../wminet.app/wminet/wminet.c.orig Mon Nov 30 19:16:01 1998 ---- ../../wminet.app/wminet/wminet.c Sun May 23 13:46:54 1999 -*************** -*** 10,15 **** ---- 10,17 ---- - - ProFTPD support by Mike Kershaw aka Dragorn (dragorn@melchior.nerv-un.ml.org) - ProFTPD support was made 64bit clean by Martijn Pieterse (pieterse@xs4all.nl) -+ -+ FreeBSD port by Stephen Kiernan (sk-ports@vegamuse.org) - - see http://windowmaker.mezaway.org for more awesome wm dock apps :) - -*************** -*** 23,28 **** ---- 25,35 ---- - #include <fcntl.h> - #include <unistd.h> - #include <ctype.h> -+ #ifdef __FreeBSD__ -+ #include <limits.h> -+ #include <kvm.h> -+ #include <netdb.h> -+ #endif /* __FreeBSD__ */ - - #include <sys/wait.h> - #include <sys/stat.h> -*************** -*** 30,35 **** ---- 37,59 ---- - #include <sys/types.h> - #include <sys/ioctl.h> - #include <sys/socket.h> -+ #ifdef __FreeBSD__ -+ #include <sys/socketvar.h> -+ #include <sys/sysctl.h> -+ -+ #include <net/route.h> -+ #include <netinet/in.h> -+ #include <netinet/in_systm.h> -+ #include <netinet/ip.h> -+ #include <netinet/in_pcb.h> -+ #include <netinet/ip_var.h> -+ #include <netinet/tcp.h> -+ #include <netinet/tcp_fsm.h> -+ #include <netinet/tcp_timer.h> -+ #include <netinet/tcp_var.h> -+ -+ #include <arpa/inet.h> -+ #endif /* __FreeBSD__ */ - - #include <utmp.h> - #include <dirent.h> -*************** -*** 57,62 **** ---- 81,90 ---- - // Lame work-around... Sigh... when will they standardize the headers!?!? - #define TCP_ESTABLISHED 1 - -+ #ifndef DEFAULT_WMINETRC -+ #define DEFAULT_WMINETRC "/etc/wminetrc" -+ #endif /* DEFAULT_WMINETRC */ -+ - extern char **environ; - - char *ProgName; -*************** -*** 97,102 **** ---- 125,137 ---- - - char uconfig_file[256]; - -+ #ifdef __FreeBSD__ -+ struct utmp *_wminet_getutent(FILE *); -+ #define setutent() { FILE *_wminet__ufp = fopen(_PATH_UTMP, "r") -+ #define getutent() _wminet_getutent(_wminet__ufp) -+ #define endutent() fclose(_wminet__ufp); } -+ #endif /* __FreeBSD__ */ -+ - void usage(void); - void printversion(void); - void BlitString(char *name, int x, int y); -*************** -*** 105,114 **** - void wminet_routine(int, char **); - int PortWatch( short port ); - int ReadConfigInt(FILE *fp, char *setting, int *value); -! int ReadConfigString(FILE *fp, char *setting, char *value); - int Read_Config_File( char *filename ); - - - int main(int argc, char *argv[]) { - - int i; ---- 140,161 ---- - void wminet_routine(int, char **); - int PortWatch( short port ); - int ReadConfigInt(FILE *fp, char *setting, int *value); -! int ReadConfigString(FILE *fp, char *setting, char *value, int len); - int Read_Config_File( char *filename ); - - -+ #ifdef __FreeBSD__ -+ inline -+ struct utmp *_wminet_getutent( FILE *fp ) -+ { -+ static struct utmp usr; -+ if( fread((char *)&usr, sizeof(usr), 1, fp) == 1 ) -+ return &usr; -+ else -+ return NULL; -+ } -+ #endif /* __FreeBSD__ */ -+ - int main(int argc, char *argv[]) { - - int i; -*************** -*** 145,151 **** - case 'c' : - if (argc > (i+1)) - { -! strcpy(uconfig_file, argv[i+1]); - i++; - } - break; ---- 192,198 ---- - case 'c' : - if (argc > (i+1)) - { -! strncpy(uconfig_file, argv[i+1], 256); - i++; - } - break; -*************** -*** 210,221 **** - } - else - { -! sprintf(config_file, "%s/.wminetrc", getenv("HOME")); - - if (!Read_Config_File(config_file)) - { - // Fall back to /etc/wminetrc -! sprintf(config_file, "/etc/wminetrc"); - - Read_Config_File(config_file); - } ---- 257,268 ---- - } - else - { -! snprintf(config_file, 256, "%s/.wminetrc", getenv("HOME")); - - if (!Read_Config_File(config_file)) - { - // Fall back to /etc/wminetrc -! snprintf(config_file, 256, DEFAULT_WMINETRC); - - Read_Config_File(config_file); - } -*************** -*** 236,248 **** - if (use_proftpd) - { - if (strstr(dent->d_name, "proftpd-") != NULL) -! strcpy(ftpclasses[0], dent->d_name); - } - else - { - if (strstr(dent->d_name, "ftp.pids-") != NULL) - { -! strcpy(ftpclasses[numftpclasses++], dent->d_name); - //printf("ftppidfile: %s\n", dent->d_name); - } - } ---- 283,295 ---- - if (use_proftpd) - { - if (strstr(dent->d_name, "proftpd-") != NULL) -! strncpy(ftpclasses[0], dent->d_name, 64); - } - else - { - if (strstr(dent->d_name, "ftp.pids-") != NULL) - { -! strncpy(ftpclasses[numftpclasses++], dent->d_name, 64); - //printf("ftppidfile: %s\n", dent->d_name); - } - } -*************** -*** 406,415 **** - FILE *fp; - pid_t pid; - char buf[1024]; - char *tok,*tok1; -- int i,j; - char seps[]={"/"}; - char sep2[]={":"}; - - #ifdef HTTP_MONITOR_PROC - DIR *dir; ---- 453,465 ---- - FILE *fp; - pid_t pid; - char buf[1024]; -+ int i; -+ #ifndef __FreeBSD__ -+ int j; - char *tok,*tok1; - char seps[]={"/"}; - char sep2[]={":"}; -+ #endif /* !__FreeBSD__ */ - - #ifdef HTTP_MONITOR_PROC - DIR *dir; -*************** -*** 427,434 **** - setutent(); - while ((ut = getutent())) - { -! if ((ut->ut_type == USER_PROCESS) && -! (ut->ut_name[0] != '\0')) - { - nUsers++; - } ---- 477,489 ---- - setutent(); - while ((ut = getutent())) - { -! if ( -! #ifdef __FreeBSD__ -! (ut->ut_line[0] != '\0') -! #else -! (ut->ut_type == USER_PROCESS) -! #endif /* __FreeBSD__ */ -! && (ut->ut_name[0] != '\0')) - { - nUsers++; - } -*************** -*** 447,453 **** - logrun_t runent; - logrun_header_t head; - -! sprintf(buf, "%s/%s", ftp_pid_path, ftpclasses[0]); - - if (( fd = open(buf, O_RDONLY, 0644)) == -1) - { ---- 502,508 ---- - logrun_t runent; - logrun_header_t head; - -! snprintf(buf, 1024, "%s/%s", ftp_pid_path, ftpclasses[0]); - - if (( fd = open(buf, O_RDONLY, 0644)) == -1) - { -*************** -*** 474,480 **** - } else { - for (i=0; i!= numftpclasses; i++) - { -! sprintf(buf, "%s/%s", ftp_pid_path, ftpclasses[i]); - //printf("opening '%s'\n", buf); - fp = fopen(buf, "r"); - if (fp) ---- 529,535 ---- - } else { - for (i=0; i!= numftpclasses; i++) - { -! snprintf(buf, 1024, "%s/%s", ftp_pid_path, ftpclasses[i]); - //printf("opening '%s'\n", buf); - fp = fopen(buf, "r"); - if (fp) -*************** -*** 496,506 **** - // httpd processes - nHttp = 0; - -! #ifdef HTTP_MONITOR_PROC - - if ( monitor_http ) - { -- - dir = opendir("/proc"); - if (dir) - { ---- 551,560 ---- - // httpd processes - nHttp = 0; - -! #if defined(HTTP_MONITOR_PROC) && !defined(__FreeBSD__) - - if ( monitor_http ) - { - dir = opendir("/proc"); - if (dir) - { -*************** -*** 508,514 **** - { - if (!isalpha(dent->d_name[0])) - { -! sprintf(buf, "/proc/%s/stat", dent->d_name); - //printf("opening '%s'\n", buf); - fp=fopen(buf, "r"); - if (fp) ---- 562,568 ---- - { - if (!isalpha(dent->d_name[0])) - { -! snprintf(buf, 1024, "/proc/%s/stat", dent->d_name); - //printf("opening '%s'\n", buf); - fp=fopen(buf, "r"); - if (fp) -*************** -*** 532,572 **** - #ifdef HTTP_MONITOR_NET - - if ( monitor_http ) -! { -! -! fp = fopen("/proc/net/tcp", "r"); -! if (fp) -! { -! fgets(buf, 512, fp); // get rid of text header -! -! while ( (fgets(buf, 512, fp)) ) -! { -! tok = strtok(buf, sep2); -! tok = strtok(NULL, sep2); -! tok = strtok(NULL, sep2); -! -! tok[4]=0; -! tok1 = strtok(NULL, sep2); -! tok1 += 5; -! tok1[2] = 0; -! -! // printf("port: %i\n", strtol(tok, NULL, 16)); -! // printf("state: %i\n", strtol(tok1, NULL, 16)); -! -! i = strtol(tok, NULL, 16); -! j = strtol(tok1, NULL, 16); -! -! // should make this configurable -! if (( i == 80 || i == 8080) && (j == TCP_ESTABLISHED)) -! { -! nHttp++; -! } -! -! } -! -! fclose(fp); -! } -! } - #endif - - ---- 586,592 ---- - #ifdef HTTP_MONITOR_NET - - if ( monitor_http ) -! nHttp = PortWatch( 80 ) + PortWatch( 8080 ); - #endif - - -*************** -*** 575,581 **** ---- 595,605 ---- - - if ( monitor_nfs ) - { -+ #ifdef __FreeBSD__ -+ fp = popen("/usr/bin/showmount -d", "r"); -+ #else - fp = popen("/usr/sbin/showmount -d", "r"); -+ #endif /* __FreeBSD__ */ - if (fp) - { - while ( (fgets(buf, 128, fp)) ) -*************** -*** 592,600 **** - // Total Processes - nProc = 0; - - if ( monitor_proc ) - { -! - fp = fopen("/proc/loadavg", "r"); - if (fp) - { ---- 616,661 ---- - // Total Processes - nProc = 0; - -+ #if defined(__FreeBSD__) && defined(HTTP_MONITOR_PROC) -+ if( monitor_proc || monitor_http ) -+ #else - if ( monitor_proc ) -+ #endif /* __FreeBSD__ && HTTP_MONITOR_PROC */ - { -! #ifdef __FreeBSD__ -! char errbuf[_POSIX2_LINE_MAX]; -! kvm_t *kd = kvm_openfiles( NULL, NULL, NULL, O_RDONLY, errbuf ); -! if( kd == 0 ) -! fprintf( stderr, "%s", errbuf ); -! else -! { -! int procs; -! -! #ifdef HTTP_MONITOR_PROC -! struct kinfo_proc *kinfo = -! #endif /* HTTP_MONITOR_PROC */ -! kvm_getprocs(kd,KERN_PROC_ALL,0,&procs); -! -! #ifdef HTTP_MONITOR_PROC -! if( monitor_http ) -! { -! int i; -! for( i = 0; i < procs; i++ ) -! { -! if( !strncmp( KI_PROC(&kinfo[i])->p_comm, "(httpd)", 7 ) ) -! { -! nHttp++; -! } -! } -! } -! #endif /* HTTP_MONITOR_PROC */ -! -! kvm_close( kd ); -! -! if( monitor_proc ) -! nProc = procs; -! } -! #else - fp = fopen("/proc/loadavg", "r"); - if (fp) - { -*************** -*** 605,610 **** ---- 666,672 ---- - - fclose(fp); - } -+ #endif /* __FreeBSD__ */ - } - - // Port Watchers -*************** -*** 622,635 **** - - int PortWatch( short port ) - { - FILE *fp; - char buf[1024]; - char *tok,*tok1; - int i,j; - char sep2[]={":"}; - -- int count=0; -- - fp = fopen("/proc/net/tcp", "r"); - if (fp) - { ---- 684,744 ---- - - int PortWatch( short port ) - { -+ -+ int count=0; -+ -+ #ifdef __FreeBSD__ -+ struct protoent *p; -+ -+ setprotoent(1); -+ setservent(1); -+ while((p = getprotoent())) -+ { -+ if( !strcmp( p->p_name, "tcp" ) ) +--- wminet.c.orig Fri Dec 18 06:07:27 1998 ++++ wminet.c Thu Aug 16 11:08:44 2001 +@@ -10,6 +10,8 @@ + + ProFTPD support by Mike Kershaw aka Dragorn (dragorn@melchior.nerv-un.ml.org) + ProFTPD support was made 64bit clean by Martijn Pieterse (pieterse@xs4all.nl) ++ ++ FreeBSD port by Stephen Kiernan (sk-ports@vegamuse.org) + + see http://windowmaker.mezaway.org for more awesome wm dock apps :) + +@@ -23,6 +25,11 @@ + #include <fcntl.h> + #include <unistd.h> + #include <ctype.h> ++#ifdef __FreeBSD__ ++#include <limits.h> ++#include <kvm.h> ++#include <netdb.h> ++#endif /* __FreeBSD__ */ + + #include <sys/wait.h> + #include <sys/stat.h> +@@ -30,6 +37,23 @@ + #include <sys/types.h> + #include <sys/ioctl.h> + #include <sys/socket.h> ++#ifdef __FreeBSD__ ++#include <sys/socketvar.h> ++#include <sys/sysctl.h> ++ ++#include <net/route.h> ++#include <netinet/in.h> ++#include <netinet/in_systm.h> ++#include <netinet/ip.h> ++#include <netinet/in_pcb.h> ++#include <netinet/ip_var.h> ++#include <netinet/tcp.h> ++#include <netinet/tcp_fsm.h> ++#include <netinet/tcp_timer.h> ++#include <netinet/tcp_var.h> ++ ++#include <arpa/inet.h> ++#endif /* __FreeBSD__ */ + + #include <utmp.h> + #include <dirent.h> +@@ -57,6 +81,10 @@ + // Lame work-around... Sigh... when will they standardize the headers!?!? + #define TCP_ESTABLISHED 1 + ++#ifndef DEFAULT_WMINETRC ++#define DEFAULT_WMINETRC "/etc/wminetrc" ++#endif /* DEFAULT_WMINETRC */ ++ + extern char **environ; + + char *ProgName; +@@ -101,6 +129,13 @@ + + char uconfig_file[256]; + ++#ifdef __FreeBSD__ ++struct utmp *_wminet_getutent(FILE *); ++#define setutent() { FILE *_wminet__ufp = fopen(_PATH_UTMP, "r") ++#define getutent() _wminet_getutent(_wminet__ufp) ++#define endutent() fclose(_wminet__ufp); } ++#endif /* __FreeBSD__ */ ++ + void usage(void); + void printversion(void); + void BlitString(char *name, int x, int y); +@@ -109,10 +144,22 @@ + void wminet_routine(int, char **); + int PortWatch( short port ); + int ReadConfigInt(FILE *fp, char *setting, int *value); +-int ReadConfigString(FILE *fp, char *setting, char *value); ++int ReadConfigString(FILE *fp, char *setting, char *value, int len); + int Read_Config_File( char *filename ); + + ++#ifdef __FreeBSD__ ++inline ++struct utmp *_wminet_getutent( FILE *fp ) ++{ ++ static struct utmp usr; ++ if( fread((char *)&usr, sizeof(usr), 1, fp) == 1 ) ++ return &usr; ++ else ++ return NULL; ++} ++#endif /* __FreeBSD__ */ ++ + int main(int argc, char *argv[]) { + + int i; +@@ -149,7 +196,7 @@ + case 'c' : + if (argc > (i+1)) + { +- strcpy(uconfig_file, argv[i+1]); ++ strncpy(uconfig_file, argv[i+1], 256); + i++; + } + break; +@@ -214,12 +261,12 @@ + } + else + { +- sprintf(config_file, "%s/.wminetrc", getenv("HOME")); ++ snprintf(config_file, 256, "%s/.wminetrc", getenv("HOME")); + + if (!Read_Config_File(config_file)) + { + // Fall back to /etc/wminetrc +- sprintf(config_file, "/etc/wminetrc"); ++ snprintf(config_file, 256, DEFAULT_WMINETRC); + + Read_Config_File(config_file); + } +@@ -240,13 +287,13 @@ + if (use_proftpd) + { + if (strstr(dent->d_name, "proftpd-") != NULL) +- strcpy(ftpclasses[0], dent->d_name); ++ strncpy(ftpclasses[0], dent->d_name, 64); + } + else + { + if (strstr(dent->d_name, "ftp.pids-") != NULL) + { +- strcpy(ftpclasses[numftpclasses++], dent->d_name); ++ strncpy(ftpclasses[numftpclasses++], dent->d_name, 64); + //printf("ftppidfile: %s\n", dent->d_name); + } + } +@@ -422,7 +469,6 @@ + char seps[]={"/"}; + char sep2[]={":"}; + char sep3[]={" "}; +- + #ifdef HTTP_MONITOR_PROC + DIR *dir; + struct dirent *dent; +@@ -439,8 +485,13 @@ + setutent(); + while ((ut = getutent())) + { +- if ((ut->ut_type == USER_PROCESS) && +- (ut->ut_name[0] != '\0')) ++ if ( ++#ifdef __FreeBSD__ ++ (ut->ut_line[0] != '\0') ++#else ++ (ut->ut_type == USER_PROCESS) ++#endif /* __FreeBSD__ */ ++ && (ut->ut_name[0] != '\0')) + { + nUsers++; + } +@@ -459,7 +510,7 @@ + logrun_t runent; + logrun_header_t head; + +- sprintf(buf, "%s/%s", ftp_pid_path, ftpclasses[0]); ++ snprintf(buf, 1024, "%s/%s", ftp_pid_path, ftpclasses[0]); + + if (( fd = open(buf, O_RDONLY, 0644)) == -1) + { +@@ -486,7 +537,7 @@ + } else { + for (i=0; i!= numftpclasses; i++) + { +- sprintf(buf, "%s/%s", ftp_pid_path, ftpclasses[i]); ++ snprintf(buf, 1024, "%s/%s", ftp_pid_path, ftpclasses[i]); + //printf("opening '%s'\n", buf); + fp = fopen(buf, "r"); + if (fp) +@@ -508,11 +559,10 @@ + // httpd processes + nHttp = 0; + +-#ifdef HTTP_MONITOR_PROC ++#if defined(HTTP_MONITOR_PROC) && !defined(__FreeBSD__) + + if ( monitor_http ) + { +- + dir = opendir("/proc"); + if (dir) + { +@@ -520,7 +570,7 @@ + { + if (!isalpha(dent->d_name[0])) + { +- sprintf(buf, "/proc/%s/stat", dent->d_name); ++ snprintf(buf, 1024, "/proc/%s/stat", dent->d_name); + //printf("opening '%s'\n", buf); + fp=fopen(buf, "r"); + if (fp) +@@ -544,41 +594,7 @@ + #ifdef HTTP_MONITOR_NET + + if ( monitor_http ) +- { +- +- fp = fopen("/proc/net/tcp", "r"); +- if (fp) +- { +- fgets(buf, 512, fp); // get rid of text header +- +- while ( (fgets(buf, 512, fp)) ) +- { +- tok = strtok(buf, sep2); +- tok = strtok(NULL, sep2); +- tok = strtok(NULL, sep2); +- +- tok[4]=0; +- tok1 = strtok(NULL, sep2); +- tok1 += 5; +- tok1[2] = 0; +- +- // printf("port: %i\n", strtol(tok, NULL, 16)); +- // printf("state: %i\n", strtol(tok1, NULL, 16)); +- +- i = strtol(tok, NULL, 16); +- j = strtol(tok1, NULL, 16); +- +- // should make this configurable +- if (( i == 80 || i == 8080) && (j == TCP_ESTABLISHED)) +- { +- nHttp++; +- } +- +- } +- +- fclose(fp); +- } +- } ++ nHttp = PortWatch( 80 ) + PortWatch( 8080 ); + #endif + + +@@ -587,7 +603,11 @@ + + if ( monitor_nfs ) + { ++#ifdef __FreeBSD__ ++ fp = popen("/usr/bin/showmount -a", "r"); ++#else + fp = popen("/usr/sbin/showmount -a", "r"); ++#endif /* __FreeBSD__ */ + if (fp) + { + while ( (fgets(buf, 128, fp)) ) +@@ -604,9 +624,46 @@ + // Total Processes + nProc = 0; + ++#if defined(__FreeBSD__) && defined(HTTP_MONITOR_PROC) ++ if( monitor_proc || monitor_http ) ++#else + if ( monitor_proc ) ++#endif /* __FreeBSD__ && HTTP_MONITOR_PROC */ + { +- ++#ifdef __FreeBSD__ ++ char errbuf[_POSIX2_LINE_MAX]; ++ kvm_t *kd = kvm_openfiles( NULL, NULL, NULL, O_RDONLY, errbuf ); ++ if( kd == 0 ) ++ fprintf( stderr, "%s", errbuf ); ++ else + { -+ int len = 0; -+ if( sysctlbyname( "net.inet.tcp.pcblist", 0, &len, 0, 0 ) >= 0 ) ++ int procs; ++ ++#ifdef HTTP_MONITOR_PROC ++ struct kinfo_proc *kinfo = ++#endif /* HTTP_MONITOR_PROC */ ++ kvm_getprocs(kd,KERN_PROC_ALL,0,&procs); ++ ++#ifdef HTTP_MONITOR_PROC ++ if( monitor_http ) + { -+ char *buf = malloc(len); -+ if( buf ) ++ int i; ++ for( i = 0; i < procs; i++ ) + { -+ if( sysctlbyname("net.inet.tcp.pcblist", buf, &len, 0, 0) >= 0 ) ++ if( !strncmp( KI_PROC(&kinfo[i])->p_comm, "(httpd)", 7 ) ) + { -+ struct xinpgen *xig, *oxig; -+ -+ oxig = xig = (struct xinpgen *)buf; -+ for( xig = (struct xinpgen *)((char *)xig + xig->xig_len); -+ xig->xig_len > sizeof(struct xinpgen); -+ xig = (struct xinpgen *)((char *)xig + xig->xig_len)) -+ { -+ struct tcpcb *tp = &((struct xtcpcb *)xig)->xt_tp; -+ struct inpcb *inp = &((struct xtcpcb *)xig)->xt_inp; -+ struct xsocket *so = &((struct xtcpcb *)xig)->xt_socket; -+ -+ if( ( so->xso_protocol != IPPROTO_TCP ) || -+ ( inp->inp_gencnt > oxig->xig_gen ) || -+ ( inet_lnaof(inp->inp_laddr) == INADDR_ANY ) ) -+ continue; -+ -+ if( ( ntohs((u_short)inp->inp_lport) == port ) && -+ ( tp->t_state == TCPS_ESTABLISHED ) ) -+ { -+ count++; -+ } -+ } ++ nHttp++; + } -+ free(buf); + } + } ++#endif /* HTTP_MONITOR_PROC */ ++ ++ kvm_close( kd ); ++ ++ if( monitor_proc ) ++ nProc = procs; + } -+ } -+ #else - FILE *fp; - char buf[1024]; - char *tok,*tok1; - int i,j; - char sep2[]={":"}; - - fp = fopen("/proc/net/tcp", "r"); - if (fp) - { -*************** -*** 661,666 **** ---- 770,776 ---- - - fclose(fp); - } -+ #endif /* __FreeBSD__ */ - - return count; - } -*************** -*** 713,726 **** - newx -= CHAR_WIDTH; - } - -! sprintf(buf, "%02i", num); - - BlitString(buf, newx, y); - } - - - // ReadConfigSetting -! int ReadConfigString(FILE *fp, char *setting, char *value) - { - char str[1024]; - char buf[1024]; ---- 823,836 ---- - newx -= CHAR_WIDTH; - } - -! snprintf(buf, 1024, "%02i", num); - - BlitString(buf, newx, y); - } - - - // ReadConfigSetting -! int ReadConfigString(FILE *fp, char *setting, char *value, int vallen) - { - char str[1024]; - char buf[1024]; -*************** -*** 735,741 **** - return 0; - } - -! sprintf(str, "%s=", setting); - slen = strlen(str); - - fseek(fp, 0, SEEK_SET); ---- 845,851 ---- - return 0; - } - -! snprintf(str, 1024, "%s=", setting); - slen = strlen(str); - - fseek(fp, 0, SEEK_SET); -*************** -*** 767,773 **** - if ( buf[i] == '=' ) - { - p=buf+i+1; -! strcpy(value, p); - return 1; - } - } ---- 877,883 ---- - if ( buf[i] == '=' ) - { - p=buf+i+1; -! strncpy(value, p, vallen); - return 1; - } - } -*************** -*** 782,788 **** - { - char buf[1024]; - -! if (ReadConfigString(fp, setting, (char *) &buf)) - { - *value = atoi(buf); - return 1; ---- 892,898 ---- - { - char buf[1024]; - -! if (ReadConfigString(fp, setting, (char *) &buf, 1024)) - { - *value = atoi(buf); - return 1; -*************** -*** 798,831 **** - fp = fopen(filename, "r"); - if (fp) - { -! ReadConfigString(fp, "action1", action1); -! ReadConfigString(fp, "action2", action2); -! ReadConfigString(fp, "action3", action3); -! ReadConfigString(fp, "action4", action4); -! ReadConfigString(fp, "action5", action5); - ReadConfigInt(fp, "monitor_proc", &monitor_proc); - ReadConfigInt(fp, "monitor_users", &monitor_users); - ReadConfigInt(fp, "monitor_ftp", &monitor_ftp); - ReadConfigInt(fp, "monitor_http", &monitor_http); - ReadConfigInt(fp, "monitor_nfs", &monitor_nfs); - ReadConfigInt(fp, "use_proftpd", &use_proftpd); -! ReadConfigString(fp, "ftp_pid_path", ftp_pid_path); - - ReadConfigInt(fp, "portwatch1.pos", &portwatch[1].pos); - ReadConfigInt(fp, "portwatch1.port", &portwatch[1].port); -! ReadConfigString(fp, "portwatch1.label", portwatch[1].label); - ReadConfigInt(fp, "portwatch2.pos", &portwatch[2].pos); - ReadConfigInt(fp, "portwatch2.port", &portwatch[2].port); -! ReadConfigString(fp, "portwatch2.label", portwatch[2].label); - ReadConfigInt(fp, "portwatch3.pos", &portwatch[3].pos); - ReadConfigInt(fp, "portwatch3.port", &portwatch[3].port); -! ReadConfigString(fp, "portwatch3.label", portwatch[3].label); - ReadConfigInt(fp, "portwatch4.pos", &portwatch[4].pos); - ReadConfigInt(fp, "portwatch4.port", &portwatch[4].port); -! ReadConfigString(fp, "portwatch4.label", portwatch[4].label); - ReadConfigInt(fp, "portwatch5.pos", &portwatch[5].pos); - ReadConfigInt(fp, "portwatch5.port", &portwatch[5].port); -! ReadConfigString(fp, "portwatch5.label", portwatch[5].label); - - fclose(fp); - return 1; ---- 908,941 ---- - fp = fopen(filename, "r"); - if (fp) - { -! ReadConfigString(fp, "action1", action1, 256); -! ReadConfigString(fp, "action2", action2, 256); -! ReadConfigString(fp, "action3", action3, 256); -! ReadConfigString(fp, "action4", action4, 256); -! ReadConfigString(fp, "action5", action5, 256); - ReadConfigInt(fp, "monitor_proc", &monitor_proc); - ReadConfigInt(fp, "monitor_users", &monitor_users); - ReadConfigInt(fp, "monitor_ftp", &monitor_ftp); - ReadConfigInt(fp, "monitor_http", &monitor_http); - ReadConfigInt(fp, "monitor_nfs", &monitor_nfs); - ReadConfigInt(fp, "use_proftpd", &use_proftpd); -! ReadConfigString(fp, "ftp_pid_path", ftp_pid_path, 256); - - ReadConfigInt(fp, "portwatch1.pos", &portwatch[1].pos); - ReadConfigInt(fp, "portwatch1.port", &portwatch[1].port); -! ReadConfigString(fp, "portwatch1.label", portwatch[1].label, 10); - ReadConfigInt(fp, "portwatch2.pos", &portwatch[2].pos); - ReadConfigInt(fp, "portwatch2.port", &portwatch[2].port); -! ReadConfigString(fp, "portwatch2.label", portwatch[2].label, 10); - ReadConfigInt(fp, "portwatch3.pos", &portwatch[3].pos); - ReadConfigInt(fp, "portwatch3.port", &portwatch[3].port); -! ReadConfigString(fp, "portwatch3.label", portwatch[3].label, 10); - ReadConfigInt(fp, "portwatch4.pos", &portwatch[4].pos); - ReadConfigInt(fp, "portwatch4.port", &portwatch[4].port); -! ReadConfigString(fp, "portwatch4.label", portwatch[4].label, 10); - ReadConfigInt(fp, "portwatch5.pos", &portwatch[5].pos); - ReadConfigInt(fp, "portwatch5.port", &portwatch[5].port); -! ReadConfigString(fp, "portwatch5.label", portwatch[5].label, 10); - - fclose(fp); - return 1; ++#else + fp = fopen("/proc/loadavg", "r"); + if (fp) + { +@@ -617,6 +674,7 @@ + + fclose(fp); + } ++#endif /* __FreeBSD__ */ + } + + // lpd +@@ -654,14 +712,61 @@ + + int PortWatch( short port ) + { ++ ++ int count=0; ++ ++#ifdef __FreeBSD__ ++ struct protoent *p; ++ ++ setprotoent(1); ++ setservent(1); ++ while((p = getprotoent())) ++ { ++ if( !strcmp( p->p_name, "tcp" ) ) ++ { ++ int len = 0; ++ if( sysctlbyname( "net.inet.tcp.pcblist", 0, &len, 0, 0 ) >= 0 ) ++ { ++ char *buf = malloc(len); ++ if( buf ) ++ { ++ if( sysctlbyname("net.inet.tcp.pcblist", buf, &len, 0, 0) >= 0 ) ++ { ++ struct xinpgen *xig, *oxig; ++ ++ oxig = xig = (struct xinpgen *)buf; ++ for( xig = (struct xinpgen *)((char *)xig + xig->xig_len); ++ xig->xig_len > sizeof(struct xinpgen); ++ xig = (struct xinpgen *)((char *)xig + xig->xig_len)) ++ { ++ struct tcpcb *tp = &((struct xtcpcb *)xig)->xt_tp; ++ struct inpcb *inp = &((struct xtcpcb *)xig)->xt_inp; ++ struct xsocket *so = &((struct xtcpcb *)xig)->xt_socket; ++ ++ if( ( so->xso_protocol != IPPROTO_TCP ) || ++ ( inp->inp_gencnt > oxig->xig_gen ) || ++ ( inet_lnaof(inp->inp_laddr) == INADDR_ANY ) ) ++ continue; ++ ++ if( ( ntohs((u_short)inp->inp_lport) == port ) && ++ ( tp->t_state == TCPS_ESTABLISHED ) ) ++ { ++ count++; ++ } ++ } ++ } ++ free(buf); ++ } ++ } ++ } ++ } ++#else + FILE *fp; + char buf[1024]; + char *tok,*tok1; + int i,j; + char sep2[]={":"}; + +- int count=0; +- + fp = fopen("/proc/net/tcp", "r"); + if (fp) + { +@@ -693,6 +798,7 @@ + + fclose(fp); + } ++#endif /* __FreeBSD__ */ + + return count; + } +@@ -745,14 +851,14 @@ + newx -= CHAR_WIDTH; + } + +- sprintf(buf, "%02i", num); ++ snprintf(buf, 1024, "%02i", num); + + BlitString(buf, newx, y); + } + + + // ReadConfigSetting +-int ReadConfigString(FILE *fp, char *setting, char *value) ++int ReadConfigString(FILE *fp, char *setting, char *value, int vallen) + { + char str[1024]; + char buf[1024]; +@@ -767,7 +873,7 @@ + return 0; + } + +- sprintf(str, "%s=", setting); ++ snprintf(str, 1024, "%s=", setting); + slen = strlen(str); + + fseek(fp, 0, SEEK_SET); +@@ -799,7 +905,7 @@ + if ( buf[i] == '=' ) + { + p=buf+i+1; +- strcpy(value, p); ++ strncpy(value, p, vallen); + return 1; + } + } +@@ -814,7 +920,7 @@ + { + char buf[1024]; + +- if (ReadConfigString(fp, setting, (char *) &buf)) ++ if (ReadConfigString(fp, setting, (char *) &buf, 1024)) + { + *value = atoi(buf); + return 1; +@@ -831,11 +937,11 @@ + if (fp) + { + ReadConfigInt(fp, "interval", &loopinterval); +- ReadConfigString(fp, "action1", action1); +- ReadConfigString(fp, "action2", action2); +- ReadConfigString(fp, "action3", action3); +- ReadConfigString(fp, "action4", action4); +- ReadConfigString(fp, "action5", action5); ++ ReadConfigString(fp, "action1", action1, 256); ++ ReadConfigString(fp, "action2", action2, 256); ++ ReadConfigString(fp, "action3", action3, 256); ++ ReadConfigString(fp, "action4", action4, 256); ++ ReadConfigString(fp, "action5", action5, 256); + ReadConfigInt(fp, "monitor_proc", &monitor_proc); + ReadConfigInt(fp, "monitor_users", &monitor_users); + ReadConfigInt(fp, "monitor_ftp", &monitor_ftp); +@@ -843,23 +949,23 @@ + ReadConfigInt(fp, "monitor_nfs", &monitor_nfs); + ReadConfigInt(fp, "monitor_lpd", &monitor_lpd); + ReadConfigInt(fp, "use_proftpd", &use_proftpd); +- ReadConfigString(fp, "ftp_pid_path", ftp_pid_path); ++ ReadConfigString(fp, "ftp_pid_path", ftp_pid_path, 256); + + ReadConfigInt(fp, "portwatch1.pos", &portwatch[1].pos); + ReadConfigInt(fp, "portwatch1.port", &portwatch[1].port); +- ReadConfigString(fp, "portwatch1.label", portwatch[1].label); ++ ReadConfigString(fp, "portwatch1.label", portwatch[1].label, 10); + ReadConfigInt(fp, "portwatch2.pos", &portwatch[2].pos); + ReadConfigInt(fp, "portwatch2.port", &portwatch[2].port); +- ReadConfigString(fp, "portwatch2.label", portwatch[2].label); ++ ReadConfigString(fp, "portwatch2.label", portwatch[2].label, 10); + ReadConfigInt(fp, "portwatch3.pos", &portwatch[3].pos); + ReadConfigInt(fp, "portwatch3.port", &portwatch[3].port); +- ReadConfigString(fp, "portwatch3.label", portwatch[3].label); ++ ReadConfigString(fp, "portwatch3.label", portwatch[3].label, 10); + ReadConfigInt(fp, "portwatch4.pos", &portwatch[4].pos); + ReadConfigInt(fp, "portwatch4.port", &portwatch[4].port); +- ReadConfigString(fp, "portwatch4.label", portwatch[4].label); ++ ReadConfigString(fp, "portwatch4.label", portwatch[4].label, 10); + ReadConfigInt(fp, "portwatch5.pos", &portwatch[5].pos); + ReadConfigInt(fp, "portwatch5.port", &portwatch[5].port); +- ReadConfigString(fp, "portwatch5.label", portwatch[5].label); ++ ReadConfigString(fp, "portwatch5.label", portwatch[5].label, 10); + + fclose(fp); + return 1; diff --git a/sysutils/wminet/files/patch-wminetrc b/sysutils/wminet/files/patch-wminetrc new file mode 100644 index 0000000..9419b97 --- /dev/null +++ b/sysutils/wminet/files/patch-wminetrc @@ -0,0 +1,25 @@ +--- wminetrc.orig Fri Dec 18 05:56:58 1998 ++++ wminetrc Thu Aug 16 11:09:23 2001 +@@ -18,7 +18,7 @@ + monitor_ftp=3 + monitor_http=4 + monitor_nfs=0 +-monitor_lpd=0 ++monitor_lpd=0 #Doesn't work in FreeBSD yet + + # ----------------- + # Interval -- seconds between stat updates +@@ -68,8 +68,8 @@ + # + # These correspond to the 5 positions. See above. + # +-action1=rxvt -bg black -fg white -e top +-action2=rxvt -bg black -fg white -e sh -c "w; read" +-action3=rxvt -bg black -fg white -e sh -c "ftpwho; read" +-action4=rxvt -bg black -fg white -e tail -f /usr/local/apache/var/logs/access_log +-action5=rxvt -bg black -fg white -e sh -c "showmount;read" ++action1=xterm -e top ++action2=xterm -e sh -c "w; read" ++action3=xterm -e sh -c "ftpwho; read" ++action4=xterm -e tail -f /usr/local/apache/var/logs/access_log ++action5=xterm -e sh -c "showmount; read" diff --git a/sysutils/wminet/pkg-descr b/sysutils/wminet/pkg-descr index c3ab522..2a9ccef 100644 --- a/sysutils/wminet/pkg-descr +++ b/sysutils/wminet/pkg-descr @@ -1,5 +1,5 @@ -WMiNET is a complete inetd monitoring dock.app, it's mainly -designed for usage in Window Maker's dock and gives you some +WMiNET is a complete inetd monitoring dockapp, it's mainly +designed for usage in WindowMaker's dock and gives you some nice & nifty features like: * Monitors number of processes, users, ftp users, @@ -10,5 +10,6 @@ nice & nifty features like: * Enable/disable monitoring through ~/.wminetrc; * Customs stats posistioning throught ~/.wminetrc * User-definable scripts/commands through ~/.wminetrc; + * lpd monitoring -WWW: http://www.neotokyo.org/illusion/ +WWW: http://www.neotokyo.org/illusion/ diff --git a/sysutils/wminet/pkg-plist b/sysutils/wminet/pkg-plist index 1249e28..c3a6d3e 100644 --- a/sysutils/wminet/pkg-plist +++ b/sysutils/wminet/pkg-plist @@ -1,4 +1,4 @@ bin/wminet etc/wminetrc -share/doc/wminet/HINTS -@dirrm share/doc/wminet +%%PORTDOCS%%share/doc/wminet/HINTS +%%PORTDOCS%%@dirrm share/doc/wminet |