mirror of
https://github.com/opnsense/src.git
synced 2026-05-28 04:12:45 -04:00
Add rcsid, usage(). Silent -Wall. Use warn(3).
This commit is contained in:
parent
370ad8d767
commit
b14d8277cc
6 changed files with 46 additions and 17 deletions
|
|
@ -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 *));
|
||||
|
|
|
|||
|
|
@ -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. */
|
||||
|
|
|
|||
|
|
@ -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>
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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>
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Reference in a new issue