head 1.13; access; symbols pkgsrc-2013Q2:1.13.0.44 pkgsrc-2013Q2-base:1.13 pkgsrc-2012Q4:1.13.0.42 pkgsrc-2012Q4-base:1.13 pkgsrc-2011Q4:1.13.0.40 pkgsrc-2011Q4-base:1.13 pkgsrc-2011Q2:1.13.0.38 pkgsrc-2011Q2-base:1.13 pkgsrc-2009Q4:1.13.0.36 pkgsrc-2009Q4-base:1.13 pkgsrc-2008Q4:1.13.0.34 pkgsrc-2008Q4-base:1.13 pkgsrc-2008Q3:1.13.0.32 pkgsrc-2008Q3-base:1.13 cube-native-xorg:1.13.0.30 cube-native-xorg-base:1.13 pkgsrc-2008Q2:1.13.0.28 pkgsrc-2008Q2-base:1.13 pkgsrc-2008Q1:1.13.0.26 pkgsrc-2008Q1-base:1.13 pkgsrc-2007Q4:1.13.0.24 pkgsrc-2007Q4-base:1.13 pkgsrc-2007Q3:1.13.0.22 pkgsrc-2007Q3-base:1.13 pkgsrc-2007Q2:1.13.0.20 pkgsrc-2007Q2-base:1.13 pkgsrc-2007Q1:1.13.0.18 pkgsrc-2007Q1-base:1.13 pkgsrc-2006Q4:1.13.0.16 pkgsrc-2006Q4-base:1.13 pkgsrc-2006Q3:1.13.0.14 pkgsrc-2006Q3-base:1.13 pkgsrc-2006Q2:1.13.0.12 pkgsrc-2006Q2-base:1.13 pkgsrc-2006Q1:1.13.0.10 pkgsrc-2006Q1-base:1.13 pkgsrc-2005Q4:1.13.0.8 pkgsrc-2005Q4-base:1.13 pkgsrc-2005Q3:1.13.0.6 pkgsrc-2005Q3-base:1.13 pkgsrc-2005Q2:1.13.0.4 pkgsrc-2005Q2-base:1.13 pkgsrc-2005Q1:1.13.0.2 pkgsrc-2005Q1-base:1.13 pkgsrc-2004Q4:1.12.0.2 pkgsrc-2004Q4-base:1.12 pkgsrc-2004Q3:1.11.0.2 pkgsrc-2004Q3-base:1.11 pkgsrc-2004Q2:1.10.0.6 pkgsrc-2004Q2-base:1.10 pkgsrc-2004Q1:1.10.0.4 pkgsrc-2004Q1-base:1.10 pkgsrc-2003Q4:1.10.0.2 pkgsrc-2003Q4-base:1.10 buildlink2-base:1.3; locks; strict; comment @# @; 1.13 date 2005.02.18.10.10.06; author tron; state dead; branches; next 1.12; 1.12 date 2004.09.21.07.43.10; author tron; state Exp; branches 1.12.2.1; next 1.11; 1.11 date 2004.07.20.13.59.12; author tron; state Exp; branches; next 1.10; 1.10 date 2003.08.30.22.17.31; author tron; state Exp; branches; next 1.9; 1.9 date 2003.07.20.11.54.24; author tron; state dead; branches; next 1.8; 1.8 date 2003.07.16.13.52.15; author tron; state Exp; branches; next 1.7; 1.7 date 2003.04.06.11.48.26; author tron; state dead; branches; next 1.6; 1.6 date 2003.03.31.07.57.25; author tron; state Exp; branches; next 1.5; 1.5 date 2002.10.27.21.54.26; author tron; state dead; branches; next 1.4; 1.4 date 2002.10.12.15.32.15; author tron; state Exp; branches; next 1.3; 1.3 date 2002.03.22.21.59.58; author tron; state dead; branches; next 1.2; 1.2 date 2001.12.08.18.38.50; author tron; state Exp; branches; next 1.1; 1.1 date 2001.11.21.22.42.04; author tron; state Exp; branches; next ; 1.12.2.1 date 2005.02.18.17.42.27; author salo; state dead; branches; next ; desc @@ 1.13 log @Update "bidwatcher" package to version 1.3.17. Changes since version 1.3.16: - Fix eBay parser. - Add libcurl support. libcurl is now a dependency. - Tons of little fixes. - Fix potential security bug in versions <= 1.3.16 (CAN-2005-0158). - Added Seller id to the Log. - Fixed BUY Only items that expire but bidwather don't think so. - Should compile on cygwin now. - Be more compatible with BSD. @ text @$NetBSD: patch-ac,v 1.12 2004/09/21 07:43:10 tron Exp $ --- helpers.cpp.orig 2004-08-31 02:40:13.000000000 +0200 +++ helpers.cpp 2004-09-21 09:40:39.000000000 +0200 @@@@ -120,9 +120,7 @@@@ bool strToFloat(const char *str, float &x) { - char *end = 0; - x = strtof(str, &end); - return end != str && *end == 0; + return (sscanf(str, "%f", &x) == 1); } float calculateBidIncrement(float currentBid, const char *currency) @@@@ -580,7 +578,8 @@@@ return PB_OUTBID; else if (strstr(Buff, "You have been outbid")) return PB_OUTBID; - else if (strstr(Buff, "Problem with bid amount")) + else if (strstr(Buff, "Problem with bid amount") || + strstr(Buff, "Your bid must be at least")) return PB_BIDTOOLOW; else if (strstr(Buff, "Problem with quantity")) return PB_BADQUANTITY; @ 1.12 log @Update "bidwatcher" to version 1.3.16. Changes since version 1.3.15: - Parse eBay pages properly again - A parsing error leading to a segmentation fault is fixed (patch from Klaus Singvogel) - Get the snipe key 60 seconds before sniping because this key becomes stale. - Snipes do not try to get a snipe key at startup or setup. - Set the proxy during startup. Otherwise a "Network error" is issued at startup behind a proxy. - Workaround a bug with german umlauts and other ascii > 127 in the details windows. They are simply removed. - Recognize shifting end times of auctions. - User listings: - The auction-id was read as "unsigned long" (4 Byte) instead of "unsigned long long" (8 Byte). Due to that truncation some auction-ids were not handled correctly. - Ebay places linebreaks at the worst places in its pages: the parser did not remove them all. So the auction id was not found. - Obtain snipe-key just when necessary, not earlier. - New feature: Snipe groups @ text @d1 1 a1 1 $NetBSD$ @ 1.12.2.1 log @Pullup ticket 294 - requested by Matthias Scheler security fix for bidwatcher Revisions pulled up: - pkgsrc/misc/bidwatcher/Makefile 1.41 - pkgsrc/misc/bidwatcher/distinfo 1.33 - pkgsrc/misc/bidwatcher/patches/patch-ac removed Module Name: pkgsrc Committed By: tron Date: Fri Feb 18 10:10:06 UTC 2005 Modified Files: pkgsrc/misc/bidwatcher: Makefile distinfo Removed Files: pkgsrc/misc/bidwatcher/patches: patch-ac Log Message: Update "bidwatcher" package to version 1.3.17. Changes since version 1.3.16: - Fix eBay parser. - Add libcurl support. libcurl is now a dependency. - Tons of little fixes. - Fix potential security bug in versions <= 1.3.16 (CAN-2005-0158). - Added Seller id to the Log. - Fixed BUY Only items that expire but bidwather don't think so. - Should compile on cygwin now. - Be more compatible with BSD. @ text @d1 1 a1 1 $NetBSD: patch-ac,v 1.12 2004/09/21 07:43:10 tron Exp $ @ 1.11 log @Add a patch from the bidwatcher home page which avoid segfaults while bidwatcher is parsing auction data. Bump package revision. @ text @d3 14 a16 30 --- helpers.cpp.orig 2004-04-23 22:23:28.000000000 +0200 +++ helpers.cpp 2004-07-20 15:48:50.000000000 +0200 @@@@ -319,7 +319,25 @@@@ // strip the html tags for (u = 0; u < buffLength; u++) { c = stringToStrip[u]; - if (c == '<') IncludeFlag=5; + if (u+7' || c == '<') ) + IncludeFlag = 6; + else if (c == '<') { + IncludeFlag=5; + if (u+4') IncludeFlag=10; else if (IncludeFlag==10) { if ((BuffIdx > 0) && (c == ' ') && @@@@ -530,7 +548,8 @@@@ @ 1.10 log @Add patch from bidwatcher's home page for bug 782059 ("snipe fails with parseerror". @ text @d3 30 a32 3 --- helpers.cpp 17 Jul 2003 04:41:59 -0000 1.90 +++ helpers.cpp 4 Aug 2003 04:22:05 -0000 @@@@ -513,7 +513,8 @@@@ @ 1.9 log @Update "bidwatcher" package to version 1.3.10. Changes since version 1.3.9: - Fixed TimeSync issue. - Fixed reserve detection. - Fixed BuyItNow detection. - Handle fixed price auctions. @ text @d1 1 a1 1 $NetBSD: patch-ac,v 1.8 2003/07/16 13:52:15 tron Exp $ d3 12 a14 64 --- helpers.cpp.orig Thu Jul 10 05:37:25 2003 +++ helpers.cpp Wed Jul 16 15:48:26 2003 @@@@ -1337,19 +1337,21 @@@@ // calculates the difference between ebay time and local time, returning // the value in seconds. ////////////////////////////////////////////////////////////////////////////// +#define CHLEN 0x40 +#define CHBUF 0x1000 int calcTimeDiff ( char * buffer) { struct timeval time_tt; //time_t new_time_t = time(NULL); gettimeofday(&time_tt, 0); time_t new_time_t = time_tt.tv_sec; - char chHr[9]; - char chMin[9]; - char chSec[9]; - char chYear[9]; - char chMonth[9]; - char chDay[9]; - char lineBuff[1024]; + char chHr[CHLEN]; + char chMin[CHLEN]; + char chSec[CHLEN]; + char chYear[CHLEN]; + char chMonth[CHLEN]; + char chDay[CHLEN]; + char lineBuff[CHBUF]; char * scratch; #ifdef HAVE_SSTREAM std::istringstream streamBuff(buffer); @@@@ -1359,7 +1361,7 @@@@ struct tm ebay_time; ebay_time.tm_isdst = -1; while(streamBuff) { - streamBuff.getline(lineBuff, 1024, '\n'); + streamBuff.getline(lineBuff, CHBUF, '\n'); /* if (strstr(lineBuff, "Look here to see what time eBay thinks it is")) { scratch = strtok(lineBuff, ">"); @@@@ -1379,17 +1381,17 @@@@ if (scratch) { scratch = strtok(scratch, " "); if (scratch) scratch = strtok(0, " "); - if (scratch) strcpy(chMonth, scratch); + if (scratch) strncpy(chMonth, scratch, CHLEN); scratch = strtok(0, " "); - if (scratch) strcpy(chDay, scratch); + if (scratch) strncpy(chDay, scratch, CHLEN); scratch = strtok(0, " "); - if (scratch) strcpy(chYear, scratch); + if (scratch) strncpy(chYear, scratch, CHLEN); scratch = strtok(0,": "); - if (scratch) strcpy(chHr, scratch); + if (scratch) strncpy(chHr, scratch, CHLEN); scratch = strtok(0,":"); - if (scratch) strcpy(chMin, scratch); + if (scratch) strncpy(chMin, scratch, CHLEN); scratch = strtok(0, " "); - if (scratch) strcpy(chSec, scratch); + if (scratch) strncpy(chSec, scratch, CHLEN); scratch = strtok(0, "<"); break; } @ 1.8 log @Add a patch submitted my Uwe Klein via the sourceforge homepage to fix time synchronization with eBay servers. Bump package revision. @ text @d1 1 a1 1 $NetBSD$ @ 1.7 log @Back out timezone fix from revision 1. It doesn't work properly when California an Central Europe are both on DST. Bump package revision again. @ text @d1 1 a1 1 $NetBSD: patch-ac,v 1.6 2003/03/31 07:57:25 tron Exp $ d3 32 a34 5 --- helpers.cpp.orig 2002-12-21 09:00:42.000000000 +0100 +++ helpers.cpp 2003-03-31 09:47:10.000000000 +0200 @@@@ -1347,7 +1347,6 @@@@ std::istrstream streamBuff(buffer); #endif d36 1 a36 1 - ebay_time.tm_isdst = 0; d38 2 a39 1 streamBuff.getline(lineBuff, 1024, '\n'); d41 8 a48 2 @@@@ -1380,9 +1379,6 @@@@ if (scratch) strcpy(chMin, scratch); d50 15 a64 4 if (scratch) strcpy(chSec, scratch); - scratch = strtok(0, "<"); - if (scratch && strcmp( scratch, "PDT" ) == 0 ) - ebay_time.tm_isdst = 1; a66 9 } @@@@ -1406,6 +1402,7 @@@@ else if (strcmp("Nov", chMonth) == 0) ebay_time.tm_mon = 10; else ebay_time.tm_mon = 11; ebay_time.tm_year = atoi(chYear) - 1900; + ebay_time.tm_isdst = -1; time_t theTime = mktime(&ebay_time) - new_time_t; @ 1.6 log @Fix time difference problem which shows up when the local system is on DST and eBay is not. Based on a suggestion from Bernd Ernesti. @ text @d1 1 a1 1 $NetBSD$ @ 1.5 log @Update "bidwatcher" to version 1.3.6. Changes since version 1.3.5: - Added Comment field. - Fixed ebay time sync'ing. - Fix bad "Host:" entity-header if a proxy server was used. It used to send "Host: proxy.do.main" instead of "Host: whatever.ebay.com". - It now sends an "User-Agent" string which looks like Mozilla 1.1 including the real operating system and machine. - It support using "POST" for the actual bid. I've succesfully tested this by bidding on an auction. - Fixed stupid bug introduced in 1.3.5 for certain ebay motors auctions - Fixed handling bad DNS responses. @ text @d1 1 a1 1 $NetBSD: patch-ac,v 1.4 2002/10/12 15:32:15 tron Exp $ d3 19 a21 62 --- netstuff.cpp.orig Sat Oct 12 16:16:49 2002 +++ netstuff.cpp Sat Oct 12 16:49:10 2002 @@@@ -34,6 +34,7 @@@@ #include #include #include +#include #include #include #include "bidwatcher.h" @@@@ -51,7 +52,7 @@@@ g_free(ustring); char *HtmlBuff; - fetchURL(url,&HtmlBuff,TIMEOUT); + fetchURL(url,0,&HtmlBuff,TIMEOUT); char *adultcookie=strstr(HtmlBuff,"Set-Cookie"); if (adultcookie==NULL) { printf("adult cookie not found\n"); @@@@ -143,16 +144,16 @@@@ } void URL::create(char *newurl,URL *proxy) { + char *hostoff = strstr(newurl, "://") + 3; + + sprintf(hoststring, "%.*s", strcspn(hostoff, "/"), hostoff); if (proxy == NULL) { - char *hostoff = strstr(newurl, "://") + 3; char tmpstr[256]; useproxy = FALSE; - strncpy(tmpstr, hostoff, strcspn(hostoff, "/")); - tmpstr[strcspn(hostoff, "/")] = '\0'; - - if (strlen(tmpstr) < strlen(newurl)) { + strcpy(tmpstr, hoststring); + if (strlen(tmpstr) < strlen(hostoff)) { strcpy(url, hostoff + strlen(tmpstr)); } else url[0] = '\0'; @@@@ -235,13 +236,17 @@@@ else return FALSE; } -int fetchURL(URL *url, char **Buff, double timeOut) +int fetchURL(URL *url, int Post, char **Buff, double timeOut) { int buffLength,recerr; int socketID; + char UserAgent[256]; + char *Host; char lineBuff[1024]; char htmlBuff[HUGEBUFF]; + struct utsname utsbuf; + struct sockaddr_in soc_in; int err; fd_set fds; @@@@ -331,9 +336,26 @@@@ return NET_NETERROR; d23 5 d29 1 a29 21 + if (uname(&utsbuf) < 0) + UserAgent[0] = '\0'; + else + sprintf(UserAgent, "User-Agent: Mozilla/5.0 (X11; U; %s %s; en-US; rv:1.1) Gecko/20020912\r\n", utsbuf.sysname, utsbuf.machine); + // send our request for the web page. // XXX: Took out the cookie for now cuz we're not yet using it. - sprintf(lineBuff, "GET %s HTTP/1.1\r\nConnection: close\r\nHost: %s\r\nUser-Agent: bidwatcher\r\n\r\n", url->url, url->hostinfo->h_name); + if (Post) { + int URLLen; + char *Args; + + URLLen = strcspn(url->url, "?"); + Args = &url->url[URLLen]; + if (*Args != '\0') + Args++; + + sprintf(lineBuff, "POST %.*s HTTP/1.1\r\nConnection: close\r\nHost: %s\r\nContent-Length: %d\r\n%s\r\n%s", URLLen, url->url, url->hoststring, strlen(Args), UserAgent, Args); + } else { + sprintf(lineBuff, "GET %s HTTP/1.1\r\nConnection: close\r\nHost: %s\r\n%s\r\n", url->url, url->hoststring, UserAgent); + } a30 11 if (send(socketID, lineBuff, strlen(lineBuff), 0) < 0) { #ifdef DEBUG_NETWORK @@@@ -406,7 +428,7 @@@@ if (checkredir(url,htmlBuff)) { g_free(time_since_pkt); g_free(time_since_start); - return fetchURL(url, Buff, timeOut); + return fetchURL(url, 0, Buff, timeOut); } else { if (!goodcall) { g_free(time_since_pkt); @ 1.4 log @Fix bugs in HTTP protocol handling: 1.) Send correct "Host:" entity-header if a proxy is used. 2.) Supply a more appropriate User Agent intetification. 3.) Use a "POST" for request for the actual bid like the eBay form would. Bump package revision to 2. @ text @d1 1 a1 1 $NetBSD$ @ 1.3 log @Update "bidwatcher" package to version 1.3.3. Changes since version 1.3.0: - many bug fixes - improved GUI - experimental bidding daemon @ text @d1 1 a1 1 $NetBSD: patch-ac,v 1.2 2001/12/08 18:38:50 tron Exp $ d3 20 a22 62 --- helpers.cpp.orig Thu Jul 5 01:54:48 2001 +++ helpers.cpp Sat Dec 8 19:33:32 2001 @@@@ -5,6 +5,7 @@@@ // Tom McNair (tmcnair@@cyberhighway.net) // Wayne Schlitt (wayne@@midwestcs.com) // Ben Byer (bushing@@users.sourceforge.net) +// Kevin Dwyer (kevin@@pheared.net) // // use of this code is restricted to the terms // of the GNU GPL, which should have been included in this @@@@ -39,7 +40,7 @@@@ char *CheckPrice="0123456789.$,"; // Characters allowed in a price -char *SearchOps[]={ "Starts at", // 1: +1 +char *SearchOps[2][14]={{ "Starts at", // 1: +1 "Currently", // 2: +1 "First bid", // 3: +1 "Quantity", // 4: +1 @@@@ -51,8 +52,21 @@@@ "Seller (Rating)", // 10: +1 "High bid", // 11: +1 "Bid increment", // 12: +1 - "High bids", // 13: +1 - "*"}; + "see winning bidders", // 13: +1 + "*"}, + /* eBay Motors */ + { "Currently", + "Time left ", + "Seller (rating) ", + "High bid ", + "# of bids ", + "Location ", + "Started ", + "ends ", + "Starts at", + "*" + } + }; float calculateBidIncrement(float currentBid, char *currency) { @@@@ -279,7 +293,10 @@@@ break; } } - if ( !foundEndOfForm ) return ERROR; + if ( !foundEndOfForm ) { + printf("ProcessBid: Could not find end of form."); + return ERROR; + } while ( streamBuff ) { streamBuff.getline(lineBuff, 1024, '\n'); printf("%s\n",lineBuff); @@@@ -291,6 +308,8 @@@@ else if ( strstr(lineBuff, "Cannot proceed") != NULL ) return PB_AUCTIONOVER; else if ( strstr(lineBuff, "or password invalid") != NULL ) return PB_BADUSER; } + printf("Bid failed - unable to parse eBay's response. \n"); + printf("%s",Buff); return ERROR; a23 31 /* @@@@ -347,8 +366,8 @@@@ while( *Buff ) { - if(index(Buff,'\n')==NULL) nlpos=strlen(Buff)-1; - else nlpos=index(Buff,'\n')-Buff; + if(strchr(Buff,'\n')==NULL) nlpos=strlen(Buff)-1; + else nlpos=strchr(Buff,'\n')-Buff; strncpy(lineBuff,Buff,nlpos); Buff+=nlpos+1; lineBuff[nlpos]='\0'; @@@@ -405,8 +424,8 @@@@ while( *Buff ) { // Get the next line - if(index(Buff,'\n')==NULL) nlpos=strlen(Buff)-1; - else nlpos=index(Buff,'\n')-Buff; + if(strchr(Buff,'\n')==NULL) nlpos=strlen(Buff)-1; + else nlpos=strchr(Buff,'\n')-Buff; strncpy(lineBuff,Buff,nlpos); Buff+=nlpos+1; lineBuff[nlpos]='\0'; @@@@ -448,13 +467,15 @@@@ ////////////////////////////////////////////////////////////////////////////// // ReturnBidVarNum ////////////////////////////////////////////////////////////////////////////// -int ReturnBidVarNum(char *LineData) +int ReturnBidVarNum(char *LineData, int auc_type) { int idx=0; d25 2 a26 7 - for(idx=0;SearchOps[idx][0]!='*';++idx) - if (strcmp(LineData,SearchOps[idx])==0) return (idx+1); - + for(idx=0;SearchOps[auc_type][idx][0]!='*';++idx) + if (strcmp(LineData,SearchOps[auc_type][idx])==0) { + return (idx+1); + } d28 19 a46 1 return 0; d48 2 a49 2 } @@@@ -664,6 +685,7 @@@@ d51 36 a86 348 int idx=0; int cnt; + int auc_type=TYPE_EBAY; char LineData[1025]; char * scratch; char newName[76]; @@@@ -681,6 +703,8 @@@@ memset( HighBidder, 0, sizeof( HighBidder ) ); reserveMet = 'x'; + CurrentBid = 0; // Not resetting this breaks the logic of updating the bid + /* * Parse the description out of the buffer first. This is * most easily done at the buffer-level and not as we try @@@@ -711,11 +735,34 @@@@ while(strstr(LineData,"eBay")==NULL && streamBuff) streamBuff.getline(LineData, 1024, '\n'); - if ( strstr(LineData,"eBay item") == NULL ) - return FALSE; + + if ( strstr(LineData,"eBay item") == NULL ) + if (strstr(LineData,"eBay Motors item") == NULL) + return FALSE; + + if (strstr(LineData,"eBay Motors item") != NULL) auc_type = TYPE_EBAYMOTORSCAR; + while(strstr(LineData,") -")==NULL && streamBuff) streamBuff.getline(LineData, 1024, '\n'); + + if (auc_type == TYPE_EBAYMOTORSCAR) { + scratch = strstr(Buff, "First bid"); + if (scratch != NULL) { + // This is totally crazy and will break as soon as they muck with + // the html but it works for now to distinguish a Car auction from + // a part or accessory. Anyone want to offer a better suggestion? + + //Should move us ahead to a $. This check is here to make sure + //we aren't looking at something the seller said in his desc etc. + scratch +=10; + + if (scratch[0] == '$') auc_type = TYPE_EBAYMOTORS; + } + } + + //printf("Auction Type=%i\n", auc_type); + while (streamBuff) { streamBuff.getline(LineData, 1024, '\n'); @@@@ -724,107 +771,203 @@@@ // some reason some of the data is missing or out of // order we can still salvage what we can.. + // This new case style I came up with is a bit redundant, but + // it may allow for bidwatcher to grow into more types. Like + // Checking yahoo or something. See also SearchOps. -kdwyer + if (LineData[0]!=0) { - switch (ReturnBidVarNum(LineData)) - { - case 1: - case 2: // current price - if (CurrentBid==0) { - streamBuff.getline(LineData, 1024, '\n'); - if ( strstr(LineData,"reserve not") != NULL ) - reserveMet = 'n'; - else if ( strstr(LineData,"reserve met") != NULL ) - reserveMet = 'y'; + //if (ReturnBidVarNum(LineData, auc_type) != 0) + //printf("DEBUG:%i\n", ReturnBidVarNum(LineData, auc_type)); + switch (auc_type) { + case TYPE_EBAY: + switch (ReturnBidVarNum(LineData, auc_type)) + { + case 1: + case 2: // current price + if (CurrentBid==0) { + streamBuff.getline(LineData, 1024, '\n'); + if ( strstr(LineData,"reserve not") != NULL ) + reserveMet = 'n'; + else if ( strstr(LineData,"reserve met") != NULL ) + reserveMet = 'y'; - parseprice(LineData,this,FALSE); - /* CheckBadChars(LineData,CheckPrice); - strncpy(CurrentBid,LineData,14); */ - } - break; - case 3: // first bid - if (FirstBid==0) { - streamBuff.getline(LineData, 1024, '\n'); - parseprice(LineData,this,TRUE); - /* CheckBadChars(LineData,CheckPrice); - strncpy(FirstBid,LineData,14); */ - } - break; - case 4: // quantity - if (Quantity==0) { - streamBuff.getline(LineData, 1024, '\n'); - CheckBadChars(LineData,"0123456789"); - // strncpy(Quantity,LineData,14); - Quantity=atoi(LineData); - } - break; - case 5: // bid count - if (BidCount==0) { - char bc[80]; - streamBuff.getline(LineData, 1024, '\n'); - for(cnt=0;(((LineData[cnt]!=' ') && - (LineData[cnt]!=0)) && (cnt<14));++cnt) - bc[cnt]=LineData[cnt]; - bc[cnt]=0; - BidCount=atoi(bc); - } - break; - case 6: // time left - if (TimeLeft[0]==0) { - streamBuff.getline(LineData, 1024, '\n'); - strncpy(TimeLeft,LineData,50); - } - break; - case 7: // location - if (Location[0]==0) { - streamBuff.getline(LineData, 1024, '\n'); - strncpy(Location,LineData,100); - } - break; - case 8: // time started - if (Started[0]==0) { - streamBuff.getline(LineData, 1024, '\n'); - strncpy(Started,LineData,50); - translate_date( Started ); - } - break; - case 9: // time ending - if (Ends[0]==0) { - streamBuff.getline(LineData, 1024, '\n'); - strncpy(Ends,LineData,50); - translate_date( Ends ); - } - break; - case 10: // seller id - if (Seller[0]==0) { - streamBuff.getline(LineData, 1024, '\n'); - strncpy(Seller,LineData,75); - } - break; - case 11: // high bidder id - if (HighBidder[0]==0) { - streamBuff.getline(LineData, 1024, '\n'); - strncpy(HighBidder,LineData,76); - HighBidder[75] = '\0'; - } - break; + parseprice(LineData,this,FALSE); + /* CheckBadChars(LineData,CheckPrice); + strncpy(CurrentBid,LineData,14); */ + } + break; + case 3: // first bid + if (FirstBid==0) { + streamBuff.getline(LineData, 1024, '\n'); + parseprice(LineData,this,TRUE); + /* CheckBadChars(LineData,CheckPrice); + strncpy(FirstBid,LineData,14); */ + } + break; + case 4: // quantity + if (Quantity==0) { + streamBuff.getline(LineData, 1024, '\n'); + CheckBadChars(LineData,"0123456789"); + // strncpy(Quantity,LineData,14); + Quantity=atoi(LineData); + } + break; + case 5: // bid count + if (BidCount==0) { + char bc[80]; + streamBuff.getline(LineData, 1024, '\n'); + for(cnt=0;(((LineData[cnt]!=' ') && + (LineData[cnt]!=0)) && (cnt<14));++cnt) + bc[cnt]=LineData[cnt]; + bc[cnt]=0; + BidCount=atoi(bc); + } + break; + case 6: // time left + if (TimeLeft[0]==0) { + streamBuff.getline(LineData, 1024, '\n'); + strncpy(TimeLeft,LineData,50); + } + break; + case 7: // location + if (Location[0]==0) { + streamBuff.getline(LineData, 1024, '\n'); + strncpy(Location,LineData,100); + } + break; + case 8: // time started + if (Started[0]==0) { + streamBuff.getline(LineData, 1024, '\n'); + strncpy(Started,LineData,50); + translate_date( Started ); + } + break; + case 9: // time ending + if (Ends[0]==0) { + streamBuff.getline(LineData, 1024, '\n'); + strncpy(Ends,LineData,50); + translate_date( Ends ); + } + break; + case 10: // seller id + if (Seller[0]==0) { + streamBuff.getline(LineData, 1024, '\n'); + strncpy(Seller,LineData,75); + } + break; + case 11: // high bidder id + if (HighBidder[0]==0) { + streamBuff.getline(LineData, 1024, '\n'); + strncpy(HighBidder,LineData,76); + HighBidder[75] = '\0'; + } + break; - //case 12: idx=GetLineOfData(idx,1024,LineData,Buff); - // CheckBadChars(LineData,CheckPrice); - // strncpy(BidInc,LineData,14); - // break; - - case 13: // dutch auction - streamBuff.getline(LineData, 1024, '\n'); - CheckBadChars(LineData,CheckPrice); - strcpy(HighBidder, "Dutch Auction"); - break; - - default:; - } - } - } + //case 12: idx=GetLineOfData(idx,1024,LineData,Buff); + // CheckBadChars(LineData,CheckPrice); + // strncpy(BidInc,LineData,14); + // break; + + case 13: // dutch auction + streamBuff.getline(LineData, 1024, '\n'); + //CheckBadChars(LineData,CheckPrice); // no longer relevant + strcpy(HighBidder, "Dutch Auction"); + break; + + default:; + } + break; + /* End case 0 of auc_type */ + case TYPE_EBAYMOTORSCAR: + //printf("LD:%s:%i\n", LineData, strlen(LineData)); + switch(ReturnBidVarNum(LineData,auc_type)) { + case 1: // Current Bid + if (CurrentBid==0) { + streamBuff.getline(LineData, 1024, '\n'); + if ( strstr(LineData,"reserve not") != NULL ) + reserveMet = 'n'; + else if ( strstr(LineData,"reserve met") != NULL ) + reserveMet = 'y'; + + parseprice(LineData,this,FALSE); + + } + break; + + case 2: //Time left + if (TimeLeft[0]==0) { + streamBuff.getline(LineData, 1024, '\n'); + strncpy(TimeLeft,LineData,50); + } + break; + case 3: //Seller + if (Seller[0]==0) { + streamBuff.getline(LineData, 1024, '\n'); + strncpy(Seller,LineData,75); + } + break; + case 4: //High bid + if (HighBidder[0]==0) { + streamBuff.getline(LineData, 1024, '\n'); + strncpy(HighBidder,LineData,76); + HighBidder[75] = '\0'; + } + break; + case 5: //Number of bids + if (BidCount==0) { + char bc[80]; + streamBuff.getline(LineData, 1024, '\n'); + for(cnt=0;(((LineData[cnt]!=' ') && + (LineData[cnt]!=0)) && (cnt<14));++cnt) + bc[cnt]=LineData[cnt]; + bc[cnt]=0; + BidCount=atoi(bc); + } + break; + case 6: //Location + if (Location[0]==0) { + streamBuff.getline(LineData, 1024, '\n'); + strncpy(Location,LineData,100); + } + break; + case 7: //Started + if (Started[0]==0) { + streamBuff.getline(LineData, 1024, '\n'); + strncpy(Started,LineData,50); + translate_date( Started ); + } + break; + case 8: //Ends + if (Ends[0]==0) { + streamBuff.getline(LineData, 1024, '\n'); + strncpy(Ends,LineData,50); + translate_date( Ends ); + } + break; + case 9: //Starts at --same as current bid isn't it? + if (CurrentBid==0) { + streamBuff.getline(LineData, 1024, '\n'); + if ( strstr(LineData,"reserve not") != NULL ) + reserveMet = 'n'; + else if ( strstr(LineData,"reserve met") != NULL ) + reserveMet = 'y'; + + parseprice(LineData,this,FALSE); + + } + break; + + default:; + break; + /* End case 1 of auc_type */ + } + default:; + /* End of switch(auc_type) */ + } + } a87 1 // if ( CurrentBid == 0 ) strcpy(CurrentBid, "Error"); d89 11 a99 23 // now calculate the ending time in seconds and save it @@@@ -834,8 +977,11 @@@@ // and assign them to .SellerRate and .BidderRate strcpy ( newName, Seller); + scratch = strtok(newName, " "); + if ( !scratch ) return FALSE; + strcpy( Seller, scratch); scratch = strtok(0,")"); if ( scratch ) @@@@ -853,7 +999,9 @@@@ { strcpy( newName, HighBidder); scratch = strtok(newName, " "); + if ( !scratch ) return FALSE; + strcpy(HighBidder, scratch); scratch = strtok(0,")"); if ( scratch ) @ 1.2 log @Fix build problems under Solaris. @ text @d1 1 a1 1 $NetBSD$ @ 1.1 log @Pull in latest bug fixes from the CVS repository which fix e.g problems with loading the configuration and updating auctions. Bump version number to 1.3.0.99 as this is now close to what will be the 1.3.1 release. @ text @d4 1 a4 1 +++ helpers.cpp Wed Nov 21 23:34:17 2001 d67 22 a268 11 - - //case 12: idx=GetLineOfData(idx,1024,LineData,Buff); - // CheckBadChars(LineData,CheckPrice); - // strncpy(BidInc,LineData,14); - // break; - - case 13: // dutch auction - streamBuff.getline(LineData, 1024, '\n'); - CheckBadChars(LineData,CheckPrice); - strcpy(HighBidder, "Dutch Auction"); - break; d341 11 @