## tests/pw/test_pw.c

/* [<][>][^][v][top][bottom][index][help] */

## FUNCTIONS

This source file includes following functions.

1. SK_close
2. SK_puts
3. CO_get_whois_suspended
4. SK_gets
5. SQ_close_connection
6. WQ_execute_whois_query
7. CO_get_password
8. CO_get_database
9. CO_get_database_port
10. CO_get_user
11. CO_get_host
12. SQ_get_connection
13. QC_new
14. QI_execute
15. QC_free
16. QI_new
17. QI_free
18. main

       1 /***************************************
       2   $Revision: 1.2 $
       3
       4   Example code: Unit test driver for protocol_whois.c
       5
       6   Status: NOT REVIEWED, NOT TESTED
       7
       8   ******************/ /******************
       9   Modification History:
      10         ottrey (09/03/1999) Created.
      11         ottrey (09/03/1999) Documented.
      12   ******************/ /******************
      13   Copyright (c) 1993, 1994, 1995, 1996, 1997  The TERENA Association
      14   Copyright (c) 1998                              RIPE NCC
      15
      16   All Rights Reserved
      17
      18   Permission to use, copy, modify, and distribute this software and its
      19   documentation for any purpose and without fee is hereby granted,
      20   provided that the above copyright notice appear in all copies and that
      21   both that copyright notice and this permission notice appear in
      22   supporting documentation, and that the name of the author not be
      23   used in advertising or publicity pertaining to distribution of the
      24   software without specific, written prior permission.
      25
      26   THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
      27   ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS; IN NO EVENT SHALL
      28   AUTHOR BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY
      29   DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
      30   AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
      31   OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
      32   ***************************************/
      33 #define UNIT_TEST
      34 #include "../test_.c" /* unit test template */
      35
      36 #define TEST1 "1 General test"
      37
      38 /* Global Default to get the input from stdin */
      39 FILE *infile = stdin;
      40
      41
      42 SK_close() {
         /* [<][>][^][v][top][bottom][index][help] */
      43   printf("call to SK_close()\n");
      44 } /* SK_close() */
      45
      46 SK_puts() {
         /* [<][>][^][v][top][bottom][index][help] */
      47   printf("call to SK_puts()\n");
      48 } /* SK_puts() */
      49
      50 int CO_get_whois_suspended() {
         /* [<][>][^][v][top][bottom][index][help] */
      51   return 0;
      52 } /* CO_get_whois_suspended() */
      53
      54 int SK_gets(int sock, char *input, int size) {
         /* [<][>][^][v][top][bottom][index][help] */
      55   int input_len;
      56
      57   fgets(input, size, infile);
      58   input_len = strlen(input);
      59   if (input[input_len-1] == '\n') {
      60     input[input_len-1] = '\0';
      61   }
      62
      63   if (Verbose == 1) {
      64     printf("input=%s\n", input);
      65   }
      66
      67   return 1;
      68 } /* SK_gets() */
      69
      70 SQ_close_connection() {
         /* [<][>][^][v][top][bottom][index][help] */
      71   printf("call to SQ_close_connection()\n");
      72 } /* SQ_close_connection() */
      73
      74 WQ_execute_whois_query() {
         /* [<][>][^][v][top][bottom][index][help] */
      75   printf("call to WQ_execute_whois_query()\n");
      76 } /* WQ_execute_whois_query() */
      77
      78 char *CO_get_password() {
         /* [<][>][^][v][top][bottom][index][help] */
      79   printf("call to CO_get_password()\n");
      80 } /* CO_get_password() */
      81
      82 CO_get_database() {
         /* [<][>][^][v][top][bottom][index][help] */
      83   printf("call to CO_get_database()\n");
      84 } /* CO_get_database() */
      85
      86 CO_get_database_port() {
         /* [<][>][^][v][top][bottom][index][help] */
      87   printf("call to CO_get_database_port()\n");
      88 } /* CO_get_database_port() */
      89
      90 CO_get_user() {
         /* [<][>][^][v][top][bottom][index][help] */
      91   printf("call to CO_get_user()\n");
      92 } /* CO_get_user() */
      93
      94 CO_get_host() {
         /* [<][>][^][v][top][bottom][index][help] */
      95   printf("call to CO_get_host()\n");
      96 } /* CO_get_host() */
      97
      98 SQ_get_connection() {
         /* [<][>][^][v][top][bottom][index][help] */
      99   printf("call to SQ_get_connection()\n");
     100 } /* SQ_get_connection() */
     101
     102 QC_new() {
         /* [<][>][^][v][top][bottom][index][help] */
     103   printf("call to QC_new()\n");
     104 } /* QC_new() */
     105
     106 QI_execute() {
         /* [<][>][^][v][top][bottom][index][help] */
     107   printf("call to QI_execute()\n");
     108 } /* QI_execute() */
     109
     110 QC_free() {
         /* [<][>][^][v][top][bottom][index][help] */
     111   printf("call to QC_free()\n");
     112 } /* QC_free() */
     113
     114 QI_new() {
         /* [<][>][^][v][top][bottom][index][help] */
     115   printf("call to QI_new()\n");
     116 } /* QI_new() */
     117
     118 QI_free() {
         /* [<][>][^][v][top][bottom][index][help] */
     119   printf("call to QI_free()\n");
     120 } /* QI_free() */
     121
     122
     123
     124 int main(int argc, char** argv) {
         /* [<][>][^][v][top][bottom][index][help] */
     125   int i;
     126
     127   char input[STR_L];
     128
     129   char  *str;
     130
     131   /* Get the options from the command line */
     132   get_options(argc, argv);
     133
     134   /* TEST1 */
     135   if(Test[1] == 1) {
     136     print_title(TEST1);
     137
     138     /* Open infile */
     139     if (Infile_name != NULL) {
     140       infile = fopen(Infile_name, "r");
     141
     142       if (infile == NULL) {
     143         perror("Couldn't load infile");
     144         return -1;
     145       }
     146     }
     147
     148     PW_interact(1);
     149
     150   } /* TEST1 */
     151
     152   return(0);
     153
     154 } /* main() */
     155

/* [<][>][^][v][top][bottom][index][help] */