X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;ds=sidebyside;f=client%2Fclient.c;h=33fcfdd0a0c17b3f7d250aa8369771e2e4d95818;hb=102fffd24eb36b4b8322b3f139166ce5f5a4b7d4;hp=9e0fd131eabbb092c6de1edd0db16099767a9fca;hpb=546c28ba38f70ca66b6ce522df97645d9d5cefb9;p=yaz-moved-to-github.git diff --git a/client/client.c b/client/client.c index 9e0fd13..33fcfdd 100644 --- a/client/client.c +++ b/client/client.c @@ -4,7 +4,13 @@ * Sebastian Hammer, Adam Dickmeiss * * $Log: client.c,v $ - * Revision 1.78 1999-03-18 12:57:18 adam + * Revision 1.80 1999-03-31 11:18:24 adam + * Implemented odr_strdup. Added Reference ID to backend server API. + * + * Revision 1.79 1999/03/23 14:14:25 adam + * Yet another fix. + * + * Revision 1.78 1999/03/18 12:57:18 adam * Minor fix. * * Revision 1.77 1999/03/11 15:26:51 adam @@ -1455,7 +1461,8 @@ int send_sortrequest(char *arg, int newset) { Z_APDU *apdu = zget_APDU(out, Z_APDU_sortRequest); Z_SortRequest *req = apdu->u.sortRequest; - Z_SortKeySpecList *sksl = (Z_SortKeySpecList *)odr_malloc (out, sizeof(*sksl)); + Z_SortKeySpecList *sksl = (Z_SortKeySpecList *) + odr_malloc (out, sizeof(*sksl)); char setstring[32]; char sort_string[32], sort_flags[32]; int off; @@ -1473,9 +1480,7 @@ int send_sortrequest(char *arg, int newset) req->num_inputResultSetNames = 1; req->inputResultSetNames = (Z_InternationalString **) odr_malloc (out, sizeof(*req->inputResultSetNames)); - req->inputResultSetNames[0] = (char *) - odr_malloc (out, strlen(setstring)+1); - strcpy (req->inputResultSetNames[0], setstring); + req->inputResultSetNames[0] = odr_strdup (out, setstring); #else req->inputResultSetNames = (Z_StringList *)odr_malloc (out, sizeof(*req->inputResultSetNames)); @@ -1483,15 +1488,13 @@ int send_sortrequest(char *arg, int newset) req->inputResultSetNames->strings = (char **)odr_malloc (out, sizeof(*req->inputResultSetNames->strings)); req->inputResultSetNames->strings[0] = - (char *)odr_malloc (out, strlen(setstring)+1); - strcpy (req->inputResultSetNames->strings[0], setstring); + odr_strdup (out, setstring); #endif if (newset && setnumber >= 0) sprintf (setstring, "%d", ++setnumber); - req->sortedResultSetName = (char *)odr_malloc (out, strlen(setstring)+1); - strcpy (req->sortedResultSetName, setstring); + req->sortedResultSetName = odr_strdup (out, setstring); req->sortSequence = sksl; sksl->num_specs = 0; @@ -1538,8 +1541,7 @@ int send_sortrequest(char *arg, int newset) else { sk->which = Z_SortKey_sortField; - sk->u.sortField = (char *)odr_malloc (out, strlen(sort_string)+1); - strcpy (sk->u.sortField, sort_string); + sk->u.sortField = odr_strdup (out, sort_string); } sks->sortRelation = (int *)odr_malloc (out, sizeof(*sks->sortRelation)); *sks->sortRelation = Z_SortRelation_ascending; @@ -1909,9 +1911,11 @@ static int client(int wait) #if HAVE_READLINE_READLINE_H char* line_in; line_in=readline(C_PROMPT); + if (!line_in) + break; #if HAVE_READLINE_HISTORY_H - if (line_in && *line_in) - add_history(line_in); + if (*line_in) + add_history(line_in); #endif strcpy(line,line_in); free (line_in);