Add code to pull options out of FINGER environment variable if present.

Yes, has same stupid bug as more(1), options must be specified as one
argument.

Submitted by:	pst
This commit is contained in:
Paul Traina 1994-09-08 19:27:06 +00:00
parent f844bfba3c
commit 59be608802
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=2589
2 changed files with 38 additions and 5 deletions

View File

@ -173,6 +173,14 @@ style.
The
.Fl l
option is the only option that may be passed to a remote machine.
.Sh ENVIRONMENT
.Nm Finger
utilizes the following environment variable, if it exists:
.Bl -tag -width Fl
.It Ev FINGER
This variable may be set with favored options to
.Nm finger .
.El
.Sh SEE ALSO
.Xr chpass 1 ,
.Xr w 1 ,

View File

@ -88,14 +88,14 @@ char tbuf[1024];
static void loginlist __P((void));
static void userlist __P((int, char **));
main(argc, argv)
int
option(argc, argv)
int argc;
char **argv;
{
int ch;
/* delete this for sun behavior */
oflag = 1; /* default to old behavior for now */
optind = 1; /* reset getopt */
while ((ch = getopt(argc, argv, "lmpsho")) != EOF)
switch(ch) {
@ -123,8 +123,33 @@ main(argc, argv)
"usage: finger [-lmpsho] [login ...]\n");
exit(1);
}
argc -= optind;
argv += optind;
return optind;
}
main(argc, argv)
int argc;
char **argv;
{
int ch, envargc, argcnt;
char *envargv[3];
/* remove this line to get remote host */
oflag = 1; /* default to old "office" behavior */
/*
* Process environment variables followed by command line arguments.
*/
if ((envargv[1] = getenv("FINGER"))) {
envargc = 2;
envargv[0] = "finger";
envargv[2] = NULL;
(void) option(envargc, envargv);
}
argcnt = option(argc, argv);
argc -= argcnt;
argv += argcnt;
(void)time(&now);
setpassent(1);