From owner-svn-ports-all@freebsd.org Wed Oct 14 23:52:05 2015 Return-Path: Delivered-To: svn-ports-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7F755A15176; Wed, 14 Oct 2015 23:52:05 +0000 (UTC) (envelope-from amdmi3@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 545C52F1; Wed, 14 Oct 2015 23:52:05 +0000 (UTC) (envelope-from amdmi3@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t9ENq4FT055655; Wed, 14 Oct 2015 23:52:04 GMT (envelope-from amdmi3@FreeBSD.org) Received: (from amdmi3@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t9ENq4DS055652; Wed, 14 Oct 2015 23:52:04 GMT (envelope-from amdmi3@FreeBSD.org) Message-Id: <201510142352.t9ENq4DS055652@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: amdmi3 set sender to amdmi3@FreeBSD.org using -f From: Dmitry Marakasov Date: Wed, 14 Oct 2015 23:52:04 +0000 (UTC) To: ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org Subject: svn commit: r399320 - in head/sysutils/whowatch: . files X-SVN-Group: ports-head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-ports-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the ports tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 14 Oct 2015 23:52:05 -0000 Author: amdmi3 Date: Wed Oct 14 23:52:03 2015 New Revision: 399320 URL: https://svnweb.freebsd.org/changeset/ports/399320 Log: - Add LICENSE - Drop 8.x support Approved by: portmgr blanket Added: head/sysutils/whowatch/files/patch-whowatch.c - copied unchanged from r397474, head/sysutils/whowatch/files/utmpx-whowatch.c head/sysutils/whowatch/files/patch-whowatch.h - copied unchanged from r397474, head/sysutils/whowatch/files/utmpx-whowatch.h Deleted: head/sysutils/whowatch/files/utmpx-whowatch.c head/sysutils/whowatch/files/utmpx-whowatch.h Modified: head/sysutils/whowatch/Makefile Modified: head/sysutils/whowatch/Makefile ============================================================================== --- head/sysutils/whowatch/Makefile Wed Oct 14 23:52:00 2015 (r399319) +++ head/sysutils/whowatch/Makefile Wed Oct 14 23:52:03 2015 (r399320) @@ -11,19 +11,15 @@ MASTER_SITES= http://wizard.ae.krakow.pl MAINTAINER= ports@FreeBSD.org COMMENT= Displays information in real time about users currently logged on +LICENSE= GPLv2 +LICENSE_FILE= ${WRKSRC}/COPYING + GNU_CONFIGURE= yes PLIST_FILES= bin/whowatch man/man1/${PORTNAME}.1.gz -.include - -.if ${OSVERSION} > 900006 -EXTRA_PATCHES= ${PATCHDIR}/utmpx-whowatch.h \ - ${PATCHDIR}/utmpx-whowatch.c -.endif - pre-patch: @${FIND} ${WRKSRC} -name 'proc????.c' | ${XARGS} ${REINPLACE_CMD} -E \ -e 's/kp_.?proc\.._/ki_/ ; s/pcred\.p_//' -.include +.include Copied: head/sysutils/whowatch/files/patch-whowatch.c (from r397474, head/sysutils/whowatch/files/utmpx-whowatch.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sysutils/whowatch/files/patch-whowatch.c Wed Oct 14 23:52:03 2015 (r399320, copy of r397474, head/sysutils/whowatch/files/utmpx-whowatch.c) @@ -0,0 +1,105 @@ +--- whowatch.c.orig 2000-06-06 03:21:44.000000000 -0700 ++++ whowatch.c 2010-02-02 19:56:37.081269004 -0800 +@@ -119,21 +119,17 @@ + /* + * Create new user structure and fill it + */ +-struct user_t *allocate_user(struct utmp *entry) ++struct user_t *allocate_user(struct utmpx *entry) + { + struct user_t *u; + int ppid; + u = calloc(1, sizeof *u); + if(!u) errx(1, "Cannot allocate memory."); +- strncpy(u->name, entry->ut_user, UT_NAMESIZE); +- strncpy(u->tty, entry->ut_line, UT_LINESIZE); +- strncpy(u->host, entry->ut_host, UT_HOSTSIZE); ++ strncpy(u->name, entry->ut_user, sizeof(entry->ut_user)); ++ strncpy(u->tty, entry->ut_line, sizeof(entry->ut_line)); ++ strncpy(u->host, entry->ut_host, sizeof(entry->ut_host)); + +-#ifdef HAVE_UTPID + u->pid = entry->ut_pid; +-#else +- u->pid = get_login_pid(u->tty); +-#endif + + if((ppid = get_ppid(u->pid)) == -1) + strncpy(u->parent, "can't access", sizeof u->parent); +@@ -192,34 +188,24 @@ + */ + void read_utmp() + { +- int fd, i; +- static struct utmp entry; ++ static struct utmpx *entry; + struct user_t *u; ++ ++ while ((entry = getutxent()) != NULL) { + +- if ((fd = open(UTMP_FILE ,O_RDONLY)) == -1){ +- curses_end(); +- errx(1, "Cannot open " UTMP_FILE); +- } +- while((i = read(fd, &entry,sizeof entry)) > 0) { +- if(i != sizeof entry) errx(1, "Error reading " UTMP_FILE ); +-#ifdef HAVE_USER_PROCESS +- if(entry.ut_type != USER_PROCESS) continue; +-#else +- if(!entry.ut_name[0]) continue; +-#endif +- u = allocate_user(&entry); ++ if(entry->ut_type != USER_PROCESS) continue; ++ u = allocate_user(entry); + print_user(u); + update_nr_users(u->parent, &u->prot, LOGIN); + how_many ++; + users_list.d_lines = how_many; + addto_list(u, users); + } +- close(fd); + wnoutrefresh(users_list.wd); + return; + } + +-struct user_t* new_user(struct utmp *newone) ++struct user_t* new_user(struct utmpx *newone) + { + struct user_t *u; + u = allocate_user(newone); +@@ -246,7 +232,7 @@ + void check_wtmp() + { + struct user_t *u; +- struct utmp entry; ++ struct utmpx entry; + int i; + + while((i = read(wtmp_fd, &entry, sizeof entry)) > 0){ +@@ -256,25 +242,17 @@ + errx(1, "Error reading " WTMP_FILE ); + } + /* user just logged in */ +-#ifdef HAVE_USER_PROCESS + if(entry.ut_type == USER_PROCESS) { +-#else +- if(entry.ut_user[0]) { +-#endif + u = new_user(&entry); + print_user(u); + wrefresh(users_list.wd); + print_info(); + continue; + } +-#ifdef HAVE_DEAD_PROCESS + if(entry.ut_type != DEAD_PROCESS) continue; +-#else +-// if(entry.ut_line[0]) continue; +-#endif + /* user just logged out */ + for_each(u, users) { +- if(strncmp(u->tty, entry.ut_line, UT_LINESIZE)) ++ if(strncmp(u->tty, entry.ut_line, sizeof(entry.ut_line))) + continue; + if (state == USERS_LIST) + delete_line(&users_list, u->line); Copied: head/sysutils/whowatch/files/patch-whowatch.h (from r397474, head/sysutils/whowatch/files/utmpx-whowatch.h) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sysutils/whowatch/files/patch-whowatch.h Wed Oct 14 23:52:03 2015 (r399320, copy of r397474, head/sysutils/whowatch/files/utmpx-whowatch.h) @@ -0,0 +1,27 @@ +--- whowatch.h.orig 2010-02-02 19:18:34.763514932 -0800 ++++ whowatch.h 2010-02-02 19:20:44.905393020 -0800 +@@ -2,7 +2,7 @@ + #include + #include + #include +-#include ++#include + #include + #include + #include +@@ -75,12 +75,12 @@ + { + struct user_t *next; + struct user_t *prev; +- char name[UT_NAMESIZE + 1]; /* login name */ +- char tty[UT_LINESIZE + 1]; /* tty */ ++ char name[sizeof(((struct utmpx *)0)->ut_user)]; /* login name */ ++ char tty[sizeof(((struct utmpx *)0)->ut_line)]; /* tty */ + int prot; + int pid; /* pid of login shell */ + char parent[16]; +- char host[UT_HOSTSIZE + 1]; ++ char host[sizeof(((struct utmpx *)0)->ut_host)]; + int line; + }; +