summaryrefslogtreecommitdiffstats
path: root/usr.bin/finger
diff options
context:
space:
mode:
authorcharnier <charnier@FreeBSD.org>1997-07-02 06:34:51 +0000
committercharnier <charnier@FreeBSD.org>1997-07-02 06:34:51 +0000
commit4f0a8d27eade450177c40030a521bf36e928072c (patch)
treebd9c4e7b5fb6ade49d178792a0d7cc84b4bbeb01 /usr.bin/finger
parent71f3417bb9e62e466a658f021e5f0c468abfe767 (diff)
downloadFreeBSD-src-4f0a8d27eade450177c40030a521bf36e928072c.zip
FreeBSD-src-4f0a8d27eade450177c40030a521bf36e928072c.tar.gz
Add rcsid, usage(). Silent -Wall. Use warn(3).
Diffstat (limited to 'usr.bin/finger')
-rw-r--r--usr.bin/finger/extern.h1
-rw-r--r--usr.bin/finger/finger.c28
-rw-r--r--usr.bin/finger/lprint.c5
-rw-r--r--usr.bin/finger/net.c13
-rw-r--r--usr.bin/finger/sprint.c5
-rw-r--r--usr.bin/finger/util.c11
6 files changed, 46 insertions, 17 deletions
diff --git a/usr.bin/finger/extern.h b/usr.bin/finger/extern.h
index b213fe4..e9abd72 100644
--- a/usr.bin/finger/extern.h
+++ b/usr.bin/finger/extern.h
@@ -41,6 +41,7 @@ void enter_lastlog __P((PERSON *));
PERSON *enter_person __P((struct passwd *));
void enter_where __P((struct utmp *, PERSON *));
PERSON *find_person __P((char *));
+int hide __P((struct passwd *));
void lflag_print __P((void));
int match __P((struct passwd *, char *));
void netfinger __P((char *));
diff --git a/usr.bin/finger/finger.c b/usr.bin/finger/finger.c
index 7e7443f..091ac16 100644
--- a/usr.bin/finger/finger.c
+++ b/usr.bin/finger/finger.c
@@ -51,7 +51,12 @@ static char copyright[] =
#endif /* not lint */
#ifndef lint
+#if 0
static char sccsid[] = "@(#)finger.c 8.5 (Berkeley) 5/4/95";
+#else
+static const char rcsid[] =
+ "$Id$";
+#endif
#endif /* not lint */
/*
@@ -92,6 +97,7 @@ int entries, lflag, mflag, pplan, sflag, oflag, Tflag;
char tbuf[1024];
static void loginlist __P((void));
+static void usage __P((void));
static void userlist __P((int, char **));
int
@@ -128,19 +134,25 @@ option(argc, argv)
break;
case '?':
default:
- (void)fprintf(stderr,
- "usage: finger [-lmpshoT] [login ...]\n");
- exit(1);
+ usage();
}
return optind;
}
+static void
+usage()
+{
+ (void)fprintf(stderr, "usage: finger [-lmpshoT] [login ...]\n");
+ exit(1);
+}
+
+int
main(argc, argv)
int argc;
char **argv;
{
- int ch, envargc, argcnt;
+ int envargc, argcnt;
char *envargv[3];
(void) setlocale(LC_ALL, "");
@@ -205,7 +217,7 @@ loginlist()
if (!freopen(_PATH_UTMP, "r", stdin))
err(1, "%s", _PATH_UTMP);
- name[UT_NAMESIZE] = NULL;
+ name[UT_NAMESIZE] = '\0';
while (fread((char *)&user, sizeof(user), 1, stdin) == 1) {
if (!user.ut_name[0])
continue;
@@ -271,8 +283,7 @@ userlist(argc, argv)
if (((pw = getpwnam(*p)) != NULL) && !hide(pw))
enter_person(pw);
else
- (void)fprintf(stderr,
- "finger: %s: no such user\n", *p);
+ warnx("%s: no such user", *p);
else {
while ((pw = getpwent()) != NULL) {
for (p = argv, ip = used; *p; ++p, ++ip)
@@ -283,8 +294,7 @@ userlist(argc, argv)
}
for (p = argv, ip = used; *p; ++p, ++ip)
if (!*ip)
- (void)fprintf(stderr,
- "finger: %s: no such user\n", *p);
+ warnx("%s: no such user", *p);
}
/* Handle network requests. */
diff --git a/usr.bin/finger/lprint.c b/usr.bin/finger/lprint.c
index 9ab0673..a0643ca 100644
--- a/usr.bin/finger/lprint.c
+++ b/usr.bin/finger/lprint.c
@@ -35,7 +35,12 @@
*/
#ifndef lint
+#if 0
static char sccsid[] = "@(#)lprint.c 8.3 (Berkeley) 4/28/95";
+#else
+static const char rcsid[] =
+ "$Id$";
+#endif
#endif /* not lint */
#include <sys/types.h>
diff --git a/usr.bin/finger/net.c b/usr.bin/finger/net.c
index 1173847..e4bbfc6 100644
--- a/usr.bin/finger/net.c
+++ b/usr.bin/finger/net.c
@@ -35,7 +35,12 @@
*/
#ifndef lint
+#if 0
static char sccsid[] = "@(#)net.c 8.4 (Berkeley) 4/28/95";
+#else
+static const char rcsid[] =
+ "$Id$";
+#endif
#endif /* not lint */
#include <sys/types.h>
@@ -44,6 +49,7 @@ static char sccsid[] = "@(#)net.c 8.4 (Berkeley) 4/28/95";
#include <arpa/inet.h>
#include <netdb.h>
#include <db.h>
+#include <err.h>
#include <unistd.h>
#include <pwd.h>
#include <utmp.h>
@@ -72,7 +78,7 @@ netfinger(name)
if (!(host = rindex(name, '@')))
return;
- *host++ = NULL;
+ *host++ = '\0';
if (isdigit(*host) && (defaddr.s_addr = inet_addr(host)) != -1) {
def.h_name = host;
def.h_addr_list = alist;
@@ -82,12 +88,11 @@ netfinger(name)
def.h_aliases = 0;
hp = &def;
} else if (!(hp = gethostbyname(host))) {
- (void)fprintf(stderr,
- "finger: unknown host: %s\n", host);
+ warnx("unknown host: %s", host);
return;
}
if (!(sp = getservbyname("finger", "tcp"))) {
- (void)fprintf(stderr, "finger: tcp/finger: unknown service\n");
+ warnx("tcp/finger: unknown service");
return;
}
sin.sin_family = hp->h_addrtype;
diff --git a/usr.bin/finger/sprint.c b/usr.bin/finger/sprint.c
index 07218aa..8c38d7c 100644
--- a/usr.bin/finger/sprint.c
+++ b/usr.bin/finger/sprint.c
@@ -35,7 +35,12 @@
*/
#ifndef lint
+#if 0
static char sccsid[] = "@(#)sprint.c 8.3 (Berkeley) 4/28/95";
+#else
+static const char rcsid[] =
+ "$Id$";
+#endif
#endif /* not lint */
#include <sys/types.h>
diff --git a/usr.bin/finger/util.c b/usr.bin/finger/util.c
index 6931f86..0a48d46 100644
--- a/usr.bin/finger/util.c
+++ b/usr.bin/finger/util.c
@@ -35,7 +35,12 @@
*/
#ifndef lint
+#if 0
static char sccsid[] = "@(#)util.c 8.3 (Berkeley) 4/28/95";
+#else
+static const char rcsid[] =
+ "$Id$";
+#endif
#endif /* not lint */
#include <sys/param.h>
@@ -114,7 +119,7 @@ enter_lastlog(pn)
(long)pn->uid * sizeof(ll) ||
read(fd, (char *)&ll, sizeof(ll)) != sizeof(ll)) {
/* as if never logged in */
- ll.ll_line[0] = ll.ll_host[0] = NULL;
+ ll.ll_line[0] = ll.ll_host[0] = '\0';
ll.ll_time = 0;
}
if ((w = pn->whead) == NULL)
@@ -368,8 +373,7 @@ userinfo(pn, pw)
pn->mailrecv = -1; /* -1 == not_valid */
if (stat(tbuf, &sb) < 0) {
if (errno != ENOENT) {
- (void)fprintf(stderr,
- "finger: %s: %s\n", tbuf, strerror(errno));
+ warn("%s", tbuf);
return;
}
} else if (sb.st_size != 0) {
@@ -387,7 +391,6 @@ int
hide(pw)
struct passwd *pw;
{
- int fd;
char buf[MAXPATHLEN+1];
if (!pw->pw_dir)
OpenPOWER on IntegriCloud