Changeset 1738
- Timestamp:
- 2000-12-04T17:08:12+13:00 (23 years ago)
- Location:
- trunk/gsdl/src/recpt
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gsdl/src/recpt/z3950proto.cpp
r1642 r1738 69 69 // FILE *errfile declared in z3950cfg.h, defined in zparse.y 70 70 71 if ((errfile=fopen(errf.getcstr(),"a"))==NULL) { 71 char *errf_str=errf.getcstr(); 72 if ((errfile=fopen(errf_str,"a"))==NULL) { 72 73 // what do we do if we can't open the error file? 73 74 // this means that errors will go to stderr, which may stuff up … … 75 76 errfile=stderr; 76 77 } 78 delete errf_str; 77 79 yyout=errfile; 78 80 … … 80 82 // which is the bison output of zparse.y 81 83 82 yyin=fopen(filename.getcstr(),"r"); 84 char *filename_str=filename.getcstr(); 85 yyin=fopen(filename_str,"r"); 83 86 if (yyin==NULL) { 84 cerr << "Could not open "<<filename.getcstr()<<" for reading.\n"; 87 cerr << "Could not open "<<filename_str<<" for reading.\n"; 88 delete filename_str; 85 89 return; 86 90 } 91 delete filename_str; 87 92 zconfigparse(); 88 93 … … 230 235 if (here==end) { 231 236 err=protocolError; 237 char *coll_str=collection.getcstr(); 232 238 logout << "z39.50: couldn't find collection" 233 << coll ection.getcstr()239 << coll_str 234 240 << endl; 241 delete coll_str; 235 242 return; 236 243 } … … 350 357 OptionValue_tarray::iterator ov_end=request.filterOptions.end(); 351 358 while (ov_here != ov_end) { 352 // cout<< "OV pair: `" << ov_here->name.getcstr() << "'=`"353 // << ov_here->value.getcstr() << "'\n";359 // cerr << "OV pair: `" << ov_here->name.getcstr() << "'=`" 360 // << ov_here->value.getcstr() << "'\n"; 354 361 if (ov_here->name=="Term") 355 362 { -
trunk/gsdl/src/recpt/z3950server.cpp
r1617 r1738 85 85 86 86 z_initialize(); 87 88 if (z_cmd_open(server_and_port.getcstr(),info->name.getcstr())==1) 87 char* serv_str=server_and_port.getcstr(); 88 char* name_str=info->name.getcstr(); 89 int retval=z_cmd_open(serv_str,name_str); 90 delete serv_str; 91 delete name_str; 92 if (retval==1) 89 93 // we got a connection error 90 94 return false; … … 110 114 // This will require us to actually come up with a query syntax and 111 115 // a parser. For now, we'll just do an "AND" query for all terms 116 // But look at Common Command Language (CCL) query syntax (ISO 8777). 117 118 // need to remove " chars from the query. We should really tell the server 119 // to do a phrase search on the terms that are between the "s, but we 120 // can't (easily) tell if the server can do that or not, 121 // so we'll currently just do a query and then post-process. (not yet 122 // implemented........) 112 123 113 124 // we need to count number of terms separated by a space … … 116 127 bool inword=false; 117 128 int num_terms=0; 129 118 130 for (int i=0;i<strlength;i++) { 131 if (*(ptr+i)=='"') { // convert " to SPACE... 132 *(ptr+i)=' '; 133 } 119 134 if (*(ptr+i)!=' ') { 120 135 if (inword==false) { … … 128 143 } 129 144 130 // set the field(s) to search on - main ones (that I've found)include:145 // set the field(s) to search on - main ones include: 131 146 // 1016 => Any 132 147 // 1 => (Personal) Name … … 150 165 parsed_query+="@and "; 151 166 // append the actual query 152 parsed_query+=query; 153 167 parsed_query+=ptr; 168 169 delete ptr; 154 170 } 155 171 … … 196 212 parseQuery(query,fields,expanded_query); 197 213 214 char* query_str=expanded_query.getcstr(); 198 215 // following functions defined in yaz_zclient.c 199 *nummatches=z_cmd_dosearch(expanded_query.getcstr()); // returns # found, -1 on err. 216 *nummatches=z_cmd_dosearch(query_str); // returns # found, -1 on err. 217 delete query_str; 200 218 if (*nummatches<=0) { 201 219 if (*nummatches==0) { … … 263 281 parseQuery(query,fields,expanded_query); 264 282 265 int returned=z_cmd_dosearch(expanded_query.getcstr()); 283 char* query_str=expanded_query.getcstr(); 284 int returned=z_cmd_dosearch(query_str); 285 delete query_str; 266 286 if (returned<=0) { 267 287 // 0 => none. … … 308 328 if (connect()==false) { 309 329 z_initstr.setcstr("<H2>Server offline</H2>Error - could not connect to server <B>"); 310 z_initstr += info->host .getcstr();330 z_initstr += info->host; 311 331 z_initstr += "</B> on port "; 312 332 z_initstr += info->port;
Note:
See TracChangeset
for help on using the changeset viewer.