X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=client%2Fclient.c;h=ef8c9a05dfa58f665c4ddf51f846e94da34b4620;hb=62f35bd310a0201576b78d7f6695e8ff3de6ae3c;hp=16a61751e887524def1594c9a825508cc3fa0344;hpb=068a5a7412f492019b4d6f5e89158098d44368f7;p=yaz-moved-to-github.git diff --git a/client/client.c b/client/client.c index 16a6175..ef8c9a0 100644 --- a/client/client.c +++ b/client/client.c @@ -1,10 +1,19 @@ /* - * Copyright (c) 1995-1997, Index Data. + * Copyright (c) 1995-1998, Index Data. * See the file LICENSE for details. * Sebastian Hammer, Adam Dickmeiss * * $Log: client.c,v $ - * Revision 1.55 1997-10-31 12:20:08 adam + * Revision 1.58 1998-01-07 13:51:45 adam + * Minor change. + * + * Revision 1.57 1998/01/07 12:58:22 adam + * Using fgets instead of gets. + * + * Revision 1.56 1997/11/05 09:18:31 adam + * The client handles records with no associated syntax. + * + * Revision 1.55 1997/10/31 12:20:08 adam * Improved memory debugging for xmalloc/nmem.c. References to NMEM * instead of ODR in n ESPEC-1 handling in source d1_espec.c. * Bug fix: missing fclose in data1_read_espec1. @@ -531,7 +540,7 @@ static void display_record(Z_DatabaseRecord *p) r->which = type->what; } } - if (ent->value == VAL_SOIF) + if (ent && ent->value == VAL_SOIF) printf("%.*s", r->u.octet_aligned->len, r->u.octet_aligned->buf); else if (r->which == Z_External_octet && p->u.octet_aligned->len) { @@ -540,7 +549,7 @@ static void display_record(Z_DatabaseRecord *p) if (marcdump) fwrite (marc_buf, strlen (marc_buf), 1, marcdump); } - else if (ent->value == VAL_SUTRS) + else if (ent && ent->value == VAL_SUTRS) { if (r->which != Z_External_sutrs) { @@ -549,7 +558,7 @@ static void display_record(Z_DatabaseRecord *p) } printf("%.*s", r->u.sutrs->len, r->u.sutrs->buf); } - else if (ent->value == VAL_GRS1) + else if (ent && ent->value == VAL_GRS1) { if (r->which != Z_External_grs1) { @@ -1210,8 +1219,11 @@ static int client(int wait) #endif { /* quick & dirty way to get a command line. */ - if (!gets(line)) + char *end_p; + if (!fgets(line, 1023, stdin)) break; + if ((end_p = strchr (line, '\n'))) + *end_p = '\0'; if ((res = sscanf(line, "%s %[^;]", word, arg)) <= 0) { strcpy(word, last_cmd);