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

Defined functions

__P2 defined in line 29; never used

Defined variables

main defined in line 30; never used

Defined macros

IN_LIBIDENT_SRC defined in line 26; never used
_POSIX_C_SOURCE defined in line 22; used 1 times
  • in line 21
Last modified: 1994-10-20
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: ?E00
Valid CSS Valid XHTML 1.0 Strict