diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 1996-05-30 08:44:12 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 1996-05-30 08:44:12 +0000 |
commit | 28ef74179be25b670085ca4bcdb42ecf5f2a5e4c (patch) | |
tree | fa08eddb30622e2c7832befef03f3b8f8f904920 /libexec/fingerd/fingerd.c | |
parent | 9619552f7534e6fb50b2aa4aac6f4243809e2523 (diff) |
optimize something like "finger @@@@@@@@@@@@@cvs@@@@@@cvs@@@@@@cvs' to hit
fewer hosts. Basically, chew @ signs when possible.
Diffstat (limited to 'libexec/fingerd/fingerd.c')
-rw-r--r-- | libexec/fingerd/fingerd.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/libexec/fingerd/fingerd.c b/libexec/fingerd/fingerd.c index 50a6b33e55a..04fac1d0538 100644 --- a/libexec/fingerd/fingerd.c +++ b/libexec/fingerd/fingerd.c @@ -39,7 +39,7 @@ char copyright[] = #ifndef lint /*static char sccsid[] = "from: @(#)fingerd.c 5.6 (Berkeley) 6/1/90";*/ -static char rcsid[] = "$Id: fingerd.c,v 1.1 1995/10/18 08:43:15 deraadt Exp $"; +static char rcsid[] = "$Id: fingerd.c,v 1.2 1996/05/30 08:44:11 deraadt Exp $"; #endif /* not lint */ #include <stdio.h> @@ -53,6 +53,7 @@ main() int p[2]; #define ENTRIES 50 char **ap, *av[ENTRIES + 1], line[1024], *strtok(); + int i; #ifdef LOGGING /* unused for now */ #include <netinet/in.h> @@ -80,6 +81,15 @@ main() lp = NULL; } + for (i = 1; av[i]; i++) { + int l = strlen(av[i]); + + while (av[i][l-1] == '@') + av[i][--l] = '\0'; + if (av[i][0] == '\0') + av[i] = NULL; + } + if (pipe(p) < 0) fatal("pipe"); |