1 /*
2 ** lookup-tester.c Tests the high-level ident calls.
3 **
4 ** Author: P�r Emanuelsson <pell@lysator.liu.se>, 28 March 1993
5 */
6
7 #if HAVE_CONFIG_H
8 # include "config.h"
9 #endif
10
11 #include <stdio.h>
12
13 #define IN_LIBIDENT_SRC
14 #include "ident.h"
15
main(int argc,char * argv[])16 int main (int argc, char *argv[])
17 {
18 IDENT *ident;
19 char *user;
20
21 /*
22 * We can't use puts() because it send LF instead of CRLF
23 * Note that perror() does not work properly either.
24 */
25 printf("Welcome to the other IDENT server tester, version 1.1\r\n\r\n");
26
27 printf("Testing ident_lookup...\r\n\r\n");
28 fflush(stdout);
29
30 ident = ident_lookup(0, 30);
31
32 if (!ident)
33 perror("ident");
34 else {
35 printf("IDENT response is:\r\n");
36 printf(" Lport........ %d\r\n", ident->lport);
37 printf(" Fport........ %d\r\n", ident->fport);
38 printf(" Opsys........ %s\r\n", ident->opsys);
39 printf(" Charset...... %s\r\n",
40 ident->charset ? ident->charset : "<not specified>");
41 printf(" Identifier... %s\r\n", ident->identifier);
42 }
43
44 ident_free(ident);
45
46 printf("\r\nTesting ident_id...\r\n\r\n");
47 fflush(stdout);
48
49 user = ident_id(fileno(stdin), 30);
50
51 if (user)
52 printf("IDENT response is identifier = %s\r\n", user);
53 else
54 perror("IDENT lookup failed");
55
56 fflush(stdout);
57 return 0;
58 }
59