2 * Copyright (c) 1983 Regents of the University of California.
3 * All rights reserved. The Berkeley software License Agreement
4 * specifies the terms and conditions for redistribution.
8 static char sccsid
[] = "@(#)in.fingerd.c 1.1 87/12/21 SMI"; /* from UCB 5.1 6/6/85 */
14 #include <sys/types.h>
22 int main( int argc
, char *argv
[] );
23 void fatal( char *prog
, char *s
);
30 int i
, p
[2], pid
, status
;
35 fgets(line
, sizeof(line
), stdin
);
36 sp
= line
+ strlen(line
);
37 if (sp
> line
&& *--sp
== '\n') *sp
= '\0';
46 if (*sp
== '/' && (sp
[1] == 'W' || sp
[1] == 'w')) {
50 if (*sp
&& !isspace(*sp
)) {
52 while (*sp
&& !isspace(*sp
))
59 fatal(argv
[0], "pipe");
60 if ((pid
= fork()) == 0) {
66 execv("/usr/bin/finger", av
);
67 printf("No finger program found\n");
72 fatal(argv
[0], "fork");
74 if ((fp
= fdopen(p
[0], "r")) == NULL
)
75 fatal(argv
[0], "fdopen");
76 while ((i
= getc(fp
)) != EOF
) {
82 while ((i
= wait(&status
)) != pid
&& i
!= -1)
91 fprintf(stderr
, "%s: ", prog
);