1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73
|
/*
** lookup-tester.c Tests the high-level ident calls.
**
** Author: Pr Emanuelsson <pell@lysator.liu.se>, 28 March 1993
*/
#ifdef NeXT3
# include <libc.h>
#endif
#include <errno.h>
#ifdef HAVE_ANSIHEADERS
# include <stdlib.h>
# include <unistd.h>
#endif
#include <sys/types.h>
/* Need this to make fileno() visible when compiling with strict ANSI */
#ifndef _POSIX_C_SOURCE
# define _POSIX_C_SOURCE
#endif
#include <stdio.h>
#define IN_LIBIDENT_SRC
#include "ident.h"
void
main __P2(int, argc,
char **, argv)
{
IDENT *ident;
char *user;
chdir("/tmp");
puts("Welcome to the other IDENT server tester, version 1.0\r\n\r");
puts("Testing ident_lookup...\r\n\r");
fflush(stdout);
ident = ident_lookup(fileno(stdin), 30);
if (!ident)
perror("ident");
else {
printf("IDENT response is:\r\n");
printf(" Lport........ %d\r\n", ident->lport);
printf(" Fport........ %d\r\n", ident->fport);
printf(" Opsys........ %s\r\n", ident->opsys);
printf(" Charset...... %s\r\n",
ident->charset ? ident->charset : "<not specified>");
printf(" Identifier... %s\r\n", ident->identifier);
}
ident_free(ident);
puts("\r\nTesting ident_id...\r\n\r");
fflush(stdout);
user = ident_id(fileno(stdin), 30);
if (user)
printf("IDENT response is identifier = %s\r\n", user);
else
puts("IDENT lookup failed!\r");
fflush(stdout);
sleep(1);
exit(0);
}
|