From: Adam Dickmeiss Date: Tue, 17 Sep 2002 11:07:30 +0000 (+0000) Subject: Fix white space. Added vim indent directives X-Git-Tag: YAZ.1.9.1~32 X-Git-Url: http://jsfdemo.indexdata.com/?a=commitdiff_plain;h=f5235f6ab427d98731fb5184ac284ac97e1dfb40;p=yaz-moved-to-github.git Fix white space. Added vim indent directives --- diff --git a/client/admin.c b/client/admin.c index b2579a1..9db314e 100644 --- a/client/admin.c +++ b/client/admin.c @@ -1,8 +1,8 @@ /* - * Copyright (c) 1995-2001, Index Data + * Copyright (c) 1995-2002, Index Data * See the file LICENSE for details. * - * $Id: admin.c,v 1.12 2002-01-17 21:04:43 adam Exp $ + * $Id: admin.c,v 1.13 2002-09-17 11:07:30 adam Exp $ */ #include @@ -19,9 +19,6 @@ #include #include -#ifdef USE_XTIMOSI -#include -#endif #include #include @@ -32,7 +29,6 @@ /* Helper functions to get to various statics in the client */ ODR getODROutputStream(); -void send_apdu(Z_APDU *a); extern char *databaseNames[]; extern int num_databaseNames; @@ -41,7 +37,7 @@ int sendAdminES(int type, char* param1) { ODR out = getODROutputStream(); char *dbname = odr_strdup (out, databaseNames[0]); - + /* Type: 1=reindex, 2=truncate, 3=delete, 4=create, 5=import, 6=refresh, 7=commit */ Z_APDU *apdu = zget_APDU(out, Z_APDU_extendedServicesRequest ); Z_ExtendedServicesRequest *req = apdu->u.extendedServicesRequest; @@ -63,18 +59,22 @@ int sendAdminES(int type, char* param1) req->packageName = "1.Extendedserveq"; /* Allocate the external */ - r = req->taskSpecificParameters = (Z_External *) odr_malloc (out, sizeof(*r)); + r = req->taskSpecificParameters = (Z_External *) + odr_malloc (out, sizeof(*r)); r->direct_reference = odr_oiddup(out,oid); r->indirect_reference = 0; r->descriptor = 0; r->which = Z_External_ESAdmin; - r->u.adminService = (Z_Admin *) odr_malloc(out, sizeof(*r->u.adminService)); + r->u.adminService = (Z_Admin *) + odr_malloc(out, sizeof(*r->u.adminService)); r->u.adminService->which = Z_Admin_esRequest; - r->u.adminService->u.esRequest = (Z_AdminEsRequest *) odr_malloc(out, sizeof(*r->u.adminService->u.esRequest)); - - toKeep = r->u.adminService->u.esRequest->toKeep = (Z_ESAdminOriginPartToKeep *) - odr_malloc(out, sizeof(*r->u.adminService->u.esRequest->toKeep)); - + r->u.adminService->u.esRequest = (Z_AdminEsRequest *) + odr_malloc(out, sizeof(*r->u.adminService->u.esRequest)); + + toKeep = r->u.adminService->u.esRequest->toKeep = + (Z_ESAdminOriginPartToKeep *) + odr_malloc(out, sizeof(*r->u.adminService->u.esRequest->toKeep)); + toKeep->which=type; toKeep->databaseName = dbname; switch ( type ) @@ -93,7 +93,8 @@ int sendAdminES(int type, char* param1) toKeep->u.create=odr_nullval(); break; case Z_ESAdminOriginPartToKeep_import: - toKeep->u.import = (Z_ImportParameters*)odr_malloc(out, sizeof(*toKeep->u.import)); + toKeep->u.import = (Z_ImportParameters*) + odr_malloc(out, sizeof(*toKeep->u.import)); toKeep->u.import->recordType=param1; /* Need to add additional setup of records here */ break; @@ -113,7 +114,7 @@ int sendAdminES(int type, char* param1) /* Unknown admin service */ break; } - + notToKeep = r->u.adminService->u.esRequest->notToKeep = (Z_ESAdminOriginPartNotToKeep *) odr_malloc(out, sizeof(*r->u.adminService->u.esRequest->notToKeep)); @@ -198,7 +199,7 @@ int cmd_adm_import(char *arg) return 0; sendAdminES(Z_ESAdminOriginPartToKeep_import, type_str); - + printf ("sent es request\n"); if ((cp=strrchr(dir_str, '/')) && cp[1] == 0) sep=""; @@ -265,65 +266,6 @@ int cmd_adm_import(char *arg) } #endif -int cmd_adm_import2(char* arg) -{ - /* Buffer for reading chunks of data from import file */ - char chunk_buffer[8192]; - - if ( arg ) - { - char rectype_buff[32]; - char filename_buff[32]; - FILE* pImportFile = NULL; - - if (sscanf (arg, "%s %s", rectype_buff, filename_buff) != 3) - { - printf("Must specify database-name, record-type and filename for import\n"); - return 0; - } - - /* Attempt to open the file */ - - pImportFile = fopen(filename_buff,"r"); - - /* This chunk of code should move into client.c sometime soon for sending files via the update es */ - /* This function will then refer to the standard client.c one for uploading a file using es update */ - if ( pImportFile ) - { - int iTotalWritten = 0; - - /* We opened the import file without problems... So no we send the es request, ready to - start sending fragments of the import file as segment messages */ - sendAdminES(Z_ESAdminOriginPartToKeep_import, rectype_buff); - - while ( ! feof(pImportFile ) ) - { - /* Read buffer_size bytes from the file */ - size_t num_items = fread((void*)chunk_buffer, 1, sizeof(chunk_buffer), pImportFile); - - /* Write num_bytes of data to */ - - if ( feof(pImportFile ) ) - { - /* This is the last chunk... Write it as the last fragment */ - printf("Last segment of %d bytes\n", num_items); - } - else if ( iTotalWritten == 0 ) - { - printf("First segment of %d bytes\n",num_items); - } - else - { - printf("Writing %d bytes\n", num_items); - } - - iTotalWritten += num_items; - } - } - return 2; - } - return 0; -} /* "Freshen" the specified database, by checking metadata records against the sources from which they were generated, and creating a new record if the source has been touched since the last extraction */ @@ -356,3 +298,12 @@ int cmd_adm_startup(char* arg) sendAdminES(Z_ESAdminOriginPartToKeep_start, NULL); return 2; } + +/* + * Local variables: + * tab-width: 8 + * c-basic-offset: 4 + * End: + * vim600: sw=4 ts=8 fdm=marker + * vim<600: sw=4 ts=8 + */ diff --git a/client/admin.h b/client/admin.h index 1a378be..efa8483 100644 --- a/client/admin.h +++ b/client/admin.h @@ -1,15 +1,8 @@ /* - * $Log: admin.h,v $ - * Revision 1.3 2000-04-05 07:39:54 adam - * Added shared library support (libtool). - * - * Revision 1.2 2000/03/16 13:55:49 ian - * Added commands for sending shutdown and startup admin requests via the admin ES. - * - * Revision 1.1 2000/03/14 09:27:07 ian - * Added code to enable sending of admin extended service requests - * + * Copyright (c) 1995-2002, Index Data + * See the file LICENSE for details. * + * $Id: admin.h,v 1.4 2002-09-17 11:07:30 adam Exp $ */ int cmd_adm_reindex(char* arg); @@ -21,3 +14,13 @@ int cmd_adm_refresh(char* arg); int cmd_adm_commit(char* arg); int cmd_adm_shutdown(char* arg); int cmd_adm_startup(char* arg); + +void send_apdu(Z_APDU *a); +/* + * Local variables: + * tab-width: 8 + * c-basic-offset: 4 + * End: + * vim600: sw=4 ts=8 fdm=marker + * vim<600: sw=4 ts=8 + */ diff --git a/client/client.c b/client/client.c index 9856550..98b8bd5 100644 --- a/client/client.c +++ b/client/client.c @@ -2,7 +2,7 @@ * Copyright (c) 1995-2002, Index Data * See the file LICENSE for details. * - * $Id: client.c,v 1.168 2002-09-15 20:41:01 adam Exp $ + * $Id: client.c,v 1.169 2002-09-17 11:07:30 adam Exp $ */ #include @@ -123,29 +123,29 @@ ODR getODROutputStream() const char* query_type_as_string(QueryType q) { - switch (q) { - case QueryType_Prefix: return "prefix (RPN sent to server)"; - case QueryType_CCL: return "CCL (CCL sent to server) "; - case QueryType_CCL2RPN: return "CCL -> RPN (RPN sent to server)"; - default: - return "unknown Query type internal yaz-client error"; - } + switch (q) { + case QueryType_Prefix: return "prefix (RPN sent to server)"; + case QueryType_CCL: return "CCL (CCL sent to server) "; + case QueryType_CCL2RPN: return "CCL -> RPN (RPN sent to server)"; + default: + return "unknown Query type internal yaz-client error"; + } } void do_hex_dump(char* buf,int len) { #if 0 - int i,x; - for( i=0; i= 32) || strchr ("\n\r\t\f", buf[i])) - printf ("%c", buf[i]); - else - printf ("\\X%02X", buf[i]); + size_t i; + for (i = 0; i= 32) || strchr ("\n\r\t\f", buf[i])) + printf ("%c", buf[i]); + else + printf ("\\X%02X", buf[i]); } static void print_refid (Z_ReferenceId *id) @@ -691,18 +691,19 @@ static void display_record(Z_External *r) odr_perror(in, "Decoding constructed record."); fprintf(stderr, "[Near %d]\n", odr_offset(in)); fprintf(stderr, "Packet dump:\n---------\n"); - odr_dumpBER(stderr, (char*)r->u.octet_aligned->buf,r->u.octet_aligned->len); + odr_dumpBER(stderr, (char*)r->u.octet_aligned->buf, + r->u.octet_aligned->len); fprintf(stderr, "---------\n"); - + /* note just ignores the error ant print the bytes form the octet_aligned laiter */ } else { - /* - * Note: we throw away the original, BER-encoded record here. - * Do something else with it if you want to keep it. - */ - r->u.sutrs = (Z_SUTRS *) rr; /* we don't actually check the type here. */ - r->which = type->what; - }; + /* + * Note: we throw away the original, BER-encoded record here. + * Do something else with it if you want to keep it. + */ + r->u.sutrs = (Z_SUTRS *) rr; /* we don't actually check the type here. */ + r->which = type->what; + } } } if (ent && ent->oclass != CLASS_RECSYN) @@ -1156,7 +1157,9 @@ static void print_string_or_numeric(int iLevel, const char *pTag, Z_StringOrNume } } -static void print_universe_report_duplicate(int iLevel, Z_UniverseReportDuplicate *pUniverseReportDuplicate) +static void print_universe_report_duplicate( + int iLevel, + Z_UniverseReportDuplicate *pUniverseReportDuplicate) { if (pUniverseReportDuplicate != NULL) { @@ -1168,9 +1171,9 @@ static void print_universe_report_duplicate(int iLevel, Z_UniverseReportDuplicat } } -static void -print_universe_report_hits(int iLevel, - Z_UniverseReportHits *pUniverseReportHits) +static void print_universe_report_hits( + int iLevel, + Z_UniverseReportHits *pUniverseReportHits) { if (pUniverseReportHits != NULL) { @@ -1194,11 +1197,13 @@ static void print_universe_report(int iLevel, Z_UniverseReport *pUniverseReport) switch (pUniverseReport->which) { case Z_UniverseReport_databaseHits: - print_universe_report_hits(iLevel, pUniverseReport->u.databaseHits); + print_universe_report_hits(iLevel, + pUniverseReport->u.databaseHits); break; case Z_UniverseReport_duplicate: - print_universe_report_duplicate(iLevel, pUniverseReport->u.duplicate); + print_universe_report_duplicate(iLevel, + pUniverseReport->u.duplicate); break; default: @@ -2386,32 +2391,31 @@ int cmd_set_cclfile(char* arg) ccl_qual_file (bibset, inf); fclose (inf); } - - strcpy(ccl_fields,arg); + strcpy(ccl_fields,arg); return 0; } int cmd_set_auto_reconnect(char* arg) { - REMOVE_TAILING_BLANKS(arg); - - if(strlen(arg)==0) { - auto_reconnect = ! auto_reconnect; - } else if(strcmp(arg,"on")==0) { - auto_reconnect = 1; - } else if(strcmp(arg,"off")==0) { - auto_reconnect = 0; - } else { - printf("Error use on or off\n"); - return 1; - }; - + REMOVE_TAILING_BLANKS(arg); + + if(strlen(arg)==0) { + auto_reconnect = ! auto_reconnect; + } else if(strcmp(arg,"on")==0) { + auto_reconnect = 1; + } else if(strcmp(arg,"off")==0) { + auto_reconnect = 0; + } else { + printf("Error use on or off\n"); + return 1; + } + if (auto_reconnect) printf("Set auto reconnect enabled.\n"); else printf("Set auto reconnect disabled.\n"); - + return 0; } @@ -2425,23 +2429,24 @@ int cmd_set_marcdump(char* arg) if(strlen(arg)<1) { return 1; } - + if(!strcmp(arg,"-")) marcdump=stderr; else marcdump=fopen(arg, "a"); - + if(!marcdump) { perror("unable to open apdu marcdump file no marcdump done\n"); } - + return 1; } -int cmd_set_proxy(char* arg) { +int cmd_set_proxy(char* arg) +{ if(yazProxy) free(yazProxy); yazProxy=NULL; - + if(strlen(arg) > 1) { yazProxy=strdup(arg); } @@ -2450,7 +2455,7 @@ int cmd_set_proxy(char* arg) { /* this command takes 3 arge {name class oid} - */ +*/ int cmd_register_oid(char* args) { static struct { char* className; @@ -2498,7 +2503,7 @@ int cmd_register_oid(char* args) { printf("Unknonwn oid class %s\n",oclass_str); return 0; } - + i = 0; name = oid_str; val = 0; @@ -2543,7 +2548,7 @@ void source_rcfile() struct stat statbuf; char buffer[1000]; char* homedir=getenv("HOME"); - + if(!homedir) return; sprintf(buffer,"%s/.yazclientrc",homedir); @@ -2561,8 +2566,8 @@ void source_rcfile() static void initialize(void) { FILE *inf; - int i; - + int i; + if (!(out = odr_createmem(ODR_ENCODE)) || !(in = odr_createmem(ODR_DECODE)) || !(print = odr_createmem(ODR_PRINT))) @@ -2571,7 +2576,7 @@ static void initialize(void) exit(1); } oid_init(); - + setvbuf(stdout, 0, _IONBF, 0); if (apdu_file) odr_setprint(print, apdu_file); @@ -2588,13 +2593,13 @@ static void initialize(void) #if HAVE_READLINE_READLINE_H rl_attempted_completion_function = (CPPFunction*)readline_completer; #endif - - - for(i=0; i=maxOtherInfosSupported) { - printf("Error otherinfo index to large (%d>%d)\n",otherinfoNo,maxOtherInfosSupported); - } - extraOtherInfos[otherinfoNo].oidval = -1; - if(extraOtherInfos[otherinfoNo].value) free(extraOtherInfos[otherinfoNo].value); - return 0; - } - if (sscan_res<3) { + char oid[101], otherinfoString[101]; + int otherinfoNo; + int sscan_res; + int oidval; + + sscan_res = sscanf (args, "%d %100[^ ] %100s", &otherinfoNo, oid, otherinfoString); + if(sscan_res==1) { + /* reset this otherinfo */ + if(otherinfoNo>=maxOtherInfosSupported) { + printf("Error otherinfo index to large (%d>%d)\n",otherinfoNo,maxOtherInfosSupported); + } + extraOtherInfos[otherinfoNo].oidval = -1; + if(extraOtherInfos[otherinfoNo].value) free(extraOtherInfos[otherinfoNo].value); + return 0; + } + if (sscan_res<3) { printf("Error in set_otherinfo command \n"); return 0; } - - if(otherinfoNo>=maxOtherInfosSupported) { - printf("Error otherinfo index to large (%d>%d)\n",otherinfoNo,maxOtherInfosSupported); - } - - - oidval = oid_getvalbyname (oid); - if(oidval == -1 ) { + + if(otherinfoNo>=maxOtherInfosSupported) { + printf("Error otherinfo index to large (%d>%d)\n",otherinfoNo,maxOtherInfosSupported); + } + + + oidval = oid_getvalbyname (oid); + if(oidval == -1 ) { printf("Error in set_otherinfo command unknown oid %s \n",oid); - return 0; - } - extraOtherInfos[otherinfoNo].oidval = oidval; - if(extraOtherInfos[otherinfoNo].value) free(extraOtherInfos[otherinfoNo].value); - extraOtherInfos[otherinfoNo].value = strdup(otherinfoString); - - return 0; + return 0; + } + extraOtherInfos[otherinfoNo].oidval = oidval; + if(extraOtherInfos[otherinfoNo].value) free(extraOtherInfos[otherinfoNo].value); + extraOtherInfos[otherinfoNo].value = strdup(otherinfoString); + + return 0; } int cmd_list_otherinfo(char* args) { - int i; - - if(strlen(args)>0) { - i = atoi(args); - if( i >= maxOtherInfosSupported ) { - printf("Error otherinfo index to large (%d>%d)\n",i,maxOtherInfosSupported); - return 0; - } + int i; + + if(strlen(args)>0) { + i = atoi(args); + if( i >= maxOtherInfosSupported ) { + printf("Error otherinfo index to large (%d>%d)\n",i,maxOtherInfosSupported); + return 0; + } - if(extraOtherInfos[i].oidval != -1) - printf(" otherinfo %d %s %s\n",i,yaz_z3950_oid_value_to_str(extraOtherInfos[i].oidval,CLASS_RECSYN), extraOtherInfos[i].value); - - } else { - for(i=0; iwhich) { - case Z_IdAuthentication_idPass: - printf("Authentication : IdPass\n"); - printf(" Login User : %s\n",auth->u.idPass->userId?auth->u.idPass->userId:""); - printf(" Login Group : %s\n",auth->u.idPass->groupId?auth->u.idPass->groupId:""); - printf(" Password : %s\n",auth->u.idPass->password?auth->u.idPass->password:""); - break; - case Z_IdAuthentication_open: - printf("Authentication : psOpen\n"); - printf(" Open string : %s\n",auth->u.open); - break; - default: - printf("Authentication : Unknown\n"); - } - } - if ( yazCharset ) printf("Character set : `%s'\n", (yazCharset) ? yazCharset:NULL); - - /* bases */ - printf("Bases : "); + int i; + + /* connection options */ + if(conn) { + printf("Connected to : %s\n",last_open_command); + } else { + if(last_open_command) + printf("Not connected to : %s\n",last_open_command); + else + printf("Not connected : \n"); + + } + if(yazProxy) printf("using proxy : %s\n",yazProxy); + + printf("auto_reconnect : %s\n",auto_reconnect?"on":"off"); + + if (!auth) { + printf("Authentication : none\n"); + } else { + switch(auth->which) { + case Z_IdAuthentication_idPass: + printf("Authentication : IdPass\n"); + printf(" Login User : %s\n",auth->u.idPass->userId?auth->u.idPass->userId:""); + printf(" Login Group : %s\n",auth->u.idPass->groupId?auth->u.idPass->groupId:""); + printf(" Password : %s\n",auth->u.idPass->password?auth->u.idPass->password:""); + break; + case Z_IdAuthentication_open: + printf("Authentication : psOpen\n"); + printf(" Open string : %s\n",auth->u.open); + break; + default: + printf("Authentication : Unknown\n"); + } + } + if ( yazCharset ) printf("Character set : `%s'\n", (yazCharset) ? yazCharset:NULL); + + /* bases */ + printf("Bases : "); for (i = 0; iu.generic:""); - - /* loging options */ - printf("APDU log : %s\n",apdu_file?"on":"off"); - printf("Record log : %s\n",marcdump?"on":"off"); - - /* other infos */ - printf("Other Info: \n"); - cmd_list_otherinfo(""); - - return 0; + printf("\n"); + + /* Query options */ + printf("CCL file : %s\n",ccl_fields); + printf("Query type : %s\n",query_type_as_string(queryType)); + + printf("Named Result Sets : %s\n",setnumber==-1?"off":"on"); + + /* piggy back options */ + printf("ssub/lslb/mspn : %d/%d/%d\n",smallSetUpperBound,largeSetLowerBound,mediumSetPresentNumber); + + /* print present related options */ + printf("Format : %s\n",yaz_z3950_oid_value_to_str(recordsyntax,CLASS_RECSYN)); + printf("Schema : %s\n",yaz_z3950_oid_value_to_str(schema,CLASS_SCHEMA)); + printf("Elements : %s\n",elementSetNames?elementSetNames->u.generic:""); + + /* loging options */ + printf("APDU log : %s\n",apdu_file?"on":"off"); + printf("Record log : %s\n",marcdump?"on":"off"); + + /* other infos */ + printf("Other Info: \n"); + cmd_list_otherinfo(""); + + return 0; } int cmd_clear_otherinfo(char* args) { - if(strlen(args)>0) { - int otherinfoNo; - otherinfoNo = atoi(args); - if( otherinfoNo >= maxOtherInfosSupported ) { - printf("Error otherinfo index to large (%d>%d)\n",otherinfoNo,maxOtherInfosSupported); - return 0; - } - - if(extraOtherInfos[otherinfoNo].oidval != -1) { - /* only clear if set. */ - extraOtherInfos[otherinfoNo].oidval=-1; - free(extraOtherInfos[otherinfoNo].value); - } - } else { - int i; + if(strlen(args)>0) { + int otherinfoNo; + otherinfoNo = atoi(args); + if( otherinfoNo >= maxOtherInfosSupported ) { + printf("Error otherinfo index to large (%d>%d)\n",otherinfoNo,maxOtherInfosSupported); + return 0; + } + + if(extraOtherInfos[otherinfoNo].oidval != -1) { + /* only clear if set. */ + extraOtherInfos[otherinfoNo].oidval=-1; + free(extraOtherInfos[otherinfoNo].value); + } + } else { + int i; - for(i=0; i[':'][/]",NULL,0,NULL}, {"quit", cmd_quit, "",NULL,0,NULL}, @@ -3012,44 +3017,44 @@ static int cmd_help (char *line) int cmd_register_tab(char* arg) { - char command[101], tabargument[101]; - int i; - int num_of_tabs; - char** tabslist; - - if (sscanf (arg, "%100s %100s", command, tabargument) < 1) { - return 0; - }; - - /* locate the amdn in the list */ - for (i = 0; cmd[i].cmd; i++) { - if (!strncmp(cmd[i].cmd, command, strlen(command))) { - break; - } - } - - if(!cmd[i].cmd) { - fprintf(stderr,"Unknown command %s\n",command); - return 1; - }; - - - - if(!cmd[i].local_tabcompletes) { - cmd[i].local_tabcompletes = calloc(1,sizeof(char**)); - }; - - num_of_tabs=0; - - tabslist = cmd[i].local_tabcompletes; - for(;tabslist && *tabslist;tabslist++) { - num_of_tabs++; - }; - - cmd[i].local_tabcompletes=realloc(cmd[i].local_tabcompletes,(num_of_tabs+2)*sizeof(char**)); - tabslist=cmd[i].local_tabcompletes; - tabslist[num_of_tabs]=strdup(tabargument); - tabslist[num_of_tabs+1]=NULL; + char command[101], tabargument[101]; + int i; + int num_of_tabs; + char** tabslist; + + if (sscanf (arg, "%100s %100s", command, tabargument) < 1) { + return 0; + } + + /* locate the amdn in the list */ + for (i = 0; cmd[i].cmd; i++) { + if (!strncmp(cmd[i].cmd, command, strlen(command))) { + break; + } + } + + if(!cmd[i].cmd) { + fprintf(stderr,"Unknown command %s\n",command); + return 1; + } + + + + if(!cmd[i].local_tabcompletes) { + cmd[i].local_tabcompletes = calloc(1,sizeof(char**)); + } + + num_of_tabs=0; + + tabslist = cmd[i].local_tabcompletes; + for(;tabslist && *tabslist;tabslist++) { + num_of_tabs++; + } + + cmd[i].local_tabcompletes=realloc(cmd[i].local_tabcompletes,(num_of_tabs+2)*sizeof(char**)); + tabslist=cmd[i].local_tabcompletes; + tabslist[num_of_tabs]=strdup(tabargument); + tabslist[num_of_tabs+1]=NULL; return 1; } @@ -3087,14 +3092,14 @@ void process_cmd_line(char* line) *(++lastnonspace) = 0; } - + for (i = 0; cmd[i].cmd; i++) if (!strncmp(cmd[i].cmd, word, strlen(word))) { res = (*cmd[i].fun)(arg); break; } - + if (!cmd[i].cmd) /* dump our help-screen */ { printf("Unknown command: %s.\n", word); @@ -3102,12 +3107,12 @@ void process_cmd_line(char* line) /* cmd_help (""); */ res = 1; } - + if(apdu_file) fflush(apdu_file); if (res >= 2) wait_and_handle_responce(); - + if(apdu_file) fflush(apdu_file); if(marcdump) @@ -3156,38 +3161,38 @@ char ** readline_completer(char *text, int start, int end) { rl_attempted_completion_over = 1; return NULL; } - + for (i = 0; cmd[i].cmd; i++) { if (!strncmp(cmd[i].cmd, word, strlen(word))) { break; } } - - if(!cmd[i].cmd) return NULL; - - - curret_global_list = cmd[i].local_tabcompletes; - - completerToUse = cmd[i].rl_completerfunction; - if(completerToUse==NULL) /* if no pr. command completer is defined use the default completer */ - completerToUse = default_completer; - + + if(!cmd[i].cmd) return NULL; + + + curret_global_list = cmd[i].local_tabcompletes; + + completerToUse = cmd[i].rl_completerfunction; + if(completerToUse==NULL) /* if no pr. command completer is defined use the default completer */ + completerToUse = default_completer; + if(completerToUse) { #ifdef HAVE_READLINE_RL_COMPLETION_MATCHES char** res= rl_completion_matches(text, - completerToUse); + completerToUse); #else char** res= completion_matches(text, (CPFunction*)completerToUse); #endif - if(!cmd[i].complete_filenames) - rl_attempted_completion_over = 1; - return res; + if(!cmd[i].complete_filenames) + rl_attempted_completion_over = 1; + return res; } else { - if(!cmd[i].complete_filenames) - rl_attempted_completion_over = 1; + if(!cmd[i].complete_filenames) + rl_attempted_completion_over = 1; return 0; } } @@ -3327,10 +3332,11 @@ int main(int argc, char **argv) exit (0); } - /* * Local variables: * tab-width: 8 * c-basic-offset: 4 * End: + * vim600: sw=4 ts=8 fdm=marker + * vim<600: sw=4 ts=8 */