/** Find the first field, if it exists... **/
cp = strchr(selstr, '\t');
if (cp != NULL) {
*cp = '\0';
cp++;
field1 = cp;
/** find the second field, if it exists **/
cp = strchr(cp, '\t');
if (cp != NULL) {
*cp = '\0';
cp++;
field2 = cp;
} else {
/** find the third field, if it exists **/
if (cp != NULL)
cp = strchr(cp, '\t');
if (cp != NULL) {
*cp = '\0';
cp++;
field3 = cp;
}
}
}
/** Okay, now decide which field is the search and
which is the command */
if (*selstr == '7' || strncmp(selstr, "waissrc:",8)==0 ||
strncmp(selstr, "mindex:",7) ==0) {
char *questionmark;
/** If it's a type 7 search, search for a ? mark in the
** selector string. (Yeah, yeah, it's weblike)
**/
/* dgg need for binary ask data */
void
CMDpushAskBinary(cmd, buf, buflen)
CMDobj *cmd;
char *buf;
long buflen;
{
String *temp = STRnew();
temp->data= buf;
temp->len= buflen;
STApush(cmd->asklines, temp);
temp->data= NULL; /* caller owns buf */
STRdestroy(temp);
}
/*
* Retrieve extra data from the client request.. This stuff is optional
*
*/
void
CMDgetXtra(cmd, fd, extradata)
CMDobj *cmd;
int fd;
int extradata;
{
char inputline[512];
/** Siphon off data if it's there.. **/
/** A ticket? **/
if ((extradata & 0x2) == 0x2) {
;
}
/** An ask block **/
if ((extradata & 0x1) == 0x1) {
/** Okay, the next line is either +-1, or +bytes .. **/
readline(fd, inputline, sizeof(inputline));
Debug("received: %s\n", inputline);
ZapCRLF(inputline);
if (strncmp(inputline, "+-1",3)==0) {
while (readline(fd, inputline, sizeof(inputline))>0) {
ZapCRLF(inputline);
ZapCRLF(inputline);
if (*inputline == '.' && *(inputline+1) == '\0')
break;
CMDpushAskline(cmd, inputline);
}
}
/* dgg: patch for askfile +bytecount or +-2 input forms */
/* dgg++ -- need this to read binary file from client */
else {
/*inputline == "+-2" or "+bytes..." */
long count, nbytes;
nbytes= atol(inputline+1);
if (nbytes == -2) do { /* read til close */
count= readrecvbuf(fd,inputline,sizeof(inputline));
if (count>0) CMDpushAskBinary(cmd, inputline, count);
} while (count>0);
else while (nbytes>0) { /* read til nbytes found */
count= sizeof(inputline);
if (count>nbytes) count= nbytes;
count= readrecvbuf(fd,inputline,count);
if (count>0) CMDpushAskBinary(cmd, inputline, count);
nbytes -= count;
}
}
}
}