From owner-svn-src-all@FreeBSD.ORG Wed Jul 3 20:44:47 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id CFB832DC; Wed, 3 Jul 2013 20:44:47 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id A5AB516EF; Wed, 3 Jul 2013 20:44:47 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r63Kilpx009820; Wed, 3 Jul 2013 20:44:47 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r63Kil9d009819; Wed, 3 Jul 2013 20:44:47 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <201307032044.r63Kil9d009819@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Wed, 3 Jul 2013 20:44:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r252599 - head/usr.bin/rwho X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 03 Jul 2013 20:44:47 -0000 Author: pjd Date: Wed Jul 3 20:44:47 2013 New Revision: 252599 URL: http://svnweb.freebsd.org/changeset/base/252599 Log: Few more style nits. MFC after: 1 month Modified: head/usr.bin/rwho/rwho.c Modified: head/usr.bin/rwho/rwho.c ============================================================================== --- head/usr.bin/rwho/rwho.c Wed Jul 3 20:42:10 2013 (r252598) +++ head/usr.bin/rwho/rwho.c Wed Jul 3 20:44:47 2013 (r252599) @@ -62,7 +62,7 @@ __FBSDID("$FreeBSD$"); #include #define NUSERS 1000 -#define WHDRSIZE (ssize_t)(sizeof (wd) - sizeof (wd.wd_we)) +#define WHDRSIZE (ssize_t)(sizeof(wd) - sizeof(wd.wd_we)) /* * this macro should be shared with ruptime. */ @@ -143,18 +143,18 @@ main(int argc, char *argv[]) continue; if (cap_rights_limit(f, CAP_READ) < 0 && errno != ENOSYS) err(1, "cap_rights_limit failed: %s", dp->d_name); - cc = read(f, (char *)&wd, sizeof (struct whod)); + cc = read(f, (char *)&wd, sizeof(struct whod)); if (cc < WHDRSIZE) { (void) close(f); continue; } - if (down(w,now) != 0) { + if (down(w, now) != 0) { (void) close(f); continue; } cc -= WHDRSIZE; we = w->wd_we; - for (n = cc / sizeof (struct whoent); n > 0; n--) { + for (n = cc / sizeof(struct whoent); n > 0; n--) { if (aflg == 0 && we->we_idle >= 60 * 60) { we++; continue; @@ -170,7 +170,7 @@ main(int argc, char *argv[]) } (void) close(f); } - qsort((char *)myutmp, nusers, sizeof (struct myutmp), utmpcmp); + qsort((char *)myutmp, nusers, sizeof(struct myutmp), utmpcmp); mp = myutmp; width = 0; for (i = 0; i < nusers; i++) { @@ -188,18 +188,14 @@ main(int argc, char *argv[]) time_t t; t = _int_to_time(mp->myutmp.out_time); - strftime(cbuf, sizeof(cbuf), - d_first ? "%e %b %R" : "%b %e %R", + strftime(cbuf, sizeof(cbuf), d_first ? "%e %b %R" : "%b %e %R", localtime(&t)); (void) sprintf(buf, "%s:%-.*s", mp->myhost, (int)sizeof(mp->myutmp.out_line), mp->myutmp.out_line); printf("%-*.*s %-*s %s", (int)sizeof(mp->myutmp.out_name), (int)sizeof(mp->myutmp.out_name), - mp->myutmp.out_name, - width, - buf, - cbuf); + mp->myutmp.out_name, width, buf, cbuf); mp->myidle /= 60; if (mp->myidle != 0) { if (aflg != 0) { @@ -224,6 +220,7 @@ main(int argc, char *argv[]) static void usage(void) { + fprintf(stderr, "usage: rwho [-a]\n"); exit(1); } @@ -242,6 +239,6 @@ utmpcmp(const void *u1, const void *u2) rc = strcmp(MYUTMP(u1)->myhost, MYUTMP(u2)->myhost); if (rc != 0) return (rc); - return (strncmp(MYUTMP(u1)->myutmp.out_line, MYUTMP(u2)->myutmp.out_line, - sizeof(MYUTMP(u2)->myutmp.out_line))); + return (strncmp(MYUTMP(u1)->myutmp.out_line, + MYUTMP(u2)->myutmp.out_line, sizeof(MYUTMP(u2)->myutmp.out_line))); }