diff -Nrux .svn -x work /usr/ports/sysutils/psmisc/Makefile psmisc/Makefile --- /usr/ports/sysutils/psmisc/Makefile 2010-08-01 00:13:14.000000000 -0700 +++ psmisc/Makefile 2010-08-12 00:02:19.087759857 -0700 @@ -7,20 +7,39 @@ PORTNAME= psmisc PORTVERSION= 22.12 +PORTREVISION= 1 CATEGORIES= sysutils MASTER_SITES= SF/${PORTNAME}/${PORTNAME} MAINTAINER= sunpoet@sunpoet.net COMMENT= A port of the Linux pstree, killall and pidof commands +BUILD_DEPENDS= gsed:${PORTSDIR}/textproc/gsed + CONFLICTS= pidof-[0-9]* pstree-2.[0-9]* -CONFIGURE_ARGS= --disable-nls +LICENSE= GPLv2 + GNU_CONFIGURE= yes USE_GMAKE= yes +OPTIONS= NLS "Native Language Support via gettext utilities" On + +.include + MAN1= killall.1 pstree.1 -PLIST_FILES= bin/killall bin/pidof bin/pstree bin/pstree.x11 + +.if defined(WITHOUT_NLS) +CONFIGURE_ARGS+=--disable-nls +PLIST_SUB+= NLS="@comment " +.else +USE_GETTEXT= yes +CONFIGURE_ARGS+=--enable-nls +CPPFLAGS+= -I${LOCALBASE}/include +LDFLAGS+= -L${LOCALBASE}/lib +CONFIGURE_ENV+= CPPFLAGS="${CPPFLAGS}" LDFLAGS="${LDFLAGS}" +PLIST_SUB+= NLS="" +.endif post-patch: @${REINPLACE_CMD} -e '/^#define COMM_LEN / s|16|254|' ${WRKSRC}/src/comm.h @@ -28,4 +47,4 @@ post-install: @${LN} -fs killall ${PREFIX}/bin/pidof -.include +.include diff -Nrux .svn -x work /usr/ports/sysutils/psmisc/files/patch-src-Makefile.in psmisc/files/patch-src-Makefile.in --- /usr/ports/sysutils/psmisc/files/patch-src-Makefile.in 2010-08-01 00:13:14.000000000 -0700 +++ psmisc/files/patch-src-Makefile.in 2010-08-11 23:40:24.404739181 -0700 @@ -1,5 +1,5 @@ ---- src/Makefile.in.orig 2010-07-12 19:38:08.000000000 +0800 -+++ src/Makefile.in 2010-07-31 18:58:38.000000000 +0800 +--- src/Makefile.in.orig 2010-07-12 04:38:08.000000000 -0700 ++++ src/Makefile.in 2010-08-11 23:39:30.652095791 -0700 @@ -34,8 +34,8 @@ POST_UNINSTALL = : build_triplet = @build@ @@ -37,32 +37,37 @@ prtstat_SOURCES = prtstat.c prtstat.h BUILT_SOURCES = signames.h EXTRA_DIST = signames.c -@@ -545,14 +543,20 @@ - +@@ -299,19 +297,19 @@ + -test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS) + fuser$(EXEEXT): $(fuser_OBJECTS) $(fuser_DEPENDENCIES) + @rm -f fuser$(EXEEXT) +- $(LINK) $(fuser_OBJECTS) $(fuser_LDADD) $(LIBS) ++ $(LINK) $(fuser_OBJECTS) $(fuser_LDADD) $(LIBS) $(INTLLIBS) + killall$(EXEEXT): $(killall_OBJECTS) $(killall_DEPENDENCIES) + @rm -f killall$(EXEEXT) +- $(LINK) $(killall_OBJECTS) $(killall_LDADD) $(LIBS) ++ $(LINK) $(killall_OBJECTS) $(killall_LDADD) $(LIBS) $(INTLLIBS) + peekfd$(EXEEXT): $(peekfd_OBJECTS) $(peekfd_DEPENDENCIES) + @rm -f peekfd$(EXEEXT) +- $(LINK) $(peekfd_OBJECTS) $(peekfd_LDADD) $(LIBS) ++ $(LINK) $(peekfd_OBJECTS) $(peekfd_LDADD) $(LIBS) $(INTLLIBS) + prtstat$(EXEEXT): $(prtstat_OBJECTS) $(prtstat_DEPENDENCIES) + @rm -f prtstat$(EXEEXT) +- $(LINK) $(prtstat_OBJECTS) $(prtstat_LDADD) $(LIBS) ++ $(LINK) $(prtstat_OBJECTS) $(prtstat_LDADD) $(LIBS) $(INTLLIBS) + pstree$(EXEEXT): $(pstree_OBJECTS) $(pstree_DEPENDENCIES) + @rm -f pstree$(EXEEXT) +- $(LINK) $(pstree_OBJECTS) $(pstree_LDADD) $(LIBS) ++ $(LINK) $(pstree_OBJECTS) $(pstree_LDADD) $(LIBS) $(INTLLIBS) + mostlyclean-compile: + -rm -f *.$(OBJEXT) +@@ -547,7 +545,7 @@ signames.h: signames.c Makefile -- export LC_ALL=C ; \ -- @CPP@ -dM $< |\ + export LC_ALL=C ; \ + @CPP@ -dM $< |\ - tr -s '\t ' ' ' | sort -n -k 3 | sed \ -- 's:#define SIG\([A-Z]\+[0-9]*\) \([0-9]\+\) *\(\|/\*.*\)$$:{\ \2,"\1" },:p;d' | \ -- grep -v '[0-9][0-9][0-9]' >signames.h || \ -- { rm -f signames.h; exit 1; } -- grep '^{ 1,"HUP" },$$' signames.h >/dev/null || \ -- { rm -f signames.h; exit 1; } -+ @CPP@ -dM $< | {\ -+ signames=`kill -l | tr a-z A-Z`; \ -+ while read define name value; do \ -+ [ "$$define" = '#define' ] || continue; \ -+ case "$$value" in \ -+ *[!0-9]*) continue; \ -+ esac; \ -+ for signame in $$signames; do \ -+ if [ "$$name" = "SIG$$signame" ]; then \ -+ echo "{ $$value, \"$$signame\" },"; \ -+ fi; \ -+ done; \ -+ done; \ -+ } | sort -n -k 2 > signames.h - - install-exec-hook: - cd $(DESTDIR)$(bindir) && \ ++ tr -s '\t ' ' ' | sort -n -k 3 | gsed \ + 's:#define SIG\([A-Z]\+[0-9]*\) \([0-9]\+\) *\(\|/\*.*\)$$:{\ \2,"\1" },:p;d' | \ + grep -v '[0-9][0-9][0-9]' >signames.h || \ + { rm -f signames.h; exit 1; } diff -Nrux .svn -x work /usr/ports/sysutils/psmisc/files/patch-src-pstree.c psmisc/files/patch-src-pstree.c --- /usr/ports/sysutils/psmisc/files/patch-src-pstree.c 2010-08-01 00:13:14.000000000 -0700 +++ psmisc/files/patch-src-pstree.c 2010-08-11 23:28:33.395505589 -0700 @@ -1,14 +1,16 @@ --- src/pstree.c.orig 2009-12-27 15:46:47.000000000 +0900 +++ src/pstree.c 2010-01-03 00:52:21.437862505 +0900 -@@ -37,6 +37,7 @@ +@@ -37,6 +37,9 @@ #include #include #include ++#ifdef __FreeBSD__ +#include ++#endif #include #include #include -@@ -590,7 +591,11 @@ +@@ -590,7 +594,11 @@ struct dirent *de; FILE *file; struct stat st; @@ -20,31 +22,53 @@ char *buffer; size_t buffer_size; char readbuf[BUFSIZ + 1]; -@@ -623,7 +628,7 @@ +@@ -623,7 +631,11 @@ if ((pid = (pid_t) atoi(de->d_name)) != 0) { if (! (path = malloc(strlen(PROC_BASE) + strlen(de->d_name) + 10))) exit(2); -- sprintf(path, "%s/%d/stat", PROC_BASE, pid); ++#ifdef __FreeBSD__ + sprintf(path, "%s/%d/status", PROC_BASE, pid); ++#else + sprintf(path, "%s/%d/stat", PROC_BASE, pid); ++#endif if ((file = fopen(path, "r")) != NULL) { empty = 0; sprintf(path, "%s/%d", PROC_BASE, pid); -@@ -638,6 +643,10 @@ +@@ -638,6 +650,29 @@ perror(path); exit(1); } +#ifdef __FreeBSD__ -+ if (fscanf(file, "%s %*d %d", comm, &ppid) == 2) -+ add_proc(comm, pid, ppid, st.st_uid, NULL, 0, 0); ++ /* Read comm and ppid */ ++ if (fscanf(file, "%s %*d %d", readbuf, &ppid) == 2) { ++ tmpptr = readbuf; ++ size = 0; ++ /* Unescape comm */ ++ do { ++ if (*tmpptr == '\\') ++ { ++ char tmp = tmpptr[4]; ++ tmpptr[4] = 0; ++ comm[size++] = strtol(++tmpptr, NULL, 8); ++ tmpptr += 2; ++ tmpptr[1] = tmp; ++ } ++ else ++ comm[size++] = *tmpptr; ++ } while (*++tmpptr); ++ comm[size] = 0; ++ /* Balance braces */ ++ { ++ { +#else size = fread(readbuf, 1, BUFSIZ, file); if (ferror(file) == 0) { readbuf[size] = 0; -@@ -725,6 +734,7 @@ - } - } - } +@@ -692,6 +727,7 @@ + (void) closedir(taskdir); + } + free(taskpath); +#endif /*__FreeBSD__*/ - (void) fclose(file); - } - free(path); + if (!print_args) + #ifdef WITH_SELINUX + add_proc(comm, pid, ppid, st.st_uid, NULL, 0, 0, scontext); diff -Nrux .svn -x work /usr/ports/sysutils/psmisc/pkg-plist psmisc/pkg-plist --- /usr/ports/sysutils/psmisc/pkg-plist 1969-12-31 16:00:00.000000000 -0800 +++ psmisc/pkg-plist 2010-05-18 22:50:42.730462413 -0700 @@ -0,0 +1,26 @@ +bin/killall +bin/pidof +bin/pstree +bin/pstree.x11 +%%NLS%%share/locale/bg/LC_MESSAGES/psmisc.mo +%%NLS%%share/locale/ca/LC_MESSAGES/psmisc.mo +%%NLS%%share/locale/cs/LC_MESSAGES/psmisc.mo +%%NLS%%share/locale/de/LC_MESSAGES/psmisc.mo +%%NLS%%share/locale/el/LC_MESSAGES/psmisc.mo +%%NLS%%share/locale/eu/LC_MESSAGES/psmisc.mo +%%NLS%%share/locale/fi/LC_MESSAGES/psmisc.mo +%%NLS%%share/locale/fr/LC_MESSAGES/psmisc.mo +%%NLS%%share/locale/hu/LC_MESSAGES/psmisc.mo +%%NLS%%share/locale/id/LC_MESSAGES/psmisc.mo +%%NLS%%share/locale/it/LC_MESSAGES/psmisc.mo +%%NLS%%share/locale/ja/LC_MESSAGES/psmisc.mo +%%NLS%%share/locale/nb/LC_MESSAGES/psmisc.mo +%%NLS%%share/locale/nl/LC_MESSAGES/psmisc.mo +%%NLS%%share/locale/pl/LC_MESSAGES/psmisc.mo +%%NLS%%share/locale/pt/LC_MESSAGES/psmisc.mo +%%NLS%%share/locale/ro/LC_MESSAGES/psmisc.mo +%%NLS%%share/locale/ru/LC_MESSAGES/psmisc.mo +%%NLS%%share/locale/sv/LC_MESSAGES/psmisc.mo +%%NLS%%share/locale/vi/LC_MESSAGES/psmisc.mo +%%NLS%%share/locale/zh_CN/LC_MESSAGES/psmisc.mo +%%NLS%%share/locale/zh_TW/LC_MESSAGES/psmisc.mo