Fix win version.
[yaz-moved-to-github.git] / client / client.c
index ed34712..00764e4 100644 (file)
@@ -2,7 +2,7 @@
  * Copyright (c) 1995-2002, Index Data
  * See the file LICENSE for details.
  *
- * $Id: client.c,v 1.141 2002-02-01 23:59:49 adam Exp $
+ * $Id: client.c,v 1.145 2002-02-24 12:24:40 adam Exp $
  */
 
 #include <stdio.h>
@@ -140,7 +140,7 @@ static void print_stringn(const unsigned char *buf, size_t len)
    size_t i;
    for (i = 0; i<len; i++)
        if ((buf[i] <= 126 && buf[i] >= 32) || strchr ("\n\r\t\f", buf[i]))
-           fputc (buf[i], stdout);
+           printf ("%c", buf[i]);
        else
            printf ("\\X%02X", buf[i]);
 }
@@ -264,6 +264,16 @@ static int process_initResponse(Z_InitResponse *res)
         printf (" namedResultSets");
         setnumber = 0;
     }
+    if (ODR_MASK_GET(res->options, Z_Options_encapsulation))
+        printf (" encapsulation");
+    if (ODR_MASK_GET(res->options, Z_Options_resultCount))
+        printf (" resultCount");
+    if (ODR_MASK_GET(res->options, Z_Options_negotiationModel))
+        printf (" negotiationModel");
+    if (ODR_MASK_GET(res->options, Z_Options_duplicateDetection))
+        printf (" duplicateDetection");
+    if (ODR_MASK_GET(res->options, Z_Options_queryType104))
+        printf (" queryType104");
     printf ("\n");
     fflush (stdout);
     return 0;
@@ -481,7 +491,7 @@ static void print_record(const unsigned char *buf, size_t len)
     print_stringn (buf, len);
     /* add newline if not already added ... */
     if (i <= 0 || buf[i-1] != '\n')
-       fputc ('\n', stdout);
+       printf ("\n");
 }
 
 static void display_record(Z_External *r)
@@ -557,13 +567,14 @@ static void display_record(Z_External *r)
         {
             if ( 
 #if AVOID_MARC_DECODE
-                /* primitive check for a marc OID 5.1-29 */
-                ent->oidsuffix[0] == 5 && ent->oidsuffix[1] < 30 
+                /* primitive check for a marc OID 5.1-29 except 16 */
+                ent->oidsuffix[0] == 5 && ent->oidsuffix[1] < 30 &&
+                ent->oidsuffix[1] != 16
 #else
-        1
+                1
 #endif
-        )
-        {
+                )
+            {
                 if (marc_display_exl (octet_buf, NULL, 0 /* debug */,
                                       r->u.octet_aligned->len) <= 0)
                 {
@@ -2061,7 +2072,7 @@ int cmd_set_apdufile(char* arg)
   
     if(apdu_file && apdu_file != stderr) { /* don't close stdout*/
         perror("unable to close apdu log file");      
-    };
+    }
     apdu_file=NULL;
   
     if(strlen(arg)<1) {
@@ -2107,7 +2118,7 @@ int cmd_set_marcdump(char* arg)
 {
     if(marcdump && marcdump != stderr) { /* don't close stdout*/
         perror("unable to close apdu log file");      
-    };
+    }
     marcdump=NULL;
     
     if(strlen(arg)<1) {
@@ -2510,7 +2521,7 @@ void process_cmd_line(char* line)
 
 char *command_generator(const char *text, int state) 
 {
-    static idx; // index is the last used the last time command_generator was called
+    static int idx; 
     if (state==0) {
         idx = 0;
     }
@@ -2518,7 +2529,7 @@ char *command_generator(const char *text, int state)
         if (!strncmp(cmd[idx].cmd,text,strlen(text))) {
             ++idx;  /* skip this entry on the next run */
             return strdup(cmd[idx-1].cmd);
-        };
+        }
     }
     return NULL;
 }
@@ -2546,7 +2557,7 @@ char ** readline_completer(char *text, int start, int end) {
         if ((res = sscanf(rl_line_buffer, "%31s %1023[^;]", word, arg)) <= 0) {     
             rl_attempted_completion_over = 1;
             return NULL;
-        };
+        }
     
         if(start != strlen(word) +1 ) {
             rl_attempted_completion_over = 1;
@@ -2576,12 +2587,12 @@ char ** readline_completer(char *text, int start, int end) {
         } else {
             rl_attempted_completion_over = 1;
             return 0;
-        };
-    };
+        }
+    }
 #else 
     return 0;
 #endif 
-};
+}
 
 
 static void client(void)