Codebase list esniper / 80d1661
Import Upstream version 2.16.0 Dmitry Smirnov 7 years ago
42 changed file(s) with 14115 addition(s) and 0 deletion(s). Raw diff Collapse all Expand all
0 esniper was originally written by Scott Nicol <esniper@users.sf.net>. Many
1 esniper users have contributed patches, updates and fixes.
0 /*
1 * Copyright (c) 2002, 2003, 2004 Scott Nicol <esniper@users.sf.net>
2 * All rights reserved
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are met:
6 *
7 * - Redistributions of source code must retain the above copyright notice,
8 * this list of conditions and the following disclaimer.
9 * - Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 *
13 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
14 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
15 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
16 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
17 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
18 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
19 * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
20 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
21 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
22 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
23 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24 */
0 2007-03-28
1 * 2.16.0 released.
2 * Add support for bid history without bidder name
3
4 2006-12-19
5 * Added note about requirement for default column order with -m option.
6
7 2006-11-27
8 * Fixed buyer & bidding history bug (need to skip over buyer history).
9 * Fixed problem with bug reports. HTTP buffer sometimes overwritten
10 by version number.
11
12 2006-11-13
13 * Fixed myItems (-m) option. eBay change tableName to "Id"
14
15 2006-11-08
16 * Fix handling of URL escapes in username.
17
18 2006-11-04
19 * 2.15.0 released.
20 * Fix bug 1579311 (and a million others), eBay changed the bid history
21 page again.
22 * Implemented feature request 1587259, handling -i without username
23 or password.
24 * Fix bug 1574881, bid increment comparison not always correct.
25
26 2006-09-05
27 * Fix for dutch auction parsing?
28
29 2006-01-05
30 * Fix bug 1352595, esniper does not encode password in URLs
31
32 2005-10-19
33 * 2.14.0 released.
34 * Added version check.
35 * Fix bug 1330486, login bug causes crash.
36
37 2005-10-12
38 * Fix bug 1324457, more detail on URL errors.
39
40 2005-10-08
41 * 2.13.0 released.
42 * Fix bug 1315702, Login failed.
43
44 2005-10-04
45 * 2.12.0 released.
46 * Fix bug 1313556, eBay login change breaks esniper.
47 * Fix bug 1275990, pagename MakeBidErrorDutchSameBidQuantity not
48 recognized.
49
50 2005-09-19
51 * Fix bug 1295057, blocked bid due to bidder location.
52 * Fix bug 1282914, blocked bid due to no paypal account.
53 * Fix bug 1252037, accept comma in price in auction file.
54 * Fix bug 1295198, FreeBSD core dump.
55
56 2005-08-07
57 * Fix bug 1253692. Fixed price auction error now handled gracefully.
58 * Fix bug 1300111, pagename MakeBidErrorCannotBidOnItem not recognized.
59
60 2005-07-24
61 * Fix bug 1301934, pagename MakeBidErrorAuctionEnded not recognized.
62
63 2005-07-04
64 * 2.11.0 released
65 * Fixed proxy handling. Removed lookup of http_proxy environment
66 variable, since libcurl does it.
67 * Fixed myItems item number parsing, including for auctions with
68 no image. Also added support for user notes.
69 * Enhanced bug reporting.
70
71 2005-06-27
72 * Fix bug 1228701. Time left heading has a table cell between it and
73 the cell containing the actual time left.
74
75 2005-04-19
76 * handle bid history for purchases (i.e. store items and buy-it-now
77 with no bidding)
78
79 2005-04-16
80 * added -i option: print information on given auctions and exit
81
82 2005-03-09
83 * rewrote error handling in prebid and bid history
84
85 2005-02-05
86 * moved getopt into util.c to make compiling on windows easier
87 * fixed handling of prebid result when auction has ended
88
89 2005-01-31
90 * 2.10.0 released
91
92 2005-01-26
93 * Fix bidding problem that sends esniper to PageReviewBid
94
95 2005-01-21
96 * handle blank time left field in bid history. This happens in
97 the last second of an auction
98
99 2005-01-19
100 * code cleanup thanks to lint and valgrind
101 * rewrote bid history parsing to use table parsing code. This should
102 resolve many little problems with bid history parsing, especially
103 with dutch auctions
104
105 2004-12-29
106 * recognize AcceptBid_HighBidder_rebid
107 * added table parsing
108 * added -m option, reads myebay watch list
109 * removed us-ascii kludge that knocked off high bit on text
110
111 2004-12-19
112 * show user's max bid
113
114 2004-12-16
115 * fixed segfault in http.c
116 * don't expose password in log files
117 * Use bid password (returned in preBid) instead of user password
118 for bidding.
119 * integrated configure patch
120
121 2004-12-15
122 * 2.9.0Beta released
123 * allow use of older versions of libcurl
124 * login rewrite
125 * bug report generator
126 * sort auctions by current status (winning bid already placed goes first)
127
128 2004-12-06
129 * autotools patch (from hoetzel)
130
131 2004-11-25
132 * Released 2.9.0Alpha
133 * Added libcurl fixes (from bomm)
0 Installation Instructions
1 *************************
2
3 Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002, 2004 Free
4 Software Foundation, Inc.
5
6 This file is free documentation; the Free Software Foundation gives
7 unlimited permission to copy, distribute and modify it.
8
9 Basic Installation
10 ==================
11
12 These are generic installation instructions.
13
14 The `configure' shell script attempts to guess correct values for
15 various system-dependent variables used during compilation. It uses
16 those values to create a `Makefile' in each directory of the package.
17 It may also create one or more `.h' files containing system-dependent
18 definitions. Finally, it creates a shell script `config.status' that
19 you can run in the future to recreate the current configuration, and a
20 file `config.log' containing compiler output (useful mainly for
21 debugging `configure').
22
23 It can also use an optional file (typically called `config.cache'
24 and enabled with `--cache-file=config.cache' or simply `-C') that saves
25 the results of its tests to speed up reconfiguring. (Caching is
26 disabled by default to prevent problems with accidental use of stale
27 cache files.)
28
29 If you need to do unusual things to compile the package, please try
30 to figure out how `configure' could check whether to do them, and mail
31 diffs or instructions to the address given in the `README' so they can
32 be considered for the next release. If you are using the cache, and at
33 some point `config.cache' contains results you don't want to keep, you
34 may remove or edit it.
35
36 The file `configure.ac' (or `configure.in') is used to create
37 `configure' by a program called `autoconf'. You only need
38 `configure.ac' if you want to change it or regenerate `configure' using
39 a newer version of `autoconf'.
40
41 The simplest way to compile this package is:
42
43 1. `cd' to the directory containing the package's source code and type
44 `./configure' to configure the package for your system. If you're
45 using `csh' on an old version of System V, you might need to type
46 `sh ./configure' instead to prevent `csh' from trying to execute
47 `configure' itself.
48
49 Running `configure' takes awhile. While running, it prints some
50 messages telling which features it is checking for.
51
52 2. Type `make' to compile the package.
53
54 3. Optionally, type `make check' to run any self-tests that come with
55 the package.
56
57 4. Type `make install' to install the programs and any data files and
58 documentation.
59
60 5. You can remove the program binaries and object files from the
61 source code directory by typing `make clean'. To also remove the
62 files that `configure' created (so you can compile the package for
63 a different kind of computer), type `make distclean'. There is
64 also a `make maintainer-clean' target, but that is intended mainly
65 for the package's developers. If you use it, you may have to get
66 all sorts of other programs in order to regenerate files that came
67 with the distribution.
68
69 Compilers and Options
70 =====================
71
72 Some systems require unusual options for compilation or linking that the
73 `configure' script does not know about. Run `./configure --help' for
74 details on some of the pertinent environment variables.
75
76 You can give `configure' initial values for configuration parameters
77 by setting variables in the command line or in the environment. Here
78 is an example:
79
80 ./configure CC=c89 CFLAGS=-O2 LIBS=-lposix
81
82 *Note Defining Variables::, for more details.
83
84 Compiling For Multiple Architectures
85 ====================================
86
87 You can compile the package for more than one kind of computer at the
88 same time, by placing the object files for each architecture in their
89 own directory. To do this, you must use a version of `make' that
90 supports the `VPATH' variable, such as GNU `make'. `cd' to the
91 directory where you want the object files and executables to go and run
92 the `configure' script. `configure' automatically checks for the
93 source code in the directory that `configure' is in and in `..'.
94
95 If you have to use a `make' that does not support the `VPATH'
96 variable, you have to compile the package for one architecture at a
97 time in the source code directory. After you have installed the
98 package for one architecture, use `make distclean' before reconfiguring
99 for another architecture.
100
101 Installation Names
102 ==================
103
104 By default, `make install' will install the package's files in
105 `/usr/local/bin', `/usr/local/man', etc. You can specify an
106 installation prefix other than `/usr/local' by giving `configure' the
107 option `--prefix=PREFIX'.
108
109 You can specify separate installation prefixes for
110 architecture-specific files and architecture-independent files. If you
111 give `configure' the option `--exec-prefix=PREFIX', the package will
112 use PREFIX as the prefix for installing programs and libraries.
113 Documentation and other data files will still use the regular prefix.
114
115 In addition, if you use an unusual directory layout you can give
116 options like `--bindir=DIR' to specify different values for particular
117 kinds of files. Run `configure --help' for a list of the directories
118 you can set and what kinds of files go in them.
119
120 If the package supports it, you can cause programs to be installed
121 with an extra prefix or suffix on their names by giving `configure' the
122 option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'.
123
124 Optional Features
125 =================
126
127 Some packages pay attention to `--enable-FEATURE' options to
128 `configure', where FEATURE indicates an optional part of the package.
129 They may also pay attention to `--with-PACKAGE' options, where PACKAGE
130 is something like `gnu-as' or `x' (for the X Window System). The
131 `README' should mention any `--enable-' and `--with-' options that the
132 package recognizes.
133
134 For packages that use the X Window System, `configure' can usually
135 find the X include and library files automatically, but if it doesn't,
136 you can use the `configure' options `--x-includes=DIR' and
137 `--x-libraries=DIR' to specify their locations.
138
139 Specifying the System Type
140 ==========================
141
142 There may be some features `configure' cannot figure out automatically,
143 but needs to determine by the type of machine the package will run on.
144 Usually, assuming the package is built to be run on the _same_
145 architectures, `configure' can figure that out, but if it prints a
146 message saying it cannot guess the machine type, give it the
147 `--build=TYPE' option. TYPE can either be a short name for the system
148 type, such as `sun4', or a canonical name which has the form:
149
150 CPU-COMPANY-SYSTEM
151
152 where SYSTEM can have one of these forms:
153
154 OS KERNEL-OS
155
156 See the file `config.sub' for the possible values of each field. If
157 `config.sub' isn't included in this package, then this package doesn't
158 need to know the machine type.
159
160 If you are _building_ compiler tools for cross-compiling, you should
161 use the `--target=TYPE' option to select the type of system they will
162 produce code for.
163
164 If you want to _use_ a cross compiler, that generates code for a
165 platform different from the build platform, you should specify the
166 "host" platform (i.e., that on which the generated programs will
167 eventually be run) with `--host=TYPE'.
168
169 Sharing Defaults
170 ================
171
172 If you want to set default values for `configure' scripts to share, you
173 can create a site shell script called `config.site' that gives default
174 values for variables like `CC', `cache_file', and `prefix'.
175 `configure' looks for `PREFIX/share/config.site' if it exists, then
176 `PREFIX/etc/config.site' if it exists. Or, you can set the
177 `CONFIG_SITE' environment variable to the location of the site script.
178 A warning: not all `configure' scripts look for a site script.
179
180 Defining Variables
181 ==================
182
183 Variables not defined in a site shell script can be set in the
184 environment passed to `configure'. However, some packages may run
185 configure again during the build, and the customized values of these
186 variables may be lost. In order to avoid this problem, you should set
187 them in the `configure' command line, using `VAR=value'. For example:
188
189 ./configure CC=/usr/local2/bin/gcc
190
191 will cause the specified gcc to be used as the C compiler (unless it is
192 overridden in the site shell script).
193
194 `configure' Invocation
195 ======================
196
197 `configure' recognizes the following options to control how it operates.
198
199 `--help'
200 `-h'
201 Print a summary of the options to `configure', and exit.
202
203 `--version'
204 `-V'
205 Print the version of Autoconf used to generate the `configure'
206 script, and exit.
207
208 `--cache-file=FILE'
209 Enable the cache: use and save the results of the tests in FILE,
210 traditionally `config.cache'. FILE defaults to `/dev/null' to
211 disable caching.
212
213 `--config-cache'
214 `-C'
215 Alias for `--cache-file=config.cache'.
216
217 `--quiet'
218 `--silent'
219 `-q'
220 Do not print messages saying which checks are being made. To
221 suppress all normal output, redirect it to `/dev/null' (any error
222 messages will still be shown).
223
224 `--srcdir=DIR'
225 Look for the package's source code in directory DIR. Usually
226 `configure' can determine that directory automatically.
227
228 `configure' also accepts some other, not widely useful, options. Run
229 `configure --help' for more details.
230
0 AM_CFLAGS = @CURLCFLAGS@
1 LDADD = @CURLLDFLAGS@
2
3 bin_PROGRAMS = esniper
4 esniper_SOURCES = auction.c auctionfile.c auctioninfo.c buffer.c esniper.c \
5 history.c html.c http.c options.c util.c \
6 auction.h auctionfile.h auctioninfo.h buffer.h esniper.h history.h \
7 html.h http.h options.h util.h
8
9 man_MANS = esniper.1
10
11 EXTRA_DIST = getopt.c sample_auction.txt sample_config.txt COPYRIGHT \
12 ReleaseBuild esniper.dsp esniper.dsw esniper.mak esniper_man.html \
13 $(man_MANS)
0 # Makefile.in generated by automake 1.9.5 from Makefile.am.
1 # @configure_input@
2
3 # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
4 # 2003, 2004, 2005 Free Software Foundation, Inc.
5 # This Makefile.in is free software; the Free Software Foundation
6 # gives unlimited permission to copy and/or distribute it,
7 # with or without modifications, as long as this notice is preserved.
8
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY, to the extent permitted by law; without
11 # even the implied warranty of MERCHANTABILITY or FITNESS FOR A
12 # PARTICULAR PURPOSE.
13
14 @SET_MAKE@
15
16 SOURCES = $(esniper_SOURCES)
17
18 srcdir = @srcdir@
19 top_srcdir = @top_srcdir@
20 VPATH = @srcdir@
21 pkgdatadir = $(datadir)/@PACKAGE@
22 pkglibdir = $(libdir)/@PACKAGE@
23 pkgincludedir = $(includedir)/@PACKAGE@
24 top_builddir = .
25 am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
26 INSTALL = @INSTALL@
27 install_sh_DATA = $(install_sh) -c -m 644
28 install_sh_PROGRAM = $(install_sh) -c
29 install_sh_SCRIPT = $(install_sh) -c
30 INSTALL_HEADER = $(INSTALL_DATA)
31 transform = $(program_transform_name)
32 NORMAL_INSTALL = :
33 PRE_INSTALL = :
34 POST_INSTALL = :
35 NORMAL_UNINSTALL = :
36 PRE_UNINSTALL = :
37 POST_UNINSTALL = :
38 bin_PROGRAMS = esniper$(EXEEXT)
39 subdir = .
40 DIST_COMMON = README $(am__configure_deps) $(srcdir)/Makefile.am \
41 $(srcdir)/Makefile.in $(top_srcdir)/configure AUTHORS COPYING \
42 ChangeLog INSTALL NEWS TODO depcomp install-sh missing
43 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
44 am__aclocal_m4_deps = $(top_srcdir)/configure.in
45 am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
46 $(ACLOCAL_M4)
47 am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \
48 configure.lineno configure.status.lineno
49 mkinstalldirs = $(install_sh) -d
50 CONFIG_CLEAN_FILES =
51 am__installdirs = "$(DESTDIR)$(bindir)" "$(DESTDIR)$(man1dir)"
52 binPROGRAMS_INSTALL = $(INSTALL_PROGRAM)
53 PROGRAMS = $(bin_PROGRAMS)
54 am_esniper_OBJECTS = auction.$(OBJEXT) auctionfile.$(OBJEXT) \
55 auctioninfo.$(OBJEXT) buffer.$(OBJEXT) esniper.$(OBJEXT) \
56 history.$(OBJEXT) html.$(OBJEXT) http.$(OBJEXT) \
57 options.$(OBJEXT) util.$(OBJEXT)
58 esniper_OBJECTS = $(am_esniper_OBJECTS)
59 esniper_LDADD = $(LDADD)
60 esniper_DEPENDENCIES =
61 DEFAULT_INCLUDES = -I. -I$(srcdir)
62 depcomp = $(SHELL) $(top_srcdir)/depcomp
63 am__depfiles_maybe = depfiles
64 COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
65 $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
66 CCLD = $(CC)
67 LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
68 SOURCES = $(esniper_SOURCES)
69 DIST_SOURCES = $(esniper_SOURCES)
70 man1dir = $(mandir)/man1
71 NROFF = nroff
72 MANS = $(man_MANS)
73 ETAGS = etags
74 CTAGS = ctags
75 DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
76 distdir = $(PACKAGE)-$(VERSION)
77 top_distdir = $(distdir)
78 am__remove_distdir = \
79 { test ! -d $(distdir) \
80 || { find $(distdir) -type d ! -perm -200 -exec chmod u+w {} ';' \
81 && rm -fr $(distdir); }; }
82 DIST_ARCHIVES = $(distdir).tar.gz
83 GZIP_ENV = --best
84 distuninstallcheck_listfiles = find . -type f -print
85 distcleancheck_listfiles = find . -type f -print
86 ACLOCAL = @ACLOCAL@
87 AMDEP_FALSE = @AMDEP_FALSE@
88 AMDEP_TRUE = @AMDEP_TRUE@
89 AMTAR = @AMTAR@
90 AUTOCONF = @AUTOCONF@
91 AUTOHEADER = @AUTOHEADER@
92 AUTOMAKE = @AUTOMAKE@
93 AWK = @AWK@
94 CC = @CC@
95 CCDEPMODE = @CCDEPMODE@
96 CFLAGS = @CFLAGS@
97 CPPFLAGS = @CPPFLAGS@
98 CURLCFLAGS = @CURLCFLAGS@
99 CURLLDFLAGS = @CURLLDFLAGS@
100 CURL_CONFIG = @CURL_CONFIG@
101 CYGPATH_W = @CYGPATH_W@
102 DEFS = @DEFS@
103 DEPDIR = @DEPDIR@
104 ECHO_C = @ECHO_C@
105 ECHO_N = @ECHO_N@
106 ECHO_T = @ECHO_T@
107 EXEEXT = @EXEEXT@
108 INSTALL_DATA = @INSTALL_DATA@
109 INSTALL_PROGRAM = @INSTALL_PROGRAM@
110 INSTALL_SCRIPT = @INSTALL_SCRIPT@
111 INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
112 LDFLAGS = @LDFLAGS@
113 LIBOBJS = @LIBOBJS@
114 LIBS = @LIBS@
115 LTLIBOBJS = @LTLIBOBJS@
116 MAKEINFO = @MAKEINFO@
117 OBJEXT = @OBJEXT@
118 PACKAGE = @PACKAGE@
119 PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
120 PACKAGE_NAME = @PACKAGE_NAME@
121 PACKAGE_STRING = @PACKAGE_STRING@
122 PACKAGE_TARNAME = @PACKAGE_TARNAME@
123 PACKAGE_VERSION = @PACKAGE_VERSION@
124 PATH_SEPARATOR = @PATH_SEPARATOR@
125 SET_MAKE = @SET_MAKE@
126 SHELL = @SHELL@
127 STRIP = @STRIP@
128 VERSION = @VERSION@
129 ac_ct_CC = @ac_ct_CC@
130 ac_ct_STRIP = @ac_ct_STRIP@
131 am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
132 am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
133 am__include = @am__include@
134 am__leading_dot = @am__leading_dot@
135 am__quote = @am__quote@
136 am__tar = @am__tar@
137 am__untar = @am__untar@
138 bindir = @bindir@
139 build_alias = @build_alias@
140 datadir = @datadir@
141 exec_prefix = @exec_prefix@
142 host_alias = @host_alias@
143 includedir = @includedir@
144 infodir = @infodir@
145 install_sh = @install_sh@
146 libdir = @libdir@
147 libexecdir = @libexecdir@
148 localstatedir = @localstatedir@
149 mandir = @mandir@
150 mkdir_p = @mkdir_p@
151 oldincludedir = @oldincludedir@
152 prefix = @prefix@
153 program_transform_name = @program_transform_name@
154 sbindir = @sbindir@
155 sharedstatedir = @sharedstatedir@
156 sysconfdir = @sysconfdir@
157 target_alias = @target_alias@
158 AM_CFLAGS = @CURLCFLAGS@
159 LDADD = @CURLLDFLAGS@
160 esniper_SOURCES = auction.c auctionfile.c auctioninfo.c buffer.c esniper.c \
161 history.c html.c http.c options.c util.c \
162 auction.h auctionfile.h auctioninfo.h buffer.h esniper.h history.h \
163 html.h http.h options.h util.h
164
165 man_MANS = esniper.1
166 EXTRA_DIST = getopt.c sample_auction.txt sample_config.txt COPYRIGHT \
167 ReleaseBuild esniper.dsp esniper.dsw esniper.mak esniper_man.html \
168 $(man_MANS)
169
170 all: all-am
171
172 .SUFFIXES:
173 .SUFFIXES: .c .o .obj
174 am--refresh:
175 @:
176 $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
177 @for dep in $?; do \
178 case '$(am__configure_deps)' in \
179 *$$dep*) \
180 echo ' cd $(srcdir) && $(AUTOMAKE) --gnu '; \
181 cd $(srcdir) && $(AUTOMAKE) --gnu \
182 && exit 0; \
183 exit 1;; \
184 esac; \
185 done; \
186 echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu Makefile'; \
187 cd $(top_srcdir) && \
188 $(AUTOMAKE) --gnu Makefile
189 .PRECIOUS: Makefile
190 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
191 @case '$?' in \
192 *config.status*) \
193 echo ' $(SHELL) ./config.status'; \
194 $(SHELL) ./config.status;; \
195 *) \
196 echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe)'; \
197 cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe);; \
198 esac;
199
200 $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
201 $(SHELL) ./config.status --recheck
202
203 $(top_srcdir)/configure: $(am__configure_deps)
204 cd $(srcdir) && $(AUTOCONF)
205 $(ACLOCAL_M4): $(am__aclocal_m4_deps)
206 cd $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS)
207 install-binPROGRAMS: $(bin_PROGRAMS)
208 @$(NORMAL_INSTALL)
209 test -z "$(bindir)" || $(mkdir_p) "$(DESTDIR)$(bindir)"
210 @list='$(bin_PROGRAMS)'; for p in $$list; do \
211 p1=`echo $$p|sed 's/$(EXEEXT)$$//'`; \
212 if test -f $$p \
213 ; then \
214 f=`echo "$$p1" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`; \
215 echo " $(INSTALL_PROGRAM_ENV) $(binPROGRAMS_INSTALL) '$$p' '$(DESTDIR)$(bindir)/$$f'"; \
216 $(INSTALL_PROGRAM_ENV) $(binPROGRAMS_INSTALL) "$$p" "$(DESTDIR)$(bindir)/$$f" || exit 1; \
217 else :; fi; \
218 done
219
220 uninstall-binPROGRAMS:
221 @$(NORMAL_UNINSTALL)
222 @list='$(bin_PROGRAMS)'; for p in $$list; do \
223 f=`echo "$$p" | sed 's,^.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \
224 echo " rm -f '$(DESTDIR)$(bindir)/$$f'"; \
225 rm -f "$(DESTDIR)$(bindir)/$$f"; \
226 done
227
228 clean-binPROGRAMS:
229 -test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS)
230 esniper$(EXEEXT): $(esniper_OBJECTS) $(esniper_DEPENDENCIES)
231 @rm -f esniper$(EXEEXT)
232 $(LINK) $(esniper_LDFLAGS) $(esniper_OBJECTS) $(esniper_LDADD) $(LIBS)
233
234 mostlyclean-compile:
235 -rm -f *.$(OBJEXT)
236
237 distclean-compile:
238 -rm -f *.tab.c
239
240 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/auction.Po@am__quote@
241 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/auctionfile.Po@am__quote@
242 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/auctioninfo.Po@am__quote@
243 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/buffer.Po@am__quote@
244 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/esniper.Po@am__quote@
245 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/history.Po@am__quote@
246 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/html.Po@am__quote@
247 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/http.Po@am__quote@
248 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/options.Po@am__quote@
249 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/util.Po@am__quote@
250
251 .c.o:
252 @am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
253 @am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
254 @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
255 @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
256 @am__fastdepCC_FALSE@ $(COMPILE) -c $<
257
258 .c.obj:
259 @am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \
260 @am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
261 @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
262 @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
263 @am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
264 uninstall-info-am:
265 install-man1: $(man1_MANS) $(man_MANS)
266 @$(NORMAL_INSTALL)
267 test -z "$(man1dir)" || $(mkdir_p) "$(DESTDIR)$(man1dir)"
268 @list='$(man1_MANS) $(dist_man1_MANS) $(nodist_man1_MANS)'; \
269 l2='$(man_MANS) $(dist_man_MANS) $(nodist_man_MANS)'; \
270 for i in $$l2; do \
271 case "$$i" in \
272 *.1*) list="$$list $$i" ;; \
273 esac; \
274 done; \
275 for i in $$list; do \
276 if test -f $(srcdir)/$$i; then file=$(srcdir)/$$i; \
277 else file=$$i; fi; \
278 ext=`echo $$i | sed -e 's/^.*\\.//'`; \
279 case "$$ext" in \
280 1*) ;; \
281 *) ext='1' ;; \
282 esac; \
283 inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \
284 inst=`echo $$inst | sed -e 's/^.*\///'`; \
285 inst=`echo $$inst | sed '$(transform)'`.$$ext; \
286 echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(man1dir)/$$inst'"; \
287 $(INSTALL_DATA) "$$file" "$(DESTDIR)$(man1dir)/$$inst"; \
288 done
289 uninstall-man1:
290 @$(NORMAL_UNINSTALL)
291 @list='$(man1_MANS) $(dist_man1_MANS) $(nodist_man1_MANS)'; \
292 l2='$(man_MANS) $(dist_man_MANS) $(nodist_man_MANS)'; \
293 for i in $$l2; do \
294 case "$$i" in \
295 *.1*) list="$$list $$i" ;; \
296 esac; \
297 done; \
298 for i in $$list; do \
299 ext=`echo $$i | sed -e 's/^.*\\.//'`; \
300 case "$$ext" in \
301 1*) ;; \
302 *) ext='1' ;; \
303 esac; \
304 inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \
305 inst=`echo $$inst | sed -e 's/^.*\///'`; \
306 inst=`echo $$inst | sed '$(transform)'`.$$ext; \
307 echo " rm -f '$(DESTDIR)$(man1dir)/$$inst'"; \
308 rm -f "$(DESTDIR)$(man1dir)/$$inst"; \
309 done
310
311 ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
312 list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
313 unique=`for i in $$list; do \
314 if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
315 done | \
316 $(AWK) ' { files[$$0] = 1; } \
317 END { for (i in files) print i; }'`; \
318 mkid -fID $$unique
319 tags: TAGS
320
321 TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
322 $(TAGS_FILES) $(LISP)
323 tags=; \
324 here=`pwd`; \
325 list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
326 unique=`for i in $$list; do \
327 if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
328 done | \
329 $(AWK) ' { files[$$0] = 1; } \
330 END { for (i in files) print i; }'`; \
331 if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
332 test -n "$$unique" || unique=$$empty_fix; \
333 $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
334 $$tags $$unique; \
335 fi
336 ctags: CTAGS
337 CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
338 $(TAGS_FILES) $(LISP)
339 tags=; \
340 here=`pwd`; \
341 list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
342 unique=`for i in $$list; do \
343 if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
344 done | \
345 $(AWK) ' { files[$$0] = 1; } \
346 END { for (i in files) print i; }'`; \
347 test -z "$(CTAGS_ARGS)$$tags$$unique" \
348 || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
349 $$tags $$unique
350
351 GTAGS:
352 here=`$(am__cd) $(top_builddir) && pwd` \
353 && cd $(top_srcdir) \
354 && gtags -i $(GTAGS_ARGS) $$here
355
356 distclean-tags:
357 -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
358
359 distdir: $(DISTFILES)
360 $(am__remove_distdir)
361 mkdir $(distdir)
362 @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
363 topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
364 list='$(DISTFILES)'; for file in $$list; do \
365 case $$file in \
366 $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
367 $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
368 esac; \
369 if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
370 dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
371 if test "$$dir" != "$$file" && test "$$dir" != "."; then \
372 dir="/$$dir"; \
373 $(mkdir_p) "$(distdir)$$dir"; \
374 else \
375 dir=''; \
376 fi; \
377 if test -d $$d/$$file; then \
378 if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
379 cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
380 fi; \
381 cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
382 else \
383 test -f $(distdir)/$$file \
384 || cp -p $$d/$$file $(distdir)/$$file \
385 || exit 1; \
386 fi; \
387 done
388 -find $(distdir) -type d ! -perm -777 -exec chmod a+rwx {} \; -o \
389 ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \
390 ! -type d ! -perm -400 -exec chmod a+r {} \; -o \
391 ! -type d ! -perm -444 -exec $(SHELL) $(install_sh) -c -m a+r {} {} \; \
392 || chmod -R a+r $(distdir)
393 dist-gzip: distdir
394 tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz
395 $(am__remove_distdir)
396
397 dist-bzip2: distdir
398 tardir=$(distdir) && $(am__tar) | bzip2 -9 -c >$(distdir).tar.bz2
399 $(am__remove_distdir)
400
401 dist-tarZ: distdir
402 tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z
403 $(am__remove_distdir)
404
405 dist-shar: distdir
406 shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz
407 $(am__remove_distdir)
408
409 dist-zip: distdir
410 -rm -f $(distdir).zip
411 zip -rq $(distdir).zip $(distdir)
412 $(am__remove_distdir)
413
414 dist dist-all: distdir
415 tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz
416 $(am__remove_distdir)
417
418 # This target untars the dist file and tries a VPATH configuration. Then
419 # it guarantees that the distribution is self-contained by making another
420 # tarfile.
421 distcheck: dist
422 case '$(DIST_ARCHIVES)' in \
423 *.tar.gz*) \
424 GZIP=$(GZIP_ENV) gunzip -c $(distdir).tar.gz | $(am__untar) ;;\
425 *.tar.bz2*) \
426 bunzip2 -c $(distdir).tar.bz2 | $(am__untar) ;;\
427 *.tar.Z*) \
428 uncompress -c $(distdir).tar.Z | $(am__untar) ;;\
429 *.shar.gz*) \
430 GZIP=$(GZIP_ENV) gunzip -c $(distdir).shar.gz | unshar ;;\
431 *.zip*) \
432 unzip $(distdir).zip ;;\
433 esac
434 chmod -R a-w $(distdir); chmod a+w $(distdir)
435 mkdir $(distdir)/_build
436 mkdir $(distdir)/_inst
437 chmod a-w $(distdir)
438 dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \
439 && dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \
440 && cd $(distdir)/_build \
441 && ../configure --srcdir=.. --prefix="$$dc_install_base" \
442 $(DISTCHECK_CONFIGURE_FLAGS) \
443 && $(MAKE) $(AM_MAKEFLAGS) \
444 && $(MAKE) $(AM_MAKEFLAGS) dvi \
445 && $(MAKE) $(AM_MAKEFLAGS) check \
446 && $(MAKE) $(AM_MAKEFLAGS) install \
447 && $(MAKE) $(AM_MAKEFLAGS) installcheck \
448 && $(MAKE) $(AM_MAKEFLAGS) uninstall \
449 && $(MAKE) $(AM_MAKEFLAGS) distuninstallcheck_dir="$$dc_install_base" \
450 distuninstallcheck \
451 && chmod -R a-w "$$dc_install_base" \
452 && ({ \
453 (cd ../.. && umask 077 && mkdir "$$dc_destdir") \
454 && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" install \
455 && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" uninstall \
456 && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" \
457 distuninstallcheck_dir="$$dc_destdir" distuninstallcheck; \
458 } || { rm -rf "$$dc_destdir"; exit 1; }) \
459 && rm -rf "$$dc_destdir" \
460 && $(MAKE) $(AM_MAKEFLAGS) dist \
461 && rm -rf $(DIST_ARCHIVES) \
462 && $(MAKE) $(AM_MAKEFLAGS) distcleancheck
463 $(am__remove_distdir)
464 @(echo "$(distdir) archives ready for distribution: "; \
465 list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \
466 sed -e '1{h;s/./=/g;p;x;}' -e '$${p;x;}'
467 distuninstallcheck:
468 @cd $(distuninstallcheck_dir) \
469 && test `$(distuninstallcheck_listfiles) | wc -l` -le 1 \
470 || { echo "ERROR: files left after uninstall:" ; \
471 if test -n "$(DESTDIR)"; then \
472 echo " (check DESTDIR support)"; \
473 fi ; \
474 $(distuninstallcheck_listfiles) ; \
475 exit 1; } >&2
476 distcleancheck: distclean
477 @if test '$(srcdir)' = . ; then \
478 echo "ERROR: distcleancheck can only run from a VPATH build" ; \
479 exit 1 ; \
480 fi
481 @test `$(distcleancheck_listfiles) | wc -l` -eq 0 \
482 || { echo "ERROR: files left in build directory after distclean:" ; \
483 $(distcleancheck_listfiles) ; \
484 exit 1; } >&2
485 check-am: all-am
486 check: check-am
487 all-am: Makefile $(PROGRAMS) $(MANS)
488 installdirs:
489 for dir in "$(DESTDIR)$(bindir)" "$(DESTDIR)$(man1dir)"; do \
490 test -z "$$dir" || $(mkdir_p) "$$dir"; \
491 done
492 install: install-am
493 install-exec: install-exec-am
494 install-data: install-data-am
495 uninstall: uninstall-am
496
497 install-am: all-am
498 @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
499
500 installcheck: installcheck-am
501 install-strip:
502 $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
503 install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
504 `test -z '$(STRIP)' || \
505 echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
506 mostlyclean-generic:
507
508 clean-generic:
509
510 distclean-generic:
511 -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
512
513 maintainer-clean-generic:
514 @echo "This command is intended for maintainers to use"
515 @echo "it deletes files that may require special tools to rebuild."
516 clean: clean-am
517
518 clean-am: clean-binPROGRAMS clean-generic mostlyclean-am
519
520 distclean: distclean-am
521 -rm -f $(am__CONFIG_DISTCLEAN_FILES)
522 -rm -rf ./$(DEPDIR)
523 -rm -f Makefile
524 distclean-am: clean-am distclean-compile distclean-generic \
525 distclean-tags
526
527 dvi: dvi-am
528
529 dvi-am:
530
531 html: html-am
532
533 info: info-am
534
535 info-am:
536
537 install-data-am: install-man
538
539 install-exec-am: install-binPROGRAMS
540
541 install-info: install-info-am
542
543 install-man: install-man1
544
545 installcheck-am:
546
547 maintainer-clean: maintainer-clean-am
548 -rm -f $(am__CONFIG_DISTCLEAN_FILES)
549 -rm -rf $(top_srcdir)/autom4te.cache
550 -rm -rf ./$(DEPDIR)
551 -rm -f Makefile
552 maintainer-clean-am: distclean-am maintainer-clean-generic
553
554 mostlyclean: mostlyclean-am
555
556 mostlyclean-am: mostlyclean-compile mostlyclean-generic
557
558 pdf: pdf-am
559
560 pdf-am:
561
562 ps: ps-am
563
564 ps-am:
565
566 uninstall-am: uninstall-binPROGRAMS uninstall-info-am uninstall-man
567
568 uninstall-man: uninstall-man1
569
570 .PHONY: CTAGS GTAGS all all-am am--refresh check check-am clean \
571 clean-binPROGRAMS clean-generic ctags dist dist-all dist-bzip2 \
572 dist-gzip dist-shar dist-tarZ dist-zip distcheck distclean \
573 distclean-compile distclean-generic distclean-tags \
574 distcleancheck distdir distuninstallcheck dvi dvi-am html \
575 html-am info info-am install install-am install-binPROGRAMS \
576 install-data install-data-am install-exec install-exec-am \
577 install-info install-info-am install-man install-man1 \
578 install-strip installcheck installcheck-am installdirs \
579 maintainer-clean maintainer-clean-generic mostlyclean \
580 mostlyclean-compile mostlyclean-generic pdf pdf-am ps ps-am \
581 tags uninstall uninstall-am uninstall-binPROGRAMS \
582 uninstall-info-am uninstall-man uninstall-man1
583
584 # Tell versions [3.59,3.63) of GNU make to not export all variables.
585 # Otherwise a system limit (for SysV at least) may be exceeded.
586 .NOEXPORT:
0 Changes from esniper 2.9.0Alpha to 2.9.0Beta:
1 ============================================
2 * added configure scripts [hoetzel]
3 * relaxed depency on libcurl version
4 * rewrote login
5
6 Changes from esniper 2.8.1 to 2.9.0Alpha:
7 =========================================
8 * http handling code rewritten using libcurl [bomm]
0 For more information, see <http://esniper.sf.net/>.
1
2 NOTE: This is an Beta release. Major changes to esniper have been made
3 to accommodate eBay's switch to SSL login. Bugs are to be expected.
4
5 A MS Visual C++ workspace (esniper.dsw), project (esniper.dsp) and
6 makefile (esniper.mak) are not up-to-date. In particular, they have
7 not been modified to use libcurl.
0 Handle auctions better. Place auctions in a queue ordered by the time they
1 need to be updated next. This will ensure that all auctions are updated at
2 least once a day.
3
4 Parse myitem list header, so that it supports fields in any order.
5
6 ae_unavailable
7 - esniper used to return this error in bidHistory() when it got the
8 "down for maintenace" message.
9
10 Languages (German, French, ...)
11 - output only. Handling input in multiple languages (i.e. reading from
12 ebay.de, ebay.ca, etc) is too much work. You would need to either add
13 an auction.c for each site supported, or create a meta-language describing
14 how to parse each page. Plus eBay likes to change their output without
15 notice!
0 # generated automatically by aclocal 1.9.5 -*- Autoconf -*-
1
2 # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
3 # 2005 Free Software Foundation, Inc.
4 # This file is free software; the Free Software Foundation
5 # gives unlimited permission to copy and/or distribute it,
6 # with or without modifications, as long as this notice is preserved.
7
8 # This program is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY, to the extent permitted by law; without
10 # even the implied warranty of MERCHANTABILITY or FITNESS FOR A
11 # PARTICULAR PURPOSE.
12
13 # Copyright (C) 2002, 2003, 2005 Free Software Foundation, Inc.
14 #
15 # This file is free software; the Free Software Foundation
16 # gives unlimited permission to copy and/or distribute it,
17 # with or without modifications, as long as this notice is preserved.
18
19 # AM_AUTOMAKE_VERSION(VERSION)
20 # ----------------------------
21 # Automake X.Y traces this macro to ensure aclocal.m4 has been
22 # generated from the m4 files accompanying Automake X.Y.
23 AC_DEFUN([AM_AUTOMAKE_VERSION], [am__api_version="1.9"])
24
25 # AM_SET_CURRENT_AUTOMAKE_VERSION
26 # -------------------------------
27 # Call AM_AUTOMAKE_VERSION so it can be traced.
28 # This function is AC_REQUIREd by AC_INIT_AUTOMAKE.
29 AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
30 [AM_AUTOMAKE_VERSION([1.9.5])])
31
32 # AM_AUX_DIR_EXPAND -*- Autoconf -*-
33
34 # Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc.
35 #
36 # This file is free software; the Free Software Foundation
37 # gives unlimited permission to copy and/or distribute it,
38 # with or without modifications, as long as this notice is preserved.
39
40 # For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
41 # $ac_aux_dir to `$srcdir/foo'. In other projects, it is set to
42 # `$srcdir', `$srcdir/..', or `$srcdir/../..'.
43 #
44 # Of course, Automake must honor this variable whenever it calls a
45 # tool from the auxiliary directory. The problem is that $srcdir (and
46 # therefore $ac_aux_dir as well) can be either absolute or relative,
47 # depending on how configure is run. This is pretty annoying, since
48 # it makes $ac_aux_dir quite unusable in subdirectories: in the top
49 # source directory, any form will work fine, but in subdirectories a
50 # relative path needs to be adjusted first.
51 #
52 # $ac_aux_dir/missing
53 # fails when called from a subdirectory if $ac_aux_dir is relative
54 # $top_srcdir/$ac_aux_dir/missing
55 # fails if $ac_aux_dir is absolute,
56 # fails when called from a subdirectory in a VPATH build with
57 # a relative $ac_aux_dir
58 #
59 # The reason of the latter failure is that $top_srcdir and $ac_aux_dir
60 # are both prefixed by $srcdir. In an in-source build this is usually
61 # harmless because $srcdir is `.', but things will broke when you
62 # start a VPATH build or use an absolute $srcdir.
63 #
64 # So we could use something similar to $top_srcdir/$ac_aux_dir/missing,
65 # iff we strip the leading $srcdir from $ac_aux_dir. That would be:
66 # am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"`
67 # and then we would define $MISSING as
68 # MISSING="\${SHELL} $am_aux_dir/missing"
69 # This will work as long as MISSING is not called from configure, because
70 # unfortunately $(top_srcdir) has no meaning in configure.
71 # However there are other variables, like CC, which are often used in
72 # configure, and could therefore not use this "fixed" $ac_aux_dir.
73 #
74 # Another solution, used here, is to always expand $ac_aux_dir to an
75 # absolute PATH. The drawback is that using absolute paths prevent a
76 # configured tree to be moved without reconfiguration.
77
78 AC_DEFUN([AM_AUX_DIR_EXPAND],
79 [dnl Rely on autoconf to set up CDPATH properly.
80 AC_PREREQ([2.50])dnl
81 # expand $ac_aux_dir to an absolute path
82 am_aux_dir=`cd $ac_aux_dir && pwd`
83 ])
84
85 # AM_CONDITIONAL -*- Autoconf -*-
86
87 # Copyright (C) 1997, 2000, 2001, 2003, 2004, 2005
88 # Free Software Foundation, Inc.
89 #
90 # This file is free software; the Free Software Foundation
91 # gives unlimited permission to copy and/or distribute it,
92 # with or without modifications, as long as this notice is preserved.
93
94 # serial 7
95
96 # AM_CONDITIONAL(NAME, SHELL-CONDITION)
97 # -------------------------------------
98 # Define a conditional.
99 AC_DEFUN([AM_CONDITIONAL],
100 [AC_PREREQ(2.52)dnl
101 ifelse([$1], [TRUE], [AC_FATAL([$0: invalid condition: $1])],
102 [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
103 AC_SUBST([$1_TRUE])
104 AC_SUBST([$1_FALSE])
105 if $2; then
106 $1_TRUE=
107 $1_FALSE='#'
108 else
109 $1_TRUE='#'
110 $1_FALSE=
111 fi
112 AC_CONFIG_COMMANDS_PRE(
113 [if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then
114 AC_MSG_ERROR([[conditional "$1" was never defined.
115 Usually this means the macro was only invoked conditionally.]])
116 fi])])
117
118
119 # Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005
120 # Free Software Foundation, Inc.
121 #
122 # This file is free software; the Free Software Foundation
123 # gives unlimited permission to copy and/or distribute it,
124 # with or without modifications, as long as this notice is preserved.
125
126 # serial 8
127
128 # There are a few dirty hacks below to avoid letting `AC_PROG_CC' be
129 # written in clear, in which case automake, when reading aclocal.m4,
130 # will think it sees a *use*, and therefore will trigger all it's
131 # C support machinery. Also note that it means that autoscan, seeing
132 # CC etc. in the Makefile, will ask for an AC_PROG_CC use...
133
134
135 # _AM_DEPENDENCIES(NAME)
136 # ----------------------
137 # See how the compiler implements dependency checking.
138 # NAME is "CC", "CXX", "GCJ", or "OBJC".
139 # We try a few techniques and use that to set a single cache variable.
140 #
141 # We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was
142 # modified to invoke _AM_DEPENDENCIES(CC); we would have a circular
143 # dependency, and given that the user is not expected to run this macro,
144 # just rely on AC_PROG_CC.
145 AC_DEFUN([_AM_DEPENDENCIES],
146 [AC_REQUIRE([AM_SET_DEPDIR])dnl
147 AC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl
148 AC_REQUIRE([AM_MAKE_INCLUDE])dnl
149 AC_REQUIRE([AM_DEP_TRACK])dnl
150
151 ifelse([$1], CC, [depcc="$CC" am_compiler_list=],
152 [$1], CXX, [depcc="$CXX" am_compiler_list=],
153 [$1], OBJC, [depcc="$OBJC" am_compiler_list='gcc3 gcc'],
154 [$1], GCJ, [depcc="$GCJ" am_compiler_list='gcc3 gcc'],
155 [depcc="$$1" am_compiler_list=])
156
157 AC_CACHE_CHECK([dependency style of $depcc],
158 [am_cv_$1_dependencies_compiler_type],
159 [if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
160 # We make a subdir and do the tests there. Otherwise we can end up
161 # making bogus files that we don't know about and never remove. For
162 # instance it was reported that on HP-UX the gcc test will end up
163 # making a dummy file named `D' -- because `-MD' means `put the output
164 # in D'.
165 mkdir conftest.dir
166 # Copy depcomp to subdir because otherwise we won't find it if we're
167 # using a relative directory.
168 cp "$am_depcomp" conftest.dir
169 cd conftest.dir
170 # We will build objects and dependencies in a subdirectory because
171 # it helps to detect inapplicable dependency modes. For instance
172 # both Tru64's cc and ICC support -MD to output dependencies as a
173 # side effect of compilation, but ICC will put the dependencies in
174 # the current directory while Tru64 will put them in the object
175 # directory.
176 mkdir sub
177
178 am_cv_$1_dependencies_compiler_type=none
179 if test "$am_compiler_list" = ""; then
180 am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp`
181 fi
182 for depmode in $am_compiler_list; do
183 # Setup a source with many dependencies, because some compilers
184 # like to wrap large dependency lists on column 80 (with \), and
185 # we should not choose a depcomp mode which is confused by this.
186 #
187 # We need to recreate these files for each test, as the compiler may
188 # overwrite some of them when testing with obscure command lines.
189 # This happens at least with the AIX C compiler.
190 : > sub/conftest.c
191 for i in 1 2 3 4 5 6; do
192 echo '#include "conftst'$i'.h"' >> sub/conftest.c
193 # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with
194 # Solaris 8's {/usr,}/bin/sh.
195 touch sub/conftst$i.h
196 done
197 echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
198
199 case $depmode in
200 nosideeffect)
201 # after this tag, mechanisms are not by side-effect, so they'll
202 # only be used when explicitly requested
203 if test "x$enable_dependency_tracking" = xyes; then
204 continue
205 else
206 break
207 fi
208 ;;
209 none) break ;;
210 esac
211 # We check with `-c' and `-o' for the sake of the "dashmstdout"
212 # mode. It turns out that the SunPro C++ compiler does not properly
213 # handle `-M -o', and we need to detect this.
214 if depmode=$depmode \
215 source=sub/conftest.c object=sub/conftest.${OBJEXT-o} \
216 depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
217 $SHELL ./depcomp $depcc -c -o sub/conftest.${OBJEXT-o} sub/conftest.c \
218 >/dev/null 2>conftest.err &&
219 grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
220 grep sub/conftest.${OBJEXT-o} sub/conftest.Po > /dev/null 2>&1 &&
221 ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
222 # icc doesn't choke on unknown options, it will just issue warnings
223 # or remarks (even with -Werror). So we grep stderr for any message
224 # that says an option was ignored or not supported.
225 # When given -MP, icc 7.0 and 7.1 complain thusly:
226 # icc: Command line warning: ignoring option '-M'; no argument required
227 # The diagnosis changed in icc 8.0:
228 # icc: Command line remark: option '-MP' not supported
229 if (grep 'ignoring option' conftest.err ||
230 grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
231 am_cv_$1_dependencies_compiler_type=$depmode
232 break
233 fi
234 fi
235 done
236
237 cd ..
238 rm -rf conftest.dir
239 else
240 am_cv_$1_dependencies_compiler_type=none
241 fi
242 ])
243 AC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type])
244 AM_CONDITIONAL([am__fastdep$1], [
245 test "x$enable_dependency_tracking" != xno \
246 && test "$am_cv_$1_dependencies_compiler_type" = gcc3])
247 ])
248
249
250 # AM_SET_DEPDIR
251 # -------------
252 # Choose a directory name for dependency files.
253 # This macro is AC_REQUIREd in _AM_DEPENDENCIES
254 AC_DEFUN([AM_SET_DEPDIR],
255 [AC_REQUIRE([AM_SET_LEADING_DOT])dnl
256 AC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl
257 ])
258
259
260 # AM_DEP_TRACK
261 # ------------
262 AC_DEFUN([AM_DEP_TRACK],
263 [AC_ARG_ENABLE(dependency-tracking,
264 [ --disable-dependency-tracking speeds up one-time build
265 --enable-dependency-tracking do not reject slow dependency extractors])
266 if test "x$enable_dependency_tracking" != xno; then
267 am_depcomp="$ac_aux_dir/depcomp"
268 AMDEPBACKSLASH='\'
269 fi
270 AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno])
271 AC_SUBST([AMDEPBACKSLASH])
272 ])
273
274 # Generate code to set up dependency tracking. -*- Autoconf -*-
275
276 # Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005
277 # Free Software Foundation, Inc.
278 #
279 # This file is free software; the Free Software Foundation
280 # gives unlimited permission to copy and/or distribute it,
281 # with or without modifications, as long as this notice is preserved.
282
283 #serial 3
284
285 # _AM_OUTPUT_DEPENDENCY_COMMANDS
286 # ------------------------------
287 AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
288 [for mf in $CONFIG_FILES; do
289 # Strip MF so we end up with the name of the file.
290 mf=`echo "$mf" | sed -e 's/:.*$//'`
291 # Check whether this is an Automake generated Makefile or not.
292 # We used to match only the files named `Makefile.in', but
293 # some people rename them; so instead we look at the file content.
294 # Grep'ing the first line is not enough: some people post-process
295 # each Makefile.in and add a new line on top of each file to say so.
296 # So let's grep whole file.
297 if grep '^#.*generated by automake' $mf > /dev/null 2>&1; then
298 dirpart=`AS_DIRNAME("$mf")`
299 else
300 continue
301 fi
302 # Extract the definition of DEPDIR, am__include, and am__quote
303 # from the Makefile without running `make'.
304 DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"`
305 test -z "$DEPDIR" && continue
306 am__include=`sed -n 's/^am__include = //p' < "$mf"`
307 test -z "am__include" && continue
308 am__quote=`sed -n 's/^am__quote = //p' < "$mf"`
309 # When using ansi2knr, U may be empty or an underscore; expand it
310 U=`sed -n 's/^U = //p' < "$mf"`
311 # Find all dependency output files, they are included files with
312 # $(DEPDIR) in their names. We invoke sed twice because it is the
313 # simplest approach to changing $(DEPDIR) to its actual value in the
314 # expansion.
315 for file in `sed -n "
316 s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \
317 sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do
318 # Make sure the directory exists.
319 test -f "$dirpart/$file" && continue
320 fdir=`AS_DIRNAME(["$file"])`
321 AS_MKDIR_P([$dirpart/$fdir])
322 # echo "creating $dirpart/$file"
323 echo '# dummy' > "$dirpart/$file"
324 done
325 done
326 ])# _AM_OUTPUT_DEPENDENCY_COMMANDS
327
328
329 # AM_OUTPUT_DEPENDENCY_COMMANDS
330 # -----------------------------
331 # This macro should only be invoked once -- use via AC_REQUIRE.
332 #
333 # This code is only required when automatic dependency tracking
334 # is enabled. FIXME. This creates each `.P' file that we will
335 # need in order to bootstrap the dependency handling code.
336 AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
337 [AC_CONFIG_COMMANDS([depfiles],
338 [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS],
339 [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"])
340 ])
341
342 # Do all the work for Automake. -*- Autoconf -*-
343
344 # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
345 # Free Software Foundation, Inc.
346 #
347 # This file is free software; the Free Software Foundation
348 # gives unlimited permission to copy and/or distribute it,
349 # with or without modifications, as long as this notice is preserved.
350
351 # serial 12
352
353 # This macro actually does too much. Some checks are only needed if
354 # your package does certain things. But this isn't really a big deal.
355
356 # AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
357 # AM_INIT_AUTOMAKE([OPTIONS])
358 # -----------------------------------------------
359 # The call with PACKAGE and VERSION arguments is the old style
360 # call (pre autoconf-2.50), which is being phased out. PACKAGE
361 # and VERSION should now be passed to AC_INIT and removed from
362 # the call to AM_INIT_AUTOMAKE.
363 # We support both call styles for the transition. After
364 # the next Automake release, Autoconf can make the AC_INIT
365 # arguments mandatory, and then we can depend on a new Autoconf
366 # release and drop the old call support.
367 AC_DEFUN([AM_INIT_AUTOMAKE],
368 [AC_PREREQ([2.58])dnl
369 dnl Autoconf wants to disallow AM_ names. We explicitly allow
370 dnl the ones we care about.
371 m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
372 AC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl
373 AC_REQUIRE([AC_PROG_INSTALL])dnl
374 # test to see if srcdir already configured
375 if test "`cd $srcdir && pwd`" != "`pwd`" &&
376 test -f $srcdir/config.status; then
377 AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
378 fi
379
380 # test whether we have cygpath
381 if test -z "$CYGPATH_W"; then
382 if (cygpath --version) >/dev/null 2>/dev/null; then
383 CYGPATH_W='cygpath -w'
384 else
385 CYGPATH_W=echo
386 fi
387 fi
388 AC_SUBST([CYGPATH_W])
389
390 # Define the identity of the package.
391 dnl Distinguish between old-style and new-style calls.
392 m4_ifval([$2],
393 [m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
394 AC_SUBST([PACKAGE], [$1])dnl
395 AC_SUBST([VERSION], [$2])],
396 [_AM_SET_OPTIONS([$1])dnl
397 AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl
398 AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl
399
400 _AM_IF_OPTION([no-define],,
401 [AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package])
402 AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])])dnl
403
404 # Some tools Automake needs.
405 AC_REQUIRE([AM_SANITY_CHECK])dnl
406 AC_REQUIRE([AC_ARG_PROGRAM])dnl
407 AM_MISSING_PROG(ACLOCAL, aclocal-${am__api_version})
408 AM_MISSING_PROG(AUTOCONF, autoconf)
409 AM_MISSING_PROG(AUTOMAKE, automake-${am__api_version})
410 AM_MISSING_PROG(AUTOHEADER, autoheader)
411 AM_MISSING_PROG(MAKEINFO, makeinfo)
412 AM_PROG_INSTALL_SH
413 AM_PROG_INSTALL_STRIP
414 AC_REQUIRE([AM_PROG_MKDIR_P])dnl
415 # We need awk for the "check" target. The system "awk" is bad on
416 # some platforms.
417 AC_REQUIRE([AC_PROG_AWK])dnl
418 AC_REQUIRE([AC_PROG_MAKE_SET])dnl
419 AC_REQUIRE([AM_SET_LEADING_DOT])dnl
420 _AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])],
421 [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])],
422 [_AM_PROG_TAR([v7])])])
423 _AM_IF_OPTION([no-dependencies],,
424 [AC_PROVIDE_IFELSE([AC_PROG_CC],
425 [_AM_DEPENDENCIES(CC)],
426 [define([AC_PROG_CC],
427 defn([AC_PROG_CC])[_AM_DEPENDENCIES(CC)])])dnl
428 AC_PROVIDE_IFELSE([AC_PROG_CXX],
429 [_AM_DEPENDENCIES(CXX)],
430 [define([AC_PROG_CXX],
431 defn([AC_PROG_CXX])[_AM_DEPENDENCIES(CXX)])])dnl
432 ])
433 ])
434
435
436 # When config.status generates a header, we must update the stamp-h file.
437 # This file resides in the same directory as the config header
438 # that is generated. The stamp files are numbered to have different names.
439
440 # Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the
441 # loop where config.status creates the headers, so we can generate
442 # our stamp files there.
443 AC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK],
444 [# Compute $1's index in $config_headers.
445 _am_stamp_count=1
446 for _am_header in $config_headers :; do
447 case $_am_header in
448 $1 | $1:* )
449 break ;;
450 * )
451 _am_stamp_count=`expr $_am_stamp_count + 1` ;;
452 esac
453 done
454 echo "timestamp for $1" >`AS_DIRNAME([$1])`/stamp-h[]$_am_stamp_count])
455
456 # Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc.
457 #
458 # This file is free software; the Free Software Foundation
459 # gives unlimited permission to copy and/or distribute it,
460 # with or without modifications, as long as this notice is preserved.
461
462 # AM_PROG_INSTALL_SH
463 # ------------------
464 # Define $install_sh.
465 AC_DEFUN([AM_PROG_INSTALL_SH],
466 [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
467 install_sh=${install_sh-"$am_aux_dir/install-sh"}
468 AC_SUBST(install_sh)])
469
470 # Copyright (C) 2003, 2005 Free Software Foundation, Inc.
471 #
472 # This file is free software; the Free Software Foundation
473 # gives unlimited permission to copy and/or distribute it,
474 # with or without modifications, as long as this notice is preserved.
475
476 # serial 2
477
478 # Check whether the underlying file-system supports filenames
479 # with a leading dot. For instance MS-DOS doesn't.
480 AC_DEFUN([AM_SET_LEADING_DOT],
481 [rm -rf .tst 2>/dev/null
482 mkdir .tst 2>/dev/null
483 if test -d .tst; then
484 am__leading_dot=.
485 else
486 am__leading_dot=_
487 fi
488 rmdir .tst 2>/dev/null
489 AC_SUBST([am__leading_dot])])
490
491 # Check to see how 'make' treats includes. -*- Autoconf -*-
492
493 # Copyright (C) 2001, 2002, 2003, 2005 Free Software Foundation, Inc.
494 #
495 # This file is free software; the Free Software Foundation
496 # gives unlimited permission to copy and/or distribute it,
497 # with or without modifications, as long as this notice is preserved.
498
499 # serial 3
500
501 # AM_MAKE_INCLUDE()
502 # -----------------
503 # Check to see how make treats includes.
504 AC_DEFUN([AM_MAKE_INCLUDE],
505 [am_make=${MAKE-make}
506 cat > confinc << 'END'
507 am__doit:
508 @echo done
509 .PHONY: am__doit
510 END
511 # If we don't find an include directive, just comment out the code.
512 AC_MSG_CHECKING([for style of include used by $am_make])
513 am__include="#"
514 am__quote=
515 _am_result=none
516 # First try GNU make style include.
517 echo "include confinc" > confmf
518 # We grep out `Entering directory' and `Leaving directory'
519 # messages which can occur if `w' ends up in MAKEFLAGS.
520 # In particular we don't look at `^make:' because GNU make might
521 # be invoked under some other name (usually "gmake"), in which
522 # case it prints its new name instead of `make'.
523 if test "`$am_make -s -f confmf 2> /dev/null | grep -v 'ing directory'`" = "done"; then
524 am__include=include
525 am__quote=
526 _am_result=GNU
527 fi
528 # Now try BSD make style include.
529 if test "$am__include" = "#"; then
530 echo '.include "confinc"' > confmf
531 if test "`$am_make -s -f confmf 2> /dev/null`" = "done"; then
532 am__include=.include
533 am__quote="\""
534 _am_result=BSD
535 fi
536 fi
537 AC_SUBST([am__include])
538 AC_SUBST([am__quote])
539 AC_MSG_RESULT([$_am_result])
540 rm -f confinc confmf
541 ])
542
543 # Fake the existence of programs that GNU maintainers use. -*- Autoconf -*-
544
545 # Copyright (C) 1997, 1999, 2000, 2001, 2003, 2005
546 # Free Software Foundation, Inc.
547 #
548 # This file is free software; the Free Software Foundation
549 # gives unlimited permission to copy and/or distribute it,
550 # with or without modifications, as long as this notice is preserved.
551
552 # serial 4
553
554 # AM_MISSING_PROG(NAME, PROGRAM)
555 # ------------------------------
556 AC_DEFUN([AM_MISSING_PROG],
557 [AC_REQUIRE([AM_MISSING_HAS_RUN])
558 $1=${$1-"${am_missing_run}$2"}
559 AC_SUBST($1)])
560
561
562 # AM_MISSING_HAS_RUN
563 # ------------------
564 # Define MISSING if not defined so far and test if it supports --run.
565 # If it does, set am_missing_run to use it, otherwise, to nothing.
566 AC_DEFUN([AM_MISSING_HAS_RUN],
567 [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
568 test x"${MISSING+set}" = xset || MISSING="\${SHELL} $am_aux_dir/missing"
569 # Use eval to expand $SHELL
570 if eval "$MISSING --run true"; then
571 am_missing_run="$MISSING --run "
572 else
573 am_missing_run=
574 AC_MSG_WARN([`missing' script is too old or missing])
575 fi
576 ])
577
578 # Copyright (C) 2003, 2004, 2005 Free Software Foundation, Inc.
579 #
580 # This file is free software; the Free Software Foundation
581 # gives unlimited permission to copy and/or distribute it,
582 # with or without modifications, as long as this notice is preserved.
583
584 # AM_PROG_MKDIR_P
585 # ---------------
586 # Check whether `mkdir -p' is supported, fallback to mkinstalldirs otherwise.
587 #
588 # Automake 1.8 used `mkdir -m 0755 -p --' to ensure that directories
589 # created by `make install' are always world readable, even if the
590 # installer happens to have an overly restrictive umask (e.g. 077).
591 # This was a mistake. There are at least two reasons why we must not
592 # use `-m 0755':
593 # - it causes special bits like SGID to be ignored,
594 # - it may be too restrictive (some setups expect 775 directories).
595 #
596 # Do not use -m 0755 and let people choose whatever they expect by
597 # setting umask.
598 #
599 # We cannot accept any implementation of `mkdir' that recognizes `-p'.
600 # Some implementations (such as Solaris 8's) are not thread-safe: if a
601 # parallel make tries to run `mkdir -p a/b' and `mkdir -p a/c'
602 # concurrently, both version can detect that a/ is missing, but only
603 # one can create it and the other will error out. Consequently we
604 # restrict ourselves to GNU make (using the --version option ensures
605 # this.)
606 AC_DEFUN([AM_PROG_MKDIR_P],
607 [if mkdir -p --version . >/dev/null 2>&1 && test ! -d ./--version; then
608 # We used to keeping the `.' as first argument, in order to
609 # allow $(mkdir_p) to be used without argument. As in
610 # $(mkdir_p) $(somedir)
611 # where $(somedir) is conditionally defined. However this is wrong
612 # for two reasons:
613 # 1. if the package is installed by a user who cannot write `.'
614 # make install will fail,
615 # 2. the above comment should most certainly read
616 # $(mkdir_p) $(DESTDIR)$(somedir)
617 # so it does not work when $(somedir) is undefined and
618 # $(DESTDIR) is not.
619 # To support the latter case, we have to write
620 # test -z "$(somedir)" || $(mkdir_p) $(DESTDIR)$(somedir),
621 # so the `.' trick is pointless.
622 mkdir_p='mkdir -p --'
623 else
624 # On NextStep and OpenStep, the `mkdir' command does not
625 # recognize any option. It will interpret all options as
626 # directories to create, and then abort because `.' already
627 # exists.
628 for d in ./-p ./--version;
629 do
630 test -d $d && rmdir $d
631 done
632 # $(mkinstalldirs) is defined by Automake if mkinstalldirs exists.
633 if test -f "$ac_aux_dir/mkinstalldirs"; then
634 mkdir_p='$(mkinstalldirs)'
635 else
636 mkdir_p='$(install_sh) -d'
637 fi
638 fi
639 AC_SUBST([mkdir_p])])
640
641 # Helper functions for option handling. -*- Autoconf -*-
642
643 # Copyright (C) 2001, 2002, 2003, 2005 Free Software Foundation, Inc.
644 #
645 # This file is free software; the Free Software Foundation
646 # gives unlimited permission to copy and/or distribute it,
647 # with or without modifications, as long as this notice is preserved.
648
649 # serial 3
650
651 # _AM_MANGLE_OPTION(NAME)
652 # -----------------------
653 AC_DEFUN([_AM_MANGLE_OPTION],
654 [[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])])
655
656 # _AM_SET_OPTION(NAME)
657 # ------------------------------
658 # Set option NAME. Presently that only means defining a flag for this option.
659 AC_DEFUN([_AM_SET_OPTION],
660 [m4_define(_AM_MANGLE_OPTION([$1]), 1)])
661
662 # _AM_SET_OPTIONS(OPTIONS)
663 # ----------------------------------
664 # OPTIONS is a space-separated list of Automake options.
665 AC_DEFUN([_AM_SET_OPTIONS],
666 [AC_FOREACH([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])
667
668 # _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET])
669 # -------------------------------------------
670 # Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
671 AC_DEFUN([_AM_IF_OPTION],
672 [m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
673
674 # Check to make sure that the build environment is sane. -*- Autoconf -*-
675
676 # Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005
677 # Free Software Foundation, Inc.
678 #
679 # This file is free software; the Free Software Foundation
680 # gives unlimited permission to copy and/or distribute it,
681 # with or without modifications, as long as this notice is preserved.
682
683 # serial 4
684
685 # AM_SANITY_CHECK
686 # ---------------
687 AC_DEFUN([AM_SANITY_CHECK],
688 [AC_MSG_CHECKING([whether build environment is sane])
689 # Just in case
690 sleep 1
691 echo timestamp > conftest.file
692 # Do `set' in a subshell so we don't clobber the current shell's
693 # arguments. Must try -L first in case configure is actually a
694 # symlink; some systems play weird games with the mod time of symlinks
695 # (eg FreeBSD returns the mod time of the symlink's containing
696 # directory).
697 if (
698 set X `ls -Lt $srcdir/configure conftest.file 2> /dev/null`
699 if test "$[*]" = "X"; then
700 # -L didn't work.
701 set X `ls -t $srcdir/configure conftest.file`
702 fi
703 rm -f conftest.file
704 if test "$[*]" != "X $srcdir/configure conftest.file" \
705 && test "$[*]" != "X conftest.file $srcdir/configure"; then
706
707 # If neither matched, then we have a broken ls. This can happen
708 # if, for instance, CONFIG_SHELL is bash and it inherits a
709 # broken ls alias from the environment. This has actually
710 # happened. Such a system could not be considered "sane".
711 AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken
712 alias in your environment])
713 fi
714
715 test "$[2]" = conftest.file
716 )
717 then
718 # Ok.
719 :
720 else
721 AC_MSG_ERROR([newly created file is older than distributed files!
722 Check your system clock])
723 fi
724 AC_MSG_RESULT(yes)])
725
726 # Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc.
727 #
728 # This file is free software; the Free Software Foundation
729 # gives unlimited permission to copy and/or distribute it,
730 # with or without modifications, as long as this notice is preserved.
731
732 # AM_PROG_INSTALL_STRIP
733 # ---------------------
734 # One issue with vendor `install' (even GNU) is that you can't
735 # specify the program used to strip binaries. This is especially
736 # annoying in cross-compiling environments, where the build's strip
737 # is unlikely to handle the host's binaries.
738 # Fortunately install-sh will honor a STRIPPROG variable, so we
739 # always use install-sh in `make install-strip', and initialize
740 # STRIPPROG with the value of the STRIP variable (set by the user).
741 AC_DEFUN([AM_PROG_INSTALL_STRIP],
742 [AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
743 # Installed binaries are usually stripped using `strip' when the user
744 # run `make install-strip'. However `strip' might not be the right
745 # tool to use in cross-compilation environments, therefore Automake
746 # will honor the `STRIP' environment variable to overrule this program.
747 dnl Don't test for $cross_compiling = yes, because it might be `maybe'.
748 if test "$cross_compiling" != no; then
749 AC_CHECK_TOOL([STRIP], [strip], :)
750 fi
751 INSTALL_STRIP_PROGRAM="\${SHELL} \$(install_sh) -c -s"
752 AC_SUBST([INSTALL_STRIP_PROGRAM])])
753
754 # Check how to create a tarball. -*- Autoconf -*-
755
756 # Copyright (C) 2004, 2005 Free Software Foundation, Inc.
757 #
758 # This file is free software; the Free Software Foundation
759 # gives unlimited permission to copy and/or distribute it,
760 # with or without modifications, as long as this notice is preserved.
761
762 # serial 2
763
764 # _AM_PROG_TAR(FORMAT)
765 # --------------------
766 # Check how to create a tarball in format FORMAT.
767 # FORMAT should be one of `v7', `ustar', or `pax'.
768 #
769 # Substitute a variable $(am__tar) that is a command
770 # writing to stdout a FORMAT-tarball containing the directory
771 # $tardir.
772 # tardir=directory && $(am__tar) > result.tar
773 #
774 # Substitute a variable $(am__untar) that extract such
775 # a tarball read from stdin.
776 # $(am__untar) < result.tar
777 AC_DEFUN([_AM_PROG_TAR],
778 [# Always define AMTAR for backward compatibility.
779 AM_MISSING_PROG([AMTAR], [tar])
780 m4_if([$1], [v7],
781 [am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -'],
782 [m4_case([$1], [ustar],, [pax],,
783 [m4_fatal([Unknown tar format])])
784 AC_MSG_CHECKING([how to create a $1 tar archive])
785 # Loop over all known methods to create a tar archive until one works.
786 _am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none'
787 _am_tools=${am_cv_prog_tar_$1-$_am_tools}
788 # Do not fold the above two line into one, because Tru64 sh and
789 # Solaris sh will not grok spaces in the rhs of `-'.
790 for _am_tool in $_am_tools
791 do
792 case $_am_tool in
793 gnutar)
794 for _am_tar in tar gnutar gtar;
795 do
796 AM_RUN_LOG([$_am_tar --version]) && break
797 done
798 am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"'
799 am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"'
800 am__untar="$_am_tar -xf -"
801 ;;
802 plaintar)
803 # Must skip GNU tar: if it does not support --format= it doesn't create
804 # ustar tarball either.
805 (tar --version) >/dev/null 2>&1 && continue
806 am__tar='tar chf - "$$tardir"'
807 am__tar_='tar chf - "$tardir"'
808 am__untar='tar xf -'
809 ;;
810 pax)
811 am__tar='pax -L -x $1 -w "$$tardir"'
812 am__tar_='pax -L -x $1 -w "$tardir"'
813 am__untar='pax -r'
814 ;;
815 cpio)
816 am__tar='find "$$tardir" -print | cpio -o -H $1 -L'
817 am__tar_='find "$tardir" -print | cpio -o -H $1 -L'
818 am__untar='cpio -i -H $1 -d'
819 ;;
820 none)
821 am__tar=false
822 am__tar_=false
823 am__untar=false
824 ;;
825 esac
826
827 # If the value was cached, stop now. We just wanted to have am__tar
828 # and am__untar set.
829 test -n "${am_cv_prog_tar_$1}" && break
830
831 # tar/untar a dummy directory, and stop if the command works
832 rm -rf conftest.dir
833 mkdir conftest.dir
834 echo GrepMe > conftest.dir/file
835 AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar])
836 rm -rf conftest.dir
837 if test -s conftest.tar; then
838 AM_RUN_LOG([$am__untar <conftest.tar])
839 grep GrepMe conftest.dir/file >/dev/null 2>&1 && break
840 fi
841 done
842 rm -rf conftest.dir
843
844 AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool])
845 AC_MSG_RESULT([$am_cv_prog_tar_$1])])
846 AC_SUBST([am__tar])
847 AC_SUBST([am__untar])
848 ]) # _AM_PROG_TAR
849
0 /*
1 * Copyright (c) 2002, 2003, 2004, Scott Nicol <esniper@users.sf.net>
2 * All rights reserved
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are met:
6 *
7 * - Redistributions of source code must retain the above copyright notice,
8 * this list of conditions and the following disclaimer.
9 * - Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 *
13 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
14 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
15 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
16 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
17 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
18 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
19 * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
20 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
21 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
22 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
23 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24 */
25
26 #include "auction.h"
27 #include "buffer.h"
28 #include "http.h"
29 #include "html.h"
30 #include "history.h"
31 #include <ctype.h>
32 #include <limits.h>
33 #include <stdio.h>
34 #include <stdlib.h>
35 #include <string.h>
36 #include <sys/types.h>
37 #include <time.h>
38 #if defined(WIN32)
39 # define strcasecmp(s1, s2) stricmp((s1), (s2))
40 # define sleep(t) _sleep((t) * 1000)
41 # define strncasecmp(s1, s2, len) strnicmp((s1), (s2), (len))
42 #else
43 # include <unistd.h>
44 #endif
45
46 #define newRemain(aip) (aip->endTime - time(NULL) - aip->latency - options.bidtime)
47
48 static time_t loginTime = 0; /* Time of last login */
49 static time_t defaultLoginInterval = 12 * 60 * 60; /* ebay login interval */
50
51 static int acceptBid(const char *pagename, auctionInfo *aip);
52 static int bid(auctionInfo *aip);
53 static int ebayLogin(auctionInfo *aip, int interval);
54 static char *getIdInternal(char *s, size_t len);
55 static int getInfoTiming(auctionInfo *aip, time_t *timeToFirstByte);
56 static int getQuantity(int want, int available);
57 static int makeBidError(const char *pagename, auctionInfo *aip);
58 static int match(memBuf_t *mp, const char *str);
59 static int parseBid(memBuf_t *mp, auctionInfo *aip);
60 static int preBid(auctionInfo *aip);
61 static int printMyItemsRow(char **row, int printNewline);
62 static int watch(auctionInfo *aip);
63
64 /*
65 * attempt to match some input, neglecting case, ignoring \r and \n.
66 * returns 0 on success, -1 on failure
67 */
68 static int
69 match(memBuf_t *mp, const char *str)
70 {
71 const char *cursor;
72 int c;
73
74 log(("\n\nmatch(\"%s\")\n\n", str));
75
76 cursor = str;
77 while ((c = memGetc(mp)) != EOF) {
78 if (options.debug)
79 logChar(c);
80 if (tolower(c) == (int)*cursor) {
81 if (*++cursor == '\0') {
82 if (options.debug)
83 logChar(EOF);
84 return 0;
85 }
86 } else if (c != '\n' && c != '\r')
87 cursor = str;
88 }
89 if (options.debug)
90 logChar(EOF);
91 return -1;
92 }
93
94 static const char PAGEID[] = "Page id: ";
95 static const char SRCID[] = "srcId: ";
96
97 /*
98 * Get page info, including pagename variable, page id and srcid comments.
99 */
100 pageInfo_t *
101 getPageInfo(memBuf_t *mp)
102 {
103 const char *line;
104 pageInfo_t p = {NULL, NULL, NULL}, *pp;
105 int needPageName = 1;
106 int needPageId = 1;
107 int needSrcId = 1;
108 int needMore = 3;
109
110 log(("getPageInfo():\n"));
111 while (needMore && (line = getTag(mp))) {
112 char *tmp;
113
114 if (strncmp(line, "!--", 3))
115 continue;
116 if (needPageName && (tmp = strstr(line, PAGENAME))) {
117 if ((tmp = getPageNameInternal(tmp))) {
118 --needMore;
119 --needPageName;
120 p.pageName = myStrdup(tmp);
121 }
122 } else if (needPageId && (tmp = strstr(line, PAGEID))) {
123 if ((tmp = getIdInternal(tmp, sizeof(PAGEID)))) {
124 --needMore;
125 --needPageId;
126 p.pageId = myStrdup(tmp);
127 }
128 } else if (needSrcId && (tmp = strstr(line, SRCID))) {
129 if ((tmp = getIdInternal(tmp, sizeof(SRCID)))) {
130 --needMore;
131 --needSrcId;
132 p.srcId = myStrdup(tmp);
133 }
134 }
135 }
136 log(("getPageInfo(): pageName = %s, pageId = %s, srcId = %s\n", nullStr(p.pageName), nullStr(p.pageId), nullStr(p.srcId)));
137 if (needMore == 3)
138 return NULL;
139 pp = (pageInfo_t *)myMalloc(sizeof(pageInfo_t));
140 pp->pageName = p.pageName;
141 pp->pageId = p.pageId;
142 pp->srcId = p.srcId;
143 return pp;
144 }
145
146 static char *
147 getIdInternal(char *s, size_t len)
148 {
149 char *id = s + len - 1;
150 char *dash = strchr(id, '-');
151
152 if (!*dash) {
153 log(("getIdInternal(): Cannot find trailing dash: %s\n", id));
154 return NULL;
155 }
156 *dash = '\0';
157 log(("getIdInternal(): id = %s\n", id));
158 return id;
159 }
160
161 /*
162 * Free a pageInfo_t and it's internal members.
163 */
164 void
165 freePageInfo(pageInfo_t *pp)
166 {
167 if (pp) {
168 free(pp->pageName);
169 free(pp->pageId);
170 free(pp->srcId);
171 free(pp);
172 }
173 }
174
175 /*
176 * Calculate quantity to bid on. If it is a dutch auction, never
177 * bid on more than 1 less item than what is available.
178 */
179 static int
180 getQuantity(int want, int available)
181 {
182 if (want == 1 || available == 1)
183 return 1;
184 if (available > want)
185 return want;
186 return available - 1;
187 }
188
189 static const char GETINFO[] = "http://offer.ebay.com/ws/eBayISAPI.dll?ViewBids&item=";
190
191 /*
192 * getInfo(): Get info on auction from bid history page.
193 *
194 * returns:
195 * 0 OK
196 * 1 error (badly formatted page, etc) set auctionError
197 */
198 int
199 getInfo(auctionInfo *aip)
200 {
201 return getInfoTiming(aip, NULL);
202 }
203
204 /*
205 * getInfoTiming(): Get info on auction from bid history page.
206 *
207 * returns:
208 * 0 OK
209 * 1 error (badly formatted page, etc) set auctionError
210 */
211 static int
212 getInfoTiming(auctionInfo *aip, time_t *timeToFirstByte)
213 {
214 int i, ret;
215 time_t start;
216
217 log(("\n\n*** getInfo auction %s price %s user %s\n", aip->auction, aip->bidPriceStr, options.username));
218 if (ebayLogin(aip, 0))
219 return 1;
220
221 for (i = 0; i < 3; ++i) {
222 memBuf_t *mp = NULL;
223
224 if (!aip->query)
225 aip->query = myStrdup2(GETINFO, aip->auction);
226 start = time(NULL);
227 if (!(mp = httpGet(aip->query, NULL))) {
228 freeMembuf(mp);
229 return httpError(aip);
230 }
231 ret = parseBidHistory(mp, aip, start, timeToFirstByte);
232 freeMembuf(mp);
233 if (i == 0 && ret == 1 && aip->auctionError == ae_mustsignin) {
234 if (ebayLogin(aip, -1))
235 break;
236 } else if (aip->auctionError == ae_notime)
237 /* Blank time remaining -- give it another chance */
238 sleep(2);
239 else
240 break;
241 }
242 return ret;
243 }
244
245 /*
246 * Note: quant=1 is just to dupe eBay into allowing the pre-bid to get
247 * through. Actual quantity will be sent with bid.
248 */
249 static const char PRE_BID_URL[] = "http://offer.ebay.com/ws/eBayISAPI.dll?MfcISAPICommand=MakeBid&fb=2&co_partner_id=&item=%s&maxbid=%s&quant=%s";
250
251 /*
252 * Get bid key
253 *
254 * returns 0 on success, 1 on failure.
255 */
256 static int
257 preBid(auctionInfo *aip)
258 {
259 memBuf_t *mp = NULL;
260 int quantity = getQuantity(options.quantity, aip->quantity);
261 char quantityStr[12]; /* must hold an int */
262 size_t urlLen;
263 char *url;
264 int ret = 0;
265 int found = 0;
266
267 if (ebayLogin(aip, 0))
268 return 1;
269 sprintf(quantityStr, "%d", quantity);
270 urlLen = sizeof(PRE_BID_URL) + strlen(aip->auction) + strlen(aip->bidPriceStr) + strlen(quantityStr) - 6;
271 url = (char *)myMalloc(urlLen);
272 sprintf(url, PRE_BID_URL, aip->auction, aip->bidPriceStr, quantityStr);
273 log(("\n\n*** preBid(): url is %s\n", url));
274 mp = httpGet(url, NULL);
275 free(url);
276 if (!mp)
277 return httpError(aip);
278
279 /* pagename should be PageReviewBidBottomButton, but don't check it */
280 while (found < 7 && !match(mp, "<input type=\"hidden\" name=\"")) {
281 if (!strncmp(mp->readptr, "key\"", 4)) {
282 char *cp, *tmpkey;
283
284 found |= 0x01;
285 match(mp, "value=\"");
286 tmpkey = getUntil(mp, '\"');
287 log((" reported key is: %s\n", tmpkey));
288
289 /* translate key for URL */
290 free(aip->bidkey);
291 aip->bidkey = (char *)myMalloc(strlen(tmpkey)*3 + 1);
292 for (cp = aip->bidkey; *tmpkey; ++tmpkey) {
293 if (*tmpkey == '$') {
294 *cp++ = '%';
295 *cp++ = '2';
296 *cp++ = '4';
297 } else
298 *cp++ = *tmpkey;
299 }
300 *cp = '\0';
301
302 log(("\n\ntranslated key is: %s\n\n", aip->bidkey));
303 } else if (!strncmp(mp->readptr, "uiid\"", 5)) {
304 found |= 0x02;
305 match(mp, "value=\"");
306 free(aip->biduiid);
307 aip->biduiid = myStrdup(getUntil(mp, '\"'));
308 log(("preBid(): biduiid is \"%s\"", aip->biduiid));
309 } else if (!strncmp(mp->readptr, "pass\"", 5)) {
310 found |= 0x04;
311 match(mp, "value=\"");
312 free(aip->bidpass);
313 aip->bidpass = myStrdup(getUntil(mp, '\"'));
314 log(("preBid(): bidpass is \"%s\"", aip->bidpass));
315 }
316 }
317 if (found < 7) {
318 char *pagename;
319
320 mp->readptr = mp->memory;
321 pagename = getPageName(mp);
322 if ((ret = makeBidError(pagename, aip)) < 0) {
323 ret = auctionError(aip, ae_bidkey, NULL);
324 bugReport("preBid", __FILE__, __LINE__, aip, mp, "cannot find bid key, uiid or password, found = %d", found);
325 }
326 }
327 freeMembuf(mp);
328 return ret;
329 }
330
331 static const char LOGIN_1_URL[] = "https://signin.ebay.com/ws/eBayISAPI.dll?SignIn";
332 static const char LOGIN_2_URL[] = "https://signin.ebay.com/ws/eBayISAPI.dll?SignInWelcome&userid=%s&pass=%s&keepMeSignInOption=1";
333
334 /*
335 * Ebay login. Make sure loging has been done with the given interval.
336 *
337 * Returns 0 on success, 1 on failure.
338 */
339 static int
340 ebayLogin(auctionInfo *aip, int interval)
341 {
342 memBuf_t *mp = NULL;
343 size_t urlLen;
344 char *url, *logUrl;
345 pageInfo_t *pp;
346 int ret = 0;
347 char *password;
348
349 /* negative value forces login */
350 if (interval >= 0) {
351 if (interval == 0)
352 interval = defaultLoginInterval; /* default: 12 hours */
353 if ((time(NULL) - loginTime) <= interval)
354 return 0;
355 }
356
357 cleanupCurlStuff();
358 if (initCurlStuff())
359 return auctionError(aip, ae_unknown, NULL);
360
361 if (!(mp = httpGet(LOGIN_1_URL, NULL))) {
362 freeMembuf(mp);
363 return httpError(aip);
364 }
365
366 freeMembuf(mp);
367 mp = NULL;
368
369 urlLen = sizeof(LOGIN_2_URL) + strlen(options.usernameEscape);
370 password = getPassword();
371 url = malloc(urlLen + strlen(password));
372 logUrl = malloc(urlLen + 5);
373
374 sprintf(url, LOGIN_2_URL, options.usernameEscape, password);
375 freePassword(password);
376 sprintf(logUrl, LOGIN_2_URL, options.usernameEscape, "*****");
377
378 mp = httpGet(url, logUrl);
379 free(url);
380 free(logUrl);
381 if (!mp)
382 return httpError(aip);
383
384 if ((pp = getPageInfo(mp))) {
385 log(("ebayLogin(): pagename = \"%s\", pageid = \"%s\", srcid = \"%s\"", nullStr(pp->pageName), nullStr(pp->pageId), nullStr(pp->srcId)));
386 /*
387 * Pagename is usually MyeBaySummary, but it seems as though
388 * it can be any MyeBay page, and eBay is not consistent with
389 * naming of MyeBay pages (MyeBay, MyEbay, myebay, ...) so
390 * esniper must use strncasecmp().
391 */
392 if ((pp->srcId && !strcmp(pp->srcId, "SignInAlertSupressor"))||
393 (pp->pageName && !strncasecmp(pp->pageName, "MyeBay", 6)))
394 loginTime = time(NULL);
395 else if (pp->pageName && !strcmp(pp->pageName, "PageSignIn"))
396 ret = auctionError(aip, ae_login, NULL);
397 else {
398 ret = auctionError(aip, ae_login, NULL);
399 bugReport("ebayLogin", __FILE__, __LINE__, aip, mp, "unknown pageinfo");
400 }
401 } else {
402 log(("ebayLogin(): pageinfo is NULL\n"));
403 ret = auctionError(aip, ae_login, NULL);
404 bugReport("ebayLogin", __FILE__, __LINE__, aip, mp, "pageinfo is NULL");
405 }
406 freeMembuf(mp);
407 freePageInfo(pp);
408 return ret;
409 }
410
411 /*
412 * acceptBid: handle all known AcceptBid pages.
413 *
414 * Returns -1 if page not recognized, 0 if bid accepted, 1 if bid not accepted.
415 */
416 static int
417 acceptBid(const char *pagename, auctionInfo *aip)
418 {
419 static const char ACCEPTBID[] = "AcceptBid_";
420 static const char HIGHBID[] = "HighBidder";
421 static const char OUTBID[] = "Outbid";
422 static const char RESERVENOTMET[] = "ReserveNotMet";
423
424 if (!pagename ||
425 strncmp(pagename, ACCEPTBID, sizeof(ACCEPTBID) - 1))
426 return -1;
427 pagename += sizeof(ACCEPTBID) - 1;
428 /*
429 * valid pagenames include AcceptBid_HighBidder,
430 * AcceptBid_HighBidder_rebid, possibly others.
431 */
432 if (!strncmp(pagename, HIGHBID, sizeof(HIGHBID) - 1))
433 return aip->bidResult = 0;
434 /*
435 * valid pagenames include AcceptBid_Outbid, AcceptBid_Outbid_rebid,
436 * possibly others.
437 */
438 if (!strncmp(pagename, OUTBID, sizeof(OUTBID) - 1))
439 return aip->bidResult = auctionError(aip, ae_outbid, NULL);
440 /*
441 * valid pagenames include AcceptBid_ReserveNotMet,
442 * AcceptBid_ReserveNotMet_rebid, possibly others.
443 */
444 if (!strncmp(pagename, RESERVENOTMET, sizeof(RESERVENOTMET) - 1))
445 return aip->bidResult = auctionError(aip, ae_reservenotmet, NULL);
446 /* unknown AcceptBid page */
447 return -1;
448 }
449
450 /*
451 * makeBidError: handle all known MakeBidError pages.
452 *
453 * Returns -1 if page not recognized, 0 if bid accepted, 1 if bid not accepted.
454 */
455 static int
456 makeBidError(const char *pagename, auctionInfo *aip)
457 {
458 static const char MAKEBIDERROR[] = "MakeBidError";
459
460 if (!pagename ||
461 strncmp(pagename, MAKEBIDERROR, sizeof(MAKEBIDERROR) - 1))
462 return -1;
463 pagename += sizeof(MAKEBIDERROR) - 1;
464 if (!*pagename ||
465 !strcmp(pagename, "AuctionEnded"))
466 return aip->bidResult = auctionError(aip, ae_ended, NULL);
467 if (!strcmp(pagename, "Password"))
468 return aip->bidResult = auctionError(aip, ae_badpass, NULL);
469 if (!strcmp(pagename, "MinBid"))
470 return aip->bidResult = auctionError(aip, ae_bidprice, NULL);
471 if (!strcmp(pagename, "BuyerBlockPref"))
472 return aip->bidResult = auctionError(aip, ae_buyerblockpref, NULL);
473 if (!strcmp(pagename, "BuyerBlockPrefDoesNotShipToLocation"))
474 return aip->bidResult = auctionError(aip, ae_buyerblockprefdoesnotshiptolocation, NULL);
475 if (!strcmp(pagename, "BuyerBlockPrefNoLinkedPaypalAccount"))
476 return aip->bidResult = auctionError(aip, ae_buyerblockprefnolinkedpaypalaccount, NULL);
477 if (!strcmp(pagename, "HighBidder"))
478 return aip->bidResult = auctionError(aip, ae_highbidder, NULL);
479 if (!strcmp(pagename, "CannotBidOnItem"))
480 return aip->bidResult = auctionError(aip, ae_cannotbid, NULL);
481 if (!strcmp(pagename, "DutchSameBidQuantity"))
482 return aip->bidResult = auctionError(aip, ae_dutchsamebidquantity, NULL);
483 /* unknown MakeBidError page */
484 return -1;
485 }
486
487 /*
488 * Parse bid result.
489 *
490 * Returns:
491 * 0: OK
492 * 1: error
493 */
494 static int
495 parseBid(memBuf_t *mp, auctionInfo *aip)
496 {
497 /*
498 * The following sometimes have more characters after them, for
499 * example AcceptBid_HighBidder_rebid (you were already the high
500 * bidder and placed another bid).
501 */
502 char *pagename = getPageName(mp);
503 int ret;
504
505 aip->bidResult = -1;
506 log(("parseBid(): pagename = %s\n", pagename));
507 if ((ret = acceptBid(pagename, aip)) >= 0 ||
508 (ret = makeBidError(pagename, aip)) >= 0)
509 return ret;
510 bugReport("parseBid", __FILE__, __LINE__, aip, mp, "unknown pagename");
511 printLog(stdout, "Cannot determine result of bid\n");
512 return 0; /* prevent another bid */
513 } /* parseBid() */
514
515 static const char BID_URL[] = "http://offer.ebay.com/ws/eBayISAPI.dll?MfcISAPICommand=MakeBid&BIN_button=Confirm%%20Bid&item=%s&key=%s&maxbid=%s&quant=%s&user=%s&pass=%s&uiid=%s&javascriptenabled=0&mode=1";
516
517 /*
518 * Place bid.
519 *
520 * Returns:
521 * 0: OK
522 * 1: error
523 */
524 static int
525 bid(auctionInfo *aip)
526 {
527 memBuf_t *mp = NULL;
528 size_t urlLen;
529 char *url, *logUrl, *tmpUsername, *tmpPassword, *tmpUiid;
530 int ret;
531 int quantity = getQuantity(options.quantity, aip->quantity);
532 char quantityStr[12]; /* must hold an int */
533
534 if (!aip->bidkey || !aip->bidpass || !aip->biduiid)
535 return auctionError(aip, ae_bidkey, NULL);
536
537 if (ebayLogin(aip, 0))
538 return 1;
539 sprintf(quantityStr, "%d", quantity);
540
541 /* create url */
542 urlLen = sizeof(BID_URL) + strlen(aip->auction) + strlen(aip->bidkey) + strlen(aip->bidPriceStr) + strlen(quantityStr) + strlen(options.usernameEscape) + strlen(aip->bidpass) + strlen(aip->biduiid) - 12;
543 url = (char *)myMalloc(urlLen);
544 sprintf(url, BID_URL, aip->auction, aip->bidkey, aip->bidPriceStr, quantityStr, options.usernameEscape, aip->bidpass, aip->biduiid);
545
546 logUrl = (char *)myMalloc(urlLen);
547 tmpUsername = stars(strlen(options.usernameEscape));
548 tmpPassword = stars(strlen(aip->bidpass));
549 tmpUiid = stars(strlen(aip->biduiid));
550 sprintf(logUrl, BID_URL, aip->auction, aip->bidkey, aip->bidPriceStr, quantityStr, tmpUsername, tmpPassword, tmpUiid);
551 free(tmpUsername);
552 free(tmpPassword);
553 free(tmpUiid);
554
555 if (!options.bid) {
556 printLog(stdout, "Bidding disabled\n");
557 log(("\n\nbid(): query url:\n%s\n", logUrl));
558 ret = aip->bidResult = 0;
559 } else if (!(mp = httpGet(url, logUrl))) {
560 ret = httpError(aip);
561 } else {
562 ret = parseBid(mp, aip);
563 }
564 free(url);
565 free(logUrl);
566 freeMembuf(mp);
567 return ret;
568 } /* bid() */
569
570 /*
571 * watch(): watch auction until it is time to bid
572 *
573 * returns:
574 * 0 OK
575 * 1 Error
576 */
577 static int
578 watch(auctionInfo *aip)
579 {
580 int errorCount = 0;
581 long remain = LONG_MIN;
582 unsigned int sleepTime = 0;
583
584 log(("*** WATCHING auction %s price-each %s quantity %d bidtime %ld\n", aip->auction, aip->bidPriceStr, options.quantity, options.bidtime));
585
586 for (;;) {
587 time_t tmpLatency;
588 time_t start = time(NULL);
589 time_t timeToFirstByte = 0;
590 int ret = getInfoTiming(aip, &timeToFirstByte);
591 time_t end = time(NULL);
592
593 if (timeToFirstByte == 0)
594 timeToFirstByte = end;
595 tmpLatency = (timeToFirstByte - start);
596 if ((tmpLatency >= 0) && (tmpLatency < 600))
597 aip->latency = tmpLatency;
598 printLog(stdout, "Latency: %d seconds\n", aip->latency);
599
600 if (ret) {
601 printAuctionError(aip, stderr);
602
603 /*
604 * Fatal error? We allow up to 50 errors, then quit.
605 * eBay "unavailable" doesn't count towards the total.
606 */
607 if (aip->auctionError == ae_unavailable) {
608 if (remain >= 0)
609 remain = newRemain(aip);
610 if (remain == LONG_MIN || remain > 86400) {
611 /* typical eBay maintenance period
612 * is two hours. Sleep for half that
613 * amount of time.
614 */
615 printLog(stdout, "%s: Will try again, sleeping for an hour\n", timestamp());
616 sleepTime = 3600;
617 sleep(sleepTime);
618 continue;
619 }
620 } else if (remain == LONG_MIN) {
621 /* first time through? Give it 3 chances then
622 * make the error fatal.
623 */
624 int j;
625
626 for (j = 0; ret && j < 3 && aip->auctionError == ae_notitle; ++j)
627 ret = getInfo(aip);
628 if (ret)
629 return 1;
630 remain = newRemain(aip);
631 } else {
632 /* non-fatal error */
633 log(("ERROR %d!!!\n", ++errorCount));
634 if (errorCount > 50)
635 return auctionError(aip, ae_toomany, NULL);
636 printLog(stdout, "Cannot find auction - internet or eBay problem?\nWill try again after sleep.\n");
637 remain = newRemain(aip);
638 }
639 } else if (!isValidBidPrice(aip))
640 return auctionError(aip, ae_bidprice, NULL);
641 else
642 remain = newRemain(aip);
643
644 /*
645 * Check login when we are close to bidding.
646 */
647 if (remain <= 300) {
648 if (ebayLogin(aip, defaultLoginInterval - 600))
649 return 1;
650 remain = newRemain(aip);
651 }
652
653 /*
654 * if we're less than two minutes away, get bid key
655 */
656 if (remain <= 150 && !aip->bidkey && aip->auctionError == ae_none) {
657 int i;
658
659 printf("\n");
660 for (i = 0; i < 5; ++i) {
661 /* ae_bidkey is used when the page loaded
662 * but failed for some unknown reason.
663 * Do not try again in this situation.
664 */
665 if (!preBid(aip) ||
666 aip->auctionError == ae_bidkey)
667 break;
668 }
669 if (aip->auctionError != ae_none &&
670 aip->auctionError != ae_highbidder) {
671 printLog(stderr, "Cannot get bid key\n");
672 return 1;
673 }
674 }
675
676 remain = newRemain(aip);
677
678 /* it's time!!! */
679 if (remain <= 0)
680 break;
681
682 /*
683 * Setup sleep schedule so we get updates once a day, then
684 * at 2 hours, 1 hour, 5 minutes, 2 minutes
685 */
686 if (remain <= 150) /* 2 minutes + 30 seconds (slop) */
687 sleepTime = remain;
688 else if (remain < 720) /* 5 minutes + 2 minutes (slop) */
689 sleepTime = remain - 120;
690 else if (remain < 3900) /* 1 hour + 5 minutes (slop) */
691 sleepTime = remain - 600;
692 else if (remain < 10800)/* 2 hours + 1 hour (slop) */
693 sleepTime = remain - 3600;
694 else if (remain < 97200)/* 1 day + 3 hours (slop) */
695 sleepTime = remain - 7200;
696 else /* knock off one day */
697 sleepTime = 86400;
698
699 printf("%s: ", timestamp());
700 if (sleepTime >= 86400)
701 printLog(stdout, "Sleeping for a day\n");
702 else if (sleepTime >= 3600)
703 printLog(stdout, "Sleeping for %d hours %d minutes\n",
704 sleepTime/3600, (sleepTime % 3600) / 60);
705 else if (sleepTime >= 60)
706 printLog(stdout, "Sleeping for %d minutes %d seconds\n",
707 sleepTime/60, sleepTime % 60);
708 else
709 printLog(stdout, "Sleeping for %ld seconds\n", sleepTime);
710 sleep(sleepTime);
711 printf("\n");
712
713 if ((remain=newRemain(aip)) <= 0)
714 break;
715 }
716 return 0;
717 } /* watch() */
718
719 /*
720 * parameters:
721 * aip auction to bid on
722 *
723 * return number of items won
724 */
725 int
726 snipeAuction(auctionInfo *aip)
727 {
728 int won = 0;
729 char *tmpUsername;
730
731 if (!aip)
732 return 0;
733
734 if (options.debug)
735 logOpen(aip, options.logdir);
736
737 tmpUsername = stars(strlen(options.username));
738 log(("auction %s price %s quantity %d user %s bidtime %ld\n",
739 aip->auction, aip->bidPriceStr,
740 options.quantity, tmpUsername, options.bidtime));
741 free(tmpUsername);
742
743 if (ebayLogin(aip, 0)) {
744 printAuctionError(aip, stderr);
745 return 0;
746 }
747
748 /* 0 means "now" */
749 if ((options.bidtime == 0) ? preBid(aip) : watch(aip)) {
750 printAuctionError(aip, stderr);
751 if (aip->auctionError != ae_highbidder)
752 return 0;
753 }
754
755 /* ran out of time! */
756 if (aip->endTime <= time(NULL)) {
757 (void)auctionError(aip, ae_ended, NULL);
758 printAuctionError(aip, stderr);
759 return 0;
760 }
761
762 if (aip->auctionError != ae_highbidder) {
763 printLog(stdout, "\nAuction %s: Bidding...\n", aip->auction);
764 if (bid(aip)) {
765 /* failed bid */
766 printAuctionError(aip, stderr);
767 return 0;
768 }
769 }
770
771 /* view auction after bid.
772 * Stick it in a loop in case our timing is a bit off (due
773 * to wild swings in latency, for instance).
774 */
775 for (;;) {
776 if (options.bidtime > 0 && options.bidtime < 60) {
777 time_t seconds = aip->endTime - time(NULL);
778
779 if (seconds < 0)
780 seconds = 0;
781 /* extra 2 seconds to make sure auction is over */
782 seconds += 2;
783 printLog(stdout, "Auction %s: Waiting %d seconds for auction to complete...\n", aip->auction, seconds);
784 sleep((unsigned int)seconds);
785 }
786
787 printLog(stdout, "\nAuction %s: Post-bid info:\n",
788 aip->auction);
789 if (getInfo(aip))
790 printAuctionError(aip, stderr);
791 if (aip->remain > 0 && aip->remain < 60 &&
792 options.bidtime > 0 && options.bidtime < 60)
793 continue;
794 break;
795 }
796
797 if (aip->won == -1) {
798 won = options.quantity < aip->quantity ?
799 options.quantity : aip->quantity;
800 printLog(stdout, "\nunknown outcome, assume that you have won %d items\n", won);
801 } else {
802 won = aip->won;
803 printLog(stdout, "\nwon %d item(s)\n", won);
804 }
805 options.quantity -= won;
806 return won;
807 }
808
809 static const char* MYITEMS_URL = "http://my.ebay.com/ws/eBayISAPI.dll?MyeBay&CurrentPage=MyeBayWatching";
810
811 #define MAX_TDS 6
812
813 /*
814 * On first call, use printNewline to 0. On subsequent calls, use return
815 * value from previous call.
816 */
817 static int
818 printMyItemsRow(char **row, int printNewline)
819 {
820 const char *myitems_description[7][MAX_TDS] = {
821 {0, 0, 0, 0, 0, 0},
822 {"Note:\t\t%s\n", 0, 0, 0, 0, 0},
823 {0, 0, 0, 0, 0, 0},
824 {0, 0, 0, 0, 0, 0},
825 {0, 0, "Description:\t%s\n", 0, 0, 0},
826 {0, 0, 0, 0, 0, 0},
827 {0, "Price:\t\t%s\n", "Shipping:\t%s\n", "Bids:\t\t%s\n",
828 "Seller:\t\t%s\n", "Time:\t\t%s\n"}
829 };
830 int nColumns = numColumns(row);
831 int column = 0;
832 int ret = printNewline;
833
834 if (nColumns == 4) {
835 if (printNewline)
836 printf("\n");
837 else
838 ret = 1;
839 }
840 for (; row[column]; ++column) {
841 memBuf_t buf;
842 char *value = NULL;
843
844 if (column >= MAX_TDS || !myitems_description[nColumns][column])
845 continue;
846 strToMemBuf(row[column], &buf);
847 /* special case: ItemNr encoded in item URL */
848 if (nColumns == 4 && column == 2) {
849 static const char search[] = "item=";
850 char *tmp = strstr(row[column], search);
851
852 if (tmp) {
853 int i;
854
855 tmp += sizeof(search) - 1;
856 for (; !isdigit(*tmp); ++tmp)
857 ;
858 for (i = 1; isdigit(tmp[i]); ++i)
859 ;
860 value = myStrndup(tmp, (size_t)(i));
861 printLog(stdout, "ItemNr:\t\t%s\n", value);
862 free(value);
863 }
864 }
865 value = getNonTag(&buf);
866 /* Note text is 2nd non-tag */
867 if (nColumns == 1 && column == 0)
868 value = getNonTag(&buf);
869 printLog(stdout, myitems_description[nColumns][column], value ? value : "");
870 }
871 return ret;
872 }
873
874 /*
875 * TODO: allow user configuration of myItems.
876 */
877 int
878 printMyItems(void)
879 {
880 memBuf_t *mp = NULL;
881 const char *table;
882 char **row;
883 auctionInfo *dummy = newAuctionInfo("0", "0");
884
885 if (ebayLogin(dummy, 0)) {
886 printAuctionError(dummy, stderr);
887 freeAuction(dummy);
888 return 1;
889 }
890 if (!(mp = httpGet(MYITEMS_URL, NULL))) {
891 httpError(dummy);
892 printAuctionError(dummy, stderr);
893 freeAuction(dummy);
894 freeMembuf(mp);
895 return 1;
896 }
897 while ((table = getTableStart(mp))) {
898 int printNewline = 0;
899
900 /* search for table containing my itmes */
901 if (!strstr(table, "id=\"Watching\""))
902 continue;
903 /* skip first descriptive table row */
904 if ((row = getTableRow(mp)))
905 freeTableRow(row);
906 else {
907 freeAuction(dummy);
908 return 0; /* error? */
909 }
910 while ((row = getTableRow(mp))) {
911 printNewline = printMyItemsRow(row, printNewline);
912 freeTableRow(row);
913 }
914 }
915 freeAuction(dummy);
916 freeMembuf(mp);
917 return 0;
918 }
919
920 #if DEBUG
921 /* secret option - test parser */
922 void
923 testParser(int flag)
924 {
925 memBuf_t *mp = readFile(stdin);
926
927 switch (flag) {
928 case 1:
929 {
930 /* print pagename */
931 char *line;
932
933 /* dump non-tag data */
934 while ((line = getNonTag(mp)))
935 printf("\"%s\"\n", line);
936
937 /* pagename? */
938 mp->readptr = mp->memory;
939 if ((line = getPageName(mp)))
940 printf("\nPAGENAME is \"%s\"\n", line);
941 else
942 printf("\nPAGENAME is NULL\n");
943 break;
944 }
945 case 2:
946 {
947 /* run through bid history parser */
948 auctionInfo *aip = newAuctionInfo("1", "2");
949 int ret = parseBidHistory(mp, aip, options.username, time(NULL), NULL);
950
951 printf("ret = %d\n", ret);
952 printAuctionError(aip, stdout);
953 break;
954 }
955 case 3:
956 {
957 /* run through bid result parser */
958 auctionInfo *aip = newAuctionInfo("1", "2");
959 int ret = parseBid(mp, aip);
960
961 printf("ret = %d\n", ret);
962 printAuctionError(aip, stdout);
963 break;
964 }
965 case 4:
966 {
967 /* print bid history table */
968 const char *table;
969 char **row;
970 char *cp;
971 int rowNum = 0;
972
973 while ((cp = getNonTag(mp))) {
974 if (!strcmp(cp, "Time left:"))
975 break;
976 }
977 if (!cp) {
978 printf("time left not found!\n");
979 break;
980 }
981 (void)getTableStart(mp); /* skip one table */
982 table = getTableStart(mp);
983 if (!table) {
984 printf("no table found!\n");
985 break;
986 }
987
988 printf("table: %s\n", table);
989 while ((row = getTableRow(mp))) {
990 int columnNum = 0;
991
992 printf("\trow %d:\n", rowNum++);
993 for (; row[columnNum]; ++columnNum) {
994 memBuf_t buf;
995
996 strToMemBuf(row[columnNum], &buf);
997 printf("\t\tcolumn %d: %s\n", columnNum, getNonTag(cmp));
998 free(row[columnNum]);
999 }
1000 }
1001 break;
1002 }
1003 }
1004 }
1005 #endif
0 /*
1 * Copyright (c) 2002, 2003, Scott Nicol <esniper@users.sf.net>
2 * All rights reserved
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are met:
6 *
7 * - Redistributions of source code must retain the above copyright notice,
8 * this list of conditions and the following disclaimer.
9 * - Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 *
13 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
14 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
15 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
16 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
17 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
18 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
19 * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
20 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
21 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
22 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
23 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24 */
25
26 #ifndef AUCTION_H_INCLUDED
27 #define AUCTION_H_INCLUDED
28
29 #include "auctioninfo.h"
30 #include "esniper.h"
31 #include "http.h"
32
33 extern int getInfo(auctionInfo *aip);
34 extern int snipeAuction(auctionInfo *aip);
35 extern int printMyItems(void);
36
37 typedef struct {
38 char *pageName;
39 char *pageId;
40 char *srcId;
41 } pageInfo_t;
42
43 extern pageInfo_t *getPageInfo(memBuf_t *mp);
44 extern void freePageInfo(pageInfo_t *pp);
45
46 #if DEBUG
47 /* secret option */
48 extern void testParser(int flag);
49 #endif
50
51 #endif /* AUCTION_H_INCLUDED */
0 /*
1 * Copyright (c) 2002, 2003, Scott Nicol <esniper@users.sf.net>
2 * All rights reserved
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are met:
6 *
7 * - Redistributions of source code must retain the above copyright notice,
8 * this list of conditions and the following disclaimer.
9 * - Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 *
13 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
14 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
15 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
16 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
17 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
18 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
19 * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
20 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
21 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
22 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
23 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24 */
25
26 /*
27 * This program will "snipe" an auction on eBay, automatically placing
28 * your bid a few seconds before the auction ends.
29 *
30 * For updates, bug reports, etc, please go to http://esniper.sf.net/.
31 */
32
33 #include "auctionfile.h"
34 #include "buffer.h"
35 #include "util.h"
36 #include <ctype.h>
37 #include <errno.h>
38 #include <stdio.h>
39 #include <string.h>
40
41 /*
42 * readAuctionFile(): read a file listing auctions to watch.
43 *
44 * returns: number of auctions to watch
45 */
46 int
47 readAuctionFile(const char *filename, auctionInfo ***aip)
48 {
49 FILE *fp = fopen(filename, "r");
50 char *buf = NULL;
51 size_t bufsize = 0, count = 0;
52 int c, i, j, line, numAuctions = 0;
53
54 if (fp == NULL) {
55 fprintf(stderr, "Cannot open auction file %s: %s\n", filename,
56 strerror(errno));
57 return -1;
58 }
59
60 while (numAuctions != -1 && (c = getc(fp)) != EOF) {
61 if (isspace(c))
62 continue;
63 /* skip comments and anything starting with a letter
64 * (assume it is a configuration option)
65 */
66 if ((c == '#') || isalpha(c))
67 c = skipline(fp);
68 else if (isdigit(c)) {
69 ++numAuctions;
70 /* get auction number */
71 line = count;
72 do {
73 addchar(buf, bufsize, count, (char)c);
74 } while (isdigit(c = getc(fp)));
75 while (isspace(c) && c != '\n' && c != '\r')
76 c = getc(fp);
77 if (c == '#') /* comment? */
78 c = skipline(fp);
79 /* no price? */
80 if (c == EOF || c == '\n' || c == '\r') {
81 /* use price of previous auction */
82 if (numAuctions == 1) {
83 fprintf(stderr, "Cannot find price on first auction\n");
84 numAuctions = -1;
85 }
86 } else {
87 addchar(buf, bufsize, count, ' ');
88 /* get price */
89 for (; isdigit(c) || c == '.' || c == ','; c = getc(fp))
90 addchar(buf, bufsize, count, (char)c);
91 while (isspace(c) && c != '\n' && c != '\r')
92 c = getc(fp);
93 if (c == '#') /* comment? */
94 c = skipline(fp);
95 if (c != EOF && c != '\n' && c != '\r') {
96 term(buf, bufsize, count);
97 fprintf(stderr, "Invalid auction line: %s\n", &buf[line]);
98 numAuctions = -1;
99 }
100 }
101 addchar(buf, bufsize, count, '\n');
102 } else {
103 fprintf(stderr, "Invalid auction line: ");
104 do {
105 putc(c, stderr);
106 } while ((c = getc(fp)) != EOF && c != '\n' && c != '\r');
107 putc('\n', stderr);
108 numAuctions = -1;
109 }
110 if (c == EOF)
111 break;
112 }
113 fclose(fp);
114
115 if (numAuctions > 0) {
116 *aip = (auctionInfo **)myMalloc(
117 sizeof(auctionInfo *) * numAuctions);
118
119 for (i = 0, j = 0; i < numAuctions; ++i, ++j) {
120 char *auction, *bidPriceStr;
121
122 auction = &buf[j];
123 for (; !isspace((int)(buf[j])); ++j)
124 ;
125 if (buf[j] == '\n') {
126 buf[j] = '\0';
127 bidPriceStr = (*aip)[i-1]->bidPriceStr;
128 } else {
129 buf[j] = '\0';
130 bidPriceStr = &buf[++j];
131 for (; buf[j] != '\n'; ++j)
132 ;
133 buf[j] = '\0';
134 }
135 (*aip)[i] = newAuctionInfo(auction, bidPriceStr);
136 }
137 } else if (numAuctions == 0)
138 fprintf(stderr, "Cannot find any auctions!\n");
139
140 free(buf);
141
142 return numAuctions;
143 } /* readAuctions() */
0 /*
1 * Copyright (c) 2002, 2003, Scott Nicol <esniper@users.sf.net>
2 * All rights reserved
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are met:
6 *
7 * - Redistributions of source code must retain the above copyright notice,
8 * this list of conditions and the following disclaimer.
9 * - Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 *
13 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
14 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
15 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
16 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
17 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
18 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
19 * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
20 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
21 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
22 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
23 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24 */
25
26 #ifndef AUCTIONFILE_H_INCLUDED
27 #define AUCTIONFILE_H_INCLUDED
28
29 #include "auctioninfo.h"
30
31 int readAuctionFile(const char *filename, auctionInfo ***aip);
32
33 #endif /* AUCTIONFILE_H_INCLUDED */
0 /*
1 * Copyright (c) 2002, 2003, Scott Nicol <esniper@users.sf.net>
2 * All rights reserved
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are met:
6 *
7 * - Redistributions of source code must retain the above copyright notice,
8 * this list of conditions and the following disclaimer.
9 * - Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 *
13 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
14 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
15 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
16 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
17 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
18 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
19 * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
20 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
21 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
22 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
23 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24 */
25
26 #include "auctioninfo.h"
27 #include "esniper.h"
28 #include "auction.h"
29 #include "util.h"
30 #include <stdlib.h>
31 #include <string.h>
32 #if defined(WIN32)
33 # define sleep(t) _sleep((t) * 1000)
34 #else
35 # include <unistd.h>
36 #endif
37
38 static double *getIncrements(const auctionInfo *aip);
39
40 /*
41 * Bidding increments
42 *
43 * first number is threshold for next increment range, second is increment.
44 * For example, 1.00, 0.05 means that under $1.00 the increment is $0.05.
45 *
46 * Increments obtained from:
47 * http://pages.ebay.com/help/buy/bid-increments.html
48 * (and similar pages on international sites)
49 */
50
51 /*
52 * Auction items not available from ebay.com:
53 *
54 * Argentina: http://www.mercadolibre.com.ar/
55 * Brazil: http://www.mercadolivre.com.br/
56 * India: http://www.baazee.com/ (seller can set increments)
57 * Korea: http://www.auction.co.kr/
58 * Mexico: http://www.mercadolibre.com.mx/
59 */
60
61 /*
62 * Australia: http://pages.ebay.com.au/help/buy/bid-increments.html
63 * AU
64 */
65 static double AUIncrements[] = {
66 1.00, 0.05,
67 5.00, 0.25,
68 25.00, 0.50,
69 100.00, 1.00,
70 250.00, 2.50,
71 500.00, 5.00,
72 1000.00, 10.00,
73 2500.00, 25.00,
74 5000.00, 50.00,
75 -1.00, 100.00
76 };
77
78 /*
79 * Austria: http://pages.ebay.at/help/buy/bid-increments.html
80 * Belgium: http://pages.befr.ebay.be/help/buy/bid-increments.html
81 * France: http://pages.ebay.fr/help/buy/bid-increments.html
82 * Germany: http://pages.ebay.de/help/buy/bid-increments.html
83 * Italy: http://pages.ebay.it/help/buy/bid-increments.html
84 * Netherlands: http://pages.ebay.nl/help/buy/bid-increments.html
85 * Spain: http://pages.es.ebay.com/help/buy/bid-increments.html
86 * EUR
87 */
88 static double EURIncrements[] = {
89 50.00, 0.50,
90 500.00, 1.00,
91 1000.00, 5.00,
92 5000.00, 10.00,
93 -1.00, 50.00
94 };
95
96 /*
97 * Canada: http://pages.ebay.ca/help/buy/bid-increments.html
98 * C
99 */
100 static double CADIncrements[] = {
101 1.00, 0.05,
102 5.00, 0.25,
103 25.00, 0.50,
104 100.00, 1.00,
105 -1.00, 2.50
106 };
107
108 /*
109 * China: http://pages.ebay.com.cn/help/buy/bid-increments.html
110 * RMB
111 */
112 static double RMBIncrements[] = {
113 1.01, 0.05,
114 5.01, 0.20,
115 15.01, 0.50,
116 60.01, 1.00,
117 150.01, 2.00,
118 300.01, 5.00,
119 600.01, 10.00,
120 1500.01, 20.00,
121 3000.01, 50.00,
122 -1.00, 100.00
123 };
124
125 /*
126 * Hong Kong: http://www.ebay.com.hk/
127 * HKD
128 *
129 * Note: Cannot find bid-increments page. Will use 0.01 to be safe.
130 */
131 static double HKDIncrements[] = {
132 -1.00, 0.01
133 };
134
135 /*
136 * Singapore: http://www.ebay.com.sg/
137 * SGD
138 *
139 * Note: Cannot find bid-increments page. Will use 0.01 to be safe.
140 * From looking at auctions, it appears to be similar to US
141 * increments.
142 */
143 static double SGDIncrements[] = {
144 -1.00, 0.01
145 };
146
147 /*
148 * Switzerland: http://pages.ebay.ch/help/buy/bid-increments.html
149 * CHF
150 */
151 static double CHFIncrements[] = {
152 50.00, 0.50,
153 500.00, 1.00,
154 1000.00, 5.00,
155 5000.00, 10.00,
156 -1.00, 50.00
157 };
158
159 /*
160 * Taiwan: http://pages.tw.ebay.com/help/buy/bid-increments.html
161 * NT
162 */
163 static double NTIncrements[] = {
164 501.00, 15.00,
165 2501.00, 30.00,
166 5001.00, 50.00,
167 25001.00, 100.00,
168 -1.00, 200.00
169 };
170
171 /*
172 * Ireland: http://pages.ebay.co.uk/help/buy/bid-increments.html
173 * Sweden: http://pages.ebay.co.uk/help/buy/bid-increments.html
174 * UK: http://pages.ebay.co.uk/help/buy/bid-increments.html
175 * Note: Sweden & Ireland use GBP or EUR. English help pages redirect
176 * to UK site.
177 * GBP
178 */
179 static double GBPIncrements[] = {
180 1.01, 0.05,
181 5.01, 0.20,
182 15.01, 0.50,
183 60.01, 1.00,
184 150.01, 2.00,
185 300.01, 5.00,
186 600.01, 10.00,
187 1500.01, 20.00,
188 3000.01, 50.00,
189 -1.00, 100.00
190 };
191
192 /*
193 * New Zealand: http://pages.ebay.com/help/buy/bid-increments.html
194 * US: http://pages.ebay.com/help/buy/bid-increments.html
195 * Note: New Zealand site uses US or NT.
196 * US
197 */
198 static double USIncrements[] = {
199 1.00, 0.05,
200 5.00, 0.25,
201 25.00, 0.50,
202 100.00, 1.00,
203 250.00, 2.50,
204 500.00, 5.00,
205 1000.00, 10.00,
206 2500.00, 25.00,
207 5000.00, 50.00,
208 -1.00, 100.00
209 };
210
211 /*
212 * Unknown currency. Increment 0.01, just to be on the safe side.
213 */
214 static double defaultIncrements[] = {
215 -1.00, 0.01
216 };
217
218 static const char *auctionErrorString[] = {
219 "",
220 "Auction %s: Unknown item\n",
221 "Auction %s: Title not found\n",
222 "Auction %s: Current price not found\n",
223 "Auction %s: Cannot convert price \"%s\"\n",
224 "Auction %s: Quantity not found\n",
225 "Auction %s: Time remaining not found\n",
226 "Auction %s: Unknown time interval \"%s\"\n",
227 "Auction %s: High bidder not found\n",
228 "Auction %s: Cannot connect to URL %s\n",
229 "Auction %s: Bid price less than minimum bid price\n",
230 "Auction %s: Bid key not found\n",
231 "Auction %s: Bad username or password\n",
232 "Auction %s: You have been outbid\n",
233 "Auction %s: Reserve not met\n",
234 "Auction %s: Auction has ended\n",
235 "Auction %s: Duplicate auction\n",
236 "Auction %s: Too many errors, quitting\n",
237 "Auction %s: eBay temporarily unavailable\n",
238 "Auction %s: Login failed\n",
239 "Auction %s: Seller has blocked your userid\n",
240 "Auction %s: Seller does not ship to your location\n",
241 "Auction %s: Seller requires buyer to have paypal account\n",
242 "Auction %s: Bid amount must be higher than the proxy you already placed\n",
243 "Auction %s: Must sign in\n",
244 "Auction %s: Cannot bid on item (fixed price item?)\n",
245 "Auction %s: Dutch auction bid must have higher price or quantity than prior bid\n",
246 /* ae_unknown must be last error */
247 "Auction %s: Unknown error code %d\n",
248 };
249
250 auctionInfo *
251 newAuctionInfo(const char *auction, const char *bidPriceStr)
252 {
253 auctionInfo *aip = (auctionInfo *)myMalloc(sizeof(auctionInfo));
254
255 aip->auction = myStrdup(auction);
256 aip->title = NULL;
257 aip->bidPriceStr = priceFixup(myStrdup(bidPriceStr), NULL);
258 aip->bidPrice = aip->bidPriceStr ? atof(aip->bidPriceStr) : -1;
259 aip->remain = 0;
260 aip->remainRaw = NULL;
261 aip->endTime = 0;
262 aip->latency = 0;
263 aip->query = NULL;
264 aip->bidkey = NULL;
265 aip->bidpass = NULL;
266 aip->biduiid = NULL;
267 aip->quantity = 0;
268 aip->quantityBid = 0;
269 aip->bids = 0;
270 aip->price = 0;
271 aip->currency = NULL;
272 aip->bidResult = -1;
273 aip->reserve = 0;
274 aip->won = -1;
275 aip->winning = 0;
276 aip->auctionError = ae_none;
277 aip->auctionErrorDetail = NULL;
278 return aip;
279 }
280
281 void
282 freeAuction(auctionInfo *aip)
283 {
284 if (!aip)
285 return;
286 free(aip->auction);
287 free(aip->title);
288 free(aip->bidPriceStr);
289 free(aip->remainRaw);
290 free(aip->query);
291 free(aip->bidkey);
292 free(aip->bidpass);
293 free(aip->biduiid);
294 free(aip->currency);
295 free(aip->auctionErrorDetail);
296 free(aip);
297 }
298
299 /*
300 * compareAuctionInfo(): used to sort auctionInfo table
301 *
302 * returns (-1, 0, 1) if time remaining in p1 is (less than, equal to, greater
303 * than) p2
304 */
305 int
306 compareAuctionInfo(const void *p1, const void *p2)
307 {
308 const auctionInfo * a1, * a2;
309
310 a1 = *((const auctionInfo * const *)p1);
311 a2 = *((const auctionInfo * const *)p2);
312
313 /* auctions are the same? */
314 if (!strcmp(a1->auction, a2->auction))
315 return 0;
316 /* Currently winning bids go first */
317 if (a1->winning != a2->winning)
318 return a1->winning > a2->winning ? -1 : 1;
319 /* if end time is the same we compare the current price
320 * and use the lower price first
321 */
322 if (a1->endTime == a2->endTime)
323 /* comparison function must return an integer so we
324 * convert the price to cent or whatever it's called
325 */
326 return (int)((a1->price * 100.0) - (a2->price * 100.0));
327 return (int)(a1->endTime - a2->endTime);
328 }
329
330 /*
331 * printAuctionError()
332 */
333 void
334 printAuctionError(auctionInfo *aip, FILE *fp)
335 {
336 enum auctionErrorCode err = aip->auctionError;
337
338 if (err == 0)
339 return;
340 if (err < 0 || err >= ae_unknown)
341 printLog(fp, auctionErrorString[ae_unknown], aip->auction, err);
342 else
343 printLog(fp, auctionErrorString[err], aip->auction,
344 aip->auctionErrorDetail);
345 }
346
347 /*
348 * reset parse error code.
349 */
350 void
351 resetAuctionError(auctionInfo *aip)
352 {
353 aip->auctionError = ae_none;
354 free(aip->auctionErrorDetail);
355 aip->auctionErrorDetail = NULL;
356 }
357
358 /*
359 * Set parse error.
360 *
361 * returns: 1, so functions that fail with code 1 can return auctionError().
362 */
363 int
364 auctionError(auctionInfo *aip, enum auctionErrorCode pe, const char *details)
365 {
366 resetAuctionError(aip);
367 aip->auctionError = pe;
368 if (details)
369 aip->auctionErrorDetail = myStrdup(details);
370 return 1;
371 }
372
373 /*
374 * isValidBidPrice(): Determine if the bid price is valid.
375 *
376 * If there are no bids, or the not enough bids to fill the auction (dutch),
377 * or you are the current high bidder, there is no increment, just the
378 * minimum price.
379 *
380 * If there are bids, then the increment depends on the current price.
381 * See http://pages.ebay.com/help/basics/g-bid-increment.html for details.
382 */
383 int
384 isValidBidPrice(const auctionInfo *aip)
385 {
386 double increment = 0.0;
387 static double EPSILON = 0.0001;
388
389 if (aip->quantityBid == aip->quantity && aip->winning == 0) {
390 int i;
391 double *increments = getIncrements(aip);
392
393 for (i = 0; increments[i] > 0; i += 2) {
394 if (aip->price < increments[i])
395 break;
396 }
397 increment = increments[i+1];
398 }
399 /*
400 * Use EPSILON to avoid floating point
401 * rounding errors on "=" comparison
402 */
403 return aip->bidPrice >= (aip->price + increment - EPSILON);
404 }
405
406 static double *
407 getIncrements(const auctionInfo *aip)
408 {
409 if (!aip->currency)
410 return USIncrements;
411 switch (aip->currency[0]) {
412 case 'A':
413 if (!strcmp(aip->currency, "AU"))
414 return AUIncrements;
415 break;
416 case 'C':
417 if (!strcmp(aip->currency, "C"))
418 return CADIncrements;
419 if (!strcmp(aip->currency, "CHF"))
420 return CHFIncrements;
421 break;
422 case 'E':
423 if (!strcmp(aip->currency, "EUR"))
424 return EURIncrements;
425 break;
426 case 'G':
427 if (!strcmp(aip->currency, "GBP"))
428 return GBPIncrements;
429 break;
430 case 'H':
431 if (!strcmp(aip->currency, "HKD"))
432 return HKDIncrements;
433 break;
434 case 'N':
435 if (!strcmp(aip->currency, "NT"))
436 return NTIncrements;
437 break;
438 case 'R':
439 if (!strcmp(aip->currency, "RMB"))
440 return RMBIncrements;
441 break;
442 case 'S':
443 if (!strcmp(aip->currency, "SGD"))
444 return SGDIncrements;
445 break;
446 case 'U':
447 if (!strcmp(aip->currency, "US"))
448 return USIncrements;
449 break;
450 }
451 return defaultIncrements;
452 }
453
454 /*
455 * Get initial auction info, sort items based on:
456 *
457 * 1. current status (i.e. you already placed a bid and are winning)
458 * 2. end time.
459 */
460 int
461 sortAuctions(auctionInfo **auctions, int numAuctions, int *quantity)
462 {
463 int i, sawError = 0;
464
465 for (i = 0; i < numAuctions; ++i) {
466 int j;
467
468 if (options.debug)
469 logOpen(auctions[i], options.logdir);
470 for (j = 0; j < 3; ++j) {
471 if (j > 0)
472 printLog(stderr, "Retrying...\n");
473 if (!getInfo(auctions[i]))
474 break;
475 printAuctionError(auctions[i], stderr);
476 if (auctions[i]->auctionError == ae_unavailable) {
477 --j; /* doesn't count as an attempt */
478 printLog(stderr, "%s: Will retry, sleeping for an hour\n", timestamp());
479 sleep(3600);
480 }
481 }
482 printLog(stdout, "\n");
483 }
484 if (numAuctions > 1) {
485 printLog(stdout, "Sorting auctions...\n");
486 /* sort by status and end time */
487 qsort(auctions, (size_t)numAuctions,
488 sizeof(auctionInfo *), compareAuctionInfo);
489 }
490
491 /* get rid of obvious cases */
492 for (i = 0; i < numAuctions; ++i) {
493 auctionInfo *aip = auctions[i];
494
495 if ((i + 1) < numAuctions &&
496 !strcmp(aip->auction, auctions[i+1]->auction))
497 (void)auctionError(aip, ae_duplicate, NULL);
498 else if (aip->won > 0)
499 *quantity -= aip->won;
500 else if (aip->auctionError != ae_none ||
501 aip->endTime <= time(NULL))
502 ;
503 else if (!isValidBidPrice(aip))
504 (void)auctionError(aip, ae_bidprice, NULL);
505 else
506 continue;
507 printAuctionError(aip, stderr);
508 freeAuction(auctions[i]);
509 auctions[i] = NULL;
510 ++sawError;
511 }
512
513 /* eliminate dead auctions */
514 if (sawError) {
515 int j;
516
517 for (i = j = 0; i < numAuctions; ++i) {
518 if (auctions[i])
519 auctions[j++] = auctions[i];
520 }
521 numAuctions -= sawError;
522 }
523 return numAuctions;
524 } /* sortAuctions() */
0 /*
1 * Copyright (c) 2002, 2003, Scott Nicol <esniper@users.sf.net>
2 * All rights reserved
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are met:
6 *
7 * - Redistributions of source code must retain the above copyright notice,
8 * this list of conditions and the following disclaimer.
9 * - Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 *
13 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
14 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
15 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
16 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
17 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
18 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
19 * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
20 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
21 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
22 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
23 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24 */
25
26 #ifndef AUCTIONINFO_H_INCLUDED
27 #define AUCTIONINFO_H_INCLUDED
28
29 #include <stdio.h>
30 #include <time.h>
31
32 /*
33 * errors from parseError(), getAuctionInfo(), watchAuction()
34 */
35 enum auctionErrorCode {
36 ae_none,
37 ae_baditem,
38 ae_notitle,
39 ae_noprice,
40 ae_convprice,
41 ae_noquantity,
42 ae_notime,
43 ae_badtime,
44 ae_nohighbid,
45 ae_curlerror,
46 ae_bidprice,
47 ae_bidkey,
48 ae_badpass,
49 ae_outbid,
50 ae_reservenotmet,
51 ae_ended,
52 ae_duplicate,
53 ae_toomany,
54 ae_unavailable,
55 ae_login,
56 ae_buyerblockpref,
57 ae_buyerblockprefdoesnotshiptolocation,
58 ae_buyerblockprefnolinkedpaypalaccount,
59 ae_highbidder,
60 ae_mustsignin,
61 ae_cannotbid,
62 ae_dutchsamebidquantity,
63 /* ae_unknown must be last error */
64 ae_unknown
65 };
66
67 /*
68 * All information associated with an auction
69 */
70 typedef struct {
71 char *auction; /* auction number */
72 char *title; /* auction title */
73 char *bidPriceStr;/* price you want to bid */
74 double bidPrice;/* price you want to bid (converted to double) */
75 time_t remain; /* remaining seconds */
76 char *remainRaw;/* remaining time string, from ebay */
77 time_t endTime; /* end time as calculated from remaining seconds */
78 time_t latency; /* latency from HTTP request to first page data */
79 char *query; /* bid history query */
80 char *bidkey; /* bid key */
81 char *bidpass; /* bid password */
82 char *biduiid; /* bid uiid */
83 int quantity; /* number of items available */
84 int quantityBid;/* number of items currently bid on */
85 int bids; /* number of bids made */
86 double price; /* current price */
87 char *currency; /* currency used in auction */
88 int bidResult; /* result code from bid (-1=no bid yet, 0=success, 1 = error) */
89 int reserve; /* auction has reserve and it hasn't been met. */
90 int won; /* number won (-1 = no clue, 0 or greater = actual #) */
91 int winning; /* number currently winning (-1 = no clue, 0 or greater = actual #) */
92 enum auctionErrorCode auctionError;/* error encountered while parsing */
93 char *auctionErrorDetail;/* details of error */
94 } auctionInfo;
95
96 extern auctionInfo *newAuctionInfo(const char *auction, const char *bidPriceStr);
97 extern void freeAuction(auctionInfo *aip);
98 extern int compareAuctionInfo(const void *p1, const void *p2);
99 extern void printAuctionError(auctionInfo *aip, FILE *fp);
100 extern void resetAuctionError(auctionInfo *aip);
101 extern int auctionError(auctionInfo *aip, enum auctionErrorCode pe,
102 const char *details);
103 extern int isValidBidPrice(const auctionInfo *aip);
104 extern int sortAuctions(auctionInfo **auctions, int numAuctions, int *quantity);
105
106 #endif /* AUCTIONINFO_H_INCLUDED */
0 /*
1 * Copyright (c) 2002, 2003, Scott Nicol <esniper@users.sf.net>
2 * All rights reserved
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are met:
6 *
7 * - Redistributions of source code must retain the above copyright notice,
8 * this list of conditions and the following disclaimer.
9 * - Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 *
13 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
14 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
15 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
16 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
17 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
18 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
19 * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
20 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
21 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
22 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
23 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24 */
25
26 #include "buffer.h"
27 #include "util.h"
28
29 #ifdef __lint
30 int NEVER = 0;
31 #endif
32
33 /*
34 * Resize a buffer. Used by addchar and term macros. See buffer.h for info.
35 */
36 char *
37 resize(char *buf, size_t *size, size_t inc)
38 {
39 *size += inc;
40 return (char *)myRealloc(buf, *size);
41 }
0 /*
1 * Copyright (c) 2002, 2003, Scott Nicol <esniper@users.sf.net>
2 * All rights reserved
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are met:
6 *
7 * - Redistributions of source code must retain the above copyright notice,
8 * this list of conditions and the following disclaimer.
9 * - Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 *
13 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
14 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
15 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
16 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
17 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
18 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
19 * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
20 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
21 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
22 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
23 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24 */
25
26 #ifndef BUFFER_H_INCLUDED
27 #define BUFFER_H_INCLUDED
28
29 #include <stdlib.h>
30
31 #ifdef __lint
32 extern int NEVER;
33 #else
34 #define NEVER 0
35 #endif
36
37 /*
38 * Buffer handling code
39 *
40 * Don't call resize directly, just start out with a clean buffer
41 * (buf = NULL, bufsize = 0, count = 0) and addchar() as much as necessary,
42 * then term() to null-terminate it.
43 */
44
45 #define addchar(buf, bufsize, count, c) \
46 do {\
47 if (count >= bufsize)\
48 buf = resize(buf, &bufsize, (size_t)1024);\
49 buf[count++] = c;\
50 } while (NEVER)
51
52 #define term(buf, bufsize, count) \
53 do {\
54 if (count >= bufsize)\
55 buf = resize(buf, &bufsize, (size_t)1024);\
56 buf[count] = '\0';\
57 } while (NEVER)
58
59 #define addcharinc(buf, bufsize, count, c, inc) \
60 do {\
61 if (count >= bufsize)\
62 buf = resize(buf, &bufsize, inc);\
63 buf[count++] = c;\
64 } while (NEVER)
65
66 #define terminc(buf, bufsize, count, inc) \
67 do {\
68 if (count >= bufsize)\
69 buf = resize(buf, &bufsize, inc);\
70 buf[count] = '\0';\
71 } while (NEVER)
72
73 extern char *resize(char *buf, size_t *size, size_t inc);
74
75 #endif /* BUFFER_H_INCLUDED */
0 #! /bin/sh
1 # Guess values for system-dependent variables and create Makefiles.
2 # Generated by GNU Autoconf 2.59.
3 #
4 # Copyright (C) 2003 Free Software Foundation, Inc.
5 # This configure script is free software; the Free Software Foundation
6 # gives unlimited permission to copy, distribute and modify it.
7 ## --------------------- ##
8 ## M4sh Initialization. ##
9 ## --------------------- ##
10
11 # Be Bourne compatible
12 if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
13 emulate sh
14 NULLCMD=:
15 # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
16 # is contrary to our usage. Disable this feature.
17 alias -g '${1+"$@"}'='"$@"'
18 elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then
19 set -o posix
20 fi
21 DUALCASE=1; export DUALCASE # for MKS sh
22
23 # Support unset when possible.
24 if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then
25 as_unset=unset
26 else
27 as_unset=false
28 fi
29
30
31 # Work around bugs in pre-3.0 UWIN ksh.
32 $as_unset ENV MAIL MAILPATH
33 PS1='$ '
34 PS2='> '
35 PS4='+ '
36
37 # NLS nuisances.
38 for as_var in \
39 LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \
40 LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \
41 LC_TELEPHONE LC_TIME
42 do
43 if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then
44 eval $as_var=C; export $as_var
45 else
46 $as_unset $as_var
47 fi
48 done
49
50 # Required to use basename.
51 if expr a : '\(a\)' >/dev/null 2>&1; then
52 as_expr=expr
53 else
54 as_expr=false
55 fi
56
57 if (basename /) >/dev/null 2>&1 && test "X`basename / 2>&1`" = "X/"; then
58 as_basename=basename
59 else
60 as_basename=false
61 fi
62
63
64 # Name of the executable.
65 as_me=`$as_basename "$0" ||
66 $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \
67 X"$0" : 'X\(//\)$' \| \
68 X"$0" : 'X\(/\)$' \| \
69 . : '\(.\)' 2>/dev/null ||
70 echo X/"$0" |
71 sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; }
72 /^X\/\(\/\/\)$/{ s//\1/; q; }
73 /^X\/\(\/\).*/{ s//\1/; q; }
74 s/.*/./; q'`
75
76
77 # PATH needs CR, and LINENO needs CR and PATH.
78 # Avoid depending upon Character Ranges.
79 as_cr_letters='abcdefghijklmnopqrstuvwxyz'
80 as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
81 as_cr_Letters=$as_cr_letters$as_cr_LETTERS
82 as_cr_digits='0123456789'
83 as_cr_alnum=$as_cr_Letters$as_cr_digits
84
85 # The user is always right.
86 if test "${PATH_SEPARATOR+set}" != set; then
87 echo "#! /bin/sh" >conf$$.sh
88 echo "exit 0" >>conf$$.sh
89 chmod +x conf$$.sh
90 if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then
91 PATH_SEPARATOR=';'
92 else
93 PATH_SEPARATOR=:
94 fi
95 rm -f conf$$.sh
96 fi
97
98
99 as_lineno_1=$LINENO
100 as_lineno_2=$LINENO
101 as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null`
102 test "x$as_lineno_1" != "x$as_lineno_2" &&
103 test "x$as_lineno_3" = "x$as_lineno_2" || {
104 # Find who we are. Look in the path if we contain no path at all
105 # relative or not.
106 case $0 in
107 *[\\/]* ) as_myself=$0 ;;
108 *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
109 for as_dir in $PATH
110 do
111 IFS=$as_save_IFS
112 test -z "$as_dir" && as_dir=.
113 test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break
114 done
115
116 ;;
117 esac
118 # We did not find ourselves, most probably we were run as `sh COMMAND'
119 # in which case we are not to be found in the path.
120 if test "x$as_myself" = x; then
121 as_myself=$0
122 fi
123 if test ! -f "$as_myself"; then
124 { echo "$as_me: error: cannot find myself; rerun with an absolute path" >&2
125 { (exit 1); exit 1; }; }
126 fi
127 case $CONFIG_SHELL in
128 '')
129 as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
130 for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH
131 do
132 IFS=$as_save_IFS
133 test -z "$as_dir" && as_dir=.
134 for as_base in sh bash ksh sh5; do
135 case $as_dir in
136 /*)
137 if ("$as_dir/$as_base" -c '
138 as_lineno_1=$LINENO
139 as_lineno_2=$LINENO
140 as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null`
141 test "x$as_lineno_1" != "x$as_lineno_2" &&
142 test "x$as_lineno_3" = "x$as_lineno_2" ') 2>/dev/null; then
143 $as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; }
144 $as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; }
145 CONFIG_SHELL=$as_dir/$as_base
146 export CONFIG_SHELL
147 exec "$CONFIG_SHELL" "$0" ${1+"$@"}
148 fi;;
149 esac
150 done
151 done
152 ;;
153 esac
154
155 # Create $as_me.lineno as a copy of $as_myself, but with $LINENO
156 # uniformly replaced by the line number. The first 'sed' inserts a
157 # line-number line before each line; the second 'sed' does the real
158 # work. The second script uses 'N' to pair each line-number line
159 # with the numbered line, and appends trailing '-' during
160 # substitution so that $LINENO is not a special case at line end.
161 # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the
162 # second 'sed' script. Blame Lee E. McMahon for sed's syntax. :-)
163 sed '=' <$as_myself |
164 sed '
165 N
166 s,$,-,
167 : loop
168 s,^\(['$as_cr_digits']*\)\(.*\)[$]LINENO\([^'$as_cr_alnum'_]\),\1\2\1\3,
169 t loop
170 s,-$,,
171 s,^['$as_cr_digits']*\n,,
172 ' >$as_me.lineno &&
173 chmod +x $as_me.lineno ||
174 { echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2
175 { (exit 1); exit 1; }; }
176
177 # Don't try to exec as it changes $[0], causing all sort of problems
178 # (the dirname of $[0] is not the place where we might find the
179 # original and so on. Autoconf is especially sensible to this).
180 . ./$as_me.lineno
181 # Exit status is that of the last command.
182 exit
183 }
184
185
186 case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in
187 *c*,-n*) ECHO_N= ECHO_C='
188 ' ECHO_T=' ' ;;
189 *c*,* ) ECHO_N=-n ECHO_C= ECHO_T= ;;
190 *) ECHO_N= ECHO_C='\c' ECHO_T= ;;
191 esac
192
193 if expr a : '\(a\)' >/dev/null 2>&1; then
194 as_expr=expr
195 else
196 as_expr=false
197 fi
198
199 rm -f conf$$ conf$$.exe conf$$.file
200 echo >conf$$.file
201 if ln -s conf$$.file conf$$ 2>/dev/null; then
202 # We could just check for DJGPP; but this test a) works b) is more generic
203 # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04).
204 if test -f conf$$.exe; then
205 # Don't use ln at all; we don't have any links
206 as_ln_s='cp -p'
207 else
208 as_ln_s='ln -s'
209 fi
210 elif ln conf$$.file conf$$ 2>/dev/null; then
211 as_ln_s=ln
212 else
213 as_ln_s='cp -p'
214 fi
215 rm -f conf$$ conf$$.exe conf$$.file
216
217 if mkdir -p . 2>/dev/null; then
218 as_mkdir_p=:
219 else
220 test -d ./-p && rmdir ./-p
221 as_mkdir_p=false
222 fi
223
224 as_executable_p="test -f"
225
226 # Sed expression to map a string onto a valid CPP name.
227 as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'"
228
229 # Sed expression to map a string onto a valid variable name.
230 as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'"
231
232
233 # IFS
234 # We need space, tab and new line, in precisely that order.
235 as_nl='
236 '
237 IFS=" $as_nl"
238
239 # CDPATH.
240 $as_unset CDPATH
241
242
243 # Name of the host.
244 # hostname on some systems (SVR3.2, Linux) returns a bogus exit status,
245 # so uname gets run too.
246 ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q`
247
248 exec 6>&1
249
250 #
251 # Initializations.
252 #
253 ac_default_prefix=/usr/local
254 ac_config_libobj_dir=.
255 cross_compiling=no
256 subdirs=
257 MFLAGS=
258 MAKEFLAGS=
259 SHELL=${CONFIG_SHELL-/bin/sh}
260
261 # Maximum number of lines to put in a shell here document.
262 # This variable seems obsolete. It should probably be removed, and
263 # only ac_max_sed_lines should be used.
264 : ${ac_max_here_lines=38}
265
266 # Identity of this package.
267 PACKAGE_NAME=
268 PACKAGE_TARNAME=
269 PACKAGE_VERSION=
270 PACKAGE_STRING=
271 PACKAGE_BUGREPORT=
272
273 ac_unique_file="esniper.c"
274 ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CYGPATH_W PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO install_sh STRIP ac_ct_STRIP INSTALL_STRIP_PROGRAM mkdir_p AWK SET_MAKE am__leading_dot AMTAR am__tar am__untar CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT DEPDIR am__include am__quote AMDEP_TRUE AMDEP_FALSE AMDEPBACKSLASH CCDEPMODE am__fastdepCC_TRUE am__fastdepCC_FALSE CURL_CONFIG CURLCFLAGS CURLLDFLAGS LIBOBJS LTLIBOBJS'
275 ac_subst_files=''
276
277 # Initialize some variables set by options.
278 ac_init_help=
279 ac_init_version=false
280 # The variables have the same names as the options, with
281 # dashes changed to underlines.
282 cache_file=/dev/null
283 exec_prefix=NONE
284 no_create=
285 no_recursion=
286 prefix=NONE
287 program_prefix=NONE
288 program_suffix=NONE
289 program_transform_name=s,x,x,
290 silent=
291 site=
292 srcdir=
293 verbose=
294 x_includes=NONE
295 x_libraries=NONE
296
297 # Installation directory options.
298 # These are left unexpanded so users can "make install exec_prefix=/foo"
299 # and all the variables that are supposed to be based on exec_prefix
300 # by default will actually change.
301 # Use braces instead of parens because sh, perl, etc. also accept them.
302 bindir='${exec_prefix}/bin'
303 sbindir='${exec_prefix}/sbin'
304 libexecdir='${exec_prefix}/libexec'
305 datadir='${prefix}/share'
306 sysconfdir='${prefix}/etc'
307 sharedstatedir='${prefix}/com'
308 localstatedir='${prefix}/var'
309 libdir='${exec_prefix}/lib'
310 includedir='${prefix}/include'
311 oldincludedir='/usr/include'
312 infodir='${prefix}/info'
313 mandir='${prefix}/man'
314
315 ac_prev=
316 for ac_option
317 do
318 # If the previous option needs an argument, assign it.
319 if test -n "$ac_prev"; then
320 eval "$ac_prev=\$ac_option"
321 ac_prev=
322 continue
323 fi
324
325 ac_optarg=`expr "x$ac_option" : 'x[^=]*=\(.*\)'`
326
327 # Accept the important Cygnus configure options, so we can diagnose typos.
328
329 case $ac_option in
330
331 -bindir | --bindir | --bindi | --bind | --bin | --bi)
332 ac_prev=bindir ;;
333 -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*)
334 bindir=$ac_optarg ;;
335
336 -build | --build | --buil | --bui | --bu)
337 ac_prev=build_alias ;;
338 -build=* | --build=* | --buil=* | --bui=* | --bu=*)
339 build_alias=$ac_optarg ;;
340
341 -cache-file | --cache-file | --cache-fil | --cache-fi \
342 | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c)
343 ac_prev=cache_file ;;
344 -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \
345 | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*)
346 cache_file=$ac_optarg ;;
347
348 --config-cache | -C)
349 cache_file=config.cache ;;
350
351 -datadir | --datadir | --datadi | --datad | --data | --dat | --da)
352 ac_prev=datadir ;;
353 -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \
354 | --da=*)
355 datadir=$ac_optarg ;;
356
357 -disable-* | --disable-*)
358 ac_feature=`expr "x$ac_option" : 'x-*disable-\(.*\)'`
359 # Reject names that are not valid shell variable names.
360 expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null &&
361 { echo "$as_me: error: invalid feature name: $ac_feature" >&2
362 { (exit 1); exit 1; }; }
363 ac_feature=`echo $ac_feature | sed 's/-/_/g'`
364 eval "enable_$ac_feature=no" ;;
365
366 -enable-* | --enable-*)
367 ac_feature=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'`
368 # Reject names that are not valid shell variable names.
369 expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null &&
370 { echo "$as_me: error: invalid feature name: $ac_feature" >&2
371 { (exit 1); exit 1; }; }
372 ac_feature=`echo $ac_feature | sed 's/-/_/g'`
373 case $ac_option in
374 *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;;
375 *) ac_optarg=yes ;;
376 esac
377 eval "enable_$ac_feature='$ac_optarg'" ;;
378
379 -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \
380 | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \
381 | --exec | --exe | --ex)
382 ac_prev=exec_prefix ;;
383 -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \
384 | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \
385 | --exec=* | --exe=* | --ex=*)
386 exec_prefix=$ac_optarg ;;
387
388 -gas | --gas | --ga | --g)
389 # Obsolete; use --with-gas.
390 with_gas=yes ;;
391
392 -help | --help | --hel | --he | -h)
393 ac_init_help=long ;;
394 -help=r* | --help=r* | --hel=r* | --he=r* | -hr*)
395 ac_init_help=recursive ;;
396 -help=s* | --help=s* | --hel=s* | --he=s* | -hs*)
397 ac_init_help=short ;;
398
399 -host | --host | --hos | --ho)
400 ac_prev=host_alias ;;
401 -host=* | --host=* | --hos=* | --ho=*)
402 host_alias=$ac_optarg ;;
403
404 -includedir | --includedir | --includedi | --included | --include \
405 | --includ | --inclu | --incl | --inc)
406 ac_prev=includedir ;;
407 -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \
408 | --includ=* | --inclu=* | --incl=* | --inc=*)
409 includedir=$ac_optarg ;;
410
411 -infodir | --infodir | --infodi | --infod | --info | --inf)
412 ac_prev=infodir ;;
413 -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*)
414 infodir=$ac_optarg ;;
415
416 -libdir | --libdir | --libdi | --libd)
417 ac_prev=libdir ;;
418 -libdir=* | --libdir=* | --libdi=* | --libd=*)
419 libdir=$ac_optarg ;;
420
421 -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \
422 | --libexe | --libex | --libe)
423 ac_prev=libexecdir ;;
424 -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \
425 | --libexe=* | --libex=* | --libe=*)
426 libexecdir=$ac_optarg ;;
427
428 -localstatedir | --localstatedir | --localstatedi | --localstated \
429 | --localstate | --localstat | --localsta | --localst \
430 | --locals | --local | --loca | --loc | --lo)
431 ac_prev=localstatedir ;;
432 -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \
433 | --localstate=* | --localstat=* | --localsta=* | --localst=* \
434 | --locals=* | --local=* | --loca=* | --loc=* | --lo=*)
435 localstatedir=$ac_optarg ;;
436
437 -mandir | --mandir | --mandi | --mand | --man | --ma | --m)
438 ac_prev=mandir ;;
439 -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*)
440 mandir=$ac_optarg ;;
441
442 -nfp | --nfp | --nf)
443 # Obsolete; use --without-fp.
444 with_fp=no ;;
445
446 -no-create | --no-create | --no-creat | --no-crea | --no-cre \
447 | --no-cr | --no-c | -n)
448 no_create=yes ;;
449
450 -no-recursion | --no-recursion | --no-recursio | --no-recursi \
451 | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r)
452 no_recursion=yes ;;
453
454 -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \
455 | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \
456 | --oldin | --oldi | --old | --ol | --o)
457 ac_prev=oldincludedir ;;
458 -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \
459 | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \
460 | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*)
461 oldincludedir=$ac_optarg ;;
462
463 -prefix | --prefix | --prefi | --pref | --pre | --pr | --p)
464 ac_prev=prefix ;;
465 -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*)
466 prefix=$ac_optarg ;;
467
468 -program-prefix | --program-prefix | --program-prefi | --program-pref \
469 | --program-pre | --program-pr | --program-p)
470 ac_prev=program_prefix ;;
471 -program-prefix=* | --program-prefix=* | --program-prefi=* \
472 | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*)
473 program_prefix=$ac_optarg ;;
474
475 -program-suffix | --program-suffix | --program-suffi | --program-suff \
476 | --program-suf | --program-su | --program-s)
477 ac_prev=program_suffix ;;
478 -program-suffix=* | --program-suffix=* | --program-suffi=* \
479 | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*)
480 program_suffix=$ac_optarg ;;
481
482 -program-transform-name | --program-transform-name \
483 | --program-transform-nam | --program-transform-na \
484 | --program-transform-n | --program-transform- \
485 | --program-transform | --program-transfor \
486 | --program-transfo | --program-transf \
487 | --program-trans | --program-tran \
488 | --progr-tra | --program-tr | --program-t)
489 ac_prev=program_transform_name ;;
490 -program-transform-name=* | --program-transform-name=* \
491 | --program-transform-nam=* | --program-transform-na=* \
492 | --program-transform-n=* | --program-transform-=* \
493 | --program-transform=* | --program-transfor=* \
494 | --program-transfo=* | --program-transf=* \
495 | --program-trans=* | --program-tran=* \
496 | --progr-tra=* | --program-tr=* | --program-t=*)
497 program_transform_name=$ac_optarg ;;
498
499 -q | -quiet | --quiet | --quie | --qui | --qu | --q \
500 | -silent | --silent | --silen | --sile | --sil)
501 silent=yes ;;
502
503 -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb)
504 ac_prev=sbindir ;;
505 -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \
506 | --sbi=* | --sb=*)
507 sbindir=$ac_optarg ;;
508
509 -sharedstatedir | --sharedstatedir | --sharedstatedi \
510 | --sharedstated | --sharedstate | --sharedstat | --sharedsta \
511 | --sharedst | --shareds | --shared | --share | --shar \
512 | --sha | --sh)
513 ac_prev=sharedstatedir ;;
514 -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \
515 | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \
516 | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \
517 | --sha=* | --sh=*)
518 sharedstatedir=$ac_optarg ;;
519
520 -site | --site | --sit)
521 ac_prev=site ;;
522 -site=* | --site=* | --sit=*)
523 site=$ac_optarg ;;
524
525 -srcdir | --srcdir | --srcdi | --srcd | --src | --sr)
526 ac_prev=srcdir ;;
527 -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*)
528 srcdir=$ac_optarg ;;
529
530 -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \
531 | --syscon | --sysco | --sysc | --sys | --sy)
532 ac_prev=sysconfdir ;;
533 -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \
534 | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*)
535 sysconfdir=$ac_optarg ;;
536
537 -target | --target | --targe | --targ | --tar | --ta | --t)
538 ac_prev=target_alias ;;
539 -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*)
540 target_alias=$ac_optarg ;;
541
542 -v | -verbose | --verbose | --verbos | --verbo | --verb)
543 verbose=yes ;;
544
545 -version | --version | --versio | --versi | --vers | -V)
546 ac_init_version=: ;;
547
548 -with-* | --with-*)
549 ac_package=`expr "x$ac_option" : 'x-*with-\([^=]*\)'`
550 # Reject names that are not valid shell variable names.
551 expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null &&
552 { echo "$as_me: error: invalid package name: $ac_package" >&2
553 { (exit 1); exit 1; }; }
554 ac_package=`echo $ac_package| sed 's/-/_/g'`
555 case $ac_option in
556 *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;;
557 *) ac_optarg=yes ;;
558 esac
559 eval "with_$ac_package='$ac_optarg'" ;;
560
561 -without-* | --without-*)
562 ac_package=`expr "x$ac_option" : 'x-*without-\(.*\)'`
563 # Reject names that are not valid shell variable names.
564 expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null &&
565 { echo "$as_me: error: invalid package name: $ac_package" >&2
566 { (exit 1); exit 1; }; }
567 ac_package=`echo $ac_package | sed 's/-/_/g'`
568 eval "with_$ac_package=no" ;;
569
570 --x)
571 # Obsolete; use --with-x.
572 with_x=yes ;;
573
574 -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \
575 | --x-incl | --x-inc | --x-in | --x-i)
576 ac_prev=x_includes ;;
577 -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \
578 | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*)
579 x_includes=$ac_optarg ;;
580
581 -x-libraries | --x-libraries | --x-librarie | --x-librari \
582 | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l)
583 ac_prev=x_libraries ;;
584 -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \
585 | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*)
586 x_libraries=$ac_optarg ;;
587
588 -*) { echo "$as_me: error: unrecognized option: $ac_option
589 Try \`$0 --help' for more information." >&2
590 { (exit 1); exit 1; }; }
591 ;;
592
593 *=*)
594 ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='`
595 # Reject names that are not valid shell variable names.
596 expr "x$ac_envvar" : ".*[^_$as_cr_alnum]" >/dev/null &&
597 { echo "$as_me: error: invalid variable name: $ac_envvar" >&2
598 { (exit 1); exit 1; }; }
599 ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`
600 eval "$ac_envvar='$ac_optarg'"
601 export $ac_envvar ;;
602
603 *)
604 # FIXME: should be removed in autoconf 3.0.
605 echo "$as_me: WARNING: you should use --build, --host, --target" >&2
606 expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null &&
607 echo "$as_me: WARNING: invalid host type: $ac_option" >&2
608 : ${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}
609 ;;
610
611 esac
612 done
613
614 if test -n "$ac_prev"; then
615 ac_option=--`echo $ac_prev | sed 's/_/-/g'`
616 { echo "$as_me: error: missing argument to $ac_option" >&2
617 { (exit 1); exit 1; }; }
618 fi
619
620 # Be sure to have absolute paths.
621 for ac_var in exec_prefix prefix
622 do
623 eval ac_val=$`echo $ac_var`
624 case $ac_val in
625 [\\/$]* | ?:[\\/]* | NONE | '' ) ;;
626 *) { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2
627 { (exit 1); exit 1; }; };;
628 esac
629 done
630
631 # Be sure to have absolute paths.
632 for ac_var in bindir sbindir libexecdir datadir sysconfdir sharedstatedir \
633 localstatedir libdir includedir oldincludedir infodir mandir
634 do
635 eval ac_val=$`echo $ac_var`
636 case $ac_val in
637 [\\/$]* | ?:[\\/]* ) ;;
638 *) { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2
639 { (exit 1); exit 1; }; };;
640 esac
641 done
642
643 # There might be people who depend on the old broken behavior: `$host'
644 # used to hold the argument of --host etc.
645 # FIXME: To remove some day.
646 build=$build_alias
647 host=$host_alias
648 target=$target_alias
649
650 # FIXME: To remove some day.
651 if test "x$host_alias" != x; then
652 if test "x$build_alias" = x; then
653 cross_compiling=maybe
654 echo "$as_me: WARNING: If you wanted to set the --build type, don't use --host.
655 If a cross compiler is detected then cross compile mode will be used." >&2
656 elif test "x$build_alias" != "x$host_alias"; then
657 cross_compiling=yes
658 fi
659 fi
660
661 ac_tool_prefix=
662 test -n "$host_alias" && ac_tool_prefix=$host_alias-
663
664 test "$silent" = yes && exec 6>/dev/null
665
666
667 # Find the source files, if location was not specified.
668 if test -z "$srcdir"; then
669 ac_srcdir_defaulted=yes
670 # Try the directory containing this script, then its parent.
671 ac_confdir=`(dirname "$0") 2>/dev/null ||
672 $as_expr X"$0" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
673 X"$0" : 'X\(//\)[^/]' \| \
674 X"$0" : 'X\(//\)$' \| \
675 X"$0" : 'X\(/\)' \| \
676 . : '\(.\)' 2>/dev/null ||
677 echo X"$0" |
678 sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
679 /^X\(\/\/\)[^/].*/{ s//\1/; q; }
680 /^X\(\/\/\)$/{ s//\1/; q; }
681 /^X\(\/\).*/{ s//\1/; q; }
682 s/.*/./; q'`
683 srcdir=$ac_confdir
684 if test ! -r $srcdir/$ac_unique_file; then
685 srcdir=..
686 fi
687 else
688 ac_srcdir_defaulted=no
689 fi
690 if test ! -r $srcdir/$ac_unique_file; then
691 if test "$ac_srcdir_defaulted" = yes; then
692 { echo "$as_me: error: cannot find sources ($ac_unique_file) in $ac_confdir or .." >&2
693 { (exit 1); exit 1; }; }
694 else
695 { echo "$as_me: error: cannot find sources ($ac_unique_file) in $srcdir" >&2
696 { (exit 1); exit 1; }; }
697 fi
698 fi
699 (cd $srcdir && test -r ./$ac_unique_file) 2>/dev/null ||
700 { echo "$as_me: error: sources are in $srcdir, but \`cd $srcdir' does not work" >&2
701 { (exit 1); exit 1; }; }
702 srcdir=`echo "$srcdir" | sed 's%\([^\\/]\)[\\/]*$%\1%'`
703 ac_env_build_alias_set=${build_alias+set}
704 ac_env_build_alias_value=$build_alias
705 ac_cv_env_build_alias_set=${build_alias+set}
706 ac_cv_env_build_alias_value=$build_alias
707 ac_env_host_alias_set=${host_alias+set}
708 ac_env_host_alias_value=$host_alias
709 ac_cv_env_host_alias_set=${host_alias+set}
710 ac_cv_env_host_alias_value=$host_alias
711 ac_env_target_alias_set=${target_alias+set}
712 ac_env_target_alias_value=$target_alias
713 ac_cv_env_target_alias_set=${target_alias+set}
714 ac_cv_env_target_alias_value=$target_alias
715 ac_env_CC_set=${CC+set}
716 ac_env_CC_value=$CC
717 ac_cv_env_CC_set=${CC+set}
718 ac_cv_env_CC_value=$CC
719 ac_env_CFLAGS_set=${CFLAGS+set}
720 ac_env_CFLAGS_value=$CFLAGS
721 ac_cv_env_CFLAGS_set=${CFLAGS+set}
722 ac_cv_env_CFLAGS_value=$CFLAGS
723 ac_env_LDFLAGS_set=${LDFLAGS+set}
724 ac_env_LDFLAGS_value=$LDFLAGS
725 ac_cv_env_LDFLAGS_set=${LDFLAGS+set}
726 ac_cv_env_LDFLAGS_value=$LDFLAGS
727 ac_env_CPPFLAGS_set=${CPPFLAGS+set}
728 ac_env_CPPFLAGS_value=$CPPFLAGS
729 ac_cv_env_CPPFLAGS_set=${CPPFLAGS+set}
730 ac_cv_env_CPPFLAGS_value=$CPPFLAGS
731
732 #
733 # Report the --help message.
734 #
735 if test "$ac_init_help" = "long"; then
736 # Omit some internal or obsolete options to make the list less imposing.
737 # This message is too long to be a string in the A/UX 3.1 sh.
738 cat <<_ACEOF
739 \`configure' configures this package to adapt to many kinds of systems.
740
741 Usage: $0 [OPTION]... [VAR=VALUE]...
742
743 To assign environment variables (e.g., CC, CFLAGS...), specify them as
744 VAR=VALUE. See below for descriptions of some of the useful variables.
745
746 Defaults for the options are specified in brackets.
747
748 Configuration:
749 -h, --help display this help and exit
750 --help=short display options specific to this package
751 --help=recursive display the short help of all the included packages
752 -V, --version display version information and exit
753 -q, --quiet, --silent do not print \`checking...' messages
754 --cache-file=FILE cache test results in FILE [disabled]
755 -C, --config-cache alias for \`--cache-file=config.cache'
756 -n, --no-create do not create output files
757 --srcdir=DIR find the sources in DIR [configure dir or \`..']
758
759 _ACEOF
760
761 cat <<_ACEOF
762 Installation directories:
763 --prefix=PREFIX install architecture-independent files in PREFIX
764 [$ac_default_prefix]
765 --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX
766 [PREFIX]
767
768 By default, \`make install' will install all the files in
769 \`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify
770 an installation prefix other than \`$ac_default_prefix' using \`--prefix',
771 for instance \`--prefix=\$HOME'.
772
773 For better control, use the options below.
774
775 Fine tuning of the installation directories:
776 --bindir=DIR user executables [EPREFIX/bin]
777 --sbindir=DIR system admin executables [EPREFIX/sbin]
778 --libexecdir=DIR program executables [EPREFIX/libexec]
779 --datadir=DIR read-only architecture-independent data [PREFIX/share]
780 --sysconfdir=DIR read-only single-machine data [PREFIX/etc]
781 --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com]
782 --localstatedir=DIR modifiable single-machine data [PREFIX/var]
783 --libdir=DIR object code libraries [EPREFIX/lib]
784 --includedir=DIR C header files [PREFIX/include]
785 --oldincludedir=DIR C header files for non-gcc [/usr/include]
786 --infodir=DIR info documentation [PREFIX/info]
787 --mandir=DIR man documentation [PREFIX/man]
788 _ACEOF
789
790 cat <<\_ACEOF
791
792 Program names:
793 --program-prefix=PREFIX prepend PREFIX to installed program names
794 --program-suffix=SUFFIX append SUFFIX to installed program names
795 --program-transform-name=PROGRAM run sed PROGRAM on installed program names
796 _ACEOF
797 fi
798
799 if test -n "$ac_init_help"; then
800
801 cat <<\_ACEOF
802
803 Optional Features:
804 --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no)
805 --enable-FEATURE[=ARG] include FEATURE [ARG=yes]
806 --disable-dependency-tracking speeds up one-time build
807 --enable-dependency-tracking do not reject slow dependency extractors
808
809 Optional Packages:
810 --with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
811 --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no)
812 --with-curl-config=PATH Location of libcurl curl-config
813
814 Some influential environment variables:
815 CC C compiler command
816 CFLAGS C compiler flags
817 LDFLAGS linker flags, e.g. -L<lib dir> if you have libraries in a
818 nonstandard directory <lib dir>
819 CPPFLAGS C/C++ preprocessor flags, e.g. -I<include dir> if you have
820 headers in a nonstandard directory <include dir>
821
822 Use these variables to override the choices made by `configure' or to help
823 it to find libraries and programs with nonstandard names/locations.
824
825 _ACEOF
826 fi
827
828 if test "$ac_init_help" = "recursive"; then
829 # If there are subdirs, report their specific --help.
830 ac_popdir=`pwd`
831 for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue
832 test -d $ac_dir || continue
833 ac_builddir=.
834
835 if test "$ac_dir" != .; then
836 ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'`
837 # A "../" for each directory in $ac_dir_suffix.
838 ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'`
839 else
840 ac_dir_suffix= ac_top_builddir=
841 fi
842
843 case $srcdir in
844 .) # No --srcdir option. We are building in place.
845 ac_srcdir=.
846 if test -z "$ac_top_builddir"; then
847 ac_top_srcdir=.
848 else
849 ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'`
850 fi ;;
851 [\\/]* | ?:[\\/]* ) # Absolute path.
852 ac_srcdir=$srcdir$ac_dir_suffix;
853 ac_top_srcdir=$srcdir ;;
854 *) # Relative path.
855 ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix
856 ac_top_srcdir=$ac_top_builddir$srcdir ;;
857 esac
858
859 # Do not use `cd foo && pwd` to compute absolute paths, because
860 # the directories may not exist.
861 case `pwd` in
862 .) ac_abs_builddir="$ac_dir";;
863 *)
864 case "$ac_dir" in
865 .) ac_abs_builddir=`pwd`;;
866 [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";;
867 *) ac_abs_builddir=`pwd`/"$ac_dir";;
868 esac;;
869 esac
870 case $ac_abs_builddir in
871 .) ac_abs_top_builddir=${ac_top_builddir}.;;
872 *)
873 case ${ac_top_builddir}. in
874 .) ac_abs_top_builddir=$ac_abs_builddir;;
875 [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;;
876 *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;;
877 esac;;
878 esac
879 case $ac_abs_builddir in
880 .) ac_abs_srcdir=$ac_srcdir;;
881 *)
882 case $ac_srcdir in
883 .) ac_abs_srcdir=$ac_abs_builddir;;
884 [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;;
885 *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;;
886 esac;;
887 esac
888 case $ac_abs_builddir in
889 .) ac_abs_top_srcdir=$ac_top_srcdir;;
890 *)
891 case $ac_top_srcdir in
892 .) ac_abs_top_srcdir=$ac_abs_builddir;;
893 [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;;
894 *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;;
895 esac;;
896 esac
897
898 cd $ac_dir
899 # Check for guested configure; otherwise get Cygnus style configure.
900 if test -f $ac_srcdir/configure.gnu; then
901 echo
902 $SHELL $ac_srcdir/configure.gnu --help=recursive
903 elif test -f $ac_srcdir/configure; then
904 echo
905 $SHELL $ac_srcdir/configure --help=recursive
906 elif test -f $ac_srcdir/configure.ac ||
907 test -f $ac_srcdir/configure.in; then
908 echo
909 $ac_configure --help
910 else
911 echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2
912 fi
913 cd $ac_popdir
914 done
915 fi
916
917 test -n "$ac_init_help" && exit 0
918 if $ac_init_version; then
919 cat <<\_ACEOF
920
921 Copyright (C) 2003 Free Software Foundation, Inc.
922 This configure script is free software; the Free Software Foundation
923 gives unlimited permission to copy, distribute and modify it.
924 _ACEOF
925 exit 0
926 fi
927 exec 5>config.log
928 cat >&5 <<_ACEOF
929 This file contains any messages produced by compilers while
930 running configure, to aid debugging if configure makes a mistake.
931
932 It was created by $as_me, which was
933 generated by GNU Autoconf 2.59. Invocation command line was
934
935 $ $0 $@
936
937 _ACEOF
938 {
939 cat <<_ASUNAME
940 ## --------- ##
941 ## Platform. ##
942 ## --------- ##
943
944 hostname = `(hostname || uname -n) 2>/dev/null | sed 1q`
945 uname -m = `(uname -m) 2>/dev/null || echo unknown`
946 uname -r = `(uname -r) 2>/dev/null || echo unknown`
947 uname -s = `(uname -s) 2>/dev/null || echo unknown`
948 uname -v = `(uname -v) 2>/dev/null || echo unknown`
949
950 /usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown`
951 /bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown`
952
953 /bin/arch = `(/bin/arch) 2>/dev/null || echo unknown`
954 /usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown`
955 /usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown`
956 hostinfo = `(hostinfo) 2>/dev/null || echo unknown`
957 /bin/machine = `(/bin/machine) 2>/dev/null || echo unknown`
958 /usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown`
959 /bin/universe = `(/bin/universe) 2>/dev/null || echo unknown`
960
961 _ASUNAME
962
963 as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
964 for as_dir in $PATH
965 do
966 IFS=$as_save_IFS
967 test -z "$as_dir" && as_dir=.
968 echo "PATH: $as_dir"
969 done
970
971 } >&5
972
973 cat >&5 <<_ACEOF
974
975
976 ## ----------- ##
977 ## Core tests. ##
978 ## ----------- ##
979
980 _ACEOF
981
982
983 # Keep a trace of the command line.
984 # Strip out --no-create and --no-recursion so they do not pile up.
985 # Strip out --silent because we don't want to record it for future runs.
986 # Also quote any args containing shell meta-characters.
987 # Make two passes to allow for proper duplicate-argument suppression.
988 ac_configure_args=
989 ac_configure_args0=
990 ac_configure_args1=
991 ac_sep=
992 ac_must_keep_next=false
993 for ac_pass in 1 2
994 do
995 for ac_arg
996 do
997 case $ac_arg in
998 -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;;
999 -q | -quiet | --quiet | --quie | --qui | --qu | --q \
1000 | -silent | --silent | --silen | --sile | --sil)
1001 continue ;;
1002 *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*)
1003 ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;;
1004 esac
1005 case $ac_pass in
1006 1) ac_configure_args0="$ac_configure_args0 '$ac_arg'" ;;
1007 2)
1008 ac_configure_args1="$ac_configure_args1 '$ac_arg'"
1009 if test $ac_must_keep_next = true; then
1010 ac_must_keep_next=false # Got value, back to normal.
1011 else
1012 case $ac_arg in
1013 *=* | --config-cache | -C | -disable-* | --disable-* \
1014 | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \
1015 | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \
1016 | -with-* | --with-* | -without-* | --without-* | --x)
1017 case "$ac_configure_args0 " in
1018 "$ac_configure_args1"*" '$ac_arg' "* ) continue ;;
1019 esac
1020 ;;
1021 -* ) ac_must_keep_next=true ;;
1022 esac
1023 fi
1024 ac_configure_args="$ac_configure_args$ac_sep'$ac_arg'"
1025 # Get rid of the leading space.
1026 ac_sep=" "
1027 ;;
1028 esac
1029 done
1030 done
1031 $as_unset ac_configure_args0 || test "${ac_configure_args0+set}" != set || { ac_configure_args0=; export ac_configure_args0; }
1032 $as_unset ac_configure_args1 || test "${ac_configure_args1+set}" != set || { ac_configure_args1=; export ac_configure_args1; }
1033
1034 # When interrupted or exit'd, cleanup temporary files, and complete
1035 # config.log. We remove comments because anyway the quotes in there
1036 # would cause problems or look ugly.
1037 # WARNING: Be sure not to use single quotes in there, as some shells,
1038 # such as our DU 5.0 friend, will then `close' the trap.
1039 trap 'exit_status=$?
1040 # Save into config.log some information that might help in debugging.
1041 {
1042 echo
1043
1044 cat <<\_ASBOX
1045 ## ---------------- ##
1046 ## Cache variables. ##
1047 ## ---------------- ##
1048 _ASBOX
1049 echo
1050 # The following way of writing the cache mishandles newlines in values,
1051 {
1052 (set) 2>&1 |
1053 case `(ac_space='"'"' '"'"'; set | grep ac_space) 2>&1` in
1054 *ac_space=\ *)
1055 sed -n \
1056 "s/'"'"'/'"'"'\\\\'"'"''"'"'/g;
1057 s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='"'"'\\2'"'"'/p"
1058 ;;
1059 *)
1060 sed -n \
1061 "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p"
1062 ;;
1063 esac;
1064 }
1065 echo
1066
1067 cat <<\_ASBOX
1068 ## ----------------- ##
1069 ## Output variables. ##
1070 ## ----------------- ##
1071 _ASBOX
1072 echo
1073 for ac_var in $ac_subst_vars
1074 do
1075 eval ac_val=$`echo $ac_var`
1076 echo "$ac_var='"'"'$ac_val'"'"'"
1077 done | sort
1078 echo
1079
1080 if test -n "$ac_subst_files"; then
1081 cat <<\_ASBOX
1082 ## ------------- ##
1083 ## Output files. ##
1084 ## ------------- ##
1085 _ASBOX
1086 echo
1087 for ac_var in $ac_subst_files
1088 do
1089 eval ac_val=$`echo $ac_var`
1090 echo "$ac_var='"'"'$ac_val'"'"'"
1091 done | sort
1092 echo
1093 fi
1094
1095 if test -s confdefs.h; then
1096 cat <<\_ASBOX
1097 ## ----------- ##
1098 ## confdefs.h. ##
1099 ## ----------- ##
1100 _ASBOX
1101 echo
1102 sed "/^$/d" confdefs.h | sort
1103 echo
1104 fi
1105 test "$ac_signal" != 0 &&
1106 echo "$as_me: caught signal $ac_signal"
1107 echo "$as_me: exit $exit_status"
1108 } >&5
1109 rm -f core *.core &&
1110 rm -rf conftest* confdefs* conf$$* $ac_clean_files &&
1111 exit $exit_status
1112 ' 0
1113 for ac_signal in 1 2 13 15; do
1114 trap 'ac_signal='$ac_signal'; { (exit 1); exit 1; }' $ac_signal
1115 done
1116 ac_signal=0
1117
1118 # confdefs.h avoids OS command line length limits that DEFS can exceed.
1119 rm -rf conftest* confdefs.h
1120 # AIX cpp loses on an empty file, so make sure it contains at least a newline.
1121 echo >confdefs.h
1122
1123 # Predefined preprocessor variables.
1124
1125 cat >>confdefs.h <<_ACEOF
1126 #define PACKAGE_NAME "$PACKAGE_NAME"
1127 _ACEOF
1128
1129
1130 cat >>confdefs.h <<_ACEOF
1131 #define PACKAGE_TARNAME "$PACKAGE_TARNAME"
1132 _ACEOF
1133
1134
1135 cat >>confdefs.h <<_ACEOF
1136 #define PACKAGE_VERSION "$PACKAGE_VERSION"
1137 _ACEOF
1138
1139
1140 cat >>confdefs.h <<_ACEOF
1141 #define PACKAGE_STRING "$PACKAGE_STRING"
1142 _ACEOF
1143
1144
1145 cat >>confdefs.h <<_ACEOF
1146 #define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT"
1147 _ACEOF
1148
1149
1150 # Let the site file select an alternate cache file if it wants to.
1151 # Prefer explicitly selected file to automatically selected ones.
1152 if test -z "$CONFIG_SITE"; then
1153 if test "x$prefix" != xNONE; then
1154 CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site"
1155 else
1156 CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site"
1157 fi
1158 fi
1159 for ac_site_file in $CONFIG_SITE; do
1160 if test -r "$ac_site_file"; then
1161 { echo "$as_me:$LINENO: loading site script $ac_site_file" >&5
1162 echo "$as_me: loading site script $ac_site_file" >&6;}
1163 sed 's/^/| /' "$ac_site_file" >&5
1164 . "$ac_site_file"
1165 fi
1166 done
1167
1168 if test -r "$cache_file"; then
1169 # Some versions of bash will fail to source /dev/null (special
1170 # files actually), so we avoid doing that.
1171 if test -f "$cache_file"; then
1172 { echo "$as_me:$LINENO: loading cache $cache_file" >&5
1173 echo "$as_me: loading cache $cache_file" >&6;}
1174 case $cache_file in
1175 [\\/]* | ?:[\\/]* ) . $cache_file;;
1176 *) . ./$cache_file;;
1177 esac
1178 fi
1179 else
1180 { echo "$as_me:$LINENO: creating cache $cache_file" >&5
1181 echo "$as_me: creating cache $cache_file" >&6;}
1182 >$cache_file
1183 fi
1184
1185 # Check that the precious variables saved in the cache have kept the same
1186 # value.
1187 ac_cache_corrupted=false
1188 for ac_var in `(set) 2>&1 |
1189 sed -n 's/^ac_env_\([a-zA-Z_0-9]*\)_set=.*/\1/p'`; do
1190 eval ac_old_set=\$ac_cv_env_${ac_var}_set
1191 eval ac_new_set=\$ac_env_${ac_var}_set
1192 eval ac_old_val="\$ac_cv_env_${ac_var}_value"
1193 eval ac_new_val="\$ac_env_${ac_var}_value"
1194 case $ac_old_set,$ac_new_set in
1195 set,)
1196 { echo "$as_me:$LINENO: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5
1197 echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;}
1198 ac_cache_corrupted=: ;;
1199 ,set)
1200 { echo "$as_me:$LINENO: error: \`$ac_var' was not set in the previous run" >&5
1201 echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;}
1202 ac_cache_corrupted=: ;;
1203 ,);;
1204 *)
1205 if test "x$ac_old_val" != "x$ac_new_val"; then
1206 { echo "$as_me:$LINENO: error: \`$ac_var' has changed since the previous run:" >&5
1207 echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;}
1208 { echo "$as_me:$LINENO: former value: $ac_old_val" >&5
1209 echo "$as_me: former value: $ac_old_val" >&2;}
1210 { echo "$as_me:$LINENO: current value: $ac_new_val" >&5
1211 echo "$as_me: current value: $ac_new_val" >&2;}
1212 ac_cache_corrupted=:
1213 fi;;
1214 esac
1215 # Pass precious variables to config.status.
1216 if test "$ac_new_set" = set; then
1217 case $ac_new_val in
1218 *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*)
1219 ac_arg=$ac_var=`echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;;
1220 *) ac_arg=$ac_var=$ac_new_val ;;
1221 esac
1222 case " $ac_configure_args " in
1223 *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy.
1224 *) ac_configure_args="$ac_configure_args '$ac_arg'" ;;
1225 esac
1226 fi
1227 done
1228 if $ac_cache_corrupted; then
1229 { echo "$as_me:$LINENO: error: changes in the environment can compromise the build" >&5
1230 echo "$as_me: error: changes in the environment can compromise the build" >&2;}
1231 { { echo "$as_me:$LINENO: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&5
1232 echo "$as_me: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&2;}
1233 { (exit 1); exit 1; }; }
1234 fi
1235
1236 ac_ext=c
1237 ac_cpp='$CPP $CPPFLAGS'
1238 ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
1239 ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
1240 ac_compiler_gnu=$ac_cv_c_compiler_gnu
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260 am__api_version="1.9"
1261 ac_aux_dir=
1262 for ac_dir in $srcdir $srcdir/.. $srcdir/../..; do
1263 if test -f $ac_dir/install-sh; then
1264 ac_aux_dir=$ac_dir
1265 ac_install_sh="$ac_aux_dir/install-sh -c"
1266 break
1267 elif test -f $ac_dir/install.sh; then
1268 ac_aux_dir=$ac_dir
1269 ac_install_sh="$ac_aux_dir/install.sh -c"
1270 break
1271 elif test -f $ac_dir/shtool; then
1272 ac_aux_dir=$ac_dir
1273 ac_install_sh="$ac_aux_dir/shtool install -c"
1274 break
1275 fi
1276 done
1277 if test -z "$ac_aux_dir"; then
1278 { { echo "$as_me:$LINENO: error: cannot find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." >&5
1279 echo "$as_me: error: cannot find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." >&2;}
1280 { (exit 1); exit 1; }; }
1281 fi
1282 ac_config_guess="$SHELL $ac_aux_dir/config.guess"
1283 ac_config_sub="$SHELL $ac_aux_dir/config.sub"
1284 ac_configure="$SHELL $ac_aux_dir/configure" # This should be Cygnus configure.
1285
1286 # Find a good install program. We prefer a C program (faster),
1287 # so one script is as good as another. But avoid the broken or
1288 # incompatible versions:
1289 # SysV /etc/install, /usr/sbin/install
1290 # SunOS /usr/etc/install
1291 # IRIX /sbin/install
1292 # AIX /bin/install
1293 # AmigaOS /C/install, which installs bootblocks on floppy discs
1294 # AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag
1295 # AFS /usr/afsws/bin/install, which mishandles nonexistent args
1296 # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
1297 # OS/2's system install, which has a completely different semantic
1298 # ./install, which can be erroneously created by make from ./install.sh.
1299 echo "$as_me:$LINENO: checking for a BSD-compatible install" >&5
1300 echo $ECHO_N "checking for a BSD-compatible install... $ECHO_C" >&6
1301 if test -z "$INSTALL"; then
1302 if test "${ac_cv_path_install+set}" = set; then
1303 echo $ECHO_N "(cached) $ECHO_C" >&6
1304 else
1305 as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
1306 for as_dir in $PATH
1307 do
1308 IFS=$as_save_IFS
1309 test -z "$as_dir" && as_dir=.
1310 # Account for people who put trailing slashes in PATH elements.
1311 case $as_dir/ in
1312 ./ | .// | /cC/* | \
1313 /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \
1314 ?:\\/os2\\/install\\/* | ?:\\/OS2\\/INSTALL\\/* | \
1315 /usr/ucb/* ) ;;
1316 *)
1317 # OSF1 and SCO ODT 3.0 have their own names for install.
1318 # Don't use installbsd from OSF since it installs stuff as root
1319 # by default.
1320 for ac_prog in ginstall scoinst install; do
1321 for ac_exec_ext in '' $ac_executable_extensions; do
1322 if $as_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then
1323 if test $ac_prog = install &&
1324 grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then
1325 # AIX install. It has an incompatible calling convention.
1326 :
1327 elif test $ac_prog = install &&
1328 grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then
1329 # program-specific install script used by HP pwplus--don't use.
1330 :
1331 else
1332 ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c"
1333 break 3
1334 fi
1335 fi
1336 done
1337 done
1338 ;;
1339 esac
1340 done
1341
1342
1343 fi
1344 if test "${ac_cv_path_install+set}" = set; then
1345 INSTALL=$ac_cv_path_install
1346 else
1347 # As a last resort, use the slow shell script. We don't cache a
1348 # path for INSTALL within a source directory, because that will
1349 # break other packages using the cache if that directory is
1350 # removed, or if the path is relative.
1351 INSTALL=$ac_install_sh
1352 fi
1353 fi
1354 echo "$as_me:$LINENO: result: $INSTALL" >&5
1355 echo "${ECHO_T}$INSTALL" >&6
1356
1357 # Use test -z because SunOS4 sh mishandles braces in ${var-val}.
1358 # It thinks the first close brace ends the variable substitution.
1359 test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}'
1360
1361 test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}'
1362
1363 test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
1364
1365 echo "$as_me:$LINENO: checking whether build environment is sane" >&5
1366 echo $ECHO_N "checking whether build environment is sane... $ECHO_C" >&6
1367 # Just in case
1368 sleep 1
1369 echo timestamp > conftest.file
1370 # Do `set' in a subshell so we don't clobber the current shell's
1371 # arguments. Must try -L first in case configure is actually a
1372 # symlink; some systems play weird games with the mod time of symlinks
1373 # (eg FreeBSD returns the mod time of the symlink's containing
1374 # directory).
1375 if (
1376 set X `ls -Lt $srcdir/configure conftest.file 2> /dev/null`
1377 if test "$*" = "X"; then
1378 # -L didn't work.
1379 set X `ls -t $srcdir/configure conftest.file`
1380 fi
1381 rm -f conftest.file
1382 if test "$*" != "X $srcdir/configure conftest.file" \
1383 && test "$*" != "X conftest.file $srcdir/configure"; then
1384
1385 # If neither matched, then we have a broken ls. This can happen
1386 # if, for instance, CONFIG_SHELL is bash and it inherits a
1387 # broken ls alias from the environment. This has actually
1388 # happened. Such a system could not be considered "sane".
1389 { { echo "$as_me:$LINENO: error: ls -t appears to fail. Make sure there is not a broken
1390 alias in your environment" >&5
1391 echo "$as_me: error: ls -t appears to fail. Make sure there is not a broken
1392 alias in your environment" >&2;}
1393 { (exit 1); exit 1; }; }
1394 fi
1395
1396 test "$2" = conftest.file
1397 )
1398 then
1399 # Ok.
1400 :
1401 else
1402 { { echo "$as_me:$LINENO: error: newly created file is older than distributed files!
1403 Check your system clock" >&5
1404 echo "$as_me: error: newly created file is older than distributed files!
1405 Check your system clock" >&2;}
1406 { (exit 1); exit 1; }; }
1407 fi
1408 echo "$as_me:$LINENO: result: yes" >&5
1409 echo "${ECHO_T}yes" >&6
1410 test "$program_prefix" != NONE &&
1411 program_transform_name="s,^,$program_prefix,;$program_transform_name"
1412 # Use a double $ so make ignores it.
1413 test "$program_suffix" != NONE &&
1414 program_transform_name="s,\$,$program_suffix,;$program_transform_name"
1415 # Double any \ or $. echo might interpret backslashes.
1416 # By default was `s,x,x', remove it if useless.
1417 cat <<\_ACEOF >conftest.sed
1418 s/[\\$]/&&/g;s/;s,x,x,$//
1419 _ACEOF
1420 program_transform_name=`echo $program_transform_name | sed -f conftest.sed`
1421 rm conftest.sed
1422
1423 # expand $ac_aux_dir to an absolute path
1424 am_aux_dir=`cd $ac_aux_dir && pwd`
1425
1426 test x"${MISSING+set}" = xset || MISSING="\${SHELL} $am_aux_dir/missing"
1427 # Use eval to expand $SHELL
1428 if eval "$MISSING --run true"; then
1429 am_missing_run="$MISSING --run "
1430 else
1431 am_missing_run=
1432 { echo "$as_me:$LINENO: WARNING: \`missing' script is too old or missing" >&5
1433 echo "$as_me: WARNING: \`missing' script is too old or missing" >&2;}
1434 fi
1435
1436 if mkdir -p --version . >/dev/null 2>&1 && test ! -d ./--version; then
1437 # We used to keeping the `.' as first argument, in order to
1438 # allow $(mkdir_p) to be used without argument. As in
1439 # $(mkdir_p) $(somedir)
1440 # where $(somedir) is conditionally defined. However this is wrong
1441 # for two reasons:
1442 # 1. if the package is installed by a user who cannot write `.'
1443 # make install will fail,
1444 # 2. the above comment should most certainly read
1445 # $(mkdir_p) $(DESTDIR)$(somedir)
1446 # so it does not work when $(somedir) is undefined and
1447 # $(DESTDIR) is not.
1448 # To support the latter case, we have to write
1449 # test -z "$(somedir)" || $(mkdir_p) $(DESTDIR)$(somedir),
1450 # so the `.' trick is pointless.
1451 mkdir_p='mkdir -p --'
1452 else
1453 # On NextStep and OpenStep, the `mkdir' command does not
1454 # recognize any option. It will interpret all options as
1455 # directories to create, and then abort because `.' already
1456 # exists.
1457 for d in ./-p ./--version;
1458 do
1459 test -d $d && rmdir $d
1460 done
1461 # $(mkinstalldirs) is defined by Automake if mkinstalldirs exists.
1462 if test -f "$ac_aux_dir/mkinstalldirs"; then
1463 mkdir_p='$(mkinstalldirs)'
1464 else
1465 mkdir_p='$(install_sh) -d'
1466 fi
1467 fi
1468
1469 for ac_prog in gawk mawk nawk awk
1470 do
1471 # Extract the first word of "$ac_prog", so it can be a program name with args.
1472 set dummy $ac_prog; ac_word=$2
1473 echo "$as_me:$LINENO: checking for $ac_word" >&5
1474 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
1475 if test "${ac_cv_prog_AWK+set}" = set; then
1476 echo $ECHO_N "(cached) $ECHO_C" >&6
1477 else
1478 if test -n "$AWK"; then
1479 ac_cv_prog_AWK="$AWK" # Let the user override the test.
1480 else
1481 as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
1482 for as_dir in $PATH
1483 do
1484 IFS=$as_save_IFS
1485 test -z "$as_dir" && as_dir=.
1486 for ac_exec_ext in '' $ac_executable_extensions; do
1487 if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
1488 ac_cv_prog_AWK="$ac_prog"
1489 echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
1490 break 2
1491 fi
1492 done
1493 done
1494
1495 fi
1496 fi
1497 AWK=$ac_cv_prog_AWK
1498 if test -n "$AWK"; then
1499 echo "$as_me:$LINENO: result: $AWK" >&5
1500 echo "${ECHO_T}$AWK" >&6
1501 else
1502 echo "$as_me:$LINENO: result: no" >&5
1503 echo "${ECHO_T}no" >&6
1504 fi
1505
1506 test -n "$AWK" && break
1507 done
1508
1509 echo "$as_me:$LINENO: checking whether ${MAKE-make} sets \$(MAKE)" >&5
1510 echo $ECHO_N "checking whether ${MAKE-make} sets \$(MAKE)... $ECHO_C" >&6
1511 set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y,:./+-,___p_,'`
1512 if eval "test \"\${ac_cv_prog_make_${ac_make}_set+set}\" = set"; then
1513 echo $ECHO_N "(cached) $ECHO_C" >&6
1514 else
1515 cat >conftest.make <<\_ACEOF
1516 all:
1517 @echo 'ac_maketemp="$(MAKE)"'
1518 _ACEOF
1519 # GNU make sometimes prints "make[1]: Entering...", which would confuse us.
1520 eval `${MAKE-make} -f conftest.make 2>/dev/null | grep temp=`
1521 if test -n "$ac_maketemp"; then
1522 eval ac_cv_prog_make_${ac_make}_set=yes
1523 else
1524 eval ac_cv_prog_make_${ac_make}_set=no
1525 fi
1526 rm -f conftest.make
1527 fi
1528 if eval "test \"`echo '$ac_cv_prog_make_'${ac_make}_set`\" = yes"; then
1529 echo "$as_me:$LINENO: result: yes" >&5
1530 echo "${ECHO_T}yes" >&6
1531 SET_MAKE=
1532 else
1533 echo "$as_me:$LINENO: result: no" >&5
1534 echo "${ECHO_T}no" >&6
1535 SET_MAKE="MAKE=${MAKE-make}"
1536 fi
1537
1538 rm -rf .tst 2>/dev/null
1539 mkdir .tst 2>/dev/null
1540 if test -d .tst; then
1541 am__leading_dot=.
1542 else
1543 am__leading_dot=_
1544 fi
1545 rmdir .tst 2>/dev/null
1546
1547 # test to see if srcdir already configured
1548 if test "`cd $srcdir && pwd`" != "`pwd`" &&
1549 test -f $srcdir/config.status; then
1550 { { echo "$as_me:$LINENO: error: source directory already configured; run \"make distclean\" there first" >&5
1551 echo "$as_me: error: source directory already configured; run \"make distclean\" there first" >&2;}
1552 { (exit 1); exit 1; }; }
1553 fi
1554
1555 # test whether we have cygpath
1556 if test -z "$CYGPATH_W"; then
1557 if (cygpath --version) >/dev/null 2>/dev/null; then
1558 CYGPATH_W='cygpath -w'
1559 else
1560 CYGPATH_W=echo
1561 fi
1562 fi
1563
1564
1565 # Define the identity of the package.
1566 PACKAGE=esniper
1567 VERSION=2.16.0
1568
1569
1570 cat >>confdefs.h <<_ACEOF
1571 #define PACKAGE "$PACKAGE"
1572 _ACEOF
1573
1574
1575 cat >>confdefs.h <<_ACEOF
1576 #define VERSION "$VERSION"
1577 _ACEOF
1578
1579 # Some tools Automake needs.
1580
1581 ACLOCAL=${ACLOCAL-"${am_missing_run}aclocal-${am__api_version}"}
1582
1583
1584 AUTOCONF=${AUTOCONF-"${am_missing_run}autoconf"}
1585
1586
1587 AUTOMAKE=${AUTOMAKE-"${am_missing_run}automake-${am__api_version}"}
1588
1589
1590 AUTOHEADER=${AUTOHEADER-"${am_missing_run}autoheader"}
1591
1592
1593 MAKEINFO=${MAKEINFO-"${am_missing_run}makeinfo"}
1594
1595 install_sh=${install_sh-"$am_aux_dir/install-sh"}
1596
1597 # Installed binaries are usually stripped using `strip' when the user
1598 # run `make install-strip'. However `strip' might not be the right
1599 # tool to use in cross-compilation environments, therefore Automake
1600 # will honor the `STRIP' environment variable to overrule this program.
1601 if test "$cross_compiling" != no; then
1602 if test -n "$ac_tool_prefix"; then
1603 # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args.
1604 set dummy ${ac_tool_prefix}strip; ac_word=$2
1605 echo "$as_me:$LINENO: checking for $ac_word" >&5
1606 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
1607 if test "${ac_cv_prog_STRIP+set}" = set; then
1608 echo $ECHO_N "(cached) $ECHO_C" >&6
1609 else
1610 if test -n "$STRIP"; then
1611 ac_cv_prog_STRIP="$STRIP" # Let the user override the test.
1612 else
1613 as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
1614 for as_dir in $PATH
1615 do
1616 IFS=$as_save_IFS
1617 test -z "$as_dir" && as_dir=.
1618 for ac_exec_ext in '' $ac_executable_extensions; do
1619 if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
1620 ac_cv_prog_STRIP="${ac_tool_prefix}strip"
1621 echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
1622 break 2
1623 fi
1624 done
1625 done
1626
1627 fi
1628 fi
1629 STRIP=$ac_cv_prog_STRIP
1630 if test -n "$STRIP"; then
1631 echo "$as_me:$LINENO: result: $STRIP" >&5
1632 echo "${ECHO_T}$STRIP" >&6
1633 else
1634 echo "$as_me:$LINENO: result: no" >&5
1635 echo "${ECHO_T}no" >&6
1636 fi
1637
1638 fi
1639 if test -z "$ac_cv_prog_STRIP"; then
1640 ac_ct_STRIP=$STRIP
1641 # Extract the first word of "strip", so it can be a program name with args.
1642 set dummy strip; ac_word=$2
1643 echo "$as_me:$LINENO: checking for $ac_word" >&5
1644 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
1645 if test "${ac_cv_prog_ac_ct_STRIP+set}" = set; then
1646 echo $ECHO_N "(cached) $ECHO_C" >&6
1647 else
1648 if test -n "$ac_ct_STRIP"; then
1649 ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test.
1650 else
1651 as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
1652 for as_dir in $PATH
1653 do
1654 IFS=$as_save_IFS
1655 test -z "$as_dir" && as_dir=.
1656 for ac_exec_ext in '' $ac_executable_extensions; do
1657 if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
1658 ac_cv_prog_ac_ct_STRIP="strip"
1659 echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
1660 break 2
1661 fi
1662 done
1663 done
1664
1665 test -z "$ac_cv_prog_ac_ct_STRIP" && ac_cv_prog_ac_ct_STRIP=":"
1666 fi
1667 fi
1668 ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP
1669 if test -n "$ac_ct_STRIP"; then
1670 echo "$as_me:$LINENO: result: $ac_ct_STRIP" >&5
1671 echo "${ECHO_T}$ac_ct_STRIP" >&6
1672 else
1673 echo "$as_me:$LINENO: result: no" >&5
1674 echo "${ECHO_T}no" >&6
1675 fi
1676
1677 STRIP=$ac_ct_STRIP
1678 else
1679 STRIP="$ac_cv_prog_STRIP"
1680 fi
1681
1682 fi
1683 INSTALL_STRIP_PROGRAM="\${SHELL} \$(install_sh) -c -s"
1684
1685 # We need awk for the "check" target. The system "awk" is bad on
1686 # some platforms.
1687 # Always define AMTAR for backward compatibility.
1688
1689 AMTAR=${AMTAR-"${am_missing_run}tar"}
1690
1691 am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -'
1692
1693
1694
1695
1696
1697 ac_ext=c
1698 ac_cpp='$CPP $CPPFLAGS'
1699 ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
1700 ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
1701 ac_compiler_gnu=$ac_cv_c_compiler_gnu
1702 if test -n "$ac_tool_prefix"; then
1703 # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args.
1704 set dummy ${ac_tool_prefix}gcc; ac_word=$2
1705 echo "$as_me:$LINENO: checking for $ac_word" >&5
1706 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
1707 if test "${ac_cv_prog_CC+set}" = set; then
1708 echo $ECHO_N "(cached) $ECHO_C" >&6
1709 else
1710 if test -n "$CC"; then
1711 ac_cv_prog_CC="$CC" # Let the user override the test.
1712 else
1713 as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
1714 for as_dir in $PATH
1715 do
1716 IFS=$as_save_IFS
1717 test -z "$as_dir" && as_dir=.
1718 for ac_exec_ext in '' $ac_executable_extensions; do
1719 if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
1720 ac_cv_prog_CC="${ac_tool_prefix}gcc"
1721 echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
1722 break 2
1723 fi
1724 done
1725 done
1726
1727 fi
1728 fi
1729 CC=$ac_cv_prog_CC
1730 if test -n "$CC"; then
1731 echo "$as_me:$LINENO: result: $CC" >&5
1732 echo "${ECHO_T}$CC" >&6
1733 else
1734 echo "$as_me:$LINENO: result: no" >&5
1735 echo "${ECHO_T}no" >&6
1736 fi
1737
1738 fi
1739 if test -z "$ac_cv_prog_CC"; then
1740 ac_ct_CC=$CC
1741 # Extract the first word of "gcc", so it can be a program name with args.
1742 set dummy gcc; ac_word=$2
1743 echo "$as_me:$LINENO: checking for $ac_word" >&5
1744 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
1745 if test "${ac_cv_prog_ac_ct_CC+set}" = set; then
1746 echo $ECHO_N "(cached) $ECHO_C" >&6
1747 else
1748 if test -n "$ac_ct_CC"; then
1749 ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
1750 else
1751 as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
1752 for as_dir in $PATH
1753 do
1754 IFS=$as_save_IFS
1755 test -z "$as_dir" && as_dir=.
1756 for ac_exec_ext in '' $ac_executable_extensions; do
1757 if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
1758 ac_cv_prog_ac_ct_CC="gcc"
1759 echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
1760 break 2
1761 fi
1762 done
1763 done
1764
1765 fi
1766 fi
1767 ac_ct_CC=$ac_cv_prog_ac_ct_CC
1768 if test -n "$ac_ct_CC"; then
1769 echo "$as_me:$LINENO: result: $ac_ct_CC" >&5
1770 echo "${ECHO_T}$ac_ct_CC" >&6
1771 else
1772 echo "$as_me:$LINENO: result: no" >&5
1773 echo "${ECHO_T}no" >&6
1774 fi
1775
1776 CC=$ac_ct_CC
1777 else
1778 CC="$ac_cv_prog_CC"
1779 fi
1780
1781 if test -z "$CC"; then
1782 if test -n "$ac_tool_prefix"; then
1783 # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args.
1784 set dummy ${ac_tool_prefix}cc; ac_word=$2
1785 echo "$as_me:$LINENO: checking for $ac_word" >&5
1786 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
1787 if test "${ac_cv_prog_CC+set}" = set; then
1788 echo $ECHO_N "(cached) $ECHO_C" >&6
1789 else
1790 if test -n "$CC"; then
1791 ac_cv_prog_CC="$CC" # Let the user override the test.
1792 else
1793 as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
1794 for as_dir in $PATH
1795 do
1796 IFS=$as_save_IFS
1797 test -z "$as_dir" && as_dir=.
1798 for ac_exec_ext in '' $ac_executable_extensions; do
1799 if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
1800 ac_cv_prog_CC="${ac_tool_prefix}cc"
1801 echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
1802 break 2
1803 fi
1804 done
1805 done
1806
1807 fi
1808 fi
1809 CC=$ac_cv_prog_CC
1810 if test -n "$CC"; then
1811 echo "$as_me:$LINENO: result: $CC" >&5
1812 echo "${ECHO_T}$CC" >&6
1813 else
1814 echo "$as_me:$LINENO: result: no" >&5
1815 echo "${ECHO_T}no" >&6
1816 fi
1817
1818 fi
1819 if test -z "$ac_cv_prog_CC"; then
1820 ac_ct_CC=$CC
1821 # Extract the first word of "cc", so it can be a program name with args.
1822 set dummy cc; ac_word=$2
1823 echo "$as_me:$LINENO: checking for $ac_word" >&5
1824 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
1825 if test "${ac_cv_prog_ac_ct_CC+set}" = set; then
1826 echo $ECHO_N "(cached) $ECHO_C" >&6
1827 else
1828 if test -n "$ac_ct_CC"; then
1829 ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
1830 else
1831 as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
1832 for as_dir in $PATH
1833 do
1834 IFS=$as_save_IFS
1835 test -z "$as_dir" && as_dir=.
1836 for ac_exec_ext in '' $ac_executable_extensions; do
1837 if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
1838 ac_cv_prog_ac_ct_CC="cc"
1839 echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
1840 break 2
1841 fi
1842 done
1843 done
1844
1845 fi
1846 fi
1847 ac_ct_CC=$ac_cv_prog_ac_ct_CC
1848 if test -n "$ac_ct_CC"; then
1849 echo "$as_me:$LINENO: result: $ac_ct_CC" >&5
1850 echo "${ECHO_T}$ac_ct_CC" >&6
1851 else
1852 echo "$as_me:$LINENO: result: no" >&5
1853 echo "${ECHO_T}no" >&6
1854 fi
1855
1856 CC=$ac_ct_CC
1857 else
1858 CC="$ac_cv_prog_CC"
1859 fi
1860
1861 fi
1862 if test -z "$CC"; then
1863 # Extract the first word of "cc", so it can be a program name with args.
1864 set dummy cc; ac_word=$2
1865 echo "$as_me:$LINENO: checking for $ac_word" >&5
1866 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
1867 if test "${ac_cv_prog_CC+set}" = set; then
1868 echo $ECHO_N "(cached) $ECHO_C" >&6
1869 else
1870 if test -n "$CC"; then
1871 ac_cv_prog_CC="$CC" # Let the user override the test.
1872 else
1873 ac_prog_rejected=no
1874 as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
1875 for as_dir in $PATH
1876 do
1877 IFS=$as_save_IFS
1878 test -z "$as_dir" && as_dir=.
1879 for ac_exec_ext in '' $ac_executable_extensions; do
1880 if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
1881 if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then
1882 ac_prog_rejected=yes
1883 continue
1884 fi
1885 ac_cv_prog_CC="cc"
1886 echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
1887 break 2
1888 fi
1889 done
1890 done
1891
1892 if test $ac_prog_rejected = yes; then
1893 # We found a bogon in the path, so make sure we never use it.
1894 set dummy $ac_cv_prog_CC
1895 shift
1896 if test $# != 0; then
1897 # We chose a different compiler from the bogus one.
1898 # However, it has the same basename, so the bogon will be chosen
1899 # first if we set CC to just the basename; use the full file name.
1900 shift
1901 ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@"
1902 fi
1903 fi
1904 fi
1905 fi
1906 CC=$ac_cv_prog_CC
1907 if test -n "$CC"; then
1908 echo "$as_me:$LINENO: result: $CC" >&5
1909 echo "${ECHO_T}$CC" >&6
1910 else
1911 echo "$as_me:$LINENO: result: no" >&5
1912 echo "${ECHO_T}no" >&6
1913 fi
1914
1915 fi
1916 if test -z "$CC"; then
1917 if test -n "$ac_tool_prefix"; then
1918 for ac_prog in cl
1919 do
1920 # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
1921 set dummy $ac_tool_prefix$ac_prog; ac_word=$2
1922 echo "$as_me:$LINENO: checking for $ac_word" >&5
1923 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
1924 if test "${ac_cv_prog_CC+set}" = set; then
1925 echo $ECHO_N "(cached) $ECHO_C" >&6
1926 else
1927 if test -n "$CC"; then
1928 ac_cv_prog_CC="$CC" # Let the user override the test.
1929 else
1930 as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
1931 for as_dir in $PATH
1932 do
1933 IFS=$as_save_IFS
1934 test -z "$as_dir" && as_dir=.
1935 for ac_exec_ext in '' $ac_executable_extensions; do
1936 if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
1937 ac_cv_prog_CC="$ac_tool_prefix$ac_prog"
1938 echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
1939 break 2
1940 fi
1941 done
1942 done
1943
1944 fi
1945 fi
1946 CC=$ac_cv_prog_CC
1947 if test -n "$CC"; then
1948 echo "$as_me:$LINENO: result: $CC" >&5
1949 echo "${ECHO_T}$CC" >&6
1950 else
1951 echo "$as_me:$LINENO: result: no" >&5
1952 echo "${ECHO_T}no" >&6
1953 fi
1954
1955 test -n "$CC" && break
1956 done
1957 fi
1958 if test -z "$CC"; then
1959 ac_ct_CC=$CC
1960 for ac_prog in cl
1961 do
1962 # Extract the first word of "$ac_prog", so it can be a program name with args.
1963 set dummy $ac_prog; ac_word=$2
1964 echo "$as_me:$LINENO: checking for $ac_word" >&5
1965 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
1966 if test "${ac_cv_prog_ac_ct_CC+set}" = set; then
1967 echo $ECHO_N "(cached) $ECHO_C" >&6
1968 else
1969 if test -n "$ac_ct_CC"; then
1970 ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
1971 else
1972 as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
1973 for as_dir in $PATH
1974 do
1975 IFS=$as_save_IFS
1976 test -z "$as_dir" && as_dir=.
1977 for ac_exec_ext in '' $ac_executable_extensions; do
1978 if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
1979 ac_cv_prog_ac_ct_CC="$ac_prog"
1980 echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
1981 break 2
1982 fi
1983 done
1984 done
1985
1986 fi
1987 fi
1988 ac_ct_CC=$ac_cv_prog_ac_ct_CC
1989 if test -n "$ac_ct_CC"; then
1990 echo "$as_me:$LINENO: result: $ac_ct_CC" >&5
1991 echo "${ECHO_T}$ac_ct_CC" >&6
1992 else
1993 echo "$as_me:$LINENO: result: no" >&5
1994 echo "${ECHO_T}no" >&6
1995 fi
1996
1997 test -n "$ac_ct_CC" && break
1998 done
1999
2000 CC=$ac_ct_CC
2001 fi
2002
2003 fi
2004
2005
2006 test -z "$CC" && { { echo "$as_me:$LINENO: error: no acceptable C compiler found in \$PATH
2007 See \`config.log' for more details." >&5
2008 echo "$as_me: error: no acceptable C compiler found in \$PATH
2009 See \`config.log' for more details." >&2;}
2010 { (exit 1); exit 1; }; }
2011
2012 # Provide some information about the compiler.
2013 echo "$as_me:$LINENO:" \
2014 "checking for C compiler version" >&5
2015 ac_compiler=`set X $ac_compile; echo $2`
2016 { (eval echo "$as_me:$LINENO: \"$ac_compiler --version </dev/null >&5\"") >&5
2017 (eval $ac_compiler --version </dev/null >&5) 2>&5
2018 ac_status=$?
2019 echo "$as_me:$LINENO: \$? = $ac_status" >&5
2020 (exit $ac_status); }
2021 { (eval echo "$as_me:$LINENO: \"$ac_compiler -v </dev/null >&5\"") >&5
2022 (eval $ac_compiler -v </dev/null >&5) 2>&5
2023 ac_status=$?
2024 echo "$as_me:$LINENO: \$? = $ac_status" >&5
2025 (exit $ac_status); }
2026 { (eval echo "$as_me:$LINENO: \"$ac_compiler -V </dev/null >&5\"") >&5
2027 (eval $ac_compiler -V </dev/null >&5) 2>&5
2028 ac_status=$?
2029 echo "$as_me:$LINENO: \$? = $ac_status" >&5
2030 (exit $ac_status); }
2031
2032 cat >conftest.$ac_ext <<_ACEOF
2033 /* confdefs.h. */
2034 _ACEOF
2035 cat confdefs.h >>conftest.$ac_ext
2036 cat >>conftest.$ac_ext <<_ACEOF
2037 /* end confdefs.h. */
2038
2039 int
2040 main ()
2041 {
2042
2043 ;
2044 return 0;
2045 }
2046 _ACEOF
2047 ac_clean_files_save=$ac_clean_files
2048 ac_clean_files="$ac_clean_files a.out a.exe b.out"
2049 # Try to create an executable without -o first, disregard a.out.
2050 # It will help us diagnose broken compilers, and finding out an intuition
2051 # of exeext.
2052 echo "$as_me:$LINENO: checking for C compiler default output file name" >&5
2053 echo $ECHO_N "checking for C compiler default output file name... $ECHO_C" >&6
2054 ac_link_default=`echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'`
2055 if { (eval echo "$as_me:$LINENO: \"$ac_link_default\"") >&5
2056 (eval $ac_link_default) 2>&5
2057 ac_status=$?
2058 echo "$as_me:$LINENO: \$? = $ac_status" >&5
2059 (exit $ac_status); }; then
2060 # Find the output, starting from the most likely. This scheme is
2061 # not robust to junk in `.', hence go to wildcards (a.*) only as a last
2062 # resort.
2063
2064 # Be careful to initialize this variable, since it used to be cached.
2065 # Otherwise an old cache value of `no' led to `EXEEXT = no' in a Makefile.
2066 ac_cv_exeext=
2067 # b.out is created by i960 compilers.
2068 for ac_file in a_out.exe a.exe conftest.exe a.out conftest a.* conftest.* b.out
2069 do
2070 test -f "$ac_file" || continue
2071 case $ac_file in
2072 *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.o | *.obj )
2073 ;;
2074 conftest.$ac_ext )
2075 # This is the source file.
2076 ;;
2077 [ab].out )
2078 # We found the default executable, but exeext='' is most
2079 # certainly right.
2080 break;;
2081 *.* )
2082 ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'`
2083 # FIXME: I believe we export ac_cv_exeext for Libtool,
2084 # but it would be cool to find out if it's true. Does anybody
2085 # maintain Libtool? --akim.
2086 export ac_cv_exeext
2087 break;;
2088 * )
2089 break;;
2090 esac
2091 done
2092 else
2093 echo "$as_me: failed program was:" >&5
2094 sed 's/^/| /' conftest.$ac_ext >&5
2095
2096 { { echo "$as_me:$LINENO: error: C compiler cannot create executables
2097 See \`config.log' for more details." >&5
2098 echo "$as_me: error: C compiler cannot create executables
2099 See \`config.log' for more details." >&2;}
2100 { (exit 77); exit 77; }; }
2101 fi
2102
2103 ac_exeext=$ac_cv_exeext
2104 echo "$as_me:$LINENO: result: $ac_file" >&5
2105 echo "${ECHO_T}$ac_file" >&6
2106
2107 # Check the compiler produces executables we can run. If not, either
2108 # the compiler is broken, or we cross compile.
2109 echo "$as_me:$LINENO: checking whether the C compiler works" >&5
2110 echo $ECHO_N "checking whether the C compiler works... $ECHO_C" >&6
2111 # FIXME: These cross compiler hacks should be removed for Autoconf 3.0
2112 # If not cross compiling, check that we can run a simple program.
2113 if test "$cross_compiling" != yes; then
2114 if { ac_try='./$ac_file'
2115 { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
2116 (eval $ac_try) 2>&5
2117 ac_status=$?
2118 echo "$as_me:$LINENO: \$? = $ac_status" >&5
2119 (exit $ac_status); }; }; then
2120 cross_compiling=no
2121 else
2122 if test "$cross_compiling" = maybe; then
2123 cross_compiling=yes
2124 else
2125 { { echo "$as_me:$LINENO: error: cannot run C compiled programs.
2126 If you meant to cross compile, use \`--host'.
2127 See \`config.log' for more details." >&5
2128 echo "$as_me: error: cannot run C compiled programs.
2129 If you meant to cross compile, use \`--host'.
2130 See \`config.log' for more details." >&2;}
2131 { (exit 1); exit 1; }; }
2132 fi
2133 fi
2134 fi
2135 echo "$as_me:$LINENO: result: yes" >&5
2136 echo "${ECHO_T}yes" >&6
2137
2138 rm -f a.out a.exe conftest$ac_cv_exeext b.out
2139 ac_clean_files=$ac_clean_files_save
2140 # Check the compiler produces executables we can run. If not, either
2141 # the compiler is broken, or we cross compile.
2142 echo "$as_me:$LINENO: checking whether we are cross compiling" >&5
2143 echo $ECHO_N "checking whether we are cross compiling... $ECHO_C" >&6
2144 echo "$as_me:$LINENO: result: $cross_compiling" >&5
2145 echo "${ECHO_T}$cross_compiling" >&6
2146
2147 echo "$as_me:$LINENO: checking for suffix of executables" >&5
2148 echo $ECHO_N "checking for suffix of executables... $ECHO_C" >&6
2149 if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
2150 (eval $ac_link) 2>&5
2151 ac_status=$?
2152 echo "$as_me:$LINENO: \$? = $ac_status" >&5
2153 (exit $ac_status); }; then
2154 # If both `conftest.exe' and `conftest' are `present' (well, observable)
2155 # catch `conftest.exe'. For instance with Cygwin, `ls conftest' will
2156 # work properly (i.e., refer to `conftest.exe'), while it won't with
2157 # `rm'.
2158 for ac_file in conftest.exe conftest conftest.*; do
2159 test -f "$ac_file" || continue
2160 case $ac_file in
2161 *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.o | *.obj ) ;;
2162 *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'`
2163 export ac_cv_exeext
2164 break;;
2165 * ) break;;
2166 esac
2167 done
2168 else
2169 { { echo "$as_me:$LINENO: error: cannot compute suffix of executables: cannot compile and link
2170 See \`config.log' for more details." >&5
2171 echo "$as_me: error: cannot compute suffix of executables: cannot compile and link
2172 See \`config.log' for more details." >&2;}
2173 { (exit 1); exit 1; }; }
2174 fi
2175
2176 rm -f conftest$ac_cv_exeext
2177 echo "$as_me:$LINENO: result: $ac_cv_exeext" >&5
2178 echo "${ECHO_T}$ac_cv_exeext" >&6
2179
2180 rm -f conftest.$ac_ext
2181 EXEEXT=$ac_cv_exeext
2182 ac_exeext=$EXEEXT
2183 echo "$as_me:$LINENO: checking for suffix of object files" >&5
2184 echo $ECHO_N "checking for suffix of object files... $ECHO_C" >&6
2185 if test "${ac_cv_objext+set}" = set; then
2186 echo $ECHO_N "(cached) $ECHO_C" >&6
2187 else
2188 cat >conftest.$ac_ext <<_ACEOF
2189 /* confdefs.h. */
2190 _ACEOF
2191 cat confdefs.h >>conftest.$ac_ext
2192 cat >>conftest.$ac_ext <<_ACEOF
2193 /* end confdefs.h. */
2194
2195 int
2196 main ()
2197 {
2198
2199 ;
2200 return 0;
2201 }
2202 _ACEOF
2203 rm -f conftest.o conftest.obj
2204 if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
2205 (eval $ac_compile) 2>&5
2206 ac_status=$?
2207 echo "$as_me:$LINENO: \$? = $ac_status" >&5
2208 (exit $ac_status); }; then
2209 for ac_file in `(ls conftest.o conftest.obj; ls conftest.*) 2>/dev/null`; do
2210 case $ac_file in
2211 *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg ) ;;
2212 *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'`
2213 break;;
2214 esac
2215 done
2216 else
2217 echo "$as_me: failed program was:" >&5
2218 sed 's/^/| /' conftest.$ac_ext >&5
2219
2220 { { echo "$as_me:$LINENO: error: cannot compute suffix of object files: cannot compile
2221 See \`config.log' for more details." >&5
2222 echo "$as_me: error: cannot compute suffix of object files: cannot compile
2223 See \`config.log' for more details." >&2;}
2224 { (exit 1); exit 1; }; }
2225 fi
2226
2227 rm -f conftest.$ac_cv_objext conftest.$ac_ext
2228 fi
2229 echo "$as_me:$LINENO: result: $ac_cv_objext" >&5
2230 echo "${ECHO_T}$ac_cv_objext" >&6
2231 OBJEXT=$ac_cv_objext
2232 ac_objext=$OBJEXT
2233 echo "$as_me:$LINENO: checking whether we are using the GNU C compiler" >&5
2234 echo $ECHO_N "checking whether we are using the GNU C compiler... $ECHO_C" >&6
2235 if test "${ac_cv_c_compiler_gnu+set}" = set; then
2236 echo $ECHO_N "(cached) $ECHO_C" >&6
2237 else
2238 cat >conftest.$ac_ext <<_ACEOF
2239 /* confdefs.h. */
2240 _ACEOF
2241 cat confdefs.h >>conftest.$ac_ext
2242 cat >>conftest.$ac_ext <<_ACEOF
2243 /* end confdefs.h. */
2244
2245 int
2246 main ()
2247 {
2248 #ifndef __GNUC__
2249 choke me
2250 #endif
2251
2252 ;
2253 return 0;
2254 }
2255 _ACEOF
2256 rm -f conftest.$ac_objext
2257 if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
2258 (eval $ac_compile) 2>conftest.er1
2259 ac_status=$?
2260 grep -v '^ *+' conftest.er1 >conftest.err
2261 rm -f conftest.er1
2262 cat conftest.err >&5
2263 echo "$as_me:$LINENO: \$? = $ac_status" >&5
2264 (exit $ac_status); } &&
2265 { ac_try='test -z "$ac_c_werror_flag"
2266 || test ! -s conftest.err'
2267 { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
2268 (eval $ac_try) 2>&5
2269 ac_status=$?
2270 echo "$as_me:$LINENO: \$? = $ac_status" >&5
2271 (exit $ac_status); }; } &&
2272 { ac_try='test -s conftest.$ac_objext'
2273 { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
2274 (eval $ac_try) 2>&5
2275 ac_status=$?
2276 echo "$as_me:$LINENO: \$? = $ac_status" >&5
2277 (exit $ac_status); }; }; then
2278 ac_compiler_gnu=yes
2279 else
2280 echo "$as_me: failed program was:" >&5
2281 sed 's/^/| /' conftest.$ac_ext >&5
2282
2283 ac_compiler_gnu=no
2284 fi
2285 rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
2286 ac_cv_c_compiler_gnu=$ac_compiler_gnu
2287
2288 fi
2289 echo "$as_me:$LINENO: result: $ac_cv_c_compiler_gnu" >&5
2290 echo "${ECHO_T}$ac_cv_c_compiler_gnu" >&6
2291 GCC=`test $ac_compiler_gnu = yes && echo yes`
2292 ac_test_CFLAGS=${CFLAGS+set}
2293 ac_save_CFLAGS=$CFLAGS
2294 CFLAGS="-g"
2295 echo "$as_me:$LINENO: checking whether $CC accepts -g" >&5
2296 echo $ECHO_N "checking whether $CC accepts -g... $ECHO_C" >&6
2297 if test "${ac_cv_prog_cc_g+set}" = set; then
2298 echo $ECHO_N "(cached) $ECHO_C" >&6
2299 else
2300 cat >conftest.$ac_ext <<_ACEOF
2301 /* confdefs.h. */
2302 _ACEOF
2303 cat confdefs.h >>conftest.$ac_ext
2304 cat >>conftest.$ac_ext <<_ACEOF
2305 /* end confdefs.h. */
2306
2307 int
2308 main ()
2309 {
2310
2311 ;
2312 return 0;
2313 }
2314 _ACEOF
2315 rm -f conftest.$ac_objext
2316 if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
2317 (eval $ac_compile) 2>conftest.er1
2318 ac_status=$?
2319 grep -v '^ *+' conftest.er1 >conftest.err
2320 rm -f conftest.er1
2321 cat conftest.err >&5
2322 echo "$as_me:$LINENO: \$? = $ac_status" >&5
2323 (exit $ac_status); } &&
2324 { ac_try='test -z "$ac_c_werror_flag"
2325 || test ! -s conftest.err'
2326 { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
2327 (eval $ac_try) 2>&5
2328 ac_status=$?
2329 echo "$as_me:$LINENO: \$? = $ac_status" >&5
2330 (exit $ac_status); }; } &&
2331 { ac_try='test -s conftest.$ac_objext'
2332 { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
2333 (eval $ac_try) 2>&5
2334 ac_status=$?
2335 echo "$as_me:$LINENO: \$? = $ac_status" >&5
2336 (exit $ac_status); }; }; then
2337 ac_cv_prog_cc_g=yes
2338 else
2339 echo "$as_me: failed program was:" >&5
2340 sed 's/^/| /' conftest.$ac_ext >&5
2341
2342 ac_cv_prog_cc_g=no
2343 fi
2344 rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
2345 fi
2346 echo "$as_me:$LINENO: result: $ac_cv_prog_cc_g" >&5
2347 echo "${ECHO_T}$ac_cv_prog_cc_g" >&6
2348 if test "$ac_test_CFLAGS" = set; then
2349 CFLAGS=$ac_save_CFLAGS
2350 elif test $ac_cv_prog_cc_g = yes; then
2351 if test "$GCC" = yes; then
2352 CFLAGS="-g -O2"
2353 else
2354 CFLAGS="-g"
2355 fi
2356 else
2357 if test "$GCC" = yes; then
2358 CFLAGS="-O2"
2359 else
2360 CFLAGS=
2361 fi
2362 fi
2363 echo "$as_me:$LINENO: checking for $CC option to accept ANSI C" >&5
2364 echo $ECHO_N "checking for $CC option to accept ANSI C... $ECHO_C" >&6
2365 if test "${ac_cv_prog_cc_stdc+set}" = set; then
2366 echo $ECHO_N "(cached) $ECHO_C" >&6
2367 else
2368 ac_cv_prog_cc_stdc=no
2369 ac_save_CC=$CC
2370 cat >conftest.$ac_ext <<_ACEOF
2371 /* confdefs.h. */
2372 _ACEOF
2373 cat confdefs.h >>conftest.$ac_ext
2374 cat >>conftest.$ac_ext <<_ACEOF
2375 /* end confdefs.h. */
2376 #include <stdarg.h>
2377 #include <stdio.h>
2378 #include <sys/types.h>
2379 #include <sys/stat.h>
2380 /* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */
2381 struct buf { int x; };
2382 FILE * (*rcsopen) (struct buf *, struct stat *, int);
2383 static char *e (p, i)
2384 char **p;
2385 int i;
2386 {
2387 return p[i];
2388 }
2389 static char *f (char * (*g) (char **, int), char **p, ...)
2390 {
2391 char *s;
2392 va_list v;
2393 va_start (v,p);
2394 s = g (p, va_arg (v,int));
2395 va_end (v);
2396 return s;
2397 }
2398
2399 /* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has
2400 function prototypes and stuff, but not '\xHH' hex character constants.
2401 These don't provoke an error unfortunately, instead are silently treated
2402 as 'x'. The following induces an error, until -std1 is added to get
2403 proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an
2404 array size at least. It's necessary to write '\x00'==0 to get something
2405 that's true only with -std1. */
2406 int osf4_cc_array ['\x00' == 0 ? 1 : -1];
2407
2408 int test (int i, double x);
2409 struct s1 {int (*f) (int a);};
2410 struct s2 {int (*f) (double a);};
2411 int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int);
2412 int argc;
2413 char **argv;
2414 int
2415 main ()
2416 {
2417 return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1];
2418 ;
2419 return 0;
2420 }
2421 _ACEOF
2422 # Don't try gcc -ansi; that turns off useful extensions and
2423 # breaks some systems' header files.
2424 # AIX -qlanglvl=ansi
2425 # Ultrix and OSF/1 -std1
2426 # HP-UX 10.20 and later -Ae
2427 # HP-UX older versions -Aa -D_HPUX_SOURCE
2428 # SVR4 -Xc -D__EXTENSIONS__
2429 for ac_arg in "" -qlanglvl=ansi -std1 -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__"
2430 do
2431 CC="$ac_save_CC $ac_arg"
2432 rm -f conftest.$ac_objext
2433 if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
2434 (eval $ac_compile) 2>conftest.er1
2435 ac_status=$?
2436 grep -v '^ *+' conftest.er1 >conftest.err
2437 rm -f conftest.er1
2438 cat conftest.err >&5
2439 echo "$as_me:$LINENO: \$? = $ac_status" >&5
2440 (exit $ac_status); } &&
2441 { ac_try='test -z "$ac_c_werror_flag"
2442 || test ! -s conftest.err'
2443 { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
2444 (eval $ac_try) 2>&5
2445 ac_status=$?
2446 echo "$as_me:$LINENO: \$? = $ac_status" >&5
2447 (exit $ac_status); }; } &&
2448 { ac_try='test -s conftest.$ac_objext'
2449 { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
2450 (eval $ac_try) 2>&5
2451 ac_status=$?
2452 echo "$as_me:$LINENO: \$? = $ac_status" >&5
2453 (exit $ac_status); }; }; then
2454 ac_cv_prog_cc_stdc=$ac_arg
2455 break
2456 else
2457 echo "$as_me: failed program was:" >&5
2458 sed 's/^/| /' conftest.$ac_ext >&5
2459
2460 fi
2461 rm -f conftest.err conftest.$ac_objext
2462 done
2463 rm -f conftest.$ac_ext conftest.$ac_objext
2464 CC=$ac_save_CC
2465
2466 fi
2467
2468 case "x$ac_cv_prog_cc_stdc" in
2469 x|xno)
2470 echo "$as_me:$LINENO: result: none needed" >&5
2471 echo "${ECHO_T}none needed" >&6 ;;
2472 *)
2473 echo "$as_me:$LINENO: result: $ac_cv_prog_cc_stdc" >&5
2474 echo "${ECHO_T}$ac_cv_prog_cc_stdc" >&6
2475 CC="$CC $ac_cv_prog_cc_stdc" ;;
2476 esac
2477
2478 # Some people use a C++ compiler to compile C. Since we use `exit',
2479 # in C++ we need to declare it. In case someone uses the same compiler
2480 # for both compiling C and C++ we need to have the C++ compiler decide
2481 # the declaration of exit, since it's the most demanding environment.
2482 cat >conftest.$ac_ext <<_ACEOF
2483 #ifndef __cplusplus
2484 choke me
2485 #endif
2486 _ACEOF
2487 rm -f conftest.$ac_objext
2488 if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
2489 (eval $ac_compile) 2>conftest.er1
2490 ac_status=$?
2491 grep -v '^ *+' conftest.er1 >conftest.err
2492 rm -f conftest.er1
2493 cat conftest.err >&5
2494 echo "$as_me:$LINENO: \$? = $ac_status" >&5
2495 (exit $ac_status); } &&
2496 { ac_try='test -z "$ac_c_werror_flag"
2497 || test ! -s conftest.err'
2498 { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
2499 (eval $ac_try) 2>&5
2500 ac_status=$?
2501 echo "$as_me:$LINENO: \$? = $ac_status" >&5
2502 (exit $ac_status); }; } &&
2503 { ac_try='test -s conftest.$ac_objext'
2504 { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
2505 (eval $ac_try) 2>&5
2506 ac_status=$?
2507 echo "$as_me:$LINENO: \$? = $ac_status" >&5
2508 (exit $ac_status); }; }; then
2509 for ac_declaration in \
2510 '' \
2511 'extern "C" void std::exit (int) throw (); using std::exit;' \
2512 'extern "C" void std::exit (int); using std::exit;' \
2513 'extern "C" void exit (int) throw ();' \
2514 'extern "C" void exit (int);' \
2515 'void exit (int);'
2516 do
2517 cat >conftest.$ac_ext <<_ACEOF
2518 /* confdefs.h. */
2519 _ACEOF
2520 cat confdefs.h >>conftest.$ac_ext
2521 cat >>conftest.$ac_ext <<_ACEOF
2522 /* end confdefs.h. */
2523 $ac_declaration
2524 #include <stdlib.h>
2525 int
2526 main ()
2527 {
2528 exit (42);
2529 ;
2530 return 0;
2531 }
2532 _ACEOF
2533 rm -f conftest.$ac_objext
2534 if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
2535 (eval $ac_compile) 2>conftest.er1
2536 ac_status=$?
2537 grep -v '^ *+' conftest.er1 >conftest.err
2538 rm -f conftest.er1
2539 cat conftest.err >&5
2540 echo "$as_me:$LINENO: \$? = $ac_status" >&5
2541 (exit $ac_status); } &&
2542 { ac_try='test -z "$ac_c_werror_flag"
2543 || test ! -s conftest.err'
2544 { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
2545 (eval $ac_try) 2>&5
2546 ac_status=$?
2547 echo "$as_me:$LINENO: \$? = $ac_status" >&5
2548 (exit $ac_status); }; } &&
2549 { ac_try='test -s conftest.$ac_objext'
2550 { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
2551 (eval $ac_try) 2>&5
2552 ac_status=$?
2553 echo "$as_me:$LINENO: \$? = $ac_status" >&5
2554 (exit $ac_status); }; }; then
2555 :
2556 else
2557 echo "$as_me: failed program was:" >&5
2558 sed 's/^/| /' conftest.$ac_ext >&5
2559
2560 continue
2561 fi
2562 rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
2563 cat >conftest.$ac_ext <<_ACEOF
2564 /* confdefs.h. */
2565 _ACEOF
2566 cat confdefs.h >>conftest.$ac_ext
2567 cat >>conftest.$ac_ext <<_ACEOF
2568 /* end confdefs.h. */
2569 $ac_declaration
2570 int
2571 main ()
2572 {
2573 exit (42);
2574 ;
2575 return 0;
2576 }
2577 _ACEOF
2578 rm -f conftest.$ac_objext
2579 if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
2580 (eval $ac_compile) 2>conftest.er1
2581 ac_status=$?
2582 grep -v '^ *+' conftest.er1 >conftest.err
2583 rm -f conftest.er1
2584 cat conftest.err >&5
2585 echo "$as_me:$LINENO: \$? = $ac_status" >&5
2586 (exit $ac_status); } &&
2587 { ac_try='test -z "$ac_c_werror_flag"
2588 || test ! -s conftest.err'
2589 { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
2590 (eval $ac_try) 2>&5
2591 ac_status=$?
2592 echo "$as_me:$LINENO: \$? = $ac_status" >&5
2593 (exit $ac_status); }; } &&
2594 { ac_try='test -s conftest.$ac_objext'
2595 { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
2596 (eval $ac_try) 2>&5
2597 ac_status=$?
2598 echo "$as_me:$LINENO: \$? = $ac_status" >&5
2599 (exit $ac_status); }; }; then
2600 break
2601 else
2602 echo "$as_me: failed program was:" >&5
2603 sed 's/^/| /' conftest.$ac_ext >&5
2604
2605 fi
2606 rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
2607 done
2608 rm -f conftest*
2609 if test -n "$ac_declaration"; then
2610 echo '#ifdef __cplusplus' >>confdefs.h
2611 echo $ac_declaration >>confdefs.h
2612 echo '#endif' >>confdefs.h
2613 fi
2614
2615 else
2616 echo "$as_me: failed program was:" >&5
2617 sed 's/^/| /' conftest.$ac_ext >&5
2618
2619 fi
2620 rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
2621 ac_ext=c
2622 ac_cpp='$CPP $CPPFLAGS'
2623 ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
2624 ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
2625 ac_compiler_gnu=$ac_cv_c_compiler_gnu
2626 DEPDIR="${am__leading_dot}deps"
2627
2628 ac_config_commands="$ac_config_commands depfiles"
2629
2630
2631 am_make=${MAKE-make}
2632 cat > confinc << 'END'
2633 am__doit:
2634 @echo done
2635 .PHONY: am__doit
2636 END
2637 # If we don't find an include directive, just comment out the code.
2638 echo "$as_me:$LINENO: checking for style of include used by $am_make" >&5
2639 echo $ECHO_N "checking for style of include used by $am_make... $ECHO_C" >&6
2640 am__include="#"
2641 am__quote=
2642 _am_result=none
2643 # First try GNU make style include.
2644 echo "include confinc" > confmf
2645 # We grep out `Entering directory' and `Leaving directory'
2646 # messages which can occur if `w' ends up in MAKEFLAGS.
2647 # In particular we don't look at `^make:' because GNU make might
2648 # be invoked under some other name (usually "gmake"), in which
2649 # case it prints its new name instead of `make'.
2650 if test "`$am_make -s -f confmf 2> /dev/null | grep -v 'ing directory'`" = "done"; then
2651 am__include=include
2652 am__quote=
2653 _am_result=GNU
2654 fi
2655 # Now try BSD make style include.
2656 if test "$am__include" = "#"; then
2657 echo '.include "confinc"' > confmf
2658 if test "`$am_make -s -f confmf 2> /dev/null`" = "done"; then
2659 am__include=.include
2660 am__quote="\""
2661 _am_result=BSD
2662 fi
2663 fi
2664
2665
2666 echo "$as_me:$LINENO: result: $_am_result" >&5
2667 echo "${ECHO_T}$_am_result" >&6
2668 rm -f confinc confmf
2669
2670 # Check whether --enable-dependency-tracking or --disable-dependency-tracking was given.
2671 if test "${enable_dependency_tracking+set}" = set; then
2672 enableval="$enable_dependency_tracking"
2673
2674 fi;
2675 if test "x$enable_dependency_tracking" != xno; then
2676 am_depcomp="$ac_aux_dir/depcomp"
2677 AMDEPBACKSLASH='\'
2678 fi
2679
2680
2681 if test "x$enable_dependency_tracking" != xno; then
2682 AMDEP_TRUE=
2683 AMDEP_FALSE='#'
2684 else
2685 AMDEP_TRUE='#'
2686 AMDEP_FALSE=
2687 fi
2688
2689
2690
2691
2692 depcc="$CC" am_compiler_list=
2693
2694 echo "$as_me:$LINENO: checking dependency style of $depcc" >&5
2695 echo $ECHO_N "checking dependency style of $depcc... $ECHO_C" >&6
2696 if test "${am_cv_CC_dependencies_compiler_type+set}" = set; then
2697 echo $ECHO_N "(cached) $ECHO_C" >&6
2698 else
2699 if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
2700 # We make a subdir and do the tests there. Otherwise we can end up
2701 # making bogus files that we don't know about and never remove. For
2702 # instance it was reported that on HP-UX the gcc test will end up
2703 # making a dummy file named `D' -- because `-MD' means `put the output
2704 # in D'.
2705 mkdir conftest.dir
2706 # Copy depcomp to subdir because otherwise we won't find it if we're
2707 # using a relative directory.
2708 cp "$am_depcomp" conftest.dir
2709 cd conftest.dir
2710 # We will build objects and dependencies in a subdirectory because
2711 # it helps to detect inapplicable dependency modes. For instance
2712 # both Tru64's cc and ICC support -MD to output dependencies as a
2713 # side effect of compilation, but ICC will put the dependencies in
2714 # the current directory while Tru64 will put them in the object
2715 # directory.
2716 mkdir sub
2717
2718 am_cv_CC_dependencies_compiler_type=none
2719 if test "$am_compiler_list" = ""; then
2720 am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp`
2721 fi
2722 for depmode in $am_compiler_list; do
2723 # Setup a source with many dependencies, because some compilers
2724 # like to wrap large dependency lists on column 80 (with \), and
2725 # we should not choose a depcomp mode which is confused by this.
2726 #
2727 # We need to recreate these files for each test, as the compiler may
2728 # overwrite some of them when testing with obscure command lines.
2729 # This happens at least with the AIX C compiler.
2730 : > sub/conftest.c
2731 for i in 1 2 3 4 5 6; do
2732 echo '#include "conftst'$i'.h"' >> sub/conftest.c
2733 # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with
2734 # Solaris 8's {/usr,}/bin/sh.
2735 touch sub/conftst$i.h
2736 done
2737 echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
2738
2739 case $depmode in
2740 nosideeffect)
2741 # after this tag, mechanisms are not by side-effect, so they'll
2742 # only be used when explicitly requested
2743 if test "x$enable_dependency_tracking" = xyes; then
2744 continue
2745 else
2746 break
2747 fi
2748 ;;
2749 none) break ;;
2750 esac
2751 # We check with `-c' and `-o' for the sake of the "dashmstdout"
2752 # mode. It turns out that the SunPro C++ compiler does not properly
2753 # handle `-M -o', and we need to detect this.
2754 if depmode=$depmode \
2755 source=sub/conftest.c object=sub/conftest.${OBJEXT-o} \
2756 depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
2757 $SHELL ./depcomp $depcc -c -o sub/conftest.${OBJEXT-o} sub/conftest.c \
2758 >/dev/null 2>conftest.err &&
2759 grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
2760 grep sub/conftest.${OBJEXT-o} sub/conftest.Po > /dev/null 2>&1 &&
2761 ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
2762 # icc doesn't choke on unknown options, it will just issue warnings
2763 # or remarks (even with -Werror). So we grep stderr for any message
2764 # that says an option was ignored or not supported.
2765 # When given -MP, icc 7.0 and 7.1 complain thusly:
2766 # icc: Command line warning: ignoring option '-M'; no argument required
2767 # The diagnosis changed in icc 8.0:
2768 # icc: Command line remark: option '-MP' not supported
2769 if (grep 'ignoring option' conftest.err ||
2770 grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
2771 am_cv_CC_dependencies_compiler_type=$depmode
2772 break
2773 fi
2774 fi
2775 done
2776
2777 cd ..
2778 rm -rf conftest.dir
2779 else
2780 am_cv_CC_dependencies_compiler_type=none
2781 fi
2782
2783 fi
2784 echo "$as_me:$LINENO: result: $am_cv_CC_dependencies_compiler_type" >&5
2785 echo "${ECHO_T}$am_cv_CC_dependencies_compiler_type" >&6
2786 CCDEPMODE=depmode=$am_cv_CC_dependencies_compiler_type
2787
2788
2789
2790 if
2791 test "x$enable_dependency_tracking" != xno \
2792 && test "$am_cv_CC_dependencies_compiler_type" = gcc3; then
2793 am__fastdepCC_TRUE=
2794 am__fastdepCC_FALSE='#'
2795 else
2796 am__fastdepCC_TRUE='#'
2797 am__fastdepCC_FALSE=
2798 fi
2799
2800
2801 echo "$as_me:$LINENO: checking whether ${MAKE-make} sets \$(MAKE)" >&5
2802 echo $ECHO_N "checking whether ${MAKE-make} sets \$(MAKE)... $ECHO_C" >&6
2803 set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y,:./+-,___p_,'`
2804 if eval "test \"\${ac_cv_prog_make_${ac_make}_set+set}\" = set"; then
2805 echo $ECHO_N "(cached) $ECHO_C" >&6
2806 else
2807 cat >conftest.make <<\_ACEOF
2808 all:
2809 @echo 'ac_maketemp="$(MAKE)"'
2810 _ACEOF
2811 # GNU make sometimes prints "make[1]: Entering...", which would confuse us.
2812 eval `${MAKE-make} -f conftest.make 2>/dev/null | grep temp=`
2813 if test -n "$ac_maketemp"; then
2814 eval ac_cv_prog_make_${ac_make}_set=yes
2815 else
2816 eval ac_cv_prog_make_${ac_make}_set=no
2817 fi
2818 rm -f conftest.make
2819 fi
2820 if eval "test \"`echo '$ac_cv_prog_make_'${ac_make}_set`\" = yes"; then
2821 echo "$as_me:$LINENO: result: yes" >&5
2822 echo "${ECHO_T}yes" >&6
2823 SET_MAKE=
2824 else
2825 echo "$as_me:$LINENO: result: no" >&5
2826 echo "${ECHO_T}no" >&6
2827 SET_MAKE="MAKE=${MAKE-make}"
2828 fi
2829
2830
2831
2832 # Check whether --with-curl-config or --without-curl-config was given.
2833 if test "${with_curl_config+set}" = set; then
2834 withval="$with_curl_config"
2835 curl_config="$withval"
2836 else
2837 curl_config="curl-config"
2838 fi;
2839
2840 if test -f $curl_config ; then
2841 CURL_CONFIG=$curl_config
2842 echo "$as_me:$LINENO: result: yes" >&5
2843 echo "${ECHO_T}yes" >&6
2844 else for ac_prog in curl-config
2845 do
2846 # Extract the first word of "$ac_prog", so it can be a program name with args.
2847 set dummy $ac_prog; ac_word=$2
2848 echo "$as_me:$LINENO: checking for $ac_word" >&5
2849 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
2850 if test "${ac_cv_prog_CURL_CONFIG+set}" = set; then
2851 echo $ECHO_N "(cached) $ECHO_C" >&6
2852 else
2853 if test -n "$CURL_CONFIG"; then
2854 ac_cv_prog_CURL_CONFIG="$CURL_CONFIG" # Let the user override the test.
2855 else
2856 as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
2857 for as_dir in $PATH
2858 do
2859 IFS=$as_save_IFS
2860 test -z "$as_dir" && as_dir=.
2861 for ac_exec_ext in '' $ac_executable_extensions; do
2862 if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
2863 ac_cv_prog_CURL_CONFIG="$ac_prog"
2864 echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
2865 break 2
2866 fi
2867 done
2868 done
2869
2870 fi
2871 fi
2872 CURL_CONFIG=$ac_cv_prog_CURL_CONFIG
2873 if test -n "$CURL_CONFIG"; then
2874 echo "$as_me:$LINENO: result: $CURL_CONFIG" >&5
2875 echo "${ECHO_T}$CURL_CONFIG" >&6
2876 else
2877 echo "$as_me:$LINENO: result: no" >&5
2878 echo "${ECHO_T}no" >&6
2879 fi
2880
2881 test -n "$CURL_CONFIG" && break
2882 done
2883
2884 fi
2885
2886 if test "X$CURL_CONFIG" = "X"; then
2887 { { echo "$as_me:$LINENO: error: $curl_config not found.
2888 cURL is available from http://curl.haxx.se/" >&5
2889 echo "$as_me: error: $curl_config not found.
2890 cURL is available from http://curl.haxx.se/" >&2;}
2891 { (exit 1); exit 1; }; }
2892 fi
2893
2894 curl_ver=`$CURL_CONFIG --version | sed -e "s/libcurl //g"`
2895 curl_ver_hex=0x`$CURL_CONFIG --vernum`
2896 curl_ver_dec=`$AWK 'BEGIN {printf("%d\n", '"$curl_ver_hex"')}' </dev/null`
2897
2898 check_min=7.1.1
2899 check_min_hex=0x070101
2900 check_min_dec=`$AWK 'BEGIN {printf("%d\n", '"$check_min_hex"')}' </dev/null`
2901
2902 check_good=7.11.2
2903 check_good_hex=0x070b02
2904 check_good_dec=`$AWK 'BEGIN {printf("%d\n", '"$check_good_hex"')}' </dev/null`
2905
2906 echo "$as_me:$LINENO: checking for cURL version" >&5
2907 echo $ECHO_N "checking for cURL version... $ECHO_C" >&6
2908 if test $curl_ver_dec -lt $check_min_dec;then
2909 { { echo "$as_me:$LINENO: error: cURL $check_min or newer required
2910 cURL is available from http://curl.haxx.se/" >&5
2911 echo "$as_me: error: cURL $check_min or newer required
2912 cURL is available from http://curl.haxx.se/" >&2;}
2913 { (exit 1); exit 1; }; }
2914 fi
2915
2916 if test $curl_ver_dec -lt $check_good_dec;then
2917 CURL_ADDITIONAL="-D NEED_CURL_EASY_STRERROR"
2918 fi
2919 echo "$as_me:$LINENO: result: $curl_ver" >&5
2920 echo "${ECHO_T}$curl_ver" >&6
2921
2922 echo "$as_me:$LINENO: checking for cURL SSL support" >&5
2923 echo $ECHO_N "checking for cURL SSL support... $ECHO_C" >&6
2924 if test XSSL != X`$CURL_CONFIG --feature|grep SSL`; then
2925 { { echo "$as_me:$LINENO: error: no SSL
2926 cURL is available from http://curl.haxx.se/" >&5
2927 echo "$as_me: error: no SSL
2928 cURL is available from http://curl.haxx.se/" >&2;}
2929 { (exit 1); exit 1; }; }
2930 else
2931 echo "$as_me:$LINENO: result: yes" >&5
2932 echo "${ECHO_T}yes" >&6
2933 fi
2934
2935 CURLCFLAGS="`$CURL_CONFIG --cflags` $CURL_ADDITIONAL"
2936 CURLLDFLAGS=`$CURL_CONFIG --libs`
2937
2938
2939
2940
2941 ac_config_files="$ac_config_files Makefile"
2942 cat >confcache <<\_ACEOF
2943 # This file is a shell script that caches the results of configure
2944 # tests run on this system so they can be shared between configure
2945 # scripts and configure runs, see configure's option --config-cache.
2946 # It is not useful on other systems. If it contains results you don't
2947 # want to keep, you may remove or edit it.
2948 #
2949 # config.status only pays attention to the cache file if you give it
2950 # the --recheck option to rerun configure.
2951 #
2952 # `ac_cv_env_foo' variables (set or unset) will be overridden when
2953 # loading this file, other *unset* `ac_cv_foo' will be assigned the
2954 # following values.
2955
2956 _ACEOF
2957
2958 # The following way of writing the cache mishandles newlines in values,
2959 # but we know of no workaround that is simple, portable, and efficient.
2960 # So, don't put newlines in cache variables' values.
2961 # Ultrix sh set writes to stderr and can't be redirected directly,
2962 # and sets the high bit in the cache file unless we assign to the vars.
2963 {
2964 (set) 2>&1 |
2965 case `(ac_space=' '; set | grep ac_space) 2>&1` in
2966 *ac_space=\ *)
2967 # `set' does not quote correctly, so add quotes (double-quote
2968 # substitution turns \\\\ into \\, and sed turns \\ into \).
2969 sed -n \
2970 "s/'/'\\\\''/g;
2971 s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p"
2972 ;;
2973 *)
2974 # `set' quotes correctly as required by POSIX, so do not add quotes.
2975 sed -n \
2976 "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p"
2977 ;;
2978 esac;
2979 } |
2980 sed '
2981 t clear
2982 : clear
2983 s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/
2984 t end
2985 /^ac_cv_env/!s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/
2986 : end' >>confcache
2987 if diff $cache_file confcache >/dev/null 2>&1; then :; else
2988 if test -w $cache_file; then
2989 test "x$cache_file" != "x/dev/null" && echo "updating cache $cache_file"
2990 cat confcache >$cache_file
2991 else
2992 echo "not updating unwritable cache $cache_file"
2993 fi
2994 fi
2995 rm -f confcache
2996
2997 test "x$prefix" = xNONE && prefix=$ac_default_prefix
2998 # Let make expand exec_prefix.
2999 test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
3000
3001 # VPATH may cause trouble with some makes, so we remove $(srcdir),
3002 # ${srcdir} and @srcdir@ from VPATH if srcdir is ".", strip leading and
3003 # trailing colons and then remove the whole line if VPATH becomes empty
3004 # (actually we leave an empty line to preserve line numbers).
3005 if test "x$srcdir" = x.; then
3006 ac_vpsub='/^[ ]*VPATH[ ]*=/{
3007 s/:*\$(srcdir):*/:/;
3008 s/:*\${srcdir}:*/:/;
3009 s/:*@srcdir@:*/:/;
3010 s/^\([^=]*=[ ]*\):*/\1/;
3011 s/:*$//;
3012 s/^[^=]*=[ ]*$//;
3013 }'
3014 fi
3015
3016 # Transform confdefs.h into DEFS.
3017 # Protect against shell expansion while executing Makefile rules.
3018 # Protect against Makefile macro expansion.
3019 #
3020 # If the first sed substitution is executed (which looks for macros that
3021 # take arguments), then we branch to the quote section. Otherwise,
3022 # look for a macro that doesn't take arguments.
3023 cat >confdef2opt.sed <<\_ACEOF
3024 t clear
3025 : clear
3026 s,^[ ]*#[ ]*define[ ][ ]*\([^ (][^ (]*([^)]*)\)[ ]*\(.*\),-D\1=\2,g
3027 t quote
3028 s,^[ ]*#[ ]*define[ ][ ]*\([^ ][^ ]*\)[ ]*\(.*\),-D\1=\2,g
3029 t quote
3030 d
3031 : quote
3032 s,[ `~#$^&*(){}\\|;'"<>?],\\&,g
3033 s,\[,\\&,g
3034 s,\],\\&,g
3035 s,\$,$$,g
3036 p
3037 _ACEOF
3038 # We use echo to avoid assuming a particular line-breaking character.
3039 # The extra dot is to prevent the shell from consuming trailing
3040 # line-breaks from the sub-command output. A line-break within
3041 # single-quotes doesn't work because, if this script is created in a
3042 # platform that uses two characters for line-breaks (e.g., DOS), tr
3043 # would break.
3044 ac_LF_and_DOT=`echo; echo .`
3045 DEFS=`sed -n -f confdef2opt.sed confdefs.h | tr "$ac_LF_and_DOT" ' .'`
3046 rm -f confdef2opt.sed
3047
3048
3049 ac_libobjs=
3050 ac_ltlibobjs=
3051 for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue
3052 # 1. Remove the extension, and $U if already installed.
3053 ac_i=`echo "$ac_i" |
3054 sed 's/\$U\././;s/\.o$//;s/\.obj$//'`
3055 # 2. Add them.
3056 ac_libobjs="$ac_libobjs $ac_i\$U.$ac_objext"
3057 ac_ltlibobjs="$ac_ltlibobjs $ac_i"'$U.lo'
3058 done
3059 LIBOBJS=$ac_libobjs
3060
3061 LTLIBOBJS=$ac_ltlibobjs
3062
3063
3064 if test -z "${AMDEP_TRUE}" && test -z "${AMDEP_FALSE}"; then
3065 { { echo "$as_me:$LINENO: error: conditional \"AMDEP\" was never defined.
3066 Usually this means the macro was only invoked conditionally." >&5
3067 echo "$as_me: error: conditional \"AMDEP\" was never defined.
3068 Usually this means the macro was only invoked conditionally." >&2;}
3069 { (exit 1); exit 1; }; }
3070 fi
3071 if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then
3072 { { echo "$as_me:$LINENO: error: conditional \"am__fastdepCC\" was never defined.
3073 Usually this means the macro was only invoked conditionally." >&5
3074 echo "$as_me: error: conditional \"am__fastdepCC\" was never defined.
3075 Usually this means the macro was only invoked conditionally." >&2;}
3076 { (exit 1); exit 1; }; }
3077 fi
3078
3079 : ${CONFIG_STATUS=./config.status}
3080 ac_clean_files_save=$ac_clean_files
3081 ac_clean_files="$ac_clean_files $CONFIG_STATUS"
3082 { echo "$as_me:$LINENO: creating $CONFIG_STATUS" >&5
3083 echo "$as_me: creating $CONFIG_STATUS" >&6;}
3084 cat >$CONFIG_STATUS <<_ACEOF
3085 #! $SHELL
3086 # Generated by $as_me.
3087 # Run this file to recreate the current configuration.
3088 # Compiler output produced by configure, useful for debugging
3089 # configure, is in config.log if it exists.
3090
3091 debug=false
3092 ac_cs_recheck=false
3093 ac_cs_silent=false
3094 SHELL=\${CONFIG_SHELL-$SHELL}
3095 _ACEOF
3096
3097 cat >>$CONFIG_STATUS <<\_ACEOF
3098 ## --------------------- ##
3099 ## M4sh Initialization. ##
3100 ## --------------------- ##
3101
3102 # Be Bourne compatible
3103 if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
3104 emulate sh
3105 NULLCMD=:
3106 # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
3107 # is contrary to our usage. Disable this feature.
3108 alias -g '${1+"$@"}'='"$@"'
3109 elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then
3110 set -o posix
3111 fi
3112 DUALCASE=1; export DUALCASE # for MKS sh
3113
3114 # Support unset when possible.
3115 if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then
3116 as_unset=unset
3117 else
3118 as_unset=false
3119 fi
3120
3121
3122 # Work around bugs in pre-3.0 UWIN ksh.
3123 $as_unset ENV MAIL MAILPATH
3124 PS1='$ '
3125 PS2='> '
3126 PS4='+ '
3127
3128 # NLS nuisances.
3129 for as_var in \
3130 LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \
3131 LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \
3132 LC_TELEPHONE LC_TIME
3133 do
3134 if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then
3135 eval $as_var=C; export $as_var
3136 else
3137 $as_unset $as_var
3138 fi
3139 done
3140
3141 # Required to use basename.
3142 if expr a : '\(a\)' >/dev/null 2>&1; then
3143 as_expr=expr
3144 else
3145 as_expr=false
3146 fi
3147
3148 if (basename /) >/dev/null 2>&1 && test "X`basename / 2>&1`" = "X/"; then
3149 as_basename=basename
3150 else
3151 as_basename=false
3152 fi
3153
3154
3155 # Name of the executable.
3156 as_me=`$as_basename "$0" ||
3157 $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \
3158 X"$0" : 'X\(//\)$' \| \
3159 X"$0" : 'X\(/\)$' \| \
3160 . : '\(.\)' 2>/dev/null ||
3161 echo X/"$0" |
3162 sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; }
3163 /^X\/\(\/\/\)$/{ s//\1/; q; }
3164 /^X\/\(\/\).*/{ s//\1/; q; }
3165 s/.*/./; q'`
3166
3167
3168 # PATH needs CR, and LINENO needs CR and PATH.
3169 # Avoid depending upon Character Ranges.
3170 as_cr_letters='abcdefghijklmnopqrstuvwxyz'
3171 as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
3172 as_cr_Letters=$as_cr_letters$as_cr_LETTERS
3173 as_cr_digits='0123456789'
3174 as_cr_alnum=$as_cr_Letters$as_cr_digits
3175
3176 # The user is always right.
3177 if test "${PATH_SEPARATOR+set}" != set; then
3178 echo "#! /bin/sh" >conf$$.sh
3179 echo "exit 0" >>conf$$.sh
3180 chmod +x conf$$.sh
3181 if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then
3182 PATH_SEPARATOR=';'
3183 else
3184 PATH_SEPARATOR=:
3185 fi
3186 rm -f conf$$.sh
3187 fi
3188
3189
3190 as_lineno_1=$LINENO
3191 as_lineno_2=$LINENO
3192 as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null`
3193 test "x$as_lineno_1" != "x$as_lineno_2" &&
3194 test "x$as_lineno_3" = "x$as_lineno_2" || {
3195 # Find who we are. Look in the path if we contain no path at all
3196 # relative or not.
3197 case $0 in
3198 *[\\/]* ) as_myself=$0 ;;
3199 *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
3200 for as_dir in $PATH
3201 do
3202 IFS=$as_save_IFS
3203 test -z "$as_dir" && as_dir=.
3204 test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break
3205 done
3206
3207 ;;
3208 esac
3209 # We did not find ourselves, most probably we were run as `sh COMMAND'
3210 # in which case we are not to be found in the path.
3211 if test "x$as_myself" = x; then
3212 as_myself=$0
3213 fi
3214 if test ! -f "$as_myself"; then
3215 { { echo "$as_me:$LINENO: error: cannot find myself; rerun with an absolute path" >&5
3216 echo "$as_me: error: cannot find myself; rerun with an absolute path" >&2;}
3217 { (exit 1); exit 1; }; }
3218 fi
3219 case $CONFIG_SHELL in
3220 '')
3221 as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
3222 for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH
3223 do
3224 IFS=$as_save_IFS
3225 test -z "$as_dir" && as_dir=.
3226 for as_base in sh bash ksh sh5; do
3227 case $as_dir in
3228 /*)
3229 if ("$as_dir/$as_base" -c '
3230 as_lineno_1=$LINENO
3231 as_lineno_2=$LINENO
3232 as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null`
3233 test "x$as_lineno_1" != "x$as_lineno_2" &&
3234 test "x$as_lineno_3" = "x$as_lineno_2" ') 2>/dev/null; then
3235 $as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; }
3236 $as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; }
3237 CONFIG_SHELL=$as_dir/$as_base
3238 export CONFIG_SHELL
3239 exec "$CONFIG_SHELL" "$0" ${1+"$@"}
3240 fi;;
3241 esac
3242 done
3243 done
3244 ;;
3245 esac
3246
3247 # Create $as_me.lineno as a copy of $as_myself, but with $LINENO
3248 # uniformly replaced by the line number. The first 'sed' inserts a
3249 # line-number line before each line; the second 'sed' does the real
3250 # work. The second script uses 'N' to pair each line-number line
3251 # with the numbered line, and appends trailing '-' during
3252 # substitution so that $LINENO is not a special case at line end.
3253 # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the
3254 # second 'sed' script. Blame Lee E. McMahon for sed's syntax. :-)
3255 sed '=' <$as_myself |
3256 sed '
3257 N
3258 s,$,-,
3259 : loop
3260 s,^\(['$as_cr_digits']*\)\(.*\)[$]LINENO\([^'$as_cr_alnum'_]\),\1\2\1\3,
3261 t loop
3262 s,-$,,
3263 s,^['$as_cr_digits']*\n,,
3264 ' >$as_me.lineno &&
3265 chmod +x $as_me.lineno ||
3266 { { echo "$as_me:$LINENO: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&5
3267 echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2;}
3268 { (exit 1); exit 1; }; }
3269
3270 # Don't try to exec as it changes $[0], causing all sort of problems
3271 # (the dirname of $[0] is not the place where we might find the
3272 # original and so on. Autoconf is especially sensible to this).
3273 . ./$as_me.lineno
3274 # Exit status is that of the last command.
3275 exit
3276 }
3277
3278
3279 case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in
3280 *c*,-n*) ECHO_N= ECHO_C='
3281 ' ECHO_T=' ' ;;
3282 *c*,* ) ECHO_N=-n ECHO_C= ECHO_T= ;;
3283 *) ECHO_N= ECHO_C='\c' ECHO_T= ;;
3284 esac
3285
3286 if expr a : '\(a\)' >/dev/null 2>&1; then
3287 as_expr=expr
3288 else
3289 as_expr=false
3290 fi
3291
3292 rm -f conf$$ conf$$.exe conf$$.file
3293 echo >conf$$.file
3294 if ln -s conf$$.file conf$$ 2>/dev/null; then
3295 # We could just check for DJGPP; but this test a) works b) is more generic
3296 # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04).
3297 if test -f conf$$.exe; then
3298 # Don't use ln at all; we don't have any links
3299 as_ln_s='cp -p'
3300 else
3301 as_ln_s='ln -s'
3302 fi
3303 elif ln conf$$.file conf$$ 2>/dev/null; then
3304 as_ln_s=ln
3305 else
3306 as_ln_s='cp -p'
3307 fi
3308 rm -f conf$$ conf$$.exe conf$$.file
3309
3310 if mkdir -p . 2>/dev/null; then
3311 as_mkdir_p=:
3312 else
3313 test -d ./-p && rmdir ./-p
3314 as_mkdir_p=false
3315 fi
3316
3317 as_executable_p="test -f"
3318
3319 # Sed expression to map a string onto a valid CPP name.
3320 as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'"
3321
3322 # Sed expression to map a string onto a valid variable name.
3323 as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'"
3324
3325
3326 # IFS
3327 # We need space, tab and new line, in precisely that order.
3328 as_nl='
3329 '
3330 IFS=" $as_nl"
3331
3332 # CDPATH.
3333 $as_unset CDPATH
3334
3335 exec 6>&1
3336
3337 # Open the log real soon, to keep \$[0] and so on meaningful, and to
3338 # report actual input values of CONFIG_FILES etc. instead of their
3339 # values after options handling. Logging --version etc. is OK.
3340 exec 5>>config.log
3341 {
3342 echo
3343 sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX
3344 ## Running $as_me. ##
3345 _ASBOX
3346 } >&5
3347 cat >&5 <<_CSEOF
3348
3349 This file was extended by $as_me, which was
3350 generated by GNU Autoconf 2.59. Invocation command line was
3351
3352 CONFIG_FILES = $CONFIG_FILES
3353 CONFIG_HEADERS = $CONFIG_HEADERS
3354 CONFIG_LINKS = $CONFIG_LINKS
3355 CONFIG_COMMANDS = $CONFIG_COMMANDS
3356 $ $0 $@
3357
3358 _CSEOF
3359 echo "on `(hostname || uname -n) 2>/dev/null | sed 1q`" >&5
3360 echo >&5
3361 _ACEOF
3362
3363 # Files that config.status was made for.
3364 if test -n "$ac_config_files"; then
3365 echo "config_files=\"$ac_config_files\"" >>$CONFIG_STATUS
3366 fi
3367
3368 if test -n "$ac_config_headers"; then
3369 echo "config_headers=\"$ac_config_headers\"" >>$CONFIG_STATUS
3370 fi
3371
3372 if test -n "$ac_config_links"; then
3373 echo "config_links=\"$ac_config_links\"" >>$CONFIG_STATUS
3374 fi
3375
3376 if test -n "$ac_config_commands"; then
3377 echo "config_commands=\"$ac_config_commands\"" >>$CONFIG_STATUS
3378 fi
3379
3380 cat >>$CONFIG_STATUS <<\_ACEOF
3381
3382 ac_cs_usage="\
3383 \`$as_me' instantiates files from templates according to the
3384 current configuration.
3385
3386 Usage: $0 [OPTIONS] [FILE]...
3387
3388 -h, --help print this help, then exit
3389 -V, --version print version number, then exit
3390 -q, --quiet do not print progress messages
3391 -d, --debug don't remove temporary files
3392 --recheck update $as_me by reconfiguring in the same conditions
3393 --file=FILE[:TEMPLATE]
3394 instantiate the configuration file FILE
3395
3396 Configuration files:
3397 $config_files
3398
3399 Configuration commands:
3400 $config_commands
3401
3402 Report bugs to <bug-autoconf@gnu.org>."
3403 _ACEOF
3404
3405 cat >>$CONFIG_STATUS <<_ACEOF
3406 ac_cs_version="\\
3407 config.status
3408 configured by $0, generated by GNU Autoconf 2.59,
3409 with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\"
3410
3411 Copyright (C) 2003 Free Software Foundation, Inc.
3412 This config.status script is free software; the Free Software Foundation
3413 gives unlimited permission to copy, distribute and modify it."
3414 srcdir=$srcdir
3415 INSTALL="$INSTALL"
3416 _ACEOF
3417
3418 cat >>$CONFIG_STATUS <<\_ACEOF
3419 # If no file are specified by the user, then we need to provide default
3420 # value. By we need to know if files were specified by the user.
3421 ac_need_defaults=:
3422 while test $# != 0
3423 do
3424 case $1 in
3425 --*=*)
3426 ac_option=`expr "x$1" : 'x\([^=]*\)='`
3427 ac_optarg=`expr "x$1" : 'x[^=]*=\(.*\)'`
3428 ac_shift=:
3429 ;;
3430 -*)
3431 ac_option=$1
3432 ac_optarg=$2
3433 ac_shift=shift
3434 ;;
3435 *) # This is not an option, so the user has probably given explicit
3436 # arguments.
3437 ac_option=$1
3438 ac_need_defaults=false;;
3439 esac
3440
3441 case $ac_option in
3442 # Handling of the options.
3443 _ACEOF
3444 cat >>$CONFIG_STATUS <<\_ACEOF
3445 -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r)
3446 ac_cs_recheck=: ;;
3447 --version | --vers* | -V )
3448 echo "$ac_cs_version"; exit 0 ;;
3449 --he | --h)
3450 # Conflict between --help and --header
3451 { { echo "$as_me:$LINENO: error: ambiguous option: $1
3452 Try \`$0 --help' for more information." >&5
3453 echo "$as_me: error: ambiguous option: $1
3454 Try \`$0 --help' for more information." >&2;}
3455 { (exit 1); exit 1; }; };;
3456 --help | --hel | -h )
3457 echo "$ac_cs_usage"; exit 0 ;;
3458 --debug | --d* | -d )
3459 debug=: ;;
3460 --file | --fil | --fi | --f )
3461 $ac_shift
3462 CONFIG_FILES="$CONFIG_FILES $ac_optarg"
3463 ac_need_defaults=false;;
3464 --header | --heade | --head | --hea )
3465 $ac_shift
3466 CONFIG_HEADERS="$CONFIG_HEADERS $ac_optarg"
3467 ac_need_defaults=false;;
3468 -q | -quiet | --quiet | --quie | --qui | --qu | --q \
3469 | -silent | --silent | --silen | --sile | --sil | --si | --s)
3470 ac_cs_silent=: ;;
3471
3472 # This is an error.
3473 -*) { { echo "$as_me:$LINENO: error: unrecognized option: $1
3474 Try \`$0 --help' for more information." >&5
3475 echo "$as_me: error: unrecognized option: $1
3476 Try \`$0 --help' for more information." >&2;}
3477 { (exit 1); exit 1; }; } ;;
3478
3479 *) ac_config_targets="$ac_config_targets $1" ;;
3480
3481 esac
3482 shift
3483 done
3484
3485 ac_configure_extra_args=
3486
3487 if $ac_cs_silent; then
3488 exec 6>/dev/null
3489 ac_configure_extra_args="$ac_configure_extra_args --silent"
3490 fi
3491
3492 _ACEOF
3493 cat >>$CONFIG_STATUS <<_ACEOF
3494 if \$ac_cs_recheck; then
3495 echo "running $SHELL $0 " $ac_configure_args \$ac_configure_extra_args " --no-create --no-recursion" >&6
3496 exec $SHELL $0 $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion
3497 fi
3498
3499 _ACEOF
3500
3501 cat >>$CONFIG_STATUS <<_ACEOF
3502 #
3503 # INIT-COMMANDS section.
3504 #
3505
3506 AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"
3507
3508 _ACEOF
3509
3510
3511
3512 cat >>$CONFIG_STATUS <<\_ACEOF
3513 for ac_config_target in $ac_config_targets
3514 do
3515 case "$ac_config_target" in
3516 # Handling of arguments.
3517 "Makefile" ) CONFIG_FILES="$CONFIG_FILES Makefile" ;;
3518 "depfiles" ) CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;;
3519 *) { { echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5
3520 echo "$as_me: error: invalid argument: $ac_config_target" >&2;}
3521 { (exit 1); exit 1; }; };;
3522 esac
3523 done
3524
3525 # If the user did not use the arguments to specify the items to instantiate,
3526 # then the envvar interface is used. Set only those that are not.
3527 # We use the long form for the default assignment because of an extremely
3528 # bizarre bug on SunOS 4.1.3.
3529 if $ac_need_defaults; then
3530 test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files
3531 test "${CONFIG_COMMANDS+set}" = set || CONFIG_COMMANDS=$config_commands
3532 fi
3533
3534 # Have a temporary directory for convenience. Make it in the build tree
3535 # simply because there is no reason to put it here, and in addition,
3536 # creating and moving files from /tmp can sometimes cause problems.
3537 # Create a temporary directory, and hook for its removal unless debugging.
3538 $debug ||
3539 {
3540 trap 'exit_status=$?; rm -rf $tmp && exit $exit_status' 0
3541 trap '{ (exit 1); exit 1; }' 1 2 13 15
3542 }
3543
3544 # Create a (secure) tmp directory for tmp files.
3545
3546 {
3547 tmp=`(umask 077 && mktemp -d -q "./confstatXXXXXX") 2>/dev/null` &&
3548 test -n "$tmp" && test -d "$tmp"
3549 } ||
3550 {
3551 tmp=./confstat$$-$RANDOM
3552 (umask 077 && mkdir $tmp)
3553 } ||
3554 {
3555 echo "$me: cannot create a temporary directory in ." >&2
3556 { (exit 1); exit 1; }
3557 }
3558
3559 _ACEOF
3560
3561 cat >>$CONFIG_STATUS <<_ACEOF
3562
3563 #
3564 # CONFIG_FILES section.
3565 #
3566
3567 # No need to generate the scripts if there are no CONFIG_FILES.
3568 # This happens for instance when ./config.status config.h
3569 if test -n "\$CONFIG_FILES"; then
3570 # Protect against being on the right side of a sed subst in config.status.
3571 sed 's/,@/@@/; s/@,/@@/; s/,;t t\$/@;t t/; /@;t t\$/s/[\\\\&,]/\\\\&/g;
3572 s/@@/,@/; s/@@/@,/; s/@;t t\$/,;t t/' >\$tmp/subs.sed <<\\CEOF
3573 s,@SHELL@,$SHELL,;t t
3574 s,@PATH_SEPARATOR@,$PATH_SEPARATOR,;t t
3575 s,@PACKAGE_NAME@,$PACKAGE_NAME,;t t
3576 s,@PACKAGE_TARNAME@,$PACKAGE_TARNAME,;t t
3577 s,@PACKAGE_VERSION@,$PACKAGE_VERSION,;t t
3578 s,@PACKAGE_STRING@,$PACKAGE_STRING,;t t
3579 s,@PACKAGE_BUGREPORT@,$PACKAGE_BUGREPORT,;t t
3580 s,@exec_prefix@,$exec_prefix,;t t
3581 s,@prefix@,$prefix,;t t
3582 s,@program_transform_name@,$program_transform_name,;t t
3583 s,@bindir@,$bindir,;t t
3584 s,@sbindir@,$sbindir,;t t
3585 s,@libexecdir@,$libexecdir,;t t
3586 s,@datadir@,$datadir,;t t
3587 s,@sysconfdir@,$sysconfdir,;t t
3588 s,@sharedstatedir@,$sharedstatedir,;t t
3589 s,@localstatedir@,$localstatedir,;t t
3590 s,@libdir@,$libdir,;t t
3591 s,@includedir@,$includedir,;t t
3592 s,@oldincludedir@,$oldincludedir,;t t
3593 s,@infodir@,$infodir,;t t
3594 s,@mandir@,$mandir,;t t
3595 s,@build_alias@,$build_alias,;t t
3596 s,@host_alias@,$host_alias,;t t
3597 s,@target_alias@,$target_alias,;t t
3598 s,@DEFS@,$DEFS,;t t
3599 s,@ECHO_C@,$ECHO_C,;t t
3600 s,@ECHO_N@,$ECHO_N,;t t
3601 s,@ECHO_T@,$ECHO_T,;t t
3602 s,@LIBS@,$LIBS,;t t
3603 s,@INSTALL_PROGRAM@,$INSTALL_PROGRAM,;t t
3604 s,@INSTALL_SCRIPT@,$INSTALL_SCRIPT,;t t
3605 s,@INSTALL_DATA@,$INSTALL_DATA,;t t
3606 s,@CYGPATH_W@,$CYGPATH_W,;t t
3607 s,@PACKAGE@,$PACKAGE,;t t
3608 s,@VERSION@,$VERSION,;t t
3609 s,@ACLOCAL@,$ACLOCAL,;t t
3610 s,@AUTOCONF@,$AUTOCONF,;t t
3611 s,@AUTOMAKE@,$AUTOMAKE,;t t
3612 s,@AUTOHEADER@,$AUTOHEADER,;t t
3613 s,@MAKEINFO@,$MAKEINFO,;t t
3614 s,@install_sh@,$install_sh,;t t
3615 s,@STRIP@,$STRIP,;t t
3616 s,@ac_ct_STRIP@,$ac_ct_STRIP,;t t
3617 s,@INSTALL_STRIP_PROGRAM@,$INSTALL_STRIP_PROGRAM,;t t
3618 s,@mkdir_p@,$mkdir_p,;t t
3619 s,@AWK@,$AWK,;t t
3620 s,@SET_MAKE@,$SET_MAKE,;t t
3621 s,@am__leading_dot@,$am__leading_dot,;t t
3622 s,@AMTAR@,$AMTAR,;t t
3623 s,@am__tar@,$am__tar,;t t
3624 s,@am__untar@,$am__untar,;t t
3625 s,@CC@,$CC,;t t
3626 s,@CFLAGS@,$CFLAGS,;t t
3627 s,@LDFLAGS@,$LDFLAGS,;t t
3628 s,@CPPFLAGS@,$CPPFLAGS,;t t
3629 s,@ac_ct_CC@,$ac_ct_CC,;t t
3630 s,@EXEEXT@,$EXEEXT,;t t
3631 s,@OBJEXT@,$OBJEXT,;t t
3632 s,@DEPDIR@,$DEPDIR,;t t
3633 s,@am__include@,$am__include,;t t
3634 s,@am__quote@,$am__quote,;t t
3635 s,@AMDEP_TRUE@,$AMDEP_TRUE,;t t
3636 s,@AMDEP_FALSE@,$AMDEP_FALSE,;t t
3637 s,@AMDEPBACKSLASH@,$AMDEPBACKSLASH,;t t
3638 s,@CCDEPMODE@,$CCDEPMODE,;t t
3639 s,@am__fastdepCC_TRUE@,$am__fastdepCC_TRUE,;t t
3640 s,@am__fastdepCC_FALSE@,$am__fastdepCC_FALSE,;t t
3641 s,@CURL_CONFIG@,$CURL_CONFIG,;t t
3642 s,@CURLCFLAGS@,$CURLCFLAGS,;t t
3643 s,@CURLLDFLAGS@,$CURLLDFLAGS,;t t
3644 s,@LIBOBJS@,$LIBOBJS,;t t
3645 s,@LTLIBOBJS@,$LTLIBOBJS,;t t
3646 CEOF
3647
3648 _ACEOF
3649
3650 cat >>$CONFIG_STATUS <<\_ACEOF
3651 # Split the substitutions into bite-sized pieces for seds with
3652 # small command number limits, like on Digital OSF/1 and HP-UX.
3653 ac_max_sed_lines=48
3654 ac_sed_frag=1 # Number of current file.
3655 ac_beg=1 # First line for current file.
3656 ac_end=$ac_max_sed_lines # Line after last line for current file.
3657 ac_more_lines=:
3658 ac_sed_cmds=
3659 while $ac_more_lines; do
3660 if test $ac_beg -gt 1; then
3661 sed "1,${ac_beg}d; ${ac_end}q" $tmp/subs.sed >$tmp/subs.frag
3662 else
3663 sed "${ac_end}q" $tmp/subs.sed >$tmp/subs.frag
3664 fi
3665 if test ! -s $tmp/subs.frag; then
3666 ac_more_lines=false
3667 else
3668 # The purpose of the label and of the branching condition is to
3669 # speed up the sed processing (if there are no `@' at all, there
3670 # is no need to browse any of the substitutions).
3671 # These are the two extra sed commands mentioned above.
3672 (echo ':t
3673 /@[a-zA-Z_][a-zA-Z_0-9]*@/!b' && cat $tmp/subs.frag) >$tmp/subs-$ac_sed_frag.sed
3674 if test -z "$ac_sed_cmds"; then
3675 ac_sed_cmds="sed -f $tmp/subs-$ac_sed_frag.sed"
3676 else
3677 ac_sed_cmds="$ac_sed_cmds | sed -f $tmp/subs-$ac_sed_frag.sed"
3678 fi
3679 ac_sed_frag=`expr $ac_sed_frag + 1`
3680 ac_beg=$ac_end
3681 ac_end=`expr $ac_end + $ac_max_sed_lines`
3682 fi
3683 done
3684 if test -z "$ac_sed_cmds"; then
3685 ac_sed_cmds=cat
3686 fi
3687 fi # test -n "$CONFIG_FILES"
3688
3689 _ACEOF
3690 cat >>$CONFIG_STATUS <<\_ACEOF
3691 for ac_file in : $CONFIG_FILES; do test "x$ac_file" = x: && continue
3692 # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in".
3693 case $ac_file in
3694 - | *:- | *:-:* ) # input from stdin
3695 cat >$tmp/stdin
3696 ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'`
3697 ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;;
3698 *:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'`
3699 ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;;
3700 * ) ac_file_in=$ac_file.in ;;
3701 esac
3702
3703 # Compute @srcdir@, @top_srcdir@, and @INSTALL@ for subdirectories.
3704 ac_dir=`(dirname "$ac_file") 2>/dev/null ||
3705 $as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
3706 X"$ac_file" : 'X\(//\)[^/]' \| \
3707 X"$ac_file" : 'X\(//\)$' \| \
3708 X"$ac_file" : 'X\(/\)' \| \
3709 . : '\(.\)' 2>/dev/null ||
3710 echo X"$ac_file" |
3711 sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
3712 /^X\(\/\/\)[^/].*/{ s//\1/; q; }
3713 /^X\(\/\/\)$/{ s//\1/; q; }
3714 /^X\(\/\).*/{ s//\1/; q; }
3715 s/.*/./; q'`
3716 { if $as_mkdir_p; then
3717 mkdir -p "$ac_dir"
3718 else
3719 as_dir="$ac_dir"
3720 as_dirs=
3721 while test ! -d "$as_dir"; do
3722 as_dirs="$as_dir $as_dirs"
3723 as_dir=`(dirname "$as_dir") 2>/dev/null ||
3724 $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
3725 X"$as_dir" : 'X\(//\)[^/]' \| \
3726 X"$as_dir" : 'X\(//\)$' \| \
3727 X"$as_dir" : 'X\(/\)' \| \
3728 . : '\(.\)' 2>/dev/null ||
3729 echo X"$as_dir" |
3730 sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
3731 /^X\(\/\/\)[^/].*/{ s//\1/; q; }
3732 /^X\(\/\/\)$/{ s//\1/; q; }
3733 /^X\(\/\).*/{ s//\1/; q; }
3734 s/.*/./; q'`
3735 done
3736 test ! -n "$as_dirs" || mkdir $as_dirs
3737 fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5
3738 echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;}
3739 { (exit 1); exit 1; }; }; }
3740
3741 ac_builddir=.
3742
3743 if test "$ac_dir" != .; then
3744 ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'`
3745 # A "../" for each directory in $ac_dir_suffix.
3746 ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'`
3747 else
3748 ac_dir_suffix= ac_top_builddir=
3749 fi
3750
3751 case $srcdir in
3752 .) # No --srcdir option. We are building in place.
3753 ac_srcdir=.
3754 if test -z "$ac_top_builddir"; then
3755 ac_top_srcdir=.
3756 else
3757 ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'`
3758 fi ;;
3759 [\\/]* | ?:[\\/]* ) # Absolute path.
3760 ac_srcdir=$srcdir$ac_dir_suffix;
3761 ac_top_srcdir=$srcdir ;;
3762 *) # Relative path.
3763 ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix
3764 ac_top_srcdir=$ac_top_builddir$srcdir ;;
3765 esac
3766
3767 # Do not use `cd foo && pwd` to compute absolute paths, because
3768 # the directories may not exist.
3769 case `pwd` in
3770 .) ac_abs_builddir="$ac_dir";;
3771 *)
3772 case "$ac_dir" in
3773 .) ac_abs_builddir=`pwd`;;
3774 [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";;
3775 *) ac_abs_builddir=`pwd`/"$ac_dir";;
3776 esac;;
3777 esac
3778 case $ac_abs_builddir in
3779 .) ac_abs_top_builddir=${ac_top_builddir}.;;
3780 *)
3781 case ${ac_top_builddir}. in
3782 .) ac_abs_top_builddir=$ac_abs_builddir;;
3783 [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;;
3784 *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;;
3785 esac;;
3786 esac
3787 case $ac_abs_builddir in
3788 .) ac_abs_srcdir=$ac_srcdir;;
3789 *)
3790 case $ac_srcdir in
3791 .) ac_abs_srcdir=$ac_abs_builddir;;
3792 [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;;
3793 *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;;
3794 esac;;
3795 esac
3796 case $ac_abs_builddir in
3797 .) ac_abs_top_srcdir=$ac_top_srcdir;;
3798 *)
3799 case $ac_top_srcdir in
3800 .) ac_abs_top_srcdir=$ac_abs_builddir;;
3801 [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;;
3802 *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;;
3803 esac;;
3804 esac
3805
3806
3807 case $INSTALL in
3808 [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;;
3809 *) ac_INSTALL=$ac_top_builddir$INSTALL ;;
3810 esac
3811
3812 if test x"$ac_file" != x-; then
3813 { echo "$as_me:$LINENO: creating $ac_file" >&5
3814 echo "$as_me: creating $ac_file" >&6;}
3815 rm -f "$ac_file"
3816 fi
3817 # Let's still pretend it is `configure' which instantiates (i.e., don't
3818 # use $as_me), people would be surprised to read:
3819 # /* config.h. Generated by config.status. */
3820 if test x"$ac_file" = x-; then
3821 configure_input=
3822 else
3823 configure_input="$ac_file. "
3824 fi
3825 configure_input=$configure_input"Generated from `echo $ac_file_in |
3826 sed 's,.*/,,'` by configure."
3827
3828 # First look for the input files in the build tree, otherwise in the
3829 # src tree.
3830 ac_file_inputs=`IFS=:
3831 for f in $ac_file_in; do
3832 case $f in
3833 -) echo $tmp/stdin ;;
3834 [\\/$]*)
3835 # Absolute (can't be DOS-style, as IFS=:)
3836 test -f "$f" || { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5
3837 echo "$as_me: error: cannot find input file: $f" >&2;}
3838 { (exit 1); exit 1; }; }
3839 echo "$f";;
3840 *) # Relative
3841 if test -f "$f"; then
3842 # Build tree
3843 echo "$f"
3844 elif test -f "$srcdir/$f"; then
3845 # Source tree
3846 echo "$srcdir/$f"
3847 else
3848 # /dev/null tree
3849 { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5
3850 echo "$as_me: error: cannot find input file: $f" >&2;}
3851 { (exit 1); exit 1; }; }
3852 fi;;
3853 esac
3854 done` || { (exit 1); exit 1; }
3855 _ACEOF
3856 cat >>$CONFIG_STATUS <<_ACEOF
3857 sed "$ac_vpsub
3858 $extrasub
3859 _ACEOF
3860 cat >>$CONFIG_STATUS <<\_ACEOF
3861 :t
3862 /@[a-zA-Z_][a-zA-Z_0-9]*@/!b
3863 s,@configure_input@,$configure_input,;t t
3864 s,@srcdir@,$ac_srcdir,;t t
3865 s,@abs_srcdir@,$ac_abs_srcdir,;t t
3866 s,@top_srcdir@,$ac_top_srcdir,;t t
3867 s,@abs_top_srcdir@,$ac_abs_top_srcdir,;t t
3868 s,@builddir@,$ac_builddir,;t t
3869 s,@abs_builddir@,$ac_abs_builddir,;t t
3870 s,@top_builddir@,$ac_top_builddir,;t t
3871 s,@abs_top_builddir@,$ac_abs_top_builddir,;t t
3872 s,@INSTALL@,$ac_INSTALL,;t t
3873 " $ac_file_inputs | (eval "$ac_sed_cmds") >$tmp/out
3874 rm -f $tmp/stdin
3875 if test x"$ac_file" != x-; then
3876 mv $tmp/out $ac_file
3877 else
3878 cat $tmp/out
3879 rm -f $tmp/out
3880 fi
3881
3882 done
3883 _ACEOF
3884 cat >>$CONFIG_STATUS <<\_ACEOF
3885
3886 #
3887 # CONFIG_COMMANDS section.
3888 #
3889 for ac_file in : $CONFIG_COMMANDS; do test "x$ac_file" = x: && continue
3890 ac_dest=`echo "$ac_file" | sed 's,:.*,,'`
3891 ac_source=`echo "$ac_file" | sed 's,[^:]*:,,'`
3892 ac_dir=`(dirname "$ac_dest") 2>/dev/null ||
3893 $as_expr X"$ac_dest" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
3894 X"$ac_dest" : 'X\(//\)[^/]' \| \
3895 X"$ac_dest" : 'X\(//\)$' \| \
3896 X"$ac_dest" : 'X\(/\)' \| \
3897 . : '\(.\)' 2>/dev/null ||
3898 echo X"$ac_dest" |
3899 sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
3900 /^X\(\/\/\)[^/].*/{ s//\1/; q; }
3901 /^X\(\/\/\)$/{ s//\1/; q; }
3902 /^X\(\/\).*/{ s//\1/; q; }
3903 s/.*/./; q'`
3904 { if $as_mkdir_p; then
3905 mkdir -p "$ac_dir"
3906 else
3907 as_dir="$ac_dir"
3908 as_dirs=
3909 while test ! -d "$as_dir"; do
3910 as_dirs="$as_dir $as_dirs"
3911 as_dir=`(dirname "$as_dir") 2>/dev/null ||
3912 $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
3913 X"$as_dir" : 'X\(//\)[^/]' \| \
3914 X"$as_dir" : 'X\(//\)$' \| \
3915 X"$as_dir" : 'X\(/\)' \| \
3916 . : '\(.\)' 2>/dev/null ||
3917 echo X"$as_dir" |
3918 sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
3919 /^X\(\/\/\)[^/].*/{ s//\1/; q; }
3920 /^X\(\/\/\)$/{ s//\1/; q; }
3921 /^X\(\/\).*/{ s//\1/; q; }
3922 s/.*/./; q'`
3923 done
3924 test ! -n "$as_dirs" || mkdir $as_dirs
3925 fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5
3926 echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;}
3927 { (exit 1); exit 1; }; }; }
3928
3929 ac_builddir=.
3930
3931 if test "$ac_dir" != .; then
3932 ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'`
3933 # A "../" for each directory in $ac_dir_suffix.
3934 ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'`
3935 else
3936 ac_dir_suffix= ac_top_builddir=
3937 fi
3938
3939 case $srcdir in
3940 .) # No --srcdir option. We are building in place.
3941 ac_srcdir=.
3942 if test -z "$ac_top_builddir"; then
3943 ac_top_srcdir=.
3944 else
3945 ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'`
3946 fi ;;
3947 [\\/]* | ?:[\\/]* ) # Absolute path.
3948 ac_srcdir=$srcdir$ac_dir_suffix;
3949 ac_top_srcdir=$srcdir ;;
3950 *) # Relative path.
3951 ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix
3952 ac_top_srcdir=$ac_top_builddir$srcdir ;;
3953 esac
3954
3955 # Do not use `cd foo && pwd` to compute absolute paths, because
3956 # the directories may not exist.
3957 case `pwd` in
3958 .) ac_abs_builddir="$ac_dir";;
3959 *)
3960 case "$ac_dir" in
3961 .) ac_abs_builddir=`pwd`;;
3962 [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";;
3963 *) ac_abs_builddir=`pwd`/"$ac_dir";;
3964 esac;;
3965 esac
3966 case $ac_abs_builddir in
3967 .) ac_abs_top_builddir=${ac_top_builddir}.;;
3968 *)
3969 case ${ac_top_builddir}. in
3970 .) ac_abs_top_builddir=$ac_abs_builddir;;
3971 [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;;
3972 *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;;
3973 esac;;
3974 esac
3975 case $ac_abs_builddir in
3976 .) ac_abs_srcdir=$ac_srcdir;;
3977 *)
3978 case $ac_srcdir in
3979 .) ac_abs_srcdir=$ac_abs_builddir;;
3980 [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;;
3981 *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;;
3982 esac;;
3983 esac
3984 case $ac_abs_builddir in
3985 .) ac_abs_top_srcdir=$ac_top_srcdir;;
3986 *)
3987 case $ac_top_srcdir in
3988 .) ac_abs_top_srcdir=$ac_abs_builddir;;
3989 [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;;
3990 *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;;
3991 esac;;
3992 esac
3993
3994
3995 { echo "$as_me:$LINENO: executing $ac_dest commands" >&5
3996 echo "$as_me: executing $ac_dest commands" >&6;}
3997 case $ac_dest in
3998 depfiles ) test x"$AMDEP_TRUE" != x"" || for mf in $CONFIG_FILES; do
3999 # Strip MF so we end up with the name of the file.
4000 mf=`echo "$mf" | sed -e 's/:.*$//'`
4001 # Check whether this is an Automake generated Makefile or not.
4002 # We used to match only the files named `Makefile.in', but
4003 # some people rename them; so instead we look at the file content.
4004 # Grep'ing the first line is not enough: some people post-process
4005 # each Makefile.in and add a new line on top of each file to say so.
4006 # So let's grep whole file.
4007 if grep '^#.*generated by automake' $mf > /dev/null 2>&1; then
4008 dirpart=`(dirname "$mf") 2>/dev/null ||
4009 $as_expr X"$mf" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
4010 X"$mf" : 'X\(//\)[^/]' \| \
4011 X"$mf" : 'X\(//\)$' \| \
4012 X"$mf" : 'X\(/\)' \| \
4013 . : '\(.\)' 2>/dev/null ||
4014 echo X"$mf" |
4015 sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
4016 /^X\(\/\/\)[^/].*/{ s//\1/; q; }
4017 /^X\(\/\/\)$/{ s//\1/; q; }
4018 /^X\(\/\).*/{ s//\1/; q; }
4019 s/.*/./; q'`
4020 else
4021 continue
4022 fi
4023 # Extract the definition of DEPDIR, am__include, and am__quote
4024 # from the Makefile without running `make'.
4025 DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"`
4026 test -z "$DEPDIR" && continue
4027 am__include=`sed -n 's/^am__include = //p' < "$mf"`
4028 test -z "am__include" && continue
4029 am__quote=`sed -n 's/^am__quote = //p' < "$mf"`
4030 # When using ansi2knr, U may be empty or an underscore; expand it
4031 U=`sed -n 's/^U = //p' < "$mf"`
4032 # Find all dependency output files, they are included files with
4033 # $(DEPDIR) in their names. We invoke sed twice because it is the
4034 # simplest approach to changing $(DEPDIR) to its actual value in the
4035 # expansion.
4036 for file in `sed -n "
4037 s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \
4038 sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do
4039 # Make sure the directory exists.
4040 test -f "$dirpart/$file" && continue
4041 fdir=`(dirname "$file") 2>/dev/null ||
4042 $as_expr X"$file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
4043 X"$file" : 'X\(//\)[^/]' \| \
4044 X"$file" : 'X\(//\)$' \| \
4045 X"$file" : 'X\(/\)' \| \
4046 . : '\(.\)' 2>/dev/null ||
4047 echo X"$file" |
4048 sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
4049 /^X\(\/\/\)[^/].*/{ s//\1/; q; }
4050 /^X\(\/\/\)$/{ s//\1/; q; }
4051 /^X\(\/\).*/{ s//\1/; q; }
4052 s/.*/./; q'`
4053 { if $as_mkdir_p; then
4054 mkdir -p $dirpart/$fdir
4055 else
4056 as_dir=$dirpart/$fdir
4057 as_dirs=
4058 while test ! -d "$as_dir"; do
4059 as_dirs="$as_dir $as_dirs"
4060 as_dir=`(dirname "$as_dir") 2>/dev/null ||
4061 $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
4062 X"$as_dir" : 'X\(//\)[^/]' \| \
4063 X"$as_dir" : 'X\(//\)$' \| \
4064 X"$as_dir" : 'X\(/\)' \| \
4065 . : '\(.\)' 2>/dev/null ||
4066 echo X"$as_dir" |
4067 sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
4068 /^X\(\/\/\)[^/].*/{ s//\1/; q; }
4069 /^X\(\/\/\)$/{ s//\1/; q; }
4070 /^X\(\/\).*/{ s//\1/; q; }
4071 s/.*/./; q'`
4072 done
4073 test ! -n "$as_dirs" || mkdir $as_dirs
4074 fi || { { echo "$as_me:$LINENO: error: cannot create directory $dirpart/$fdir" >&5
4075 echo "$as_me: error: cannot create directory $dirpart/$fdir" >&2;}
4076 { (exit 1); exit 1; }; }; }
4077
4078 # echo "creating $dirpart/$file"
4079 echo '# dummy' > "$dirpart/$file"
4080 done
4081 done
4082 ;;
4083 esac
4084 done
4085 _ACEOF
4086
4087 cat >>$CONFIG_STATUS <<\_ACEOF
4088
4089 { (exit 0); exit 0; }
4090 _ACEOF
4091 chmod +x $CONFIG_STATUS
4092 ac_clean_files=$ac_clean_files_save
4093
4094
4095 # configure is writing to config.log, and then calls config.status.
4096 # config.status does its own redirection, appending to config.log.
4097 # Unfortunately, on DOS this fails, as config.log is still kept open
4098 # by configure, so config.status won't be able to write to it; its
4099 # output is simply discarded. So we exec the FD to /dev/null,
4100 # effectively closing config.log, so it can be properly (re)opened and
4101 # appended to by config.status. When coming back to configure, we
4102 # need to make the FD available again.
4103 if test "$no_create" != yes; then
4104 ac_cs_success=:
4105 ac_config_status_args=
4106 test "$silent" = yes &&
4107 ac_config_status_args="$ac_config_status_args --quiet"
4108 exec 5>/dev/null
4109 $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false
4110 exec 5>>config.log
4111 # Use ||, not &&, to avoid exiting from the if with $? = 1, which
4112 # would make configure fail if this is the last instruction.
4113 $ac_cs_success || { (exit 1); exit 1; }
4114 fi
4115
0 AC_INIT(esniper.c)
1 AM_INIT_AUTOMAKE(esniper,2.16.0)
2 AC_PROG_CC
3 AC_PROG_MAKE_SET
4
5 AC_ARG_WITH(curl-config, [ --with-curl-config=PATH Location of libcurl curl-config []], curl_config="$withval", curl_config="curl-config")
6
7 if test -f $curl_config ; then
8 CURL_CONFIG=$curl_config
9 AC_MSG_RESULT(yes)
10 else dnl check in path
11 AC_CHECK_PROGS(CURL_CONFIG, curl-config)
12 fi
13
14 if test "X$CURL_CONFIG" = "X"; then
15 AC_MSG_ERROR($curl_config not found.
16 cURL is available from http://curl.haxx.se/)
17 fi
18
19 curl_ver=`$CURL_CONFIG --version | sed -e "s/libcurl //g"`
20 curl_ver_hex=0x`$CURL_CONFIG --vernum`
21 dnl use awk instead of straight printf, because printf of hex fails on solaris
22 curl_ver_dec=`$AWK 'BEGIN {printf("%d\n", '"$curl_ver_hex"')}' </dev/null`
23
24 dnl check version all other curl_easy were added in 7.1.1
25 check_min=7.1.1
26 check_min_hex=0x070101
27 dnl use awk instead of straight printf, because printf of hex fails on solaris
28 check_min_dec=`$AWK 'BEGIN {printf("%d\n", '"$check_min_hex"')}' </dev/null`
29
30 dnl check version curl_easy_strerror was added in 7.11.2
31 check_good=7.11.2
32 check_good_hex=0x070b02
33 dnl use awk instead of straight printf, because printf of hex fails on solaris
34 check_good_dec=`$AWK 'BEGIN {printf("%d\n", '"$check_good_hex"')}' </dev/null`
35
36 AC_MSG_CHECKING(for cURL version)
37 if test $curl_ver_dec -lt $check_min_dec;then
38 AC_MSG_ERROR([cURL $check_min or newer required
39 cURL is available from http://curl.haxx.se/])
40 fi
41
42 if test $curl_ver_dec -lt $check_good_dec;then
43 CURL_ADDITIONAL="-D NEED_CURL_EASY_STRERROR"
44 fi
45 AC_MSG_RESULT($curl_ver)
46
47 dnl check for curl SSL support
48 AC_MSG_CHECKING(for cURL SSL support)
49 if test XSSL != X`$CURL_CONFIG --feature|grep SSL`; then
50 AC_MSG_ERROR([no SSL
51 cURL is available from http://curl.haxx.se/])
52 else
53 AC_MSG_RESULT(yes)
54 fi
55
56 CURLCFLAGS="`$CURL_CONFIG --cflags` $CURL_ADDITIONAL"
57 CURLLDFLAGS=`$CURL_CONFIG --libs`
58
59 AC_SUBST(CURLCFLAGS)
60 AC_SUBST(CURLLDFLAGS)
61
62 AC_OUTPUT(Makefile)
0 #! /bin/sh
1 # depcomp - compile a program generating dependencies as side-effects
2
3 scriptversion=2004-05-31.23
4
5 # Copyright (C) 1999, 2000, 2003, 2004 Free Software Foundation, Inc.
6
7 # This program is free software; you can redistribute it and/or modify
8 # it under the terms of the GNU General Public License as published by
9 # the Free Software Foundation; either version 2, or (at your option)
10 # any later version.
11
12 # This program is distributed in the hope that it will be useful,
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 # GNU General Public License for more details.
16
17 # You should have received a copy of the GNU General Public License
18 # along with this program; if not, write to the Free Software
19 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
20 # 02111-1307, USA.
21
22 # As a special exception to the GNU General Public License, if you
23 # distribute this file as part of a program that contains a
24 # configuration script generated by Autoconf, you may include it under
25 # the same distribution terms that you use for the rest of that program.
26
27 # Originally written by Alexandre Oliva <oliva@dcc.unicamp.br>.
28
29 case $1 in
30 '')
31 echo "$0: No command. Try \`$0 --help' for more information." 1>&2
32 exit 1;
33 ;;
34 -h | --h*)
35 cat <<\EOF
36 Usage: depcomp [--help] [--version] PROGRAM [ARGS]
37
38 Run PROGRAMS ARGS to compile a file, generating dependencies
39 as side-effects.
40
41 Environment variables:
42 depmode Dependency tracking mode.
43 source Source file read by `PROGRAMS ARGS'.
44 object Object file output by `PROGRAMS ARGS'.
45 DEPDIR directory where to store dependencies.
46 depfile Dependency file to output.
47 tmpdepfile Temporary file to use when outputing dependencies.
48 libtool Whether libtool is used (yes/no).
49
50 Report bugs to <bug-automake@gnu.org>.
51 EOF
52 exit 0
53 ;;
54 -v | --v*)
55 echo "depcomp $scriptversion"
56 exit 0
57 ;;
58 esac
59
60 if test -z "$depmode" || test -z "$source" || test -z "$object"; then
61 echo "depcomp: Variables source, object and depmode must be set" 1>&2
62 exit 1
63 fi
64
65 # Dependencies for sub/bar.o or sub/bar.obj go into sub/.deps/bar.Po.
66 depfile=${depfile-`echo "$object" |
67 sed 's|[^\\/]*$|'${DEPDIR-.deps}'/&|;s|\.\([^.]*\)$|.P\1|;s|Pobj$|Po|'`}
68 tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`}
69
70 rm -f "$tmpdepfile"
71
72 # Some modes work just like other modes, but use different flags. We
73 # parameterize here, but still list the modes in the big case below,
74 # to make depend.m4 easier to write. Note that we *cannot* use a case
75 # here, because this file can only contain one case statement.
76 if test "$depmode" = hp; then
77 # HP compiler uses -M and no extra arg.
78 gccflag=-M
79 depmode=gcc
80 fi
81
82 if test "$depmode" = dashXmstdout; then
83 # This is just like dashmstdout with a different argument.
84 dashmflag=-xM
85 depmode=dashmstdout
86 fi
87
88 case "$depmode" in
89 gcc3)
90 ## gcc 3 implements dependency tracking that does exactly what
91 ## we want. Yay! Note: for some reason libtool 1.4 doesn't like
92 ## it if -MD -MP comes after the -MF stuff. Hmm.
93 "$@" -MT "$object" -MD -MP -MF "$tmpdepfile"
94 stat=$?
95 if test $stat -eq 0; then :
96 else
97 rm -f "$tmpdepfile"
98 exit $stat
99 fi
100 mv "$tmpdepfile" "$depfile"
101 ;;
102
103 gcc)
104 ## There are various ways to get dependency output from gcc. Here's
105 ## why we pick this rather obscure method:
106 ## - Don't want to use -MD because we'd like the dependencies to end
107 ## up in a subdir. Having to rename by hand is ugly.
108 ## (We might end up doing this anyway to support other compilers.)
109 ## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like
110 ## -MM, not -M (despite what the docs say).
111 ## - Using -M directly means running the compiler twice (even worse
112 ## than renaming).
113 if test -z "$gccflag"; then
114 gccflag=-MD,
115 fi
116 "$@" -Wp,"$gccflag$tmpdepfile"
117 stat=$?
118 if test $stat -eq 0; then :
119 else
120 rm -f "$tmpdepfile"
121 exit $stat
122 fi
123 rm -f "$depfile"
124 echo "$object : \\" > "$depfile"
125 alpha=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz
126 ## The second -e expression handles DOS-style file names with drive letters.
127 sed -e 's/^[^:]*: / /' \
128 -e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile"
129 ## This next piece of magic avoids the `deleted header file' problem.
130 ## The problem is that when a header file which appears in a .P file
131 ## is deleted, the dependency causes make to die (because there is
132 ## typically no way to rebuild the header). We avoid this by adding
133 ## dummy dependencies for each header file. Too bad gcc doesn't do
134 ## this for us directly.
135 tr ' ' '
136 ' < "$tmpdepfile" |
137 ## Some versions of gcc put a space before the `:'. On the theory
138 ## that the space means something, we add a space to the output as
139 ## well.
140 ## Some versions of the HPUX 10.20 sed can't process this invocation
141 ## correctly. Breaking it into two sed invocations is a workaround.
142 sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
143 rm -f "$tmpdepfile"
144 ;;
145
146 hp)
147 # This case exists only to let depend.m4 do its work. It works by
148 # looking at the text of this script. This case will never be run,
149 # since it is checked for above.
150 exit 1
151 ;;
152
153 sgi)
154 if test "$libtool" = yes; then
155 "$@" "-Wp,-MDupdate,$tmpdepfile"
156 else
157 "$@" -MDupdate "$tmpdepfile"
158 fi
159 stat=$?
160 if test $stat -eq 0; then :
161 else
162 rm -f "$tmpdepfile"
163 exit $stat
164 fi
165 rm -f "$depfile"
166
167 if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files
168 echo "$object : \\" > "$depfile"
169
170 # Clip off the initial element (the dependent). Don't try to be
171 # clever and replace this with sed code, as IRIX sed won't handle
172 # lines with more than a fixed number of characters (4096 in
173 # IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines;
174 # the IRIX cc adds comments like `#:fec' to the end of the
175 # dependency line.
176 tr ' ' '
177 ' < "$tmpdepfile" \
178 | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \
179 tr '
180 ' ' ' >> $depfile
181 echo >> $depfile
182
183 # The second pass generates a dummy entry for each header file.
184 tr ' ' '
185 ' < "$tmpdepfile" \
186 | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \
187 >> $depfile
188 else
189 # The sourcefile does not contain any dependencies, so just
190 # store a dummy comment line, to avoid errors with the Makefile
191 # "include basename.Plo" scheme.
192 echo "#dummy" > "$depfile"
193 fi
194 rm -f "$tmpdepfile"
195 ;;
196
197 aix)
198 # The C for AIX Compiler uses -M and outputs the dependencies
199 # in a .u file. In older versions, this file always lives in the
200 # current directory. Also, the AIX compiler puts `$object:' at the
201 # start of each line; $object doesn't have directory information.
202 # Version 6 uses the directory in both cases.
203 stripped=`echo "$object" | sed 's/\(.*\)\..*$/\1/'`
204 tmpdepfile="$stripped.u"
205 if test "$libtool" = yes; then
206 "$@" -Wc,-M
207 else
208 "$@" -M
209 fi
210 stat=$?
211
212 if test -f "$tmpdepfile"; then :
213 else
214 stripped=`echo "$stripped" | sed 's,^.*/,,'`
215 tmpdepfile="$stripped.u"
216 fi
217
218 if test $stat -eq 0; then :
219 else
220 rm -f "$tmpdepfile"
221 exit $stat
222 fi
223
224 if test -f "$tmpdepfile"; then
225 outname="$stripped.o"
226 # Each line is of the form `foo.o: dependent.h'.
227 # Do two passes, one to just change these to
228 # `$object: dependent.h' and one to simply `dependent.h:'.
229 sed -e "s,^$outname:,$object :," < "$tmpdepfile" > "$depfile"
230 sed -e "s,^$outname: \(.*\)$,\1:," < "$tmpdepfile" >> "$depfile"
231 else
232 # The sourcefile does not contain any dependencies, so just
233 # store a dummy comment line, to avoid errors with the Makefile
234 # "include basename.Plo" scheme.
235 echo "#dummy" > "$depfile"
236 fi
237 rm -f "$tmpdepfile"
238 ;;
239
240 icc)
241 # Intel's C compiler understands `-MD -MF file'. However on
242 # icc -MD -MF foo.d -c -o sub/foo.o sub/foo.c
243 # ICC 7.0 will fill foo.d with something like
244 # foo.o: sub/foo.c
245 # foo.o: sub/foo.h
246 # which is wrong. We want:
247 # sub/foo.o: sub/foo.c
248 # sub/foo.o: sub/foo.h
249 # sub/foo.c:
250 # sub/foo.h:
251 # ICC 7.1 will output
252 # foo.o: sub/foo.c sub/foo.h
253 # and will wrap long lines using \ :
254 # foo.o: sub/foo.c ... \
255 # sub/foo.h ... \
256 # ...
257
258 "$@" -MD -MF "$tmpdepfile"
259 stat=$?
260 if test $stat -eq 0; then :
261 else
262 rm -f "$tmpdepfile"
263 exit $stat
264 fi
265 rm -f "$depfile"
266 # Each line is of the form `foo.o: dependent.h',
267 # or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'.
268 # Do two passes, one to just change these to
269 # `$object: dependent.h' and one to simply `dependent.h:'.
270 sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile"
271 # Some versions of the HPUX 10.20 sed can't process this invocation
272 # correctly. Breaking it into two sed invocations is a workaround.
273 sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" |
274 sed -e 's/$/ :/' >> "$depfile"
275 rm -f "$tmpdepfile"
276 ;;
277
278 tru64)
279 # The Tru64 compiler uses -MD to generate dependencies as a side
280 # effect. `cc -MD -o foo.o ...' puts the dependencies into `foo.o.d'.
281 # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put
282 # dependencies in `foo.d' instead, so we check for that too.
283 # Subdirectories are respected.
284 dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
285 test "x$dir" = "x$object" && dir=
286 base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`
287
288 if test "$libtool" = yes; then
289 # Dependencies are output in .lo.d with libtool 1.4.
290 # With libtool 1.5 they are output both in $dir.libs/$base.o.d
291 # and in $dir.libs/$base.o.d and $dir$base.o.d. We process the
292 # latter, because the former will be cleaned when $dir.libs is
293 # erased.
294 tmpdepfile1="$dir.libs/$base.lo.d"
295 tmpdepfile2="$dir$base.o.d"
296 tmpdepfile3="$dir.libs/$base.d"
297 "$@" -Wc,-MD
298 else
299 tmpdepfile1="$dir$base.o.d"
300 tmpdepfile2="$dir$base.d"
301 tmpdepfile3="$dir$base.d"
302 "$@" -MD
303 fi
304
305 stat=$?
306 if test $stat -eq 0; then :
307 else
308 rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
309 exit $stat
310 fi
311
312 if test -f "$tmpdepfile1"; then
313 tmpdepfile="$tmpdepfile1"
314 elif test -f "$tmpdepfile2"; then
315 tmpdepfile="$tmpdepfile2"
316 else
317 tmpdepfile="$tmpdepfile3"
318 fi
319 if test -f "$tmpdepfile"; then
320 sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile"
321 # That's a tab and a space in the [].
322 sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile"
323 else
324 echo "#dummy" > "$depfile"
325 fi
326 rm -f "$tmpdepfile"
327 ;;
328
329 #nosideeffect)
330 # This comment above is used by automake to tell side-effect
331 # dependency tracking mechanisms from slower ones.
332
333 dashmstdout)
334 # Important note: in order to support this mode, a compiler *must*
335 # always write the preprocessed file to stdout, regardless of -o.
336 "$@" || exit $?
337
338 # Remove the call to Libtool.
339 if test "$libtool" = yes; then
340 while test $1 != '--mode=compile'; do
341 shift
342 done
343 shift
344 fi
345
346 # Remove `-o $object'.
347 IFS=" "
348 for arg
349 do
350 case $arg in
351 -o)
352 shift
353 ;;
354 $object)
355 shift
356 ;;
357 *)
358 set fnord "$@" "$arg"
359 shift # fnord
360 shift # $arg
361 ;;
362 esac
363 done
364
365 test -z "$dashmflag" && dashmflag=-M
366 # Require at least two characters before searching for `:'
367 # in the target name. This is to cope with DOS-style filenames:
368 # a dependency such as `c:/foo/bar' could be seen as target `c' otherwise.
369 "$@" $dashmflag |
370 sed 's:^[ ]*[^: ][^:][^:]*\:[ ]*:'"$object"'\: :' > "$tmpdepfile"
371 rm -f "$depfile"
372 cat < "$tmpdepfile" > "$depfile"
373 tr ' ' '
374 ' < "$tmpdepfile" | \
375 ## Some versions of the HPUX 10.20 sed can't process this invocation
376 ## correctly. Breaking it into two sed invocations is a workaround.
377 sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
378 rm -f "$tmpdepfile"
379 ;;
380
381 dashXmstdout)
382 # This case only exists to satisfy depend.m4. It is never actually
383 # run, as this mode is specially recognized in the preamble.
384 exit 1
385 ;;
386
387 makedepend)
388 "$@" || exit $?
389 # Remove any Libtool call
390 if test "$libtool" = yes; then
391 while test $1 != '--mode=compile'; do
392 shift
393 done
394 shift
395 fi
396 # X makedepend
397 shift
398 cleared=no
399 for arg in "$@"; do
400 case $cleared in
401 no)
402 set ""; shift
403 cleared=yes ;;
404 esac
405 case "$arg" in
406 -D*|-I*)
407 set fnord "$@" "$arg"; shift ;;
408 # Strip any option that makedepend may not understand. Remove
409 # the object too, otherwise makedepend will parse it as a source file.
410 -*|$object)
411 ;;
412 *)
413 set fnord "$@" "$arg"; shift ;;
414 esac
415 done
416 obj_suffix="`echo $object | sed 's/^.*\././'`"
417 touch "$tmpdepfile"
418 ${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@"
419 rm -f "$depfile"
420 cat < "$tmpdepfile" > "$depfile"
421 sed '1,2d' "$tmpdepfile" | tr ' ' '
422 ' | \
423 ## Some versions of the HPUX 10.20 sed can't process this invocation
424 ## correctly. Breaking it into two sed invocations is a workaround.
425 sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
426 rm -f "$tmpdepfile" "$tmpdepfile".bak
427 ;;
428
429 cpp)
430 # Important note: in order to support this mode, a compiler *must*
431 # always write the preprocessed file to stdout.
432 "$@" || exit $?
433
434 # Remove the call to Libtool.
435 if test "$libtool" = yes; then
436 while test $1 != '--mode=compile'; do
437 shift
438 done
439 shift
440 fi
441
442 # Remove `-o $object'.
443 IFS=" "
444 for arg
445 do
446 case $arg in
447 -o)
448 shift
449 ;;
450 $object)
451 shift
452 ;;
453 *)
454 set fnord "$@" "$arg"
455 shift # fnord
456 shift # $arg
457 ;;
458 esac
459 done
460
461 "$@" -E |
462 sed -n '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' |
463 sed '$ s: \\$::' > "$tmpdepfile"
464 rm -f "$depfile"
465 echo "$object : \\" > "$depfile"
466 cat < "$tmpdepfile" >> "$depfile"
467 sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile"
468 rm -f "$tmpdepfile"
469 ;;
470
471 msvisualcpp)
472 # Important note: in order to support this mode, a compiler *must*
473 # always write the preprocessed file to stdout, regardless of -o,
474 # because we must use -o when running libtool.
475 "$@" || exit $?
476 IFS=" "
477 for arg
478 do
479 case "$arg" in
480 "-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI")
481 set fnord "$@"
482 shift
483 shift
484 ;;
485 *)
486 set fnord "$@" "$arg"
487 shift
488 shift
489 ;;
490 esac
491 done
492 "$@" -E |
493 sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::echo "`cygpath -u \\"\1\\"`":p' | sort | uniq > "$tmpdepfile"
494 rm -f "$depfile"
495 echo "$object : \\" > "$depfile"
496 . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s:: \1 \\:p' >> "$depfile"
497 echo " " >> "$depfile"
498 . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s::\1\::p' >> "$depfile"
499 rm -f "$tmpdepfile"
500 ;;
501
502 none)
503 exec "$@"
504 ;;
505
506 *)
507 echo "Unknown depmode $depmode" 1>&2
508 exit 1
509 ;;
510 esac
511
512 exit 0
513
514 # Local Variables:
515 # mode: shell-script
516 # sh-indentation: 2
517 # eval: (add-hook 'write-file-hooks 'time-stamp)
518 # time-stamp-start: "scriptversion="
519 # time-stamp-format: "%:y-%02m-%02d.%02H"
520 # time-stamp-end: "$"
521 # End:
0 .TH esniper 1 "31 Jan 2005"
1 .SH NAME
2 esniper - a lightweight ebay sniping tool
3 .SH SYNOPSIS
4 .B esniper
5 .RB [ -bdhHimnPrUv ]
6 .RB [ -c
7 .IR conf_file ]
8 .RB [ -l
9 .IR logdir ]
10 .RB [ -p
11 .IR proxy ]
12 .RB [ -q
13 .IR quantity ]
14 .RB [ -s
15 .IR secs|now ]
16 .RB [ -u
17 .IR user ]
18 .RB "(auction_file | [ auction price ... ])"
19 .SH DESCRIPTION
20 .PP
21 .I esniper
22 is a lightweight ebay sniping tool. It doesn't have a lot of features, and
23 that is by design.
24 .PP
25 Auctions are specified on the command line, using the auction number and
26 your bid price. Multiple auctions can be bid on by specifying more auctions
27 and bid prices. esniper stops when the desired quantity has been won
28 (default is 1).
29 .PP
30 You can use an auction file instead of specifying auctions on the command
31 line. See the \fBAUCTION FILE\fP section below for more details.
32 .SH OPTIONS
33 .TP
34 .B -b
35 Enable batch mode.
36 The corresponding configuration option is batch, default value is false.
37 In batch mode, esniper never prompts for password and/or
38 username. If the password or username cannot be determined from options or
39 read from configuration or auction files, esniper will fail.
40 .TP
41 .B -c
42 Specifies a configuration file to read.
43 All options can be set either by command-line flags or in the
44 configuration file.
45 See the \fBCONFIGURATION FILE\fP section for details.
46 The default configuration file is $HOME/.esniper
47 (or $USERPROFILE/My Documents/.esniper in Windows).
48 .TP
49 .B -d
50 Enable debug mode.
51 The corresponding configuration option is debug, default value is false.
52 Log files are named esniper.<auction_num>.log and esniper.log, and are
53 written to the current working directory.
54 If the -l option or logdir configuration option is used, log files are
55 written to the specified directory.
56 .TP
57 .B -h
58 Show command line option help.
59 .TP
60 .B -H
61 Show configuration and auction file help.
62 .TP
63 .B -i
64 Print information on given auctions and exit.
65 .TP
66 .B -l
67 Set the directory where log files will be written.
68 The corresponding configuration option is logdir, default value is the
69 current working directory, or if an auction file is specified the directory
70 of the auction file.
71 The directory must exist and be writeable.
72 Log files are written when the -d option is used.
73 .TP
74 .B -m
75 Print user's my eBay watched items list and exit.
76 The user's myEbay watched items list must use the default column ordering.
77 .TP
78 .B -n
79 Do not bid.
80 The corresponding configuration option is bid, default value is true.
81 Useful for debugging, it exercises most of esniper except
82 actually placing bids. It is also be useful for checking the status of
83 an auction, without accidentally placing a bid.
84 .TP
85 .B -p
86 Specify an http proxy to use.
87 The corresponding configuration option is proxy, default value is the
88 value of the http_proxy environment variable.
89 The proxy should be of the form http://host:port/.
90 .TP
91 .B -P
92 Prompt the user for their ebay password. This overrides the password set in
93 any configuration or auction file.
94 .TP
95 .B -q
96 Set the quantity.
97 The corresponding configuration option is quantity, default value is 1.
98 esniper will quit when it has won enough items.
99 .TP
100 .B -r
101 Do not reduce quantity on startup for items you have already won.
102 The corresponding configuration option is reduce, default value is true.
103 .TP
104 .B -s
105 Set the bidding time, specified as now, or seconds before the end of an
106 auction. If now is used, bids will be placed immediately.
107 The corresponding configuration option is seconds, default value is 10 seconds.
108 You should snipe late enough in an auction to
109 prevent a manual bidder to update their bid, but before other snipes.
110 In case two bids are within one bid increment of each other, the first
111 bid placed wins.
112 .TP
113 .B -u
114 Set the ebay username.
115 The corresponding configuration option is username, there is no default value.
116 .TP
117 .B -U
118 Prompt the user for their ebay username.
119 .TP
120 .B -v
121 Print version and exit.
122 .SH "CONFIGURATION FILE"
123 .PP
124 Most command-line options can also be set in a configuration file.
125 The advantage of using a configuration file is that you can set all of you
126 options once and not have to enter them on the command line every time you
127 run esniper.
128 .PP
129 A configuration file consists of option lines, in the format "option=value",
130 blank lines, and comments. Option names are listed above with their
131 corresponding command-line flags. Comments begin with #.
132 .PP
133 One configuration file option that doesn't have a corresponding command-line
134 flag is password. The password option allows you to set your eBay password.
135 If you store your eBay password in a configuration file, you should ensure that
136 the configuration file can be read only by you.
137 .PP
138 The default configuration file is $HOME/.esniper
139 (or $USERPROFILE/My Documents/.esniper in Windows).
140 If an auction file is used, esniper will also attempt to read .esniper
141 from the directory that contains the auction file; options set in this
142 configuration file will override options set in the user's default
143 configuration file.
144 However, if the -c command line option is used, then only the configuration
145 file specified by the -c command line option is read.
146 .PP
147 Options specified on the command line override corresponding options set in
148 an auction file, and options set in an auction file override options set in
149 any configuration file.
150 .SH "AUCTION FILE"
151 .PP
152 An auction file is similar to a configuration file, but it also has one or
153 more auction lines. An auction line contains an auction number, optionally
154 followed by a bid price. If no bid price is given, the auction number uses
155 the bid price of the first prior auction line that contains a bid price.
156 .PP
157 If an auction file is specified and the -c option isn't used, esniper
158 attempts to read .esniper from the directory where the auction file
159 is located. See the \fBCONFIGURATION FILE\fP section for more details.
160 .SH "EXAMPLES"
161 .PP
162 An example of a configuration file:
163 .PP
164 .in +5
165 .nf
166 # A configuration file contains option settings,
167 # blank lines, and comments (begin with #). The
168 # default configuration file is $HOME/.esniper, and
169 # if you specify an auction file, .esniper in the
170 # auction file's directory as well. If you specify a
171 # configuration file using the -c command-line option,
172 # then that configuration file will be the only one
173 # read.
174 #
175 # If you set your password in a configuration file
176 # and you are on a unix system, you should be the
177 # owner of the file, and you should set the
178 # permissions so that it is readable only by the
179 # owner.
180 #
181 # Here are all the options. Note that if the
182 # default (as defined in esniper -H) is fine, you
183 # don't need to specify it in a configuration file.
184
185 # boolean parameters can be set to:
186 # true, y, yes, on, 1, enabled
187 # false, n, no, off, 0, disabled
188 batch = false
189 bid = yes
190 debug = enabled
191 reduce = y
192
193 # Note: it would be nice if logdir could use ~myuser,
194 # or $HOME. Perhaps in a future version.
195 logdir = /export/home/myuser/esniperlogs
196 password = myebaypassword
197 # Note: proxy authentication not yet supported
198 proxy = http://192.168.1.1:8080/
199 username = myebayusername
200
201 # Note: quantity is usually set in an auction file
202 quantity = 1
203 # Note: seconds can also be "now", if you want to
204 # bid immediately
205 seconds = 10
206 .fi
207 .in -5
208 .PP
209 An example of an auction file:
210 .PP
211 .in +5
212 .nf
213 # An auction file may contain any line that is valid
214 # in a configuration file (see sample_config.txt for
215 # details), plus it may also have auction lines.
216 #
217 # An auction line contains an auction number, optionally
218 # followed by a price. If a price isn't specified, the
219 # price used is the same as the previous auction line.
220 #
221 # You should have one auction file for each type of item
222 # you are bidding on, so that you can change the quantity,
223 # username, or other options to suit the item you are
224 # bidding on. For instance, you may want to buy up to 10
225 # laser print cartridges, but only one digital camera.
226
227 # Sample auction file for laser printer cartridges
228
229 # I'd like 10 of them, and my target price is $50
230 quantity = 10
231
232 # seller surpluslaserjunk, shipping $15,
233 # questionable reputation (so I'll only pay $40 total)
234 9298389738 25
235 9872749829
236 9872972987
237 9087289973
238
239 # seller highqualityprintersupplies, shipping $8,
240 # excellent reputation
241 9982309829 42
242 9827349827
243
244 # seller nonbusinesshomeseller, shipping not mentioned
245 # (assume $10), good reputation
246 9287398473 35
247
248 # seller lasersuppliesforcheap, lousy reputation,
249 # don't buy!!!
250 #9239889372 0
251 .fi
252 .in -5
253 .SH "ENVIRONMENT VARIABLES"
254 .TP 15
255 .SB http_proxy
256 The default http proxy. The -p command-line option and proxy configuration
257 option override this setting.
258 .TP 15
259 .SB USERPROFILE
260 Windows user's home directory. If no configuration file is specified, esniper
261 tries to read the file My Documents/.esniper under the USERPROFILE directory.
262 Note: esniper for Windows 95, 98 and Me is compiled under cygwin, a unix-like
263 environment for Windows. This version of esniper uses the HOME environment
264 variable, as described below.
265 .TP 15
266 .SB HOME
267 Unix user's home directory. If no configuration file is specified, esniper
268 tries to read the file .esniper in this directory.
269 .SH "BUGS"
270 .PP
271 eBay likes to change their website often. Some of these changes will
272 break esniper. If esniper doesn't work for you, please make sure you
273 have the most recent version. You can check the version of esniper you
274 are using by running esniper with the -v option. Updates to esniper are
275 available at http://esniper.sf.net/.
276 .PP
277 If you are running the most current version and you are still encountering
278 a bug, please report the bug at http://esniper.sf.net/. To keep up to date
279 with new releases and major bugs, subscribe to the esniper announce mailing
280 list at http://lists.sf.net/lists/listinfo/esniper-announce
281 .SH THANKS
282 .PP
283 Many thanks to all contributors and users.
284 .SH AUTHOR
285 Copyright © 2002, 2003, 2004 Scott Nicol <esniper@users.sf.net>
286 All rights reserved.
287 .\" Redistribution and use in source and binary forms, with or without
288 .\" modification, are permitted provided that the following conditions are met:
289 .\"
290 .\" - Redistributions of source code must retain the above copyright notice,
291 .\" this list of conditions and the following disclaimer.
292 .\" - Redistributions in binary form must reproduce the above copyright
293 .\" notice, this list of conditions and the following disclaimer in the
294 .\" documentation and/or other materials provided with the distribution.
295 .\"
296 .\" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
297 .\" "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
298 .\" LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
299 .\" A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
300 .\" OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
301 .\" SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
302 .\" TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
303 .\" PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
304 .\" LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
305 .\" NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
306 .\" SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
0 /*
1 * Copyright (c) 2002, 2003, 2004, Scott Nicol <esniper@users.sf.net>
2 * All rights reserved
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are met:
6 *
7 * - Redistributions of source code must retain the above copyright notice,
8 * this list of conditions and the following disclaimer.
9 * - Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 *
13 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
14 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
15 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
16 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
17 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
18 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
19 * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
20 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
21 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
22 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
23 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24 */
25
26 /*
27 * This program will "snipe" an auction on eBay, automatically placing
28 * your bid a few seconds before the auction ends.
29 *
30 * For updates, bug reports, etc, please go to http://esniper.sf.net/.
31 */
32
33 #include "esniper.h"
34 #include "auction.h"
35 #include "auctionfile.h"
36 #include "auctioninfo.h"
37 #include "options.h"
38 #include "util.h"
39
40 static const char *progname = NULL;
41 static const char blurb[] =
42 "Please visit http://esniper.sf.net/ for updates and bug reports. To learn\n"
43 "about updates to and major bugs in esniper, subscribe to the esniper mailing\n"
44 "list at http://lists.sf.net/lists/listinfo/esniper-announce";
45 static const char DEFAULT_CONF_FILE[] = ".esniper";
46
47 #include <errno.h>
48 #include <signal.h>
49 #include <stdio.h>
50 #include <stdlib.h>
51 #include <string.h>
52 #if defined(WIN32)
53 # include <io.h>
54 # define access(name, mode) _access((name), (mode))
55 # define sleep(t) _sleep((t) * 1000)
56 # define R_OK 0x04
57 #else
58 # include <unistd.h>
59 #endif
60
61 /* minimum bid time, in seconds before end of auction */
62 #define MIN_BIDTIME 5
63 /* default bid time */
64 #define DEFAULT_BIDTIME 10
65
66 #define DEFAULT_HISTORY_HOST "offer.ebay.com"
67 #define DEFAULT_PREBID_HOST "offer.ebay.com"
68 #define DEFAULT_BID_HOST "offer.ebay.com"
69
70 option_t options = {
71 NULL, /* username */
72 NULL, /* usernameEscape */
73 NULL, /* password */
74 DEFAULT_BIDTIME,/* bidtime */
75 1, /* quantity */
76 NULL, /* configuration file */
77 NULL, /* auction file */
78 1, /* bid */
79 1, /* reduce quantity */
80 0, /* debug */
81 0, /* usage */
82 0, /* info on given auctions only */
83 0, /* get my eBay items */
84 0, /* batch */
85 0, /* password encrypted? */
86 NULL, /* proxy */
87 NULL, /* log directory */
88 NULL, /* historyHost */
89 NULL, /* prebidHost */
90 NULL, /* bidHost */
91 };
92
93 /* support functions */
94 #if !defined(WIN32)
95 static void sigAlarm(int sig);
96 #endif
97 static void sigTerm(int sig);
98 static void cleanup(void);
99 static int usage(int helptype);
100 static void printRemain(int remain);
101 static void printVersion(void);
102 #define USAGE_SUMMARY 0x01
103 #define USAGE_LONG 0x02
104 #define USAGE_CONFIG 0x04
105 int main(int argc, char *argv[]);
106
107 /* used for option table */
108 static int CheckDebug(const void *valueptr, const optionTable_t *tableptr,
109 const char *filename, const char *line);
110 static int CheckSecs(const void *valueptr, const optionTable_t *tableptr,
111 const char *filename, const char *line);
112 static int CheckQuantity(const void *valueptr, const optionTable_t *tableptr,
113 const char *filename, const char *line);
114 static int ReadUser(const void *valueptr, const optionTable_t *tableptr,
115 const char *filename, const char *line);
116 static int ReadPass(const void *valueptr, const optionTable_t *tableptr,
117 const char *filename, const char *line);
118 static int CheckAuctionFile(const void *valueptr, const optionTable_t *tableptr,
119 const char *filename, const char *line);
120 static int CheckConfigFile(const void *valueptr, const optionTable_t *tableptr,
121 const char *filename, const char *line);
122 static int SetLongHelp(const void *valueptr, const optionTable_t *tableptr,
123 const char *filename, const char *line);
124 static int SetConfigHelp(const void *valueptr, const optionTable_t *tableptr,
125 const char *filename, const char *line);
126
127 /* called by CheckAuctionFile, CheckConfigFile */
128 static int CheckFile(const void *valueptr, const optionTable_t *tableptr,
129 const char *filename, const char *line,
130 const char *fileType);
131
132
133 const char *
134 getVersion(void)
135 {
136 return VERSION;
137 }
138
139 const char *
140 getProgname(void)
141 {
142 return progname ? progname : "esniper";
143 }
144
145 #if !defined(WIN32)
146 static void
147 sigAlarm(int sig)
148 {
149 signal(sig, sigAlarm);
150 log((" SIGALRM"));
151 }
152 #endif
153
154 static void
155 sigTerm(int sig)
156 {
157 signal(sig, SIG_DFL);
158 log(("SIGTERM...\n"));
159 raise(sig);
160 }
161
162 /* cleanup open files */
163 static void
164 cleanup()
165 {
166 logClose();
167 }
168
169 /* specific check functions would reside in main module */
170
171 /*
172 * CheckDebug(): convert boolean value, open of close log file
173 *
174 * returns: 0 = OK, else error
175 */
176 static int
177 CheckDebug(const void *valueptr, const optionTable_t *tableptr,
178 const char *filename, const char *line)
179 {
180 int val = *((const int*)valueptr);
181
182 val ? logOpen(NULL, options.logdir) : logClose();
183 *(int*)(tableptr->value) = val;
184 log(("Debug mode is %s\n", val ? "on" : "off"));
185 return 0;
186 }
187
188 /*
189 * CheckSecs(): convert integer value or "now", check minimum value
190 *
191 * returns: 0 = OK, else error
192 */
193 static int
194 CheckSecs(const void *valueptr, const optionTable_t *tableptr,
195 const char *filename, const char *line)
196 {
197 int intval;
198 char *endptr;
199
200 /* value specified? */
201 if (!valueptr) {
202 if (filename)
203 printLog(stderr, "Configuration option \"%s\" in file %s needs an integer value or \"now\"\n", line, filename);
204 else
205 printLog(stderr, "Option -%s needs an integer value or \"now\"\n", line);
206 }
207 /* specific string value "now" */
208 if (!strcmp((const char *)valueptr, "now")) {
209 /* copy value to target option */
210 *(int *)(tableptr->value)=0;
211 log(("seconds value is %d (now)", *(int *)(tableptr->value)));
212 return 0;
213 }
214
215 /* else must be integer value */
216 intval = strtol((const char*)valueptr, &endptr, 10);
217 if (*endptr != '\0') {
218 if (filename)
219 printLog(stderr, "Configuration option \"%s\" in file %s", line, filename);
220 else
221 printLog(stderr, "Option -%s", line);
222 printLog(stderr, "accepts integer values greater than %d or \"now\"\n", MIN_BIDTIME - 1);
223 return 1;
224 }
225 /* check minimum */
226 if (intval < MIN_BIDTIME) {
227 if (filename)
228 printLog(stderr, "Value at configuration option \"%s\" in file %s", line, filename);
229 else
230 printLog(stderr, "Value %d at option -%s", intval, line);
231 printLog(stderr, " too small, using minimum value of %d seconds\n", MIN_BIDTIME);
232 intval = MIN_BIDTIME;
233 }
234
235 /* copy value to target option */
236 *(int *)(tableptr->value) = intval;
237 log(("seconds value is %d\n", *(const int *)(tableptr->value)));
238 return 0;
239 }
240
241 /*
242 * CheckPass(): set password
243 *
244 * returns: 0 = OK, else error
245 */
246 static int
247 CheckPass(const void *valueptr, const optionTable_t *tableptr,
248 const char *filename, const char *line)
249 {
250 if (!valueptr) {
251 if (filename)
252 printLog(stderr,
253 "Invalid password at \"%s\" in file %s\n",
254 line, filename);
255 else
256 printLog(stderr, "Invalid password at option -%s\n",
257 line);
258 return 1;
259 }
260 setPassword(myStrdup((const char *)valueptr));
261 log(("password has been set\n"));
262 return 0;
263 }
264
265 /*
266 * CheckQuantity(): convert integer value, check for positive value
267 *
268 * returns: 0 = OK, else error
269 */
270 static int
271 CheckQuantity(const void *valueptr, const optionTable_t *tableptr,
272 const char *filename, const char *line)
273 {
274 if (*(const int*)valueptr <= 0) {
275 if (filename)
276 printLog(stderr, "Quantity must be positive at \"%s\" in file %s\n", line, filename);
277 else
278 printLog(stderr,
279 "Quantity must be positive at option -%s\n",
280 line);
281 return 1;
282 }
283 /* copy value to target option */
284 *(int *)(tableptr->value) = *(const int *)valueptr;
285 log(("quantity is %d\n", *(const int *)(tableptr->value)));
286 return 0;
287 }
288
289 /*
290 * CheckUser(): set user
291 *
292 * returns: 0 = OK, else error
293 */
294 static int
295 CheckUser(const void *valueptr, const optionTable_t *tableptr,
296 const char *filename, const char *line)
297 {
298 if (!valueptr) {
299 if (filename)
300 printLog(stderr, "Invalid user at \"%s\" in file %s\n",
301 line, filename);
302 else
303 printLog(stderr, "Invalid user at option -%s\n", line);
304 return 1;
305 }
306 setUsername(myStrdup((const char *)valueptr));
307 log(("user has been set\n"));
308 return 0;
309 }
310
311 /*
312 * ReadUser(): read username from console
313 *
314 * note: not called by option processing code. Called directly from main()
315 * if esniper has not been given username.
316 *
317 * returns: 0 = OK, else error
318 */
319 static int
320 ReadUser(const void *valueptr, const optionTable_t *tableptr,
321 const char *filename, const char *line)
322 {
323 char *username = prompt("Enter eBay username: ", 0);
324
325 if (!username) {
326 printLog(stderr, "Username entry failed!\n");
327 return 1;
328 }
329
330 setUsername(myStrdup(username));
331 log(("username is %s\n", *(char **)(tableptr->value)));
332 return 0;
333 }
334
335 /*
336 * ReadPass(): read password from console
337 *
338 * returns: 0 = OK, else error
339 */
340 static int
341 ReadPass(const void *valueptr, const optionTable_t *tableptr,
342 const char *filename, const char *line)
343 {
344 char *passwd = prompt("Enter eBay password: ", 1);
345
346 if (!passwd) {
347 printLog(stderr, "Password entry failed!\n");
348 return 1;
349 }
350 putchar('\n');
351
352 setPassword(passwd);
353 /* don't log password! */
354 return 0;
355 }
356
357 /*
358 * CheckAuctionFile(): accept accessible files only
359 *
360 * returns: 0 = OK, else error
361 */
362 static int CheckAuctionFile(const void *valueptr, const optionTable_t *tableptr,
363 const char *filename, const char *line)
364 {
365 return CheckFile(valueptr, tableptr, filename, line, "Auction");
366 }
367
368 /*
369 * CheckConfigFile(): accept accessible files only
370 *
371 * returns: 0 = OK, else error
372 */
373 static int CheckConfigFile(const void *valueptr, const optionTable_t *tableptr,
374 const char *filename, const char *line)
375 {
376 return CheckFile(valueptr, tableptr, filename, line, "Config");
377 }
378
379 /*
380 * CheckFile(): accept accessible files only
381 *
382 * returns: 0 = OK, else error
383 */
384 static int CheckFile(const void *valueptr, const optionTable_t *tableptr,
385 const char *filename, const char *line,
386 const char *filetype)
387 {
388 if (access((const char*)valueptr, R_OK)) {
389 printLog(stderr, "%s file \"%s\" is not readable: %s\n",
390 filetype, nullStr((const char*)valueptr),
391 strerror(errno));
392 return 1;
393 }
394 free(*(char **)(tableptr->value));
395 *(char **)(tableptr->value) = myStrdup(valueptr);
396 return 0;
397 }
398
399 /*
400 * SetLongHelp(): set usage to 2 to activate long help
401 *
402 * returns: 0 = OK
403 */
404 static int SetLongHelp(const void *valueptr, const optionTable_t *tableptr,
405 const char *filename, const char *line)
406 {
407 /* copy value to target option */
408 *(int *)(tableptr->value) |= USAGE_SUMMARY | USAGE_LONG;
409 return 0;
410 }
411
412 /*
413 * SetConfigHelp(): set usage to 3 to activate config file help
414 *
415 * returns: 0 = OK
416 */
417 static int SetConfigHelp(const void *valueptr, const optionTable_t *tableptr,
418 const char *filename, const char *line)
419 {
420 /* copy value to target option */
421 *(int *)(tableptr->value) = USAGE_CONFIG;
422 return 0;
423 }
424
425 /*
426 * Print number of auctions remaining.
427 */
428 static void
429 printRemain(int remain)
430 {
431 printLog(stdout, "\nNeed to win %d item(s), %d auction(s) remain\n\n",
432 options.quantity, remain);
433 }
434
435 static void
436 printVersion(void)
437 {
438 const char *newVersion;
439
440 fprintf(stderr, "%s version %s\n", getProgname(), getVersion());
441 if ((newVersion = checkVersion()))
442 fprintf(stderr,
443 "\n"
444 "The newest version is %s, you should upgrade.\n"
445 "Get it from http://esniper.sf.net/\n",
446 newVersion);
447 fprintf(stderr, "\n%s\n", blurb);
448 }
449
450 static const char usageSummary[] =
451 "usage: %s [-bdhHnmPrUv] [-c conf_file] [-l logdir] [-p proxy] [-q quantity]\n"
452 " [-s secs|now] [-u user] (auction_file | [auction price ...])\n"
453 "\n";
454
455 /* split in two to prevent gcc portability warning. maximum length is 509 */
456 static const char usageLong1[] =
457 "where:\n"
458 "-b: batch mode, don't prompt for password or username if not specified\n"
459 #if defined(WIN32)
460 "-c: configuration file (default is \"My Documents/.esniper\" and, if auction\n"
461 #else
462 "-c: configuration file (default is \"$HOME/.esniper\" and, if auction\n"
463 #endif
464 " file is specified, .esniper in auction file's directory)\n"
465 "-d: write debug output to file\n"
466 "-h: command line options help\n"
467 "-H: configuration and auction file help\n"
468 "-i: get info on auctions and exit\n"
469 "-l: log directory (default: ., or directory of auction file, if specified)\n"
470 "-m: get my ebay watched items and exit\n"
471 "-n: do not place bid\n";
472 static const char usageLong2[] =
473 "-p: http proxy (default: http_proxy environment variable, format is\n"
474 " http://host:port/)\n"
475 "-P: prompt for password\n"
476 "-q: quantity to buy (default is 1)\n"
477 "-r: do not reduce quantity on startup if already won item(s)\n"
478 "-s: time to place bid which may be \"now\" or seconds before end of auction\n"
479 " (default is %d seconds before end of auction)\n"
480 "-u: ebay username\n"
481 "-U: prompt for ebay username\n";
482 static const char usageLong3[] =
483 "-v: print version and exit\n"
484 "\n"
485 "You must specify an auction file or <auction> <price> pair[s]. Options\n"
486 "on the command line override settings in auction and configuration files.\n";
487
488 /* split in two to prevent gcc portability warning. maximum length is 509 */
489 static const char usageConfig1[] =
490 "Configuration options (values shown are default):\n"
491 " Boolean: (valid values: true,y,yes,on,1,enabled false,n,no,off,0,disabled)\n"
492 " batch = false\n"
493 " bid = true\n"
494 " debug = false\n"
495 " reduce = true\n"
496 " String:\n"
497 " logdir = .\n"
498 " password =\n"
499 " proxy = <http_proxy environment variable, format is http://host:port/>\n"
500 " username =\n"
501 " historyHost = %s\n"
502 " prebidHost = %s\n"
503 " bidHost = %s\n"
504 " Numeric: (seconds may also be \"now\")\n"
505 " quantity = 1\n"
506 " seconds = %d\n"
507 "\n";
508 static const char usageConfig2[] =
509 "A configuration file consists of option settings, blank lines, and comment\n"
510 "lines. Comment lines begin with #\n"
511 "\n"
512 "An auction file is similar to a configuration file, but it also has one or\n"
513 "more auction lines. An auction line contains an auction number, optionally\n"
514 "followed by a bid price. If no bid price is given, the auction number uses\n"
515 "the bid price of the first prior auction line that contains a bid price.\n";
516
517 static int
518 usage(int helplevel)
519 {
520 if (helplevel & USAGE_SUMMARY)
521 fprintf(stderr, usageSummary, getProgname());
522 if (helplevel & USAGE_LONG) {
523 fprintf(stderr, usageLong1);
524 fprintf(stderr, usageLong2, DEFAULT_BIDTIME);
525 fprintf(stderr, usageLong3);
526 }
527 if (helplevel & USAGE_CONFIG) {
528 fprintf(stderr, usageConfig1, options.historyHost, options.prebidHost, options.bidHost, DEFAULT_BIDTIME);
529 fprintf(stderr, usageConfig2);
530 }
531 if (helplevel == USAGE_SUMMARY)
532 fprintf(stderr, "Try \"%s -h\" for more help.\n", getProgname());
533 fprintf(stderr,"\n%s\n", blurb);
534 return 1;
535 }
536
537 int
538 main(int argc, char *argv[])
539 {
540 int won = 0; /* number of items won */
541 auctionInfo **auctions = NULL;
542 int c, i, numAuctions = 0, numAuctionsOrig = 0;
543 #if DEBUG
544 int XFlag = 0;
545 #endif
546
547 /* this table describes options and config entries */
548 static optionTable_t optiontab[] = {
549 {"username", "u", (void*)&options.username, OPTION_STRING, &CheckUser},
550 {"password",NULL, (void*)&options.password, OPTION_SPECIAL, &CheckPass},
551 {"seconds", "s", (void*)&options.bidtime, OPTION_SPECIAL, &CheckSecs},
552 {"quantity", "q", (void*)&options.quantity, OPTION_INT, &CheckQuantity},
553 {"proxy", "p", (void*)&options.proxy, OPTION_STRING, NULL},
554 {NULL, "P", (void*)&options.password, OPTION_STRING, &ReadPass},
555 {NULL, "U", (void*)&options.username, OPTION_STRING, &ReadUser},
556 {NULL, "c", (void*)&options.conffilename, OPTION_STRING, &CheckConfigFile},
557 /*
558 * -f can't be entered from command line, it's just a convenient way
559 * to integrate auction filename processing with option processing.
560 */
561 {NULL, "f", (void*)&options.auctfilename, OPTION_STRING, &CheckAuctionFile},
562 {"reduce", NULL, (void*)&options.reduce, OPTION_BOOL, NULL},
563 {NULL, "r", (void*)&options.reduce, OPTION_BOOL_NEG, NULL},
564 {"bid", NULL, (void*)&options.bid, OPTION_BOOL, NULL},
565 {NULL, "n", (void*)&options.bid, OPTION_BOOL_NEG, NULL},
566 {NULL, "m", (void*)&options.myitems, OPTION_BOOL, NULL},
567 {NULL, "i", (void*)&options.info, OPTION_BOOL, NULL},
568 {"debug", "d", (void*)&options.debug, OPTION_BOOL, &CheckDebug},
569 {"curldebug","C", (void*)&options.curldebug, OPTION_BOOL, NULL},
570 {"batch", "b", (void*)&options.batch, OPTION_BOOL, NULL},
571 {"logdir", "l", (void*)&options.logdir, OPTION_STRING, NULL},
572 {"historyHost",NULL,(void*)&options.historyHost,OPTION_STRING, NULL},
573 {"prebidHost",NULL,(void*)&options.prebidHost, OPTION_STRING, NULL},
574 {"bidHost", NULL, (void*)&options.bidHost, OPTION_STRING, NULL},
575 {NULL, "?", (void*)&options.usage, OPTION_BOOL, NULL},
576 {NULL, "h", (void*)&options.usage, OPTION_STRING, &SetLongHelp},
577 {NULL, "H", (void*)&options.usage, OPTION_STRING, &SetConfigHelp},
578 {NULL, NULL, NULL, 0, NULL}
579 };
580
581 /* all known options */
582 static const char optionstring[]="bc:dhHil:mnp:Pq:rs:u:Uv"
583 #if DEBUG
584 "X"
585 #endif
586 ;
587
588 atexit(cleanup);
589 progname = basename(argv[0]);
590
591 /* some defaults... */
592 options.historyHost = myStrdup(DEFAULT_HISTORY_HOST);
593 options.prebidHost = myStrdup(DEFAULT_PREBID_HOST);
594 options.bidHost = myStrdup(DEFAULT_BID_HOST);
595
596 /* first, check for debug, configuration file and auction file
597 * options but accept all other options to avoid error messages
598 */
599 while ((c = getopt(argc, argv, optionstring)) != EOF) {
600 switch (c) {
601 /* Debug is in both getopt() sections, because we want
602 * debugging as soon as possible, and also because
603 * command line -d overrides settings in config files
604 */
605 case 'd': /* debug */
606 case 'h': /* command-line options help */
607 case 'H': /* configuration and auction file help */
608 case 'i': /* info only */
609 case 'm': /* get my ebay items */
610 case '?': /* unknown -> help */
611 if (parseGetoptValue(c, NULL, optiontab))
612 options.usage |= USAGE_SUMMARY;
613 break;
614 case 'c': /* configuration file */
615 case 'l': /* log directory */
616 if (parseGetoptValue(c, optarg, optiontab))
617 options.usage |= USAGE_SUMMARY;
618 break;
619 #if DEBUG
620 case 'X': /* secret option - for testing page parsing */
621 ++XFlag;
622 break;
623 #endif
624 case 'v': /* version */
625 printVersion();
626 exit(0);
627 break;
628 default:
629 /* ignore other options, these will be parsed
630 * after configuration and auction files.
631 */
632 break;
633 }
634 }
635
636 if (options.usage)
637 exit(usage(options.usage));
638
639 /* One argument after options? Must be an auction file. */
640 if ((argc - optind) == 1) {
641 if (parseGetoptValue('f', argv[optind], optiontab)) {
642 options.usage |= USAGE_SUMMARY;
643 exit(usage(options.usage));
644 }
645 }
646
647 /*
648 * if configuration file is specified don't try to load any other
649 * configuration file (i.e. $HOME/.esniper, etc).
650 */
651 if (options.conffilename) {
652 if (readConfigFile(options.conffilename, optiontab) > 1)
653 options.usage |= USAGE_SUMMARY;
654 } else {
655 /* TODO: on UNIX use getpwuid() to find the home dir? */
656 char *homedir = getenv("HOME");
657 #if defined(WIN32)
658 char *profiledir = getenv("USERPROFILE");
659
660 if (profiledir && *profiledir) {
661 /* parse $USERPROFILE/My Documents/.esniper */
662 char *cfname = myStrdup3(profiledir,
663 "\\My Documents\\",
664 DEFAULT_CONF_FILE);
665
666 switch (readConfigFile(cfname, optiontab)) {
667 case 1: /* file not found */
668 if (homedir && *homedir) {
669 /* parse $HOME/.esniper */
670 free(cfname);
671 cfname = myStrdup3(homedir, "/",
672 DEFAULT_CONF_FILE);
673 if (readConfigFile(cfname, optiontab) > 1)
674 options.usage |= USAGE_SUMMARY;
675 }
676 break;
677 case 0: /* OK */
678 break;
679 default: /* other error */
680 options.usage |= USAGE_SUMMARY;
681 }
682 free(cfname);
683 } else
684 printLog(stderr, "Warning: environment variable USERPROFILE not set. Cannot parse $USERPROFILE/My Documents/%s.\n", DEFAULT_CONF_FILE);
685 #else
686 if (homedir && *homedir) {
687 /* parse $HOME/.esniper */
688 char *cfname = myStrdup3(homedir,"/",DEFAULT_CONF_FILE);
689 if (readConfigFile(cfname, optiontab) > 1)
690 options.usage |= USAGE_SUMMARY;
691 free(cfname);
692 } else
693 printLog(stderr, "Warning: environment variable HOME not set. Cannot parse $HOME/%s.\n", DEFAULT_CONF_FILE);
694 #endif
695
696 if (options.auctfilename) {
697 /* parse .esniper in auction file's directory */
698 char *auctfilename = myStrdup(options.auctfilename);
699 char *cfname = myStrdup3(dirname(auctfilename), "/", DEFAULT_CONF_FILE);
700
701 if (readConfigFile(cfname, optiontab) > 1)
702 options.usage |= USAGE_SUMMARY;
703 free(auctfilename);
704 free(cfname);
705 }
706 }
707
708 /* parse auction file */
709 if (options.auctfilename) {
710 if (!options.logdir) {
711 char *tmp = myStrdup(options.auctfilename);
712
713 options.logdir = myStrdup(dirname(tmp));
714 free(tmp);
715 }
716 if (readConfigFile(options.auctfilename, optiontab) > 1)
717 options.usage |= USAGE_SUMMARY;
718 }
719
720 /* skip back to first arg */
721 optind = 1;
722 /*
723 * check options which may overwrite settings from configuration
724 * or auction file.
725 */
726 while ((c = getopt(argc, argv, optionstring)) != EOF) {
727 switch (c) {
728 case 'l': /* log directory */
729 case 'p': /* proxy */
730 case 'q': /* quantity */
731 case 's': /* seconds */
732 case 'u': /* user */
733 if (parseGetoptValue(c, optarg, optiontab))
734 options.usage |= USAGE_SUMMARY;
735 break;
736 /* Debug is in both getopt() sections, because we want
737 * debugging as soon as possible, and also because
738 * command line -d overrides settings in config files
739 */
740 case 'd': /* debug */
741 if (options.debug)
742 break;
743 /* fall through */
744 case 'b': /* batch */
745 case 'n': /* don't bid */
746 case 'P': /* read password */
747 case 'r': /* reduce */
748 case 'U': /* read username */
749 if (parseGetoptValue(c, NULL, optiontab))
750 options.usage |= USAGE_SUMMARY;
751 break;
752 default:
753 /* ignore other options, these have been parsed
754 * before configuration and auction files.
755 */
756 break;
757 }
758 }
759
760 argc -= optind;
761 argv += optind;
762
763 /* don't log username/password */
764 /*log(("options.username=%s\n", nullStr(options.username)));*/
765 /*log(("options.password=%s\n", nullStr(options.password)));*/
766 log(("options.bidtime=%d\n", options.bidtime));
767 log(("options.quantity=%d\n", options.quantity));
768 log(("options.conffilename=%s\n", nullStr(options.conffilename)));
769 log(("options.auctfilename=%s\n", nullStr(options.auctfilename)));
770 log(("options.bid=%d\n", options.bid));
771 log(("options.reduce=%d\n", options.reduce));
772 log(("options.debug=%d\n", options.debug));
773 log(("options.usage=%d\n", options.usage));
774 log(("options.info=%d\n", options.info));
775 log(("options.myitems=%d\n", options.myitems));
776
777 if (!options.usage) {
778 #if DEBUG
779 if (!XFlag) {
780 #endif
781 if (options.auctfilename) {
782 /* should never happen */
783 if (argc != 1) {
784 printLog(stderr, "Error: arguments specified after auction filename.\n");
785 options.usage |= USAGE_SUMMARY;
786 }
787 } else if (options.myitems) {
788 if (argc != 0) {
789 printLog(stderr, "Error: auctions specified with -m option.\n");
790 options.usage |= USAGE_SUMMARY;
791 }
792 } else if (argc < 2) {
793 printLog(stderr, "Error: no auctions specified.\n");
794 options.usage |= USAGE_SUMMARY;
795 } else if (argc % 2) {
796 printLog(stderr, "Error: auctions and prices must be specified in pairs.\n");
797 options.usage |= USAGE_SUMMARY;
798 }
799 #if DEBUG
800 }
801 #endif
802 if (!options.username) {
803 if (options.info) {
804 options.username = myStrdup("");
805 options.usernameEscape = myStrdup("");
806 } else if (options.batch) {
807 printLog(stderr, "Error: no username specified.\n");
808 options.usage |= USAGE_SUMMARY;
809 } else if (!options.usage &&
810 parseGetoptValue('U', NULL, optiontab)) {
811 options.usage |= USAGE_SUMMARY;
812 }
813 }
814 if (!options.password) {
815 if (options.info) {
816 } else if (options.batch) {
817 printLog(stderr, "Error: no password specified.\n");
818 options.usage |= USAGE_SUMMARY;
819 } else if (!options.usage &&
820 parseGetoptValue('P', NULL, optiontab)) {
821 options.usage |= USAGE_SUMMARY;
822 }
823 }
824 }
825
826 #if DEBUG
827 if (XFlag) {
828 testParser(XFlag);
829 exit(0);
830 }
831 #endif
832
833 if (options.usage)
834 exit(usage(options.usage));
835
836 /* init variables */
837 if (options.auctfilename) {
838 numAuctions = readAuctionFile(options.auctfilename, &auctions);
839 } else {
840 numAuctions = argc / 2;
841 auctions = (auctionInfo **)malloc(numAuctions * sizeof(auctionInfo *));
842 for (i = 0; i < argc/2; i++)
843 auctions[i] = newAuctionInfo(argv[2*i], argv[2*i+1]);
844 }
845
846 if (options.myitems)
847 exit(printMyItems());
848 if (numAuctions <= 0)
849 exit(usage(USAGE_SUMMARY));
850
851 #if !defined(WIN32)
852 signal(SIGALRM, sigAlarm);
853 signal(SIGHUP, SIG_IGN);
854 signal(SIGPIPE, SIG_IGN);
855 #endif
856 signal(SIGTERM, sigTerm);
857
858 numAuctionsOrig = numAuctions;
859 {
860 int quantity = options.quantity;
861 numAuctions = sortAuctions(auctions, numAuctions, &quantity);
862
863 if (quantity < options.quantity) {
864 printLog(stdout, "\nYou have already won %d item(s).\n",
865 options.quantity - quantity);
866 if (options.reduce) {
867 options.quantity = quantity;
868 printLog(stdout,
869 "Quantity reduced to %d item(s).\n",
870 options.quantity);
871 }
872 }
873 }
874
875 if (options.info) {
876 if (numAuctionsOrig > 1)
877 printRemain(numAuctions);
878 exit(0);
879 }
880
881 for (i = 0; i < numAuctions && options.quantity > 0; ++i) {
882 if (numAuctionsOrig > 1)
883 printRemain(numAuctions - i);
884 won += snipeAuction(auctions[i]);
885 }
886 for (i = 0; i < numAuctions && options.quantity > 0; ++i)
887 freeAuction(auctions[i]);
888 free(auctions);
889
890 cleanupCurlStuff();
891
892 return won > 0 ? 0 : 1;
893 }
0 /*
1 * Copyright (c) 2002, 2003, Scott Nicol <esniper@users.sf.net>
2 * All rights reserved
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are met:
6 *
7 * - Redistributions of source code must retain the above copyright notice,
8 * this list of conditions and the following disclaimer.
9 * - Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 *
13 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
14 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
15 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
16 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
17 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
18 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
19 * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
20 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
21 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
22 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
23 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24 */
25
26 #ifndef ESNIPER_H_INCLUDED
27 #define ESNIPER_H_INCLUDED
28
29 #include "options.h"
30 #include "util.h"
31
32 /* this structure holds all values from command line or config entries */
33 typedef struct {
34 char *username;
35 char *usernameEscape; /* URL escaped */
36 char *password;
37 int bidtime;
38 int quantity;
39 char *conffilename;
40 char *auctfilename;
41 int bid;
42 int reduce;
43 int debug;
44 int usage;
45 int info;
46 int myitems;
47 int batch;
48 int encrypted;
49 char *proxy;
50 char *logdir;
51 char *historyHost;
52 char *prebidHost;
53 char *bidHost;
54 int curldebug;
55 } option_t;
56
57 extern option_t options;
58
59 extern const char *getVersion(void);
60 extern const char *getProgname(void);
61
62 #ifdef __lint
63 #define log(x) if(!options.debug) 0; else dlog x
64 #else
65 #define log(x) if(!options.debug) ; else dlog x
66 #endif
67
68 #endif /* ESNIPER_H_INCLUDED */
0 Content-type: text/html
1
2 <HTML><HEAD><TITLE>Manpage of esniper</TITLE>
3 </HEAD><BODY>
4 <H1>esniper</H1>
5 Section: User Commands (1)<BR>Updated: 31 Jan 2005<BR><A HREF="#index">Index</A>
6 <A HREF="http://localhost/cgi-bin/man/man2html">Return to Main Contents</A><HR>
7
8 <A NAME="lbAB">&nbsp;</A>
9 <H2>NAME</H2>
10
11 esniper - a lightweight ebay sniping tool
12 <A NAME="lbAC">&nbsp;</A>
13 <H2>SYNOPSIS</H2>
14
15 <B>esniper</B>
16
17 [<B>-bdhHimnPrUv</B>]
18
19 [<B>-c</B>
20
21 <I>conf_file</I>]
22
23 [<B>-l</B>
24
25 <I>logdir</I>]
26
27 [<B>-p</B>
28
29 <I>proxy</I>]
30
31 [<B>-q</B>
32
33 <I>quantity</I>]
34
35 [<B>-s</B>
36
37 <I>secs|now</I>]
38
39 [<B>-u</B>
40
41 <I>user</I>]
42
43 (auction_file | [ auction price ... ])
44
45 <A NAME="lbAD">&nbsp;</A>
46 <H2>DESCRIPTION</H2>
47
48 <P>
49
50 <I>esniper</I>
51
52 is a lightweight ebay sniping tool. It doesn't have a lot of features, and
53 that is by design.
54 <P>
55
56 Auctions are specified on the command line, using the auction number and
57 your bid price. Multiple auctions can be bid on by specifying more auctions
58 and bid prices. esniper stops when the desired quantity has been won
59 (default is 1).
60 <P>
61
62 You can use an auction file instead of specifying auctions on the command
63 line. See the <B>AUCTION FILE</B> section below for more details.
64 <A NAME="lbAE">&nbsp;</A>
65 <H2>OPTIONS</H2>
66
67 <DL COMPACT>
68 <DT><B>-b</B>
69
70 <DD>
71 Enable batch mode.
72 The corresponding configuration option is batch, default value is false.
73 In batch mode, esniper never prompts for password and/or
74 username. If the password or username cannot be determined from options or
75 read from configuration or auction files, esniper will fail.
76 <DT><B>-c</B>
77
78 <DD>
79 Specifies a configuration file to read.
80 All options can be set either by command-line flags or in the
81 configuration file.
82 See the <B>CONFIGURATION FILE</B> section for details.
83 The default configuration file is $HOME/.esniper
84 (or $USERPROFILE/My Documents/.esniper in Windows).
85 <DT><B>-d</B>
86
87 <DD>
88 Enable debug mode.
89 The corresponding configuration option is debug, default value is false.
90 Log files are named esniper.&lt;auction_num&gt;.log and esniper.log, and are
91 written to the current working directory.
92 If the -l option or logdir configuration option is used, log files are
93 written to the specified directory.
94 <DT><B>-h</B>
95
96 <DD>
97 Show command line option help.
98 <DT><B>-H</B>
99
100 <DD>
101 Show configuration and auction file help.
102 <DT><B>-i</B>
103
104 <DD>
105 Print information on given auctions and exit.
106 <DT><B>-l</B>
107
108 <DD>
109 Set the directory where log files will be written.
110 The corresponding configuration option is logdir, default value is the
111 current working directory, or if an auction file is specified the directory
112 of the auction file.
113 The directory must exist and be writeable.
114 Log files are written when the -d option is used.
115 <DT><B>-m</B>
116
117 <DD>
118 Print user's my eBay watched items list and exit.
119 The user's myEbay watched items list must use the default column ordering.
120 <DT><B>-n</B>
121
122 <DD>
123 Do not bid.
124 The corresponding configuration option is bid, default value is true.
125 Useful for debugging, it exercises most of esniper except
126 actually placing bids. It is also be useful for checking the status of
127 an auction, without accidentally placing a bid.
128 <DT><B>-p</B>
129
130 <DD>
131 Specify an http proxy to use.
132 The corresponding configuration option is proxy, default value is the
133 value of the http_proxy environment variable.
134 The proxy should be of the form <A HREF="http://host:port/.">http://host:port/.</A>
135 <DT><B>-P</B>
136
137 <DD>
138 Prompt the user for their ebay password. This overrides the password set in
139 any configuration or auction file.
140 <DT><B>-q</B>
141
142 <DD>
143 Set the quantity.
144 The corresponding configuration option is quantity, default value is 1.
145 esniper will quit when it has won enough items.
146 <DT><B>-r</B>
147
148 <DD>
149 Do not reduce quantity on startup for items you have already won.
150 The corresponding configuration option is reduce, default value is true.
151 <DT><B>-s</B>
152
153 <DD>
154 Set the bidding time, specified as now, or seconds before the end of an
155 auction. If now is used, bids will be placed immediately.
156 The corresponding configuration option is seconds, default value is 10 seconds.
157 You should snipe late enough in an auction to
158 prevent a manual bidder to update their bid, but before other snipes.
159 In case two bids are within one bid increment of each other, the first
160 bid placed wins.
161 <DT><B>-u</B>
162
163 <DD>
164 Set the ebay username.
165 The corresponding configuration option is username, there is no default value.
166 <DT><B>-U</B>
167
168 <DD>
169 Prompt the user for their ebay username.
170 <DT><B>-v</B>
171
172 <DD>
173 Print version and exit.
174 </DL>
175 <A NAME="lbAF">&nbsp;</A>
176 <H2>CONFIGURATION FILE</H2>
177
178 <P>
179
180 Most command-line options can also be set in a configuration file.
181 The advantage of using a configuration file is that you can set all of you
182 options once and not have to enter them on the command line every time you
183 run esniper.
184 <P>
185
186 A configuration file consists of option lines, in the format &quot;option=value&quot;,
187 blank lines, and comments. Option names are listed above with their
188 corresponding command-line flags. Comments begin with #.
189 <P>
190
191 One configuration file option that doesn't have a corresponding command-line
192 flag is password. The password option allows you to set your eBay password.
193 If you store your eBay password in a configuration file, you should ensure that
194 the configuration file can be read only by you.
195 <P>
196
197 The default configuration file is $HOME/.esniper
198 (or $USERPROFILE/My Documents/.esniper in Windows).
199 If an auction file is used, esniper will also attempt to read .esniper
200 from the directory that contains the auction file; options set in this
201 configuration file will override options set in the user's default
202 configuration file.
203 However, if the -c command line option is used, then only the configuration
204 file specified by the -c command line option is read.
205 <P>
206
207 Options specified on the command line override corresponding options set in
208 an auction file, and options set in an auction file override options set in
209 any configuration file.
210 <A NAME="lbAG">&nbsp;</A>
211 <H2>AUCTION FILE</H2>
212
213 <P>
214
215 An auction file is similar to a configuration file, but it also has one or
216 more auction lines. An auction line contains an auction number, optionally
217 followed by a bid price. If no bid price is given, the auction number uses
218 the bid price of the first prior auction line that contains a bid price.
219 <P>
220
221 If an auction file is specified and the -c option isn't used, esniper
222 attempts to read .esniper from the directory where the auction file
223 is located. See the <B>CONFIGURATION FILE</B> section for more details.
224 <A NAME="lbAH">&nbsp;</A>
225 <H2>EXAMPLES</H2>
226
227 <P>
228
229 An example of a configuration file:
230 <P>
231
232
233 <PRE>
234 # A configuration file contains option settings,
235 # blank lines, and comments (begin with #). The
236 # default configuration file is $HOME/.esniper, and
237 # if you specify an auction file, .esniper in the
238 # auction file's directory as well. If you specify a
239 # configuration file using the -c command-line option,
240 # then that configuration file will be the only one
241 # read.
242 #
243 # If you set your password in a configuration file
244 # and you are on a unix system, you should be the
245 # owner of the file, and you should set the
246 # permissions so that it is readable only by the
247 # owner.
248 #
249 # Here are all the options. Note that if the
250 # default (as defined in esniper -H) is fine, you
251 # don't need to specify it in a configuration file.
252
253 # boolean parameters can be set to:
254 # true, y, yes, on, 1, enabled
255 # false, n, no, off, 0, disabled
256 batch = false
257 bid = yes
258 debug = enabled
259 reduce = y
260
261 # Note: it would be nice if logdir could use ~myuser,
262 # or $HOME. Perhaps in a future version.
263 logdir = /export/home/myuser/esniperlogs
264 password = myebaypassword
265 # Note: proxy authentication not yet supported
266 proxy = <A HREF="http://192.168.1.1:8080/">http://192.168.1.1:8080/</A>
267 username = myebayusername
268
269 # Note: quantity is usually set in an auction file
270 quantity = 1
271 # Note: seconds can also be &quot;now&quot;, if you want to
272 # bid immediately
273 seconds = 10
274 </PRE>
275
276
277 <P>
278
279 An example of an auction file:
280 <P>
281
282
283 <PRE>
284 # An auction file may contain any line that is valid
285 # in a configuration file (see sample_config.txt for
286 # details), plus it may also have auction lines.
287 #
288 # An auction line contains an auction number, optionally
289 # followed by a price. If a price isn't specified, the
290 # price used is the same as the previous auction line.
291 #
292 # You should have one auction file for each type of item
293 # you are bidding on, so that you can change the quantity,
294 # username, or other options to suit the item you are
295 # bidding on. For instance, you may want to buy up to 10
296 # laser print cartridges, but only one digital camera.
297
298 # Sample auction file for laser printer cartridges
299
300 # I'd like 10 of them, and my target price is $50
301 quantity = 10
302
303 # seller surpluslaserjunk, shipping $15,
304 # questionable reputation (so I'll only pay $40 total)
305 9298389738 25
306 9872749829
307 9872972987
308 9087289973
309
310 # seller highqualityprintersupplies, shipping $8,
311 # excellent reputation
312 9982309829 42
313 9827349827
314
315 # seller nonbusinesshomeseller, shipping not mentioned
316 # (assume $10), good reputation
317 9287398473 35
318
319 # seller lasersuppliesforcheap, lousy reputation,
320 # don't buy!!!
321 #9239889372 0
322 </PRE>
323
324
325 <A NAME="lbAI">&nbsp;</A>
326 <H2>ENVIRONMENT VARIABLES</H2>
327
328 <DL COMPACT>
329 <DT><FONT SIZE="-1"><B>http_proxy</B></FONT>
330 <DD>
331 The default http proxy. The -p command-line option and proxy configuration
332 option override this setting.
333 <DT><FONT SIZE="-1"><B>USERPROFILE</B></FONT>
334 <DD>
335 Windows user's home directory. If no configuration file is specified, esniper
336 tries to read the file My Documents/.esniper under the USERPROFILE directory.
337 Note: esniper for Windows 95, 98 and Me is compiled under cygwin, a unix-like
338 environment for Windows. This version of esniper uses the HOME environment
339 variable, as described below.
340 <DT><FONT SIZE="-1"><B>HOME</B></FONT>
341 <DD>
342 Unix user's home directory. If no configuration file is specified, esniper
343 tries to read the file .esniper in this directory.
344 </DL>
345 <A NAME="lbAJ">&nbsp;</A>
346 <H2>BUGS</H2>
347
348 <P>
349
350 eBay likes to change their website often. Some of these changes will
351 break esniper. If esniper doesn't work for you, please make sure you
352 have the most recent version. You can check the version of esniper you
353 are using by running esniper with the -v option. Updates to esniper are
354 available at <A HREF="http://esniper.sf.net/.">http://esniper.sf.net/.</A>
355 <P>
356
357 If you are running the most current version and you are still encountering
358 a bug, please report the bug at <A HREF="http://esniper.sf.net/.">http://esniper.sf.net/.</A> To keep up to date
359 with new releases and major bugs, subscribe to the esniper announce mailing
360 list at <A HREF="http://lists.sf.net/lists/listinfo/esniper-announce">http://lists.sf.net/lists/listinfo/esniper-announce</A>
361 <A NAME="lbAK">&nbsp;</A>
362 <H2>THANKS</H2>
363
364 <P>
365
366 Many thanks to all contributors and users.
367 <A NAME="lbAL">&nbsp;</A>
368 <H2>AUTHOR</H2>
369
370 Copyright © 2002, 2003, 2004 Scott Nicol &lt;<A HREF="mailto:esniper@users.sf.net">esniper@users.sf.net</A>&gt;
371 All rights reserved.
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392 <P>
393
394 <HR>
395 <A NAME="index">&nbsp;</A><H2>Index</H2>
396 <DL>
397 <DT><A HREF="#lbAB">NAME</A><DD>
398 <DT><A HREF="#lbAC">SYNOPSIS</A><DD>
399 <DT><A HREF="#lbAD">DESCRIPTION</A><DD>
400 <DT><A HREF="#lbAE">OPTIONS</A><DD>
401 <DT><A HREF="#lbAF">CONFIGURATION FILE</A><DD>
402 <DT><A HREF="#lbAG">AUCTION FILE</A><DD>
403 <DT><A HREF="#lbAH">EXAMPLES</A><DD>
404 <DT><A HREF="#lbAI">ENVIRONMENT VARIABLES</A><DD>
405 <DT><A HREF="#lbAJ">BUGS</A><DD>
406 <DT><A HREF="#lbAK">THANKS</A><DD>
407 <DT><A HREF="#lbAL">AUTHOR</A><DD>
408 </DL>
409 <HR>
410 This document was created by
411 <A HREF="http://localhost/cgi-bin/man/man2html">man2html</A>,
412 using the manual pages.<BR>
413 Time: 13:56:46 GMT, December 19, 2006
414 </BODY>
415 </HTML>
0 This directory contains frontends that can be helpful in using esniper.
1
2 snipe
3 =====
4
5 snipe is a shell script that should work on any unix system, or on cygwin.
6 snipe runs snipes in the background, and can tell you what auction files
7 are currently active. You can get the status of a snipe or kill a
8 snipe using the auction filename or pid.
0 #!/bin/sh
1
2 SNIPE_OUTDIR=${SNIPE_OUTDIR:-$HOME/.snipe}
3 PROGNAME=`basename $0`
4
5 # setup $SNIPE_OUTDIR
6 if [ ! -d "$SNIPE_OUTDIR" ]; then
7 mkdir -p "$SNIPE_OUTDIR" || error "Cannot create $SNIPE_OUTDIR. Change value of \$SNIPE_OUTDIR and try again."
8 fi
9 [ -r "$SNIPE_OUTDIR" -a -w "$SNIPE_OUTDIR" -a -x "$SNIPE_OUTDIR" ] || warn "Permissions problem with $SNIPE_OUTDIR, should be rwx."
10
11 # avoid using Sun's crappy old awk
12 AWK=`which gawk 2>/dev/null`
13 AWK=${AWK:-`which nawk`}
14 AWK=${AWK:-`which awk`}
15
16 # need ksh or bash for subshell pid hack
17 KSH=`which ksh 2>/dev/null`
18 KSH=${KSH:-`which bash`}
19
20 usage() {
21 [ $# -gt 0 ] && echo "$PROGNAME: $@" 1>&2
22 echo "usage:" 1>&2
23 echo "list running auctions: $PROGNAME" 1>&2
24 echo "start auctions: $PROGNAME auctionfile [...]" 1>&2
25 echo "get status of auctions: $PROGNAME (-i | -I num) auctionfile_or_pid [...]" 1>&2
26 echo "kill auctions: $PROGNAME -k auctionfile_or_pid [...]" 1>&2
27 echo "kill all auctions: $PROGNAME -k" 1>&2
28 exit 2
29 }
30
31 # error exitcode message
32 error() {
33 exitcode="$1"
34 shift
35 echo "$PROGNAME: $@" 1>&2
36 exit "$exitcode"
37 }
38
39 # warn message
40 warn() {
41 echo "$PROGNAME: $@" 1>&2
42 }
43
44 active() {
45 if grepSnipes >/dev/null 2>&1; then
46 echo "Currently active snipes:"
47 grepSnipes
48 else
49 echo "No snipes currently active."
50 false
51 fi
52 }
53
54 grepSnipes() {
55 ps -ef | grep "^$USER[ \\t].*[ /]esniper "
56 }
57
58 # killSnipes <auctionfile_or_pid>
59 killSnipes() {
60 PID=`grepSnipes | awk '$NF == "'"$1"'" {print $2; exit}'`
61 if [ "$PID" = "" ]; then
62 PID=`grepSnipes | awk '$2 == "'"$1"'" {print $2; exit}'`
63 if [ "$PID" = "" ]; then
64 echo "unknown auction file or pid: $1"
65 return
66 fi
67 fi
68 kill "$PID"
69 }
70
71 # info <auctionfile_or_pid>
72 info() {
73 outfile="$SNIPE_OUTDIR/$1.txt"
74 if [ ! -f "$outfile" ]; then
75 PID=`grepSnipes | \
76 $AWK '$0 ~ " esniper ([^ ]* )*'"$1"'$" {print $2; exit}'`
77 if [ "$PID" = "" ]; then
78 outfile=`ls -t "$SNIPE_OUTDIR"/*.txt | $AWK '{
79 fn = $0
80 ret = getline <fn
81 close(fn)
82 if (ret > 0 && $0 == "# esniper '"$1"'") {
83 print fn
84 exit
85 }
86 }'`
87 else
88 outfile="$SNIPE_OUTDIR/$PID.txt"
89 fi
90 if [ ! -f "$outfile" ]; then
91 echo "Cannot find info on $1"
92 return
93 fi
94 fi
95 echo "Info on $1:"
96 case "$LINES" in
97 all) cat "$outfile";;
98 *) tail -"$LINES" "$outfile";;
99 esac
100 }
101
102 OP=run
103 LINES=
104 while getopts "iI:k" opt; do
105 case "$opt" in
106 i) OP=info; LINES=all;;
107 I) OP=info; LINES="$OPTARG";
108 echo "$LINES" | grep '^[0-9][0-9]*$' >/dev/null 2>&1 || \
109 usage "Argument to -I must be numeric";;
110 k) OP=kill;;
111 \?) usage;;
112 esac
113 done
114 shift `expr $OPTIND - 1`
115
116 if [ $# -eq 0 ]; then
117 case "$OP" in
118 run | info)
119 active
120 ;;
121 kill)
122 if active; then
123 echo killing...
124 grepSnipes | awk '{print $2}' | xargs kill
125 # wait until processes die (hopefully)
126 for attempts in 1 2 3 4 5; do
127 grepSnipes >/dev/null 2>&1 || break
128 sleep 1
129 done
130 # what's left?
131 active
132 fi
133 ;;
134 esac
135 else
136 case "$OP" in
137 run)
138 for i in "$@"; do
139 if [ ! -f "$i" ]; then
140 warn "Auction file $i not found"
141 continue
142 fi
143 (PID="`"$KSH" -c 'echo $PPID'`"; \
144 echo "$PID" >"$SNIPE_OUTDIR/lastpid"; \
145 echo "# esniper $i" >"$SNIPE_OUTDIR/$PID.txt"; \
146 exec esniper "$i" >>"$SNIPE_OUTDIR/$PID.txt" 2>&1) &
147 done
148 ;;
149 info)
150 info "$1"
151 shift
152 for i in "$@"; do
153 echo
154 info "$i"
155 done
156 ;;
157 kill)
158 for i in "$@"; do
159 killSnipes "$i"
160 done
161 ;;
162 esac
163 fi
0 /*
1 * Copyright (c) 2002, 2007, Scott Nicol <esniper@users.sf.net>
2 * All rights reserved
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are met:
6 *
7 * - Redistributions of source code must retain the above copyright notice,
8 * this list of conditions and the following disclaimer.
9 * - Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 *
13 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
14 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
15 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
16 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
17 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
18 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
19 * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
20 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
21 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
22 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
23 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24 */
25
26 #include <ctype.h>
27 #include <errno.h>
28 #include <stdlib.h>
29 #include <string.h>
30 #include "html.h"
31 #include "auctioninfo.h"
32 #include "history.h"
33 #include "esniper.h"
34
35 static int checkHeaderColumns(char **row);
36 static long getSeconds(char *timestr);
37
38 static const char PRIVATE[] = "private auction - bidders' identities protected";
39
40 /*
41 * parseBidHistory(): parses bid history page (pageName: PageViewBids)
42 *
43 * returns:
44 * 0 OK
45 * 1 error (badly formatted page, etc) - sets auctionError
46 */
47 int
48 parseBidHistory(memBuf_t *mp, auctionInfo *aip, time_t start, time_t *timeToFirstByte)
49 {
50 char *line;
51 char **row;
52 int foundHeader = 0; /* found header for bid table */
53 int ret = 0; /* 0 = OK, 1 = failed */
54 char *pagename;
55 int pageType = 0; /* 0 = bidHistory, 1 = buyer and bid history */
56 int extraColumns = 0; /* 1 if Bidding Details or Action column in table */
57 int skipTables = 0; /* number of bid history tables to skip */
58
59 resetAuctionError(aip);
60
61 if (timeToFirstByte)
62 *timeToFirstByte = getTimeToFirstByte(mp);
63
64 /*
65 * Auction title
66 */
67 pagename = getPageName(mp);
68 if (!strcmp(pagename, "PageViewBids")) {
69 /* bid history or expired/bad auction number */
70 while ((line = getNonTag(mp))) {
71 if (!strcmp(line, "Bid History")) {
72 log(("parseBidHistory(): got \"Bid History\"\n"));
73 break;
74 }
75 if (!strcmp(line, "Buyer and Bid History")) {
76 log(("parseBidHistory(): got \"Buyer and Bid History\"\n"));
77 pageType = 1;
78 skipTables = 1;
79 break;
80 }
81 if (!strcmp(line, "Unknown Item")) {
82 log(("parseBidHistory(): got \"Unknown Item\"\n"));
83 return auctionError(aip, ae_baditem, NULL);
84 }
85 }
86 if (!line) {
87 log(("parseBidHistory(): No title, place 1\n"));
88 return auctionError(aip, ae_notitle, NULL);
89 }
90 } else if (!strcmp(pagename, "PageViewTransactions")) {
91 /* transaction history -- buy it now only */
92 } else if (!strcmp(pagename, "PageSignIn")) {
93 return auctionError(aip, ae_mustsignin, NULL);
94 }
95
96 /*
97 * Auction item
98 */
99 while ((line = getNonTag(mp))) {
100 if (!strcmp(line, "Item title:")) {
101 line = getNonTag(mp);
102 break;
103 }
104 }
105 if (!line) {
106 log(("parseBidHistory(): No title, place 2\n"));
107 return auctionError(aip, ae_notitle, NULL);
108 }
109 free(aip->title);
110 aip->title = myStrdup(line);
111 while ((line = getNonTag(mp))) {
112 char *tmp;
113
114 if (line[strlen(line) - 1] == ':')
115 break;
116 tmp = aip->title;
117 aip->title = myStrdup2(tmp, line);
118 free(tmp);
119 }
120 printLog(stdout, "Auction %s: %s\n", aip->auction, aip->title);
121
122 /*
123 * Quantity/Current price/Time remaining
124 */
125 aip->quantity = 1; /* If quantity not found, assume 1 */
126 for (; line; line = getNonTag(mp)) {
127 if (!strcmp("Quantity:", line) ||
128 !strcmp("Quantity left:", line)) {
129 line = getNonTag(mp);
130 if (!line)
131 return auctionError(aip, ae_noquantity, NULL);
132 errno = 0;
133 aip->quantity = (int)strtol(line, NULL, 10);
134 if (aip->quantity < 0 || (aip->quantity == 0 && errno == EINVAL))
135 return auctionError(aip, ae_noquantity, NULL);
136 log(("quantity: %d", aip->quantity));
137 } else if (!strcmp("Currently:", line)) {
138 line = getNonTag(mp);
139 if (!line)
140 return auctionError(aip, ae_noprice, NULL);
141 log(("Currently: %s\n", line));
142 aip->price = atof(priceFixup(line, aip));
143 if (aip->price < 0.01)
144 return auctionError(aip, ae_convprice, line);
145 } else if (!strcmp("Time left:", line)) {
146 /* Use getTableCell() instead of getNonTag(), because
147 * for about a second at the end of an auction the
148 * time is left blank. getTableCell() will give you
149 * a cell, even if it is empty. getNonTag() will
150 * happily skip over to the next real text (like
151 * "Reserve not met", or whatever).
152 */
153 getTableCell(mp); /* end of "Time left:" cell */
154 getTableCell(mp); /* spacer */
155 free(aip->remainRaw);
156 aip->remainRaw = getNonTagFromString(getTableCell(mp));
157 break;
158 }
159 }
160 if (!aip->remainRaw)
161 return auctionError(aip, ae_notime, NULL);
162 if ((aip->remain = getSeconds(aip->remainRaw)) < 0)
163 return auctionError(aip, ae_badtime, aip->remainRaw);
164 printLog(stdout, "Time remaining: %s (%ld seconds)\n", line, aip->remain);
165 if (aip->remain) {
166 struct tm *tmPtr;
167 char timestr[20];
168
169 aip->endTime = start + aip->remain;
170 /* formated time/date output */
171 tmPtr = localtime(&(aip->endTime));
172 strftime(timestr , 20, "%d/%m/%Y %H:%M:%S", tmPtr);
173 printLog(stdout, "End time: %s\n", timestr);
174 } else
175 aip->endTime = aip->remain;
176
177 if (!(line = getNonTag(mp)))
178 return auctionError(aip, ae_nohighbid, NULL);
179 if (!strcmp("Reserve not met", line))
180 aip->reserve = 1;
181 else {
182 aip->reserve = 0;
183 /* start of header? Probably a purchase */
184 if ((foundHeader = !strncmp("Bidder", line, 6)) ||
185 (foundHeader = !strncmp("User ID", line, 7))) {
186 log(("ParseBidHistory(): found table with header \"%s\"\n", line));
187 /* get other headers to check them */
188 row = getTableRow(mp);
189 extraColumns += checkHeaderColumns(row);
190 freeTableRow(row);
191 }
192 }
193
194 /*
195 * Determine high bidder
196 *
197 * Format of high bidder table is:
198 *
199 * Single item auction:
200 * Header line:
201 * ""
202 * "User ID"
203 * "Bid Amount"
204 * "Date of bid"
205 * "Bidding Details" (new, not on all auctions)
206 * ""
207 * For each bid:
208 * ""
209 * <user>
210 * <amount>
211 * <date>
212 * <view bidder details> (new, not on all auctions)
213 * ""
214 * (plus multiple rows of 1 column between entries)
215 *
216 * If there are no bids:
217 * ""
218 * "No bids have been placed."
219 *
220 * If the auction is private, the user names are:
221 * "private auction - bidders' identities protected"
222 *
223 * Purchase (buy-it-now only):
224 * Header line:
225 * ""
226 * "User ID"
227 * "Bid Amount"
228 * "Qty"
229 * "Date of Purchase"
230 * "Bidding Details" (new, not on all auctions)
231 * "Action" (new, not on all auctions)
232 * ""
233 * For each bid:
234 * ""
235 * <user>
236 * <amount>
237 * <quantity>
238 * <date>
239 * <view bidder details> (new, not on all auctions)
240 * <action> (new, not on all auctions)
241 * ""
242 * (plus multiple rows of 1 column between entries)
243 *
244 * If there are no bids:
245 * ""
246 * "No purchases have been made."
247 *
248 * If the auction is private, the user names are:
249 * "private auction - bidders' identities protected"
250 *
251 * Dutch auction:
252 * Header line:
253 * ""
254 * "User ID"
255 * "Bid Amount"
256 * "Quantity wanted"
257 * "Quantity winning"
258 * "Date of Bid"
259 * "Bidding Details" (new, not on all auctions)
260 * ""
261 *
262 * For each bid:
263 * ""
264 * <user>
265 * <amount>
266 * <quantity wanted>
267 * <quantity winning>
268 * <date>
269 * <view bidder details> (new, not on all auctions)
270 * ""
271 * (plus multiple rows of 1 column between entries)
272 *
273 * If there are no bids:
274 * ""
275 * "No bids have been placed."
276 *
277 * Dutch auctions cannot be private.
278 *
279 * If there are no bids, the text "No bids have been placed."
280 * will be the first entry in the table.
281 */
282 /* find header line */
283 if (foundHeader && skipTables > 0) {
284 log(("ParseBidHistory(): Skipping table"));
285 foundHeader = 0;
286 --skipTables;
287 }
288 while (!foundHeader && getTableStart(mp)) {
289 while (!foundHeader && (row = getTableRow(mp))) {
290 int ncolumns = numColumns(row);
291 char *rawHeader = (ncolumns >= 5) ? row[1] : NULL;
292 char *header = getNonTagFromString(rawHeader);
293
294 foundHeader = header &&
295 (!strncmp(header, "Bidder", 6) ||
296 !strncmp(header, "User ID", 7));
297 if (foundHeader) {
298 log(("ParseBidHistory(): found table with header \"%s\"\n", line));
299 if (skipTables > 0) {
300 log(("ParseBidHistory(): Skipping table"));
301 foundHeader = 0;
302 --skipTables;
303 } else
304 extraColumns += checkHeaderColumns(row);
305 }
306 freeTableRow(row);
307 free(header);
308 }
309 }
310 if (!foundHeader) {
311 bugReport("parseBidHistory", __FILE__, __LINE__, aip, mp, "Cannot find bid table header");
312 return auctionError(aip, ae_nohighbid, NULL);
313 }
314 /* skip over initial single-column rows */
315 while ((row = getTableRow(mp))) {
316 if (numColumns(row) == 1) {
317 freeTableRow(row);
318 continue;
319 }
320 break;
321 }
322 /* roll through table */
323 switch (numColumns(row) - extraColumns) {
324 case 2: /* auction with no bids */
325 {
326 char *s = getNonTagFromString(row[1]);
327
328 if (!strcmp("No bids have been placed.", s) ||
329 !strcmp("No purchases have been made.", s)) {
330 aip->quantityBid = 0;
331 aip->bids = 0;
332 /* can't determine starting bid on history page */
333 aip->price = 0;
334 printf("# of bids: 0\n"
335 "Currently: -- (your maximum bid: %s)\n",
336 aip->bidPriceStr);
337 if (*options.username)
338 printf("High bidder: -- (NOT %s)\n", options.username);
339 else
340 printf("High bidder: --\n");
341 } else {
342 bugReport("parseBidHistory", __FILE__, __LINE__, aip, mp, "Unrecognized bid table line");
343 ret = auctionError(aip, ae_nohighbid, NULL);
344 }
345 freeTableRow(row);
346 free(s);
347 break;
348 }
349 case 5: /* single auction with bids */
350 {
351 /* blank, user, price, date, blank */
352 char *winner = getNonTagFromString(row[1]);
353 char *currently = getNonTagFromString(row[2]);
354
355 aip->quantityBid = 1;
356
357 /* current price */
358 aip->price = atof(priceFixup(currently, aip));
359 if (aip->price < 0.01) {
360 free(winner);
361 free(currently);
362 return auctionError(aip, ae_convprice, currently);
363 }
364 printLog(stdout, "Currently: %s (your maximum bid: %s)\n",
365 currently, aip->bidPriceStr);
366 free(currently);
367
368 /* winning user */
369 if (!strcmp(winner, PRIVATE)) {
370 free(winner);
371 winner = myStrdup((aip->price <= aip->bidPrice &&
372 (aip->bidResult == 0 ||
373 (aip->bidResult == -1 && aip->endTime - time(NULL) < options.bidtime))) ? options.username : "[private]");
374 }
375 freeTableRow(row);
376
377 /* count bids */
378 for (aip->bids = 1; (row = getTableRow(mp)); ) {
379 if (numColumns(row) - extraColumns == 5)
380 ++aip->bids;
381 freeTableRow(row);
382 }
383 printLog(stdout, "# of bids: %d\n", aip->bids);
384
385 /* print high bidder */
386 if (strcasecmp(winner, options.username)) {
387 if (*options.username)
388 printLog(stdout, "High bidder: %s (NOT %s)\n",
389 winner, options.username);
390 else
391 printLog(stdout, "High bidder: %s\n", winner);
392 aip->winning = 0;
393 if (!aip->remain)
394 aip->won = 0;
395 } else if (aip->reserve) {
396 printLog(stdout, "High bidder: %s (reserve not met)\n",
397 winner);
398 aip->winning = 0;
399 if (!aip->remain)
400 aip->won = 0;
401 } else {
402 printLog(stdout, "High bidder: %s!!!\n", winner);
403 aip->winning = 1;
404 if (!aip->remain)
405 aip->won = 1;
406 }
407 free(winner);
408 break;
409 }
410 case 6: /* purchase */
411 {
412 char *currently = getNonTagFromString(row[2]);
413
414 aip->bids = 0;
415 aip->quantityBid = 0;
416 aip->won = 0;
417 aip->winning = 0;
418 /* find your purchase, count number of purchases */
419 /* blank, user, price, quantity, date, blank */
420 for (; row; row = getTableRow(mp)) {
421 if (numColumns(row) - extraColumns == 6) {
422 int quantity = getIntFromString(row[3]);
423 char *bidder;
424
425 ++aip->bids;
426 aip->quantityBid += quantity;
427 bidder = getNonTagFromString(row[1]);
428 if (!strcasecmp(bidder, options.username))
429 aip->won = aip->winning = quantity;
430 free(bidder);
431 }
432 freeTableRow(row);
433 }
434 printf("# of bids: %d\n", aip->bids);
435 printf("Currently: %s (your maximum bid: %s)\n",
436 currently, aip->bidPriceStr);
437 free(currently);
438 switch (aip->winning) {
439 case 0:
440 if (*options.username)
441 printLog(stdout, "High bidder: various purchasers (NOT %s)\n", options.username);
442 else
443 printLog(stdout, "High bidder: various purchasers\n");
444 break;
445 case 1:
446 printLog(stdout, "High bidder: %s!!!\n", options.username);
447 break;
448 default:
449 printLog(stdout, "High bidder: %s!!! (%d items)\n", options.username, aip->winning);
450 break;
451 }
452 break;
453 }
454 case 7: /* dutch with bids */
455 {
456 int wanted = 0;
457 char *currently = NULL;
458
459 aip->bids = 0;
460 aip->quantityBid = 0;
461 aip->won = 0;
462 aip->winning = 0;
463 /* find your bid, count number of bids */
464 /* blank, user, price, wanted, winning, date, blank */
465 for (; row; row = getTableRow(mp)) {
466 if (numColumns(row) - extraColumns == 7) {
467 int bidderWinning = getIntFromString(row[4]);
468
469 ++aip->bids;
470 if (bidderWinning > 0) {
471 char *bidder;
472
473 aip->quantityBid += bidderWinning;
474 free(currently);
475 bidder = getNonTagFromString(row[1]);
476 currently = getNonTagFromString(row[2]);
477 if (!strcasecmp(bidder, options.username)) {
478 wanted = getIntFromString(row[3]);
479 aip->winning = bidderWinning;
480 }
481 free(bidder);
482 }
483 }
484 freeTableRow(row);
485 }
486 if (!aip->remain)
487 aip->won = aip->winning;
488 printf("# of bids: %d\n", aip->bids);
489 printf("Currently: %s (your maximum bid: %s)\n",
490 currently, aip->bidPriceStr);
491 free(currently);
492 if (aip->winning > 0) {
493 if (aip->winning == wanted)
494 printLog(stdout, "High bidder: %s!!!\n", options.username);
495 else
496 printLog(stdout, "High bidder: %s!!! (%d out of %d items)\n", options.username, aip->winning, wanted);
497 } else {
498 if (*options.username)
499 printLog(stdout, "High bidder: various dutch bidders (NOT %s)\n", options.username);
500 else
501 printLog(stdout, "High bidder: various dutch bidders\n");
502 }
503 break;
504 }
505 default:
506 bugReport("parseBidHistory", __FILE__, __LINE__, aip, mp, "%d columns in bid table, extraColumns = %d", numColumns(row), extraColumns);
507 ret = auctionError(aip, ae_nohighbid, NULL);
508 freeTableRow(row);
509 }
510
511 return ret;
512 } /* parseBidHistory() */
513
514 static int
515 checkHeaderColumns(char **row)
516 {
517 char *lastHeader = getNonTagFromString(row[numColumns(row)-2]);
518 int ret = 0;
519
520 if (!strncmp(lastHeader, "Bidding Details", 15)) {
521 log(("checkHeaderColumns(): this table has Bidding Details column"));
522 ++ret;
523 } else if (!strncmp(lastHeader, "Action", 6)) {
524 log(("checkHeaderColumns(): this table has Action column"));
525 ++ret;
526 }
527 free(lastHeader);
528 return ret;
529 }
530
531 static long
532 getSeconds(char *timestr)
533 {
534 static char second[] = "sec";
535 static char minute[] = "min";
536 static char hour[] = "hour";
537 static char day[] = "day";
538 static char ended[] = "ended";
539 long accum = 0;
540 long num;
541
542 /* Time is blank in transition between "Time left: 1 seconds" and
543 * "Time left: auction has ended". I don't know if blank means
544 * the auction is over, or it still running with less than 1 second.
545 * I'll make the safer assumption and say that there is 1 second
546 * remaining.
547 * bomm: The transition seems to have changed to "--". I will accept
548 * any string starting with "--".
549 */
550 if (!*timestr || !strncmp(timestr, "--", 2))
551 return 1;
552 if (strstr(timestr, ended))
553 return 0;
554 while (*timestr) {
555 num = strtol(timestr, &timestr, 10);
556 while (isspace((int)*timestr))
557 ++timestr;
558 if (!strncmp(timestr, second, sizeof(second) - 1))
559 return(accum + num);
560 else if (!strncmp(timestr, minute, sizeof(minute) - 1))
561 accum += num * 60;
562 else if (!strncmp(timestr, hour, sizeof(hour) - 1))
563 accum += num * 3600;
564 else if (!strncmp(timestr, day, sizeof(day) - 1))
565 accum += num * 86400;
566 else
567 return -1;
568 while (*timestr && !isdigit((int)*timestr))
569 ++timestr;
570 }
571
572 return accum;
573 }
0 /*
1 * Copyright (c) 2002, 2007, Scott Nicol <esniper@users.sf.net>
2 * All rights reserved
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are met:
6 *
7 * - Redistributions of source code must retain the above copyright notice,
8 * this list of conditions and the following disclaimer.
9 * - Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 *
13 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
14 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
15 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
16 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
17 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
18 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
19 * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
20 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
21 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
22 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
23 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24 */
25
26 #ifndef HISTORY_H_
27 #define HISTORY_H_
28
29 #include <time.h>
30 #include "http.h"
31
32 /*
33 * parseBidHistory(): parses bid history page (pageName: PageViewBids)
34 *
35 * returns:
36 * 0 OK
37 * 1 error (badly formatted page, etc) - sets auctionError
38 */
39 extern int
40 parseBidHistory(memBuf_t *mp, auctionInfo *aip, time_t start, time_t *timeToFirstByte);
41
42 #endif /*HISTORY_H_*/
0 /*
1 * Copyright (c) 2002, 2007, Scott Nicol <esniper@users.sf.net>
2 * All rights reserved
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are met:
6 *
7 * - Redistributions of source code must retain the above copyright notice,
8 * this list of conditions and the following disclaimer.
9 * - Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 *
13 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
14 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
15 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
16 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
17 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
18 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
19 * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
20 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
21 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
22 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
23 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24 */
25
26 #include <ctype.h>
27 #include <string.h>
28 #include "buffer.h"
29 #include "http.h"
30 #include "html.h"
31 #include "esniper.h"
32
33 /*
34 * rudimentary HTML parser, maybe, we should use libxml2 instead?
35 */
36
37
38 /*
39 * Get next tag text, eliminating leading and trailing whitespace
40 * and leaving only a single space for all internal whitespace.
41 */
42 const char *
43 getTag(memBuf_t *mp)
44 {
45 static char *buf = NULL;
46 static size_t bufsize = 0;
47 size_t count = 0;
48 int inStr = 0, comment = 0, c;
49
50 if (memEof(mp)) {
51 log(("getTag(): returning NULL\n"));
52 return NULL;
53 }
54 while ((c = memGetc(mp)) != EOF && c != '<')
55 ;
56 if (c == EOF) {
57 log(("getTag(): returning NULL\n"));
58 return NULL;
59 }
60
61 /* first char - check for comment */
62 c = memGetc(mp);
63 if (c == '>') {
64 log(("getTag(): returning empty tag\n"));
65 return "";
66 } else if (c == EOF) {
67 log(("getTag(): returning NULL\n"));
68 return NULL;
69 }
70 addchar(buf, bufsize, count, (char)c);
71 if (c == '!') {
72 int c2 = memGetc(mp);
73
74 if (c2 == '>' || c2 == EOF) {
75 term(buf, bufsize, count);
76 log(("getTag(): returning %s\n", buf));
77 return buf;
78 }
79 addchar(buf, bufsize, count, (char)c2);
80 if (c2 == '-') {
81 int c3 = memGetc(mp);
82
83 if (c3 == '>' || c3 == EOF) {
84 term(buf, bufsize, count);
85 log(("getTag(): returning %s\n", buf));
86 return buf;
87 }
88 addchar(buf, bufsize, count, (char)c3);
89 comment = 1;
90 }
91 }
92
93 if (comment) {
94 while ((c = memGetc(mp)) != EOF) {
95 if (c=='>' && buf[count-1]=='-' && buf[count-2]=='-') {
96 term(buf, bufsize, count);
97 log(("getTag(): returning %s\n", buf));
98 return buf;
99 }
100 if (isspace(c) && buf[count-1] == ' ')
101 continue;
102 addchar(buf, bufsize, count, (char)c);
103 }
104 } else {
105 while ((c = memGetc(mp)) != EOF) {
106 switch (c) {
107 case '\\':
108 addchar(buf, bufsize, count, (char)c);
109 c = memGetc(mp);
110 if (c == EOF) {
111 term(buf, bufsize, count);
112 log(("getTag(): returning %s\n", buf));
113 return buf;
114 }
115 addchar(buf, bufsize, count, (char)c);
116 break;
117 case '>':
118 if (inStr)
119 addchar(buf, bufsize, count, (char)c);
120 else {
121 term(buf, bufsize, count);
122 log(("getTag(): returning %s\n", buf));
123 return buf;
124 }
125 break;
126 case ' ':
127 case '\n':
128 case '\r':
129 case '\t':
130 case '\v':
131 if (inStr)
132 addchar(buf, bufsize, count, (char)c);
133 else if (count > 0 && buf[count-1] != ' ')
134 addchar(buf, bufsize, count, ' ');
135 break;
136 case '"':
137 inStr = !inStr;
138 /* fall through */
139 default:
140 addchar(buf, bufsize, count, (char)c);
141 }
142 }
143 }
144 term(buf, bufsize, count);
145 log(("getTag(): returning %s\n", count ? buf : "NULL"));
146 return count ? buf : NULL;
147 }
148
149 /*
150 * Get next non-tag text, eliminating leading and trailing whitespace
151 * and leaving only a single space for all internal whitespace.
152 */
153 char *
154 getNonTag(memBuf_t *mp)
155 {
156 static char *buf = NULL;
157 static size_t bufsize = 0;
158 size_t count = 0, amp = 0;
159 int c;
160
161 if (memEof(mp)) {
162 log(("getNonTag(): returning NULL\n"));
163 return NULL;
164 }
165 while ((c = memGetc(mp)) != EOF) {
166 switch (c) {
167 case '<':
168 memUngetc(mp);
169 if (count) {
170 if (buf[count-1] == ' ')
171 --count;
172 term(buf, bufsize, count);
173 log(("getNonTag(): returning %s\n", buf));
174 return buf;
175 } else
176 (void)getTag(mp);
177 break;
178 case ' ':
179 case '\n':
180 case '\r':
181 case '\t':
182 case '\v':
183 case 0xA0: /* iso-8859-1 nbsp */
184 if (count && buf[count-1] != ' ')
185 addchar(buf, bufsize, count, ' ');
186 break;
187 case ';':
188 if (amp > 0) {
189 char *cp = &buf[amp];
190
191 term(buf, bufsize, count);
192 if (*cp == '#') {
193 buf[amp-1] = atoi(cp+1);
194 count = amp;
195 } else if (!strcmp(cp, "amp")) {
196 count = amp;
197 } else if (!strcmp(cp, "gt")) {
198 buf[amp-1] = '>';
199 count = amp;
200 } else if (!strcmp(cp, "lt")) {
201 buf[amp-1] = '<';
202 count = amp;
203 } else if (!strcmp(cp, "nbsp")) {
204 buf[amp-1] = ' ';
205 count = amp;
206 if (count && buf[count-1] == ' ')
207 --count;
208 } else if (!strcmp(cp, "quot")) {
209 buf[amp-1] = '&';
210 count = amp;
211 } else
212 addchar(buf, bufsize, count, (char)c);
213 amp = 0;
214 } else
215 addchar(buf, bufsize, count, (char)c);
216 break;
217 case '&':
218 amp = count + 1;
219 /* fall through */
220 default:
221 addchar(buf, bufsize, count, (char)c);
222 }
223 }
224 if (count && buf[count-1] == ' ')
225 --count;
226 term(buf, bufsize, count);
227 log(("getNonTag(): returning %s\n", count ? buf : "NULL"));
228 return count ? buf : NULL;
229 } /* getNonTag() */
230
231 char *
232 getNonTagFromString(const char *s)
233 {
234 memBuf_t buf;
235
236 strToMemBuf(s, &buf);
237 return myStrdup(getNonTag(&buf));
238 }
239
240 int
241 getIntFromString(const char *s)
242 {
243 memBuf_t buf;
244
245 strToMemBuf(s, &buf);
246 return atoi(getNonTag(&buf));
247 }
248
249 const char PAGENAME[] = "var pageName = \"";
250
251 /*
252 * Get pagename variable, or NULL if not found.
253 */
254 char *
255 getPageName(memBuf_t *mp)
256 {
257 const char *line;
258
259 log(("getPageName():\n"));
260 while ((line = getTag(mp))) {
261 char *tmp;
262
263 if (strncmp(line, "!--", 3))
264 continue;
265 if ((tmp = strstr(line, PAGENAME))) {
266 tmp = getPageNameInternal(tmp);
267 log(("getPageName(): pagename = %s\n", nullStr(tmp)));
268 return tmp;
269 }
270 }
271 log(("getPageName(): Cannot find pagename, returning NULL\n"));
272 return NULL;
273 }
274
275 char *
276 getPageNameInternal(char *s)
277 {
278 char *pagename = s + sizeof(PAGENAME) - 1;
279 char *quote = strchr(pagename, '"');
280
281 if (!quote) { /* TG: returns NULL, not \0 */
282 log(("getPageNameInternal(): Cannot find trailing quote in pagename: %s\n", pagename));
283 return NULL;
284 }
285 *quote = '\0';
286 log(("getPageName(): pagename = %s\n", pagename));
287 return pagename;
288 }
289
290 /*
291 * Search to end of table, returning /table tag (or NULL if not found).
292 * Embedded tables are skipped.
293 */
294 const char *
295 getTableEnd(memBuf_t *mp)
296 {
297 int nesting = 1;
298 const char *cp;
299
300 while ((cp = getTag(mp))) {
301 if (!strcmp(cp, "/table")) {
302 if (--nesting == 0)
303 return cp;
304 } else if (!strncmp(cp, "table", 5) &&
305 (isspace((int)*(cp+5)) || *(cp+5) == '\0')) {
306 ++nesting;
307 }
308 }
309 return NULL;
310 }
311
312 /*
313 * Search for next table item. Return NULL at end of a row, and another NULL
314 * at the end of a table.
315 */
316 char *
317 getTableCell(memBuf_t *mp)
318 {
319 int nesting = 1;
320 const char *cp, *start = mp->readptr, *end = NULL;
321 static char *buf = NULL;
322 static size_t bufsize = 0;
323 size_t count = 0;
324
325 while ((cp = getTag(mp))) {
326 if (nesting == 1 && !strncmp(cp, "td", 2) &&
327 (isspace((int)*(cp+2)) || *(cp+2) == '\0')) {
328 /* found <td>, now must find </td> */
329 start = mp->readptr;
330 } else if (nesting == 1 && !strcmp(cp, "/td")) {
331 /* end of this item */
332 for (end = mp->readptr - 1; *end != '<'; --end)
333 ;
334 for (cp = start; cp < end; ++cp) {
335 addchar(buf, bufsize, count, *cp);
336 }
337 term(buf, bufsize, count);
338 return buf;
339 } else if (nesting == 1 && !strcmp(cp, "/tr")) {
340 /* end of this row */
341 return NULL;
342 } else if (!strcmp(cp, "/table")) {
343 /* end of this table? */
344 if (--nesting == 0)
345 return NULL;
346 } else if (!strncmp(cp, "table", 5) &&
347 (isspace((int)*(cp+5)) || *(cp+5) == '\0')) {
348 ++nesting;
349 }
350 }
351 /* error? */
352 return NULL;
353 }
354
355 /*
356 * Return NULL-terminated table row, or NULL at end of table.
357 * All cells are malloc'ed and should be freed by the calling function.
358 */
359 char **
360 getTableRow(memBuf_t *mp)
361 {
362 char **ret = NULL, *cp = NULL;
363 size_t size = 0, i = 0;
364
365 do {
366 cp = getTableCell(mp);
367 if (cp || i) {
368 if (i >= size) {
369 size += 10;
370 ret = (char **)myRealloc(ret, size * sizeof(char *));
371 }
372 ret[i++] = myStrdup(cp);
373 }
374 } while ((cp));
375 return ret;
376 }
377
378 /*
379 * Return number of columns in row, or -1 if null.
380 */
381 int
382 numColumns(char **row)
383 {
384 int ncols = 0;
385
386 if (!row)
387 return -1;
388 while (row[ncols++])
389 ;
390 return --ncols;
391 }
392
393 /*
394 * Free a TableRow allocated by getTableRow
395 */
396 void
397 freeTableRow(char **row)
398 {
399 char **cpp;
400
401 for (cpp = row; *cpp; ++cpp)
402 free(*cpp);
403 free(row);
404 }
405
406 /*
407 * Search for next table tag.
408 */
409 const char *
410 getTableStart(memBuf_t *mp)
411 {
412 const char *cp;
413
414 while ((cp = getTag(mp))) {
415 if (!strncmp(cp, "table", 5) &&
416 (isspace((int)*(cp+5)) || *(cp+5) == '\0'))
417 return cp;
418 }
419 return NULL;
420 }
0 /*
1 * Copyright (c) 2002, 2007, Scott Nicol <esniper@users.sf.net>
2 * All rights reserved
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are met:
6 *
7 * - Redistributions of source code must retain the above copyright notice,
8 * this list of conditions and the following disclaimer.
9 * - Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 *
13 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
14 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
15 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
16 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
17 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
18 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
19 * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
20 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
21 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
22 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
23 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24 */
25
26 #ifndef HTML_H_
27 #define HTML_H_
28
29 #include "http.h"
30
31 /*
32 * Get next tag text, eliminating leading and trailing whitespace
33 * and leaving only a single space for all internal whitespace.
34 */
35 extern const char *getTag(memBuf_t *mp);
36
37 /*
38 * Get next non-tag text, eliminating leading and trailing whitespace
39 * and leaving only a single space for all internal whitespace.
40 */
41 extern char *getNonTag(memBuf_t *mp);
42 extern char *getNonTagFromString(const char *s);
43 extern int getIntFromString(const char *s);
44
45 /*
46 * Get pagename variable, or NULL if not found.
47 */
48 extern char *getPageName(memBuf_t *mp);
49 extern char *getPageNameInternal(char *s);
50
51 extern const char PAGENAME[];
52
53 /*
54 * Search for next table tag.
55 */
56 extern const char *getTableStart(memBuf_t *mp);
57
58 /*
59 * Return NULL-terminated table row, or NULL at end of table.
60 * All cells are malloc'ed and should be freed by the calling function.
61 */
62 extern char **getTableRow(memBuf_t *mp);
63
64 /*
65 * Free a TableRow allocated by getTableRow
66 */
67 extern void freeTableRow(char **row);
68
69 /*
70 * Return number of columns in row, or -1 if null.
71 */
72 extern int numColumns(char **row);
73
74 /*
75 * Search for next table item. Return NULL at end of a row, and another NULL
76 * at the end of a table.
77 */
78 extern char *getTableCell(memBuf_t *mp);
79
80 /*
81 * Search to end of table, returning /table tag (or NULL if not found).
82 * Embedded tables are skipped.
83 */
84 extern const char *getTableEnd(memBuf_t *mp);
85
86
87 #endif /*HTML_H_*/
0 /*
1 * Copyright (c) 2002, 2003, Scott Nicol <esniper@users.sf.net>
2 * All rights reserved
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are met:
6 *
7 * - Redistributions of source code must retain the above copyright notice,
8 * this list of conditions and the following disclaimer.
9 * - Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 *
13 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
14 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
15 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
16 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
17 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
18 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
19 * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
20 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
21 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
22 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
23 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24 */
25
26 #include "http.h"
27 #include "esniper.h"
28 #include <curl/curl.h>
29 #include <curl/types.h>
30 #include <curl/easy.h>
31 #include <stdlib.h>
32 #include <string.h>
33 #if defined(WIN32)
34 # define DEVNULL "nul"
35 #else
36 # define DEVNULL "/dev/null"
37 #endif
38
39 enum requestType {GET, POST};
40
41 static CURL *easyhandle = NULL;
42 static CURLcode curlrc = CURLE_OK;
43 static const char *lastURL = NULL;
44 static int curlInitDone = 0;
45 static char globalErrorbuf[CURL_ERROR_SIZE];
46
47 static memBuf_t *httpRequest(const char *url, const char *logUrl, const char *data, const char *logData, enum requestType);
48 static memBuf_t *httpRequestFailed(memBuf_t *mp);
49 static size_t WriteMemoryCallback(void *ptr, size_t size, size_t nmemb, void *data);
50 static int initCurlStuffFailed(void);
51
52 #ifdef NEED_CURL_EASY_STRERROR
53 static const char *curl_easy_strerror(CURLcode error);
54 #endif
55
56 /* Set auction error with full libcurl details */
57 int
58 httpError(auctionInfo *aip)
59 {
60 int ret = 0;
61
62 if (curlrc != CURLE_OK) {
63 char *details = myStrdup4(myStrdup2(lastURL, ": "),
64 curl_easy_strerror(curlrc), ": ",
65 globalErrorbuf);
66
67 ret = auctionError(aip, ae_curlerror, details);
68 free(details);
69 }
70 return ret;
71 }
72
73 /* returns open socket, or NULL on error */
74 memBuf_t *
75 httpGet(const char *url, const char *logUrl)
76 {
77 return httpRequest(url, logUrl, "", NULL, GET);
78 }
79
80 /* returns open socket, or NULL on error */
81 memBuf_t *
82 httpPost(const char *url, const char *data, const char *logData)
83 {
84 return httpRequest(url, NULL, data, logData, POST);
85 }
86
87 /*
88 * Create a membuf from a string.
89 */
90 memBuf_t *
91 strToMemBuf(const char *s, memBuf_t *mp)
92 {
93 mp->timeToFirstByte = time(NULL);
94 mp->memory = myStrdup(s);
95 mp->readptr = mp->memory;
96 mp->size = s ? strlen(s) : 0;
97 return mp;
98 }
99
100 /*
101 * Free membuf.
102 */
103 void
104 freeMembuf(memBuf_t *mp)
105 {
106 if (mp) {
107 free(mp->memory);
108 free(mp);
109 }
110 }
111
112 #ifdef DEBUG
113 /*
114 * Create a membuf from a file.
115 */
116 memBuf_t *
117 readFile(FILE *fp)
118 {
119 static memBuf_t membuf = { NULL, 0, NULL, 0 };
120 static const int BUFINC = 20 * 1024;
121 size_t i = 0;
122 int c;
123
124 if (membuf.memory)
125 clearMembuf(&membuf);
126
127 membuf.size = BUFINC;
128 membuf.memory = (char *)myMalloc(membuf.size);
129 while ((c = getc(fp)) != EOF) {
130 if (i == membuf.size) {
131 membuf.size += BUFINC;
132 membuf.memory = (char *)myRealloc(membuf.memory, membuf.size);
133 }
134 membuf.memory[i++] = (char)c;
135 }
136 membuf.size = i;
137 membuf.readptr = membuf.memory;
138 return &membuf;
139 }
140 #endif
141
142 static memBuf_t *
143 httpRequest(const char *url, const char *logUrl, const char *data, const char *logData, enum requestType rt)
144 {
145 const char *nonNullData = data ? data : "";
146 memBuf_t *mp = (memBuf_t *)myMalloc(sizeof(memBuf_t));
147
148 mp->memory = mp->readptr = NULL;
149 mp->size = 0;
150 mp->timeToFirstByte = 0;
151
152 lastURL = url;
153
154 if (!curlInitDone && initCurlStuff())
155 return NULL;
156
157 /* Note: was CURLOPT_WRITEDATA, which is the same as CURLOPT_FILE.
158 * Some older versions of libcurl don't have CURLOPT_WRITEDATA.
159 */
160 if ((curlrc = curl_easy_setopt(easyhandle, CURLOPT_FILE, (void *)mp)))
161 return httpRequestFailed(mp);
162
163 if (rt == GET) {
164 if ((curlrc = curl_easy_setopt(easyhandle, CURLOPT_HTTPGET, 1)))
165 return httpRequestFailed(mp);
166 } else {
167 log(("%s", logData ? logData : nonNullData));
168 if ((curlrc = curl_easy_setopt(easyhandle, CURLOPT_POSTFIELDS, nonNullData)))
169 return httpRequestFailed(mp);
170 }
171
172 log(("%s", logUrl ? logUrl : url));
173 if ((curlrc = curl_easy_setopt(easyhandle, CURLOPT_URL, url)))
174 return httpRequestFailed(mp);
175
176 if ((curlrc = curl_easy_perform(easyhandle)))
177 return httpRequestFailed(mp);
178
179 return mp;
180 }
181
182 static memBuf_t *
183 httpRequestFailed(memBuf_t *mp)
184 {
185 freeMembuf(mp);
186 log(("%s", curl_easy_strerror(curlrc)));
187 log(("%s", globalErrorbuf));
188 return NULL;
189 }
190
191 /*
192 * Returns 0 on success, non-0 otherwise.
193 */
194 int
195 initCurlStuff(void)
196 {
197 /* list for custom headers */
198 struct curl_slist *slist=NULL;
199
200 curl_global_init(CURL_GLOBAL_ALL);
201
202 /* init the curl session */
203 if (!(easyhandle = curl_easy_init()))
204 return -1;
205
206 /* buffer for error messages */
207 if ((curlrc = curl_easy_setopt(easyhandle, CURLOPT_ERRORBUFFER, globalErrorbuf)))
208 return initCurlStuffFailed();
209
210 /* debug output, show what libcurl does */
211 if (options.curldebug &&
212 (curlrc = curl_easy_setopt(easyhandle, CURLOPT_VERBOSE, 1)))
213 return initCurlStuffFailed();
214
215 /* follow all redirects */
216 if ((curlrc = curl_easy_setopt(easyhandle, CURLOPT_FOLLOWLOCATION, 1)))
217 return initCurlStuffFailed();
218
219 /* use proxy */
220 if (options.proxy &&
221 (curlrc = curl_easy_setopt(easyhandle, CURLOPT_PROXY, options.proxy)))
222 return initCurlStuffFailed();
223
224 /* send all data to this function */
225 if ((curlrc = curl_easy_setopt(easyhandle, CURLOPT_WRITEFUNCTION, WriteMemoryCallback)))
226 return initCurlStuffFailed();
227
228 /* some servers don't like requests that are made without a user-agent
229 * field, so we provide one */
230 if ((curlrc = curl_easy_setopt(easyhandle, CURLOPT_USERAGENT, "Mozilla/4.7 [en] (X11; U; Linux 2.2.12 i686)")))
231 return initCurlStuffFailed();
232
233 slist = curl_slist_append(slist, "Accept: text/*");
234 slist = curl_slist_append(slist, "Accept-Language: en");
235 slist = curl_slist_append(slist, "Accept-Charset: iso-8859-1,*,utf-8");
236 slist = curl_slist_append(slist, "Cache-Control: no-cache");
237 if ((curlrc = curl_easy_setopt(easyhandle, CURLOPT_HTTPHEADER, slist)))
238 return initCurlStuffFailed();
239
240 if ((curlrc = curl_easy_setopt(easyhandle, CURLOPT_COOKIEFILE, DEVNULL)))
241 return initCurlStuffFailed();
242
243 curlInitDone = 1;
244 return 0;
245 }
246
247 static int
248 initCurlStuffFailed(void)
249 {
250 log(("%s", curl_easy_strerror(curlrc)));
251 log(("%s", globalErrorbuf));
252 return -1;
253 }
254
255 void
256 cleanupCurlStuff(void)
257 {
258 curl_easy_cleanup(easyhandle);
259 easyhandle = NULL;
260 curl_global_cleanup();
261 curlInitDone = 0;
262 }
263
264 static size_t
265 WriteMemoryCallback(void *ptr, size_t size, size_t nmemb, void *data)
266 {
267 register size_t realsize = size * nmemb;
268 memBuf_t *mp = (memBuf_t *)data;
269
270 if (!mp->timeToFirstByte)
271 mp->timeToFirstByte = time(NULL);
272
273 mp->memory = (char *)myRealloc(mp->memory, mp->size + realsize + 1);
274 mp->readptr = mp->memory;
275 memcpy(&(mp->memory[mp->size]), ptr, realsize);
276 mp->size += realsize;
277 mp->memory[mp->size] = 0;
278 return realsize;
279 }
280
281 int
282 memEof(memBuf_t *mp)
283 {
284 return (!mp || !mp->size || mp->readptr == (mp->memory + mp->size));
285 }
286
287 int
288 memGetc(memBuf_t *mp)
289 {
290 return memEof(mp) ? EOF : (int)(*(unsigned char *)(mp->readptr++));
291 }
292
293 void
294 memUngetc(memBuf_t *mp)
295 {
296 if (mp->readptr > mp->memory)
297 mp->readptr--;
298 }
299
300 time_t
301 getTimeToFirstByte(memBuf_t *mp)
302 {
303 return mp->timeToFirstByte;
304 }
305
306 #ifdef NEED_CURL_EASY_STRERROR
307 /*
308 * This is only needed if we are using libcurl that doesn't have its own
309 * curl_easy_strerror. curl_easy_strerror was added in 7.11.2.
310 */
311 static const char *curlErrorTable[] = {
312 "no error", /* CURLE_OK */
313 "unsupported protocol", /* CURLE_UNSUPPORTED_PROTOCOL */
314 "failed init", /* CURLE_FAILED_INIT */
315 "URL using bad/illegal format or missing URL", /* CURLE_URL_MALFORMAT */
316 "CURLE_URL_MALFORMAT_USER", /* CURLE_URL_MALFORMAT_USER */
317 "couldnt resolve proxy name", /* CURLE_COULDNT_RESOLVE_PROXY */
318 "couldnt resolve host name", /* CURLE_COULDNT_RESOLVE_HOST */
319 "couldn't connect to server", /* CURLE_COULDNT_CONNECT */
320 "FTP: weird server reply", /* CURLE_FTP_WEIRD_SERVER_REPLY */
321 "FTP: access denied", /* CURLE_FTP_ACCESS_DENIED */
322 "FTP: user and/or password incorrect", /* CURLE_FTP_USER_PASSWORD_INCORRECT */
323 "FTP: unknown PASS reply", /* CURLE_FTP_WEIRD_PASS_REPLY */
324 "FTP: unknown USER reply", /* CURLE_FTP_WEIRD_USER_REPLY */
325 "FTP: unknown PASV reply", /* CURLE_FTP_WEIRD_PASV_REPLY */
326 "FTP: unknown 227 response format", /* CURLE_FTP_WEIRD_227_FORMAT */
327 "FTP: can't figure out the host in the PASV response", /* CURLE_FTP_CANT_GET_HOST */
328 "FTP: can't connect to server the response code is unknown", /* CURLE_FTP_CANT_RECONNECT */
329 "FTP: couldn't set binary mode", /* CURLE_FTP_COULDNT_SET_BINARY */
330 "Transferred a partial file", /* CURLE_PARTIAL_FILE */
331 "FTP: couldn't retrieve (RETR failed) the specified file", /* CURLE_FTP_COULDNT_RETR_FILE */
332 "FTP: the post-transfer acknowledge response was not OK", /* CURLE_FTP_WRITE_ERROR */
333 "FTP: a quote command returned error", /* CURLE_FTP_QUOTE_ERROR */
334 "HTTP response code said error", /* CURLE_HTTP_RETURNED_ERROR */
335 "failed writing received data to disk/application", /* CURLE_WRITE_ERROR */
336 "CURLE_MALFORMAT_USER", /* CURLE_MALFORMAT_USER */
337 "failed FTP upload (the STOR command)", /* CURLE_FTP_COULDNT_STOR_FILE */
338 "failed to open/read local data from file/application", /* CURLE_READ_ERROR */
339 "out of memory", /* CURLE_OUT_OF_MEMORY */
340 "a timeout was reached", /* CURLE_OPERATION_TIMEOUTED */
341 "FTP could not set ASCII mode (TYPE A)", /* CURLE_FTP_COULDNT_SET_ASCII */
342 "FTP command PORT failed", /* CURLE_FTP_PORT_FAILED */
343 "FTP command REST failed", /* CURLE_FTP_COULDNT_USE_REST */
344 "FTP command SIZE failed", /* CURLE_FTP_COULDNT_GET_SIZE */
345 "a range was requested but the server did not deliver it", /* CURLE_HTTP_RANGE_ERROR */
346 "internal problem setting up the POST", /* CURLE_HTTP_POST_ERROR */
347 "SSL connect error", /* CURLE_SSL_CONNECT_ERROR */
348 "couldn't resume FTP download", /* CURLE_FTP_BAD_DOWNLOAD_RESUME */
349 "couldn't read a file:// file", /* CURLE_FILE_COULDNT_READ_FILE */
350 "LDAP: cannot bind", /* CURLE_LDAP_CANNOT_BIND */
351 "LDAP: search failed", /* CURLE_LDAP_SEARCH_FAILED */
352 "a required shared library was not found", /* CURLE_LIBRARY_NOT_FOUND */
353 "a required function in the shared library was not found", /* CURLE_FUNCTION_NOT_FOUND */
354 "the operation was aborted by an application callback", /* CURLE_ABORTED_BY_CALLBACK */
355 "a libcurl function was given a bad argument", /* CURLE_BAD_FUNCTION_ARGUMENT */
356 "CURLE_BAD_CALLING_ORDER", /* CURLE_BAD_CALLING_ORDER */
357 "failed binding local connection end", /* CURLE_INTERFACE_FAILED */
358 "CURLE_BAD_PASSWORD_ENTERED", /* CURLE_BAD_PASSWORD_ENTERED */
359 "number of redirects hit maximum amount", /* CURLE_TOO_MANY_REDIRECTS */
360 "User specified an unknown option", /* CURLE_UNKNOWN_TELNET_OPTION */
361 "Malformed telnet option", /* CURLE_TELNET_OPTION_SYNTAX */
362 "CURLE_OBSOLETE", /* CURLE_OBSOLETE */
363 "SSL peer certificate was not ok", /* CURLE_SSL_PEER_CERTIFICATE */
364 "server returned nothing (no headers, no data)", /* CURLE_GOT_NOTHING */
365 "SSL crypto engine not found", /* CURLE_SSL_ENGINE_NOTFOUND */
366 "can not set SSL crypto engine as default", /* CURLE_SSL_ENGINE_SETFAILED */
367 "failed sending data to the peer", /* CURLE_SEND_ERROR */
368 "failure when receiving data from the peer", /* CURLE_RECV_ERROR */
369 "share is already in use", /* CURLE_SHARE_IN_USE */
370 "problem with the local SSL certificate", /* CURLE_SSL_CERTPROBLEM */
371 "couldn't use specified SSL cipher", /* CURLE_SSL_CIPHER */
372 "problem with the SSL CA cert (path? access rights?)", /* CURLE_SSL_CACERT */
373 "Unrecognized HTTP Content-Encoding", /* CURLE_BAD_CONTENT_ENCODING */
374 "Invalid LDAP URL", /* CURLE_LDAP_INVALID_URL */
375 "Maximum file size exceeded", /* CURLE_FILESIZE_EXCEEDED */
376 "Requested FTP SSL level failed", /* CURLE_FTP_SSL_FAILED */
377 };
378
379 static const char *
380 curl_easy_strerror(CURLcode error)
381 {
382 if (error < 0 || error >= CURL_LAST ||
383 error >= (sizeof(curlErrorTable) / sizeof(const char *)))
384
385 return "unknown error";
386 return curlErrorTable[error];
387 }
388 #endif
0 /*
1 * Copyright (c) 2002, 2003, Scott Nicol <esniper@users.sf.net>
2 * All rights reserved
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are met:
6 *
7 * - Redistributions of source code must retain the above copyright notice,
8 * this list of conditions and the following disclaimer.
9 * - Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 *
13 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
14 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
15 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
16 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
17 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
18 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
19 * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
20 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
21 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
22 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
23 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24 */
25
26 #ifndef HTTP_H_INCLUDED
27 #define HTTP_H_INCLUDED
28
29 #include "auctioninfo.h"
30
31 typedef struct {
32 char *memory;
33 size_t size;
34 char *readptr;
35 time_t timeToFirstByte;
36 } memBuf_t;
37
38 extern int memEof(memBuf_t *mp);
39 extern int memGetc(memBuf_t *mp);
40 extern void memUngetc(memBuf_t *mp);
41 extern time_t getTimeToFirstByte(memBuf_t *mp);
42
43 extern int initCurlStuff(void);
44 extern void cleanupCurlStuff(void);
45
46 extern int httpError(auctionInfo *aip);
47 extern memBuf_t *httpGet(const char *url, const char *logUrl);
48 extern memBuf_t *httpPost(const char *url, const char *data, const char *logData);
49 extern void freeMembuf(memBuf_t *mp);
50 extern memBuf_t *strToMemBuf(const char *s, memBuf_t *buf);
51
52 #ifdef DEBUG
53 #include <stdio.h>
54 extern memBuf_t *readFile(FILE *fp);
55 #endif
56
57 #endif /* HTTP_H_INCLUDED */
0 #!/bin/sh
1 # install - install a program, script, or datafile
2
3 scriptversion=2004-10-22.00
4
5 # This originates from X11R5 (mit/util/scripts/install.sh), which was
6 # later released in X11R6 (xc/config/util/install.sh) with the
7 # following copyright and license.
8 #
9 # Copyright (C) 1994 X Consortium
10 #
11 # Permission is hereby granted, free of charge, to any person obtaining a copy
12 # of this software and associated documentation files (the "Software"), to
13 # deal in the Software without restriction, including without limitation the
14 # rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
15 # sell copies of the Software, and to permit persons to whom the Software is
16 # furnished to do so, subject to the following conditions:
17 #
18 # The above copyright notice and this permission notice shall be included in
19 # all copies or substantial portions of the Software.
20 #
21 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
22 # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
23 # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
24 # X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
25 # AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC-
26 # TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
27 #
28 # Except as contained in this notice, the name of the X Consortium shall not
29 # be used in advertising or otherwise to promote the sale, use or other deal-
30 # ings in this Software without prior written authorization from the X Consor-
31 # tium.
32 #
33 #
34 # FSF changes to this file are in the public domain.
35 #
36 # Calling this script install-sh is preferred over install.sh, to prevent
37 # `make' implicit rules from creating a file called install from it
38 # when there is no Makefile.
39 #
40 # This script is compatible with the BSD install script, but was written
41 # from scratch. It can only install one file at a time, a restriction
42 # shared with many OS's install programs.
43
44 # set DOITPROG to echo to test this script
45
46 # Don't use :- since 4.3BSD and earlier shells don't like it.
47 doit="${DOITPROG-}"
48
49 # put in absolute paths if you don't have them in your path; or use env. vars.
50
51 mvprog="${MVPROG-mv}"
52 cpprog="${CPPROG-cp}"
53 chmodprog="${CHMODPROG-chmod}"
54 chownprog="${CHOWNPROG-chown}"
55 chgrpprog="${CHGRPPROG-chgrp}"
56 stripprog="${STRIPPROG-strip}"
57 rmprog="${RMPROG-rm}"
58 mkdirprog="${MKDIRPROG-mkdir}"
59
60 chmodcmd="$chmodprog 0755"
61 chowncmd=
62 chgrpcmd=
63 stripcmd=
64 rmcmd="$rmprog -f"
65 mvcmd="$mvprog"
66 src=
67 dst=
68 dir_arg=
69 dstarg=
70 no_target_directory=
71
72 usage="Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE
73 or: $0 [OPTION]... SRCFILES... DIRECTORY
74 or: $0 [OPTION]... -t DIRECTORY SRCFILES...
75 or: $0 [OPTION]... -d DIRECTORIES...
76
77 In the 1st form, copy SRCFILE to DSTFILE.
78 In the 2nd and 3rd, copy all SRCFILES to DIRECTORY.
79 In the 4th, create DIRECTORIES.
80
81 Options:
82 -c (ignored)
83 -d create directories instead of installing files.
84 -g GROUP $chgrpprog installed files to GROUP.
85 -m MODE $chmodprog installed files to MODE.
86 -o USER $chownprog installed files to USER.
87 -s $stripprog installed files.
88 -t DIRECTORY install into DIRECTORY.
89 -T report an error if DSTFILE is a directory.
90 --help display this help and exit.
91 --version display version info and exit.
92
93 Environment variables override the default commands:
94 CHGRPPROG CHMODPROG CHOWNPROG CPPROG MKDIRPROG MVPROG RMPROG STRIPPROG
95 "
96
97 while test -n "$1"; do
98 case $1 in
99 -c) shift
100 continue;;
101
102 -d) dir_arg=true
103 shift
104 continue;;
105
106 -g) chgrpcmd="$chgrpprog $2"
107 shift
108 shift
109 continue;;
110
111 --help) echo "$usage"; exit 0;;
112
113 -m) chmodcmd="$chmodprog $2"
114 shift
115 shift
116 continue;;
117
118 -o) chowncmd="$chownprog $2"
119 shift
120 shift
121 continue;;
122
123 -s) stripcmd=$stripprog
124 shift
125 continue;;
126
127 -t) dstarg=$2
128 shift
129 shift
130 continue;;
131
132 -T) no_target_directory=true
133 shift
134 continue;;
135
136 --version) echo "$0 $scriptversion"; exit 0;;
137
138 *) # When -d is used, all remaining arguments are directories to create.
139 # When -t is used, the destination is already specified.
140 test -n "$dir_arg$dstarg" && break
141 # Otherwise, the last argument is the destination. Remove it from $@.
142 for arg
143 do
144 if test -n "$dstarg"; then
145 # $@ is not empty: it contains at least $arg.
146 set fnord "$@" "$dstarg"
147 shift # fnord
148 fi
149 shift # arg
150 dstarg=$arg
151 done
152 break;;
153 esac
154 done
155
156 if test -z "$1"; then
157 if test -z "$dir_arg"; then
158 echo "$0: no input file specified." >&2
159 exit 1
160 fi
161 # It's OK to call `install-sh -d' without argument.
162 # This can happen when creating conditional directories.
163 exit 0
164 fi
165
166 for src
167 do
168 # Protect names starting with `-'.
169 case $src in
170 -*) src=./$src ;;
171 esac
172
173 if test -n "$dir_arg"; then
174 dst=$src
175 src=
176
177 if test -d "$dst"; then
178 mkdircmd=:
179 chmodcmd=
180 else
181 mkdircmd=$mkdirprog
182 fi
183 else
184 # Waiting for this to be detected by the "$cpprog $src $dsttmp" command
185 # might cause directories to be created, which would be especially bad
186 # if $src (and thus $dsttmp) contains '*'.
187 if test ! -f "$src" && test ! -d "$src"; then
188 echo "$0: $src does not exist." >&2
189 exit 1
190 fi
191
192 if test -z "$dstarg"; then
193 echo "$0: no destination specified." >&2
194 exit 1
195 fi
196
197 dst=$dstarg
198 # Protect names starting with `-'.
199 case $dst in
200 -*) dst=./$dst ;;
201 esac
202
203 # If destination is a directory, append the input filename; won't work
204 # if double slashes aren't ignored.
205 if test -d "$dst"; then
206 if test -n "$no_target_directory"; then
207 echo "$0: $dstarg: Is a directory" >&2
208 exit 1
209 fi
210 dst=$dst/`basename "$src"`
211 fi
212 fi
213
214 # This sed command emulates the dirname command.
215 dstdir=`echo "$dst" | sed -e 's,/*$,,;s,[^/]*$,,;s,/*$,,;s,^$,.,'`
216
217 # Make sure that the destination directory exists.
218
219 # Skip lots of stat calls in the usual case.
220 if test ! -d "$dstdir"; then
221 defaultIFS='
222 '
223 IFS="${IFS-$defaultIFS}"
224
225 oIFS=$IFS
226 # Some sh's can't handle IFS=/ for some reason.
227 IFS='%'
228 set x `echo "$dstdir" | sed -e 's@/@%@g' -e 's@^%@/@'`
229 shift
230 IFS=$oIFS
231
232 pathcomp=
233
234 while test $# -ne 0 ; do
235 pathcomp=$pathcomp$1
236 shift
237 if test ! -d "$pathcomp"; then
238 $mkdirprog "$pathcomp"
239 # mkdir can fail with a `File exist' error in case several
240 # install-sh are creating the directory concurrently. This
241 # is OK.
242 test -d "$pathcomp" || exit
243 fi
244 pathcomp=$pathcomp/
245 done
246 fi
247
248 if test -n "$dir_arg"; then
249 $doit $mkdircmd "$dst" \
250 && { test -z "$chowncmd" || $doit $chowncmd "$dst"; } \
251 && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } \
252 && { test -z "$stripcmd" || $doit $stripcmd "$dst"; } \
253 && { test -z "$chmodcmd" || $doit $chmodcmd "$dst"; }
254
255 else
256 dstfile=`basename "$dst"`
257
258 # Make a couple of temp file names in the proper directory.
259 dsttmp=$dstdir/_inst.$$_
260 rmtmp=$dstdir/_rm.$$_
261
262 # Trap to clean up those temp files at exit.
263 trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0
264 trap '(exit $?); exit' 1 2 13 15
265
266 # Copy the file name to the temp name.
267 $doit $cpprog "$src" "$dsttmp" &&
268
269 # and set any options; do chmod last to preserve setuid bits.
270 #
271 # If any of these fail, we abort the whole thing. If we want to
272 # ignore errors from any of these, just make sure not to ignore
273 # errors from the above "$doit $cpprog $src $dsttmp" command.
274 #
275 { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } \
276 && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } \
277 && { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } \
278 && { test -z "$chmodcmd" || $doit $chmodcmd "$dsttmp"; } &&
279
280 # Now rename the file to the real destination.
281 { $doit $mvcmd -f "$dsttmp" "$dstdir/$dstfile" 2>/dev/null \
282 || {
283 # The rename failed, perhaps because mv can't rename something else
284 # to itself, or perhaps because mv is so ancient that it does not
285 # support -f.
286
287 # Now remove or move aside any old file at destination location.
288 # We try this two ways since rm can't unlink itself on some
289 # systems and the destination file might be busy for other
290 # reasons. In this case, the final cleanup might fail but the new
291 # file should still install successfully.
292 {
293 if test -f "$dstdir/$dstfile"; then
294 $doit $rmcmd -f "$dstdir/$dstfile" 2>/dev/null \
295 || $doit $mvcmd -f "$dstdir/$dstfile" "$rmtmp" 2>/dev/null \
296 || {
297 echo "$0: cannot unlink or rename $dstdir/$dstfile" >&2
298 (exit 1); exit
299 }
300 else
301 :
302 fi
303 } &&
304
305 # Now rename the file to the real destination.
306 $doit $mvcmd "$dsttmp" "$dstdir/$dstfile"
307 }
308 }
309 fi || { (exit 1); exit; }
310 done
311
312 # The final little trick to "correctly" pass the exit status to the exit trap.
313 {
314 (exit 0); exit
315 }
316
317 # Local variables:
318 # eval: (add-hook 'write-file-hooks 'time-stamp)
319 # time-stamp-start: "scriptversion="
320 # time-stamp-format: "%:y-%02m-%02d.%02H"
321 # time-stamp-end: "$"
322 # End:
0 # Makefile for miscellaneous stuff.
1
2 #
3 # check: fish for portability and obvious bugs by compiling with most
4 # of gcc's warning options enabled
5 #
6
7 SRC = auction.c auctionfile.c auctioninfo.c buffer.c esniper.c \
8 history.c html.c http.c options.c util.c
9
10 # System dependencies
11 # HP-UX 10.20
12 #CFLAGS = -D_XOPEN_SOURCE_EXTENDED
13 # Digital UNIX (OSF1 V4.0)
14 #CFLAGS = -D_XOPEN_SOURCE_EXTENDED
15
16 # strict checking options
17 # Note: -O needed for uninitialized variable warning (part of -Wall)
18 #
19 # Flags not included:
20 # -Wshadow -Wtraditional -Wid-clash-len -Wredundant-decls
21 CHECKFLAGS = -O -pedantic -Wall -Wpointer-arith -Wcast-qual \
22 -Wcast-align -Wwrite-strings -Wconversion -Waggregate-return \
23 -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations \
24 -Wnested-externs
25
26 # Simple portability check - look for no warnings
27 check:
28 gcc -c $(CFLAGS) -DVERSION=\"check\" `curl-config --cflags` $(CHECKFLAGS) $(SRC)
29
30 # lint check
31 lint:
32 lint $(CFLAGS) `curl-config --cflags` $(SRC)
33
34
35
36 #
37 # configure: generate updated autotools files.
38 #
39 configure: Makefile.am configure.in
40 automake -a
41 aclocal
42 autoconf
43
44
45
46 #
47 # esniper_man.html: generate new html-ized man file
48 #
49 esniper_man.html: esniper.1
50 man2html esniper.1 >esniper_man.html
0 #! /bin/sh
1 # Common stub for a few missing GNU programs while installing.
2
3 scriptversion=2004-09-07.08
4
5 # Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004
6 # Free Software Foundation, Inc.
7 # Originally by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996.
8
9 # This program is free software; you can redistribute it and/or modify
10 # it under the terms of the GNU General Public License as published by
11 # the Free Software Foundation; either version 2, or (at your option)
12 # any later version.
13
14 # This program is distributed in the hope that it will be useful,
15 # but WITHOUT ANY WARRANTY; without even the implied warranty of
16 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 # GNU General Public License for more details.
18
19 # You should have received a copy of the GNU General Public License
20 # along with this program; if not, write to the Free Software
21 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
22 # 02111-1307, USA.
23
24 # As a special exception to the GNU General Public License, if you
25 # distribute this file as part of a program that contains a
26 # configuration script generated by Autoconf, you may include it under
27 # the same distribution terms that you use for the rest of that program.
28
29 if test $# -eq 0; then
30 echo 1>&2 "Try \`$0 --help' for more information"
31 exit 1
32 fi
33
34 run=:
35
36 # In the cases where this matters, `missing' is being run in the
37 # srcdir already.
38 if test -f configure.ac; then
39 configure_ac=configure.ac
40 else
41 configure_ac=configure.in
42 fi
43
44 msg="missing on your system"
45
46 case "$1" in
47 --run)
48 # Try to run requested program, and just exit if it succeeds.
49 run=
50 shift
51 "$@" && exit 0
52 # Exit code 63 means version mismatch. This often happens
53 # when the user try to use an ancient version of a tool on
54 # a file that requires a minimum version. In this case we
55 # we should proceed has if the program had been absent, or
56 # if --run hadn't been passed.
57 if test $? = 63; then
58 run=:
59 msg="probably too old"
60 fi
61 ;;
62
63 -h|--h|--he|--hel|--help)
64 echo "\
65 $0 [OPTION]... PROGRAM [ARGUMENT]...
66
67 Handle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an
68 error status if there is no known handling for PROGRAM.
69
70 Options:
71 -h, --help display this help and exit
72 -v, --version output version information and exit
73 --run try to run the given command, and emulate it if it fails
74
75 Supported PROGRAM values:
76 aclocal touch file \`aclocal.m4'
77 autoconf touch file \`configure'
78 autoheader touch file \`config.h.in'
79 automake touch all \`Makefile.in' files
80 bison create \`y.tab.[ch]', if possible, from existing .[ch]
81 flex create \`lex.yy.c', if possible, from existing .c
82 help2man touch the output file
83 lex create \`lex.yy.c', if possible, from existing .c
84 makeinfo touch the output file
85 tar try tar, gnutar, gtar, then tar without non-portable flags
86 yacc create \`y.tab.[ch]', if possible, from existing .[ch]
87
88 Send bug reports to <bug-automake@gnu.org>."
89 exit 0
90 ;;
91
92 -v|--v|--ve|--ver|--vers|--versi|--versio|--version)
93 echo "missing $scriptversion (GNU Automake)"
94 exit 0
95 ;;
96
97 -*)
98 echo 1>&2 "$0: Unknown \`$1' option"
99 echo 1>&2 "Try \`$0 --help' for more information"
100 exit 1
101 ;;
102
103 esac
104
105 # Now exit if we have it, but it failed. Also exit now if we
106 # don't have it and --version was passed (most likely to detect
107 # the program).
108 case "$1" in
109 lex|yacc)
110 # Not GNU programs, they don't have --version.
111 ;;
112
113 tar)
114 if test -n "$run"; then
115 echo 1>&2 "ERROR: \`tar' requires --run"
116 exit 1
117 elif test "x$2" = "x--version" || test "x$2" = "x--help"; then
118 exit 1
119 fi
120 ;;
121
122 *)
123 if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
124 # We have it, but it failed.
125 exit 1
126 elif test "x$2" = "x--version" || test "x$2" = "x--help"; then
127 # Could not run --version or --help. This is probably someone
128 # running `$TOOL --version' or `$TOOL --help' to check whether
129 # $TOOL exists and not knowing $TOOL uses missing.
130 exit 1
131 fi
132 ;;
133 esac
134
135 # If it does not exist, or fails to run (possibly an outdated version),
136 # try to emulate it.
137 case "$1" in
138 aclocal*)
139 echo 1>&2 "\
140 WARNING: \`$1' is $msg. You should only need it if
141 you modified \`acinclude.m4' or \`${configure_ac}'. You might want
142 to install the \`Automake' and \`Perl' packages. Grab them from
143 any GNU archive site."
144 touch aclocal.m4
145 ;;
146
147 autoconf)
148 echo 1>&2 "\
149 WARNING: \`$1' is $msg. You should only need it if
150 you modified \`${configure_ac}'. You might want to install the
151 \`Autoconf' and \`GNU m4' packages. Grab them from any GNU
152 archive site."
153 touch configure
154 ;;
155
156 autoheader)
157 echo 1>&2 "\
158 WARNING: \`$1' is $msg. You should only need it if
159 you modified \`acconfig.h' or \`${configure_ac}'. You might want
160 to install the \`Autoconf' and \`GNU m4' packages. Grab them
161 from any GNU archive site."
162 files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}`
163 test -z "$files" && files="config.h"
164 touch_files=
165 for f in $files; do
166 case "$f" in
167 *:*) touch_files="$touch_files "`echo "$f" |
168 sed -e 's/^[^:]*://' -e 's/:.*//'`;;
169 *) touch_files="$touch_files $f.in";;
170 esac
171 done
172 touch $touch_files
173 ;;
174
175 automake*)
176 echo 1>&2 "\
177 WARNING: \`$1' is $msg. You should only need it if
178 you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'.
179 You might want to install the \`Automake' and \`Perl' packages.
180 Grab them from any GNU archive site."
181 find . -type f -name Makefile.am -print |
182 sed 's/\.am$/.in/' |
183 while read f; do touch "$f"; done
184 ;;
185
186 autom4te)
187 echo 1>&2 "\
188 WARNING: \`$1' is needed, but is $msg.
189 You might have modified some files without having the
190 proper tools for further handling them.
191 You can get \`$1' as part of \`Autoconf' from any GNU
192 archive site."
193
194 file=`echo "$*" | sed -n 's/.*--output[ =]*\([^ ]*\).*/\1/p'`
195 test -z "$file" && file=`echo "$*" | sed -n 's/.*-o[ ]*\([^ ]*\).*/\1/p'`
196 if test -f "$file"; then
197 touch $file
198 else
199 test -z "$file" || exec >$file
200 echo "#! /bin/sh"
201 echo "# Created by GNU Automake missing as a replacement of"
202 echo "# $ $@"
203 echo "exit 0"
204 chmod +x $file
205 exit 1
206 fi
207 ;;
208
209 bison|yacc)
210 echo 1>&2 "\
211 WARNING: \`$1' $msg. You should only need it if
212 you modified a \`.y' file. You may need the \`Bison' package
213 in order for those modifications to take effect. You can get
214 \`Bison' from any GNU archive site."
215 rm -f y.tab.c y.tab.h
216 if [ $# -ne 1 ]; then
217 eval LASTARG="\${$#}"
218 case "$LASTARG" in
219 *.y)
220 SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'`
221 if [ -f "$SRCFILE" ]; then
222 cp "$SRCFILE" y.tab.c
223 fi
224 SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'`
225 if [ -f "$SRCFILE" ]; then
226 cp "$SRCFILE" y.tab.h
227 fi
228 ;;
229 esac
230 fi
231 if [ ! -f y.tab.h ]; then
232 echo >y.tab.h
233 fi
234 if [ ! -f y.tab.c ]; then
235 echo 'main() { return 0; }' >y.tab.c
236 fi
237 ;;
238
239 lex|flex)
240 echo 1>&2 "\
241 WARNING: \`$1' is $msg. You should only need it if
242 you modified a \`.l' file. You may need the \`Flex' package
243 in order for those modifications to take effect. You can get
244 \`Flex' from any GNU archive site."
245 rm -f lex.yy.c
246 if [ $# -ne 1 ]; then
247 eval LASTARG="\${$#}"
248 case "$LASTARG" in
249 *.l)
250 SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'`
251 if [ -f "$SRCFILE" ]; then
252 cp "$SRCFILE" lex.yy.c
253 fi
254 ;;
255 esac
256 fi
257 if [ ! -f lex.yy.c ]; then
258 echo 'main() { return 0; }' >lex.yy.c
259 fi
260 ;;
261
262 help2man)
263 echo 1>&2 "\
264 WARNING: \`$1' is $msg. You should only need it if
265 you modified a dependency of a manual page. You may need the
266 \`Help2man' package in order for those modifications to take
267 effect. You can get \`Help2man' from any GNU archive site."
268
269 file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'`
270 if test -z "$file"; then
271 file=`echo "$*" | sed -n 's/.*--output=\([^ ]*\).*/\1/p'`
272 fi
273 if [ -f "$file" ]; then
274 touch $file
275 else
276 test -z "$file" || exec >$file
277 echo ".ab help2man is required to generate this page"
278 exit 1
279 fi
280 ;;
281
282 makeinfo)
283 echo 1>&2 "\
284 WARNING: \`$1' is $msg. You should only need it if
285 you modified a \`.texi' or \`.texinfo' file, or any other file
286 indirectly affecting the aspect of the manual. The spurious
287 call might also be the consequence of using a buggy \`make' (AIX,
288 DU, IRIX). You might want to install the \`Texinfo' package or
289 the \`GNU make' package. Grab either from any GNU archive site."
290 file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'`
291 if test -z "$file"; then
292 file=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'`
293 file=`sed -n '/^@setfilename/ { s/.* \([^ ]*\) *$/\1/; p; q; }' $file`
294 fi
295 touch $file
296 ;;
297
298 tar)
299 shift
300
301 # We have already tried tar in the generic part.
302 # Look for gnutar/gtar before invocation to avoid ugly error
303 # messages.
304 if (gnutar --version > /dev/null 2>&1); then
305 gnutar "$@" && exit 0
306 fi
307 if (gtar --version > /dev/null 2>&1); then
308 gtar "$@" && exit 0
309 fi
310 firstarg="$1"
311 if shift; then
312 case "$firstarg" in
313 *o*)
314 firstarg=`echo "$firstarg" | sed s/o//`
315 tar "$firstarg" "$@" && exit 0
316 ;;
317 esac
318 case "$firstarg" in
319 *h*)
320 firstarg=`echo "$firstarg" | sed s/h//`
321 tar "$firstarg" "$@" && exit 0
322 ;;
323 esac
324 fi
325
326 echo 1>&2 "\
327 WARNING: I can't seem to be able to run \`tar' with the given arguments.
328 You may want to install GNU tar or Free paxutils, or check the
329 command line arguments."
330 exit 1
331 ;;
332
333 *)
334 echo 1>&2 "\
335 WARNING: \`$1' is needed, and is $msg.
336 You might have modified some files without having the
337 proper tools for further handling them. Check the \`README' file,
338 it often tells you about the needed prerequisites for installing
339 this package. You may also peek at any GNU archive site, in case
340 some other package would contain this missing \`$1' program."
341 exit 1
342 ;;
343 esac
344
345 exit 0
346
347 # Local variables:
348 # eval: (add-hook 'write-file-hooks 'time-stamp)
349 # time-stamp-start: "scriptversion="
350 # time-stamp-format: "%:y-%02m-%02d.%02H"
351 # time-stamp-end: "$"
352 # End:
0 /*
1 * Copyright (c) 2002, 2003, 2004, Scott Nicol <esniper@users.sf.net>
2 * All rights reserved
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are met:
6 *
7 * - Redistributions of source code must retain the above copyright notice,
8 * this list of conditions and the following disclaimer.
9 * - Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 *
13 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
14 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
15 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
16 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
17 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
18 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
19 * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
20 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
21 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
22 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
23 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24 */
25
26 /*
27 * This program will "snipe" an auction on eBay, automatically placing
28 * your bid a few seconds before the auction ends.
29 *
30 * For updates, bug reports, etc, please go to http://esniper.sf.net/.
31 */
32
33 #include "options.h"
34 #include "buffer.h"
35 #include "esniper.h"
36 #include "util.h"
37 #include <ctype.h>
38 #include <errno.h>
39 #include <stdlib.h>
40 #include <string.h>
41
42 static int parseConfigValue(const char *name, const char *value,
43 const optionTable_t *table, const char *filename,
44 const char *line);
45 static int parseBoolValue(const char *name, const char *value,
46 const optionTable_t *tableptr, const char *filename,
47 const char *line, int neg);
48 static int parseStringValue(const char *name, const char *value,
49 const optionTable_t *tableptr, const char *filename,
50 const char *line);
51 static int parseIntValue(const char *name, const char *value,
52 const optionTable_t *tableptr, const char *filename,
53 const char *line);
54 static int parseSpecialValue(const char *name, const char *value,
55 const optionTable_t *tableptr,
56 const char *filename, const char *line);
57
58 /*
59 * readConfigFile(): read configuration from file, skipping auctions
60 *
61 * returns:
62 * 0 file successfully read, even if no configuration options found
63 * 1 file not found
64 * 2 other error
65 */
66 int
67 readConfigFile(const char *filename, optionTable_t *table)
68 {
69 char *buf = NULL;
70 size_t bufsize = 0, count = 0;
71 int c, ret = 0;
72 FILE *fp = fopen(filename, "r");
73
74 if (fp == NULL) {
75 /* file not found is OK */
76 if (errno == ENOENT)
77 return 1;
78 printLog(stderr, "Cannot open %s: %s\n", filename,
79 strerror(errno));
80 return 2;
81 }
82
83 while ((c = getc(fp)) != EOF) {
84 if (isspace(c))
85 continue;
86 /* skip comments and anything starting with a number,
87 * assuming this is an auction entry */
88 if ((c == '#') || isdigit(c))
89 c = skipline(fp);
90 else if (isalpha(c)) {
91 char *name = NULL, *value = NULL;
92
93 count = 0;
94 do {
95 addchar(buf, bufsize, count, (char)c);
96 c = getc(fp);
97 } while (c != EOF && !isspace(c) && c != '=');
98 addchar(buf, bufsize, count, '\0');
99 name = buf;
100
101 if (c != EOF && c != '\n' && c != '\r') {
102 do {
103 c = getc(fp);
104 } while (c == ' ' || c == '\t');
105 if (c == '=') {
106 do {
107 c = getc(fp);
108 } while (c == ' ' || c == '\t');
109 }
110
111 if (c != EOF && c != '\n' && c != '\r') {
112 value = &buf[count];
113 do {
114 addchar(buf, bufsize, count, (char)c);
115 c = getc(fp);
116 } while (c != EOF && c != '\n' && c != '\r');
117 /* strip trailing whitespace */
118 while (isspace((int)(buf[count - 1])))
119 --count;
120 term(buf, bufsize, count);
121 }
122 }
123 if (parseConfigValue(name, value, table, filename, buf))
124 ret = 2;
125 }
126
127 /* don't read EOF twice! */
128 if (c == EOF)
129 break;
130 }
131
132 if (ferror(fp)) {
133 printLog(stderr, "Cannot read %s: %s\n", filename,
134 strerror(errno));
135 ret = 2;
136 }
137 fclose(fp);
138 free(buf);
139 return ret;
140 } /* readConfigFile() */
141
142 /*
143 * parseGetoptValue(): parse option character and value
144 *
145 * returns: 0 = OK, else error
146 */
147 int
148 parseGetoptValue(int option, const char *optval, optionTable_t *table)
149 {
150 char optstr[] = { '\0', '\0' };
151
152 optstr[0] = (char)option;
153 /* optval "" should be handled the same as empty configuration option */
154 if (optval && !*optval)
155 optval = NULL;
156 /* filename NULL means command line option */
157 return parseConfigValue(optstr, optval, table, NULL, optstr);
158 }
159
160 /*
161 * parseConfigValue(): lookup command line or configuration option in option
162 * table and call appropriate function according to table entry.
163 *
164 * returns: 0 = OK, else error
165 */
166 static int
167 parseConfigValue(const char *name, const char *value,
168 const optionTable_t *table, const char *filename, const char *line)
169 {
170 const optionTable_t *tableptr;
171 const char *tablename;
172 int ret = 0;
173
174 if (strcmp(name, "password")) {
175 log(("parsing name %s value %s\n", name, nullStr(value)));
176 }
177
178 /* lookup name in table */
179 for (tableptr=table; tableptr->value; tableptr++) {
180 tablename = filename ?
181 tableptr->configname : tableptr->optionname;
182 if (tablename && !strcmp(name, tablename))
183 break;
184 }
185 if (tableptr->value) { /* found */
186 switch (tableptr->type) {
187 case OPTION_BOOL:
188 case OPTION_BOOL_NEG:
189 ret = parseBoolValue(name, value, tableptr, filename,
190 line, (tableptr->type == OPTION_BOOL_NEG));
191 break;
192 case OPTION_STRING:
193 ret = parseStringValue(name, value, tableptr, filename,
194 line);
195 break;
196 case OPTION_SPECIAL:
197 ret = parseSpecialValue(name, value, tableptr, filename,
198 line);
199 break;
200 case OPTION_INT:
201 ret = parseIntValue(name, value, tableptr, filename,
202 line);
203 break;
204 default:
205 printLog(stderr, "Internal error: invalid type in option table (%s)", tableptr->configname ? tableptr->configname : tableptr->optionname);
206 ret = 1;
207 }
208 } else {
209 if (filename)
210 printLog(stderr, "Unknown configuration entry \"%s\" in file %s\n", line, filename);
211 else
212 printLog(stderr, "Unknown command line option -%s\n",
213 line);
214 ret = 1;
215 }
216 return ret;
217 }
218
219 /*
220 * parseBoolValue(): parse a boolean value
221 *
222 * returns: 0 = OK, else error
223 */
224 static int
225 parseBoolValue(const char *name, const char *value,
226 const optionTable_t *tableptr, const char *filename, const char *line,
227 int neg)
228 {
229 int intval = boolValue(value);
230
231 if (intval == -1) {
232 if (filename)
233 printLog(stderr, "Invalid boolean value in file %s, line \"%s\"\n", filename, line);
234 else
235 printLog(stderr, "Invalid boolean value \"%s\" at command line option -%s\n", value, line);
236 return 1;
237 }
238 if (neg)
239 intval = !intval;
240 if (tableptr->checkfunc) { /* check value with check function */
241 if ((*tableptr->checkfunc)(&intval, tableptr, filename, line))
242 return 1;
243 } else
244 *(int*)(tableptr->value) = intval;
245 log(("bool value for %s is %d\n", name, *(int*)(tableptr->value)));
246 return 0;
247 }
248
249 /*
250 * parseStringValue(): parse a string value, call checking func if specified
251 *
252 * returns: 0 = OK, else error
253 */
254 static int
255 parseStringValue(const char *name, const char *value,
256 const optionTable_t *tableptr, const char *filename, const char *line)
257 {
258 if (tableptr->checkfunc) {
259 /* Check value with specific check function.
260 * Check function is responsible for allocating/freeing values
261 */
262 if ((*tableptr->checkfunc)(value, tableptr, filename, line))
263 return 1;
264 } else {
265 free(*(char**)(tableptr->value));
266 *(char**)(tableptr->value) = myStrdup(value);
267 }
268 log(("string value for %s is \"%s\"\n",
269 name, nullStr(*(char**)(tableptr->value))));
270 return 0;
271 }
272
273 /*
274 * parseSpecialValue(): parse a special value, which is is not interpreted here
275 * A checking func is required to convert/check value.
276 *
277 * returns: 0 = OK, else error
278 */
279 static int
280 parseSpecialValue(const char *name, const char *value,
281 const optionTable_t *tableptr, const char *filename, const char *line)
282 {
283 if (tableptr->checkfunc) { /* check value with check function */
284 if ((*tableptr->checkfunc)(value, tableptr, filename, line))
285 return 1;
286 } else {
287 printLog(stderr, "Internal error: special type needs check function in option table (%s)", tableptr->configname ? tableptr->configname : tableptr->optionname);
288 return 1;
289 }
290 return 0;
291 }
292
293 /*
294 * parseIntValue(): parse an integer value, call checking func if specified
295 *
296 * returns: 0 = OK, else error
297 */
298 static int
299 parseIntValue(const char *name, const char *value,
300 const optionTable_t *tableptr, const char *filename, const char *line)
301 {
302 int intval;
303 char *endptr;
304
305 if (!value) {
306 if(filename)
307 printLog(stderr, "Configuration option \"%s\" in file %s needs an integer value\n", line, filename);
308 else
309 printLog(stderr, "Option -%s needs an integer value\n",
310 line);
311 return 1;
312 }
313 intval = strtol(value, &endptr, 10);
314 if (*endptr != '\0') {
315 if (filename)
316 printLog(stderr, "Invalid integer value at configuration option \"%s\" in file %s\n", line, filename);
317 else
318 printLog(stderr, "Invalid integer value \"%s\" at command line option -%s\n", value, line);
319 return 1;
320 }
321
322 if (tableptr->checkfunc) {
323 /* check value with specific check function */
324 if ((*tableptr->checkfunc)(&intval, tableptr, filename, line))
325 return 1;
326 } else
327 *(int*)(tableptr->value) = intval;
328 log(("integer value for %s is %d\n", name, *(int*)(tableptr->value)));
329 return 0;
330 }
0 /*
1 * Copyright (c) 2002, 2003, 2004, Scott Nicol <esniper@users.sf.net>
2 * All rights reserved
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are met:
6 *
7 * - Redistributions of source code must retain the above copyright notice,
8 * this list of conditions and the following disclaimer.
9 * - Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 *
13 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
14 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
15 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
16 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
17 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
18 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
19 * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
20 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
21 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
22 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
23 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24 */
25
26 #ifndef OPTIONS_H_INCLUDED
27 #define OPTIONS_H_INCLUDED
28
29 /* data types for option or configuration values */
30 #define OPTION_STRING 1
31 #define OPTION_INT 2
32 #define OPTION_BOOL 3
33 #define OPTION_BOOL_NEG 4
34 /* OPTION_SPECIAL does not specify data type, the checking function,
35 * which is mandatory here, must know what to do. The parsing function
36 * will provide the string value or NULL to the checking function
37 */
38 #define OPTION_SPECIAL 5
39
40 /* table to describe all option or configuration values */
41 typedef struct optionTable optionTable_t;
42
43 struct optionTable {
44 const char *configname; /* keyword in configuration files */
45 const char *optionname; /* option without '-' */
46 void *value; /* variable to store value */
47 int type; /* data type of expected value or option arg */
48 /* This function will be called to check and copy value if specified.
49 * It can get the value by other means than converting the string
50 * found in configuration file or on command line.
51 */
52 int (*checkfunc)(const void* valueptr, const optionTable_t* tableptr,
53 const char* filename, const char *line);
54 };
55
56 extern int readConfigFile(const char *filename, optionTable_t *table);
57 extern int parseGetoptValue(int option, const char *optval,
58 optionTable_t *table);
59
60 #endif /* OPTIONS_H_INCLUDED */
0 # An auction file may contain any line that is valid
1 # in a configuration file (see sample_config.txt for
2 # details), plus it may also have auction lines.
3 #
4 # An auction line contains an auction number, optionally
5 # followed by a price. If a price isn't specified, the
6 # price used is the same as the previous auction line.
7 #
8 # You should have one auction file for each type of item
9 # you are bidding on, so that you can change the quantity,
10 # username, or other options to suit the item you are
11 # bidding on. For instance, you may want to buy up to 10
12 # laser print cartridges, but only one digital camera.
13
14 # Sample auction file for laser printer cartridges
15
16 # I'd like 10 of them, and my target price is $50
17 quantity = 10
18
19 # seller surpluslaserjunk, shipping $15,
20 # questionable reputation (so I'll only pay $40 total)
21 9298389738 25
22 9872749829
23 9872972987
24 9087289973
25
26 # seller highqualityprintersupplies, shipping $8,
27 # excellent reputation
28 9982309829 42
29 9827349827
30
31 # seller nonbusinesshomeseller, shipping not mentioned
32 # (assume $10), good reputation
33 9287398473 35
34
35 # seller lasersuppliesforcheap, lousy reputation,
36 # don't buy!!!
37 #9239889372 0
0 # A configuration file contains option settings,
1 # blank lines, and comments (begin with #). The
2 # default configuration file is $HOME/.esniper, and
3 # if you specify an auction file, .esniper in the
4 # auction file's directory as well. If you specify a
5 # configuration file using the -c command-line option,
6 # then that configuration file will be the only one
7 # read.
8 #
9 # If you set your password in a configuration file
10 # and you are on a unix system, you should be the
11 # owner of the file, and you should set the
12 # permissions so that it is readable only by the
13 # owner.
14 #
15 # Here are all the options. Note that if the
16 # default (as defined in esniper -H) is fine, you
17 # don't need to specify it in a configuration file.
18
19 # boolean parameters can be set to:
20 # true, y, yes, on, 1, enabled
21 # false, n, no, off, 0, disabled
22 batch = false
23 bid = yes
24 debug = enabled
25 reduce = y
26
27 # Note: it would be nice if logdir could use ~myuser,
28 # or $HOME. Perhaps in a future version.
29 logdir = /export/home/myuser/esniperlogs
30 password = myebaypassword
31 # Note: proxy authentication not yet supported
32 proxy = http://192.168.1.1:8080/
33 username = myebayusername
34
35 # Note: quantity is usually set in an auction file
36 quantity = 1
37 # Note: seconds can also be "now", if you want to
38 # bid immediately
39 seconds = 10
0 /*
1 * Copyright (c) 2002, 2003, Scott Nicol <esniper@users.sf.net>
2 * All rights reserved
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are met:
6 *
7 * - Redistributions of source code must retain the above copyright notice,
8 * this list of conditions and the following disclaimer.
9 * - Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 *
13 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
14 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
15 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
16 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
17 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
18 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
19 * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
20 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
21 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
22 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
23 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24 */
25
26 #include "util.h"
27 #include "esniper.h"
28 #include "auction.h"
29 #include "buffer.h"
30 #include <ctype.h>
31 #include <curl/curl.h>
32 #include <errno.h>
33 #include <stdio.h>
34 #include <stdlib.h>
35 #include <string.h>
36 #include <sys/types.h>
37 #include <time.h>
38 #if defined(WIN32)
39 # include <windows.h>
40 # include <io.h>
41 # include <sys/timeb.h>
42 #else
43 # include <sys/types.h>
44 # include <sys/time.h>
45 # include <termios.h>
46 # include <unistd.h>
47 #endif
48
49 static void vlog(const char *fmt, va_list arglist);
50 static void toLowerString(char *s);
51 static void seedPasswordRandom(void);
52 static void cryptPassword(char *password);
53
54 /*
55 * various utility functions used in esniper.
56 */
57
58 /*
59 * Replacement malloc/realloc/strdup, with error checking
60 */
61
62 void *
63 myMalloc(size_t size)
64 {
65 void *ret = malloc(size);
66
67 if (!ret) {
68 printLog(stderr, "Cannot allocate memory: %s\n", strerror(errno));
69 exit(1);
70 }
71 return ret;
72 }
73
74 void *
75 myRealloc(void *buf, size_t size)
76 {
77 void *ret = buf ? realloc(buf, size) : malloc(size);
78
79 if (!ret) {
80 printLog(stderr, "Cannot reallocate memory: %s\n", strerror(errno));
81 exit(1);
82 }
83 return ret;
84 }
85
86 char *
87 myStrdup(const char *s)
88 {
89 char *ret;
90 size_t len;
91
92 if (!s)
93 return NULL;
94 len = strlen(s);
95 ret = myMalloc(len + 1);
96 memcpy(ret, s, len);
97 ret[len] = '\0';
98 return ret;
99 }
100
101 char *
102 myStrndup(const char *s, size_t len)
103 {
104 char *ret;
105
106 if (!s)
107 return NULL;
108 ret = myMalloc(len + 1);
109 memcpy(ret, s, len);
110 ret[len] = '\0';
111 return ret;
112 }
113
114 char *
115 myStrdup2(const char *s1, const char *s2)
116 {
117 char *ret = myMalloc(strlen(s1) + strlen(s2) + 1);
118
119 sprintf(ret, "%s%s", s1, s2);
120 return ret;
121 }
122
123 char *
124 myStrdup3(const char *s1, const char *s2, const char *s3)
125 {
126 char *ret = myMalloc(strlen(s1) + strlen(s2) + strlen(s3) + 1);
127
128 sprintf(ret, "%s%s%s", s1, s2, s3);
129 return ret;
130 }
131
132 char *
133 myStrdup4(const char *s1, const char *s2, const char *s3, const char *s4)
134 {
135 char *ret = myMalloc(strlen(s1) + strlen(s2) + strlen(s3) + strlen(s4) + 1);
136
137 sprintf(ret, "%s%s%s%s", s1, s2, s3, s4);
138 return ret;
139 }
140
141 /*
142 * Debugging functions.
143 */
144
145 static FILE *logfile = NULL;
146
147 void
148 logClose()
149 {
150 if (logfile) {
151 fclose(logfile);
152 logfile = NULL;
153 }
154 }
155
156 void
157 logOpen(const auctionInfo *aip, const char *logdir)
158 {
159 char *logfilename;
160
161 if (aip == NULL)
162 logfilename = myStrdup2(getProgname(), ".log");
163 else
164 logfilename = myStrdup4(getProgname(), ".", aip->auction, ".log");
165 if (logdir) {
166 char *tmp = logfilename;
167
168 logfilename = myStrdup3(logdir, "/", logfilename);
169 free(tmp);
170 }
171 logClose();
172 if (!(logfile = fopen(logfilename, "a"))) {
173 /* non-fatal error! */
174 fprintf(stderr, "Unable to open log file %s: %s\n",
175 logfilename, strerror(errno));
176 } else
177 dlog("### %s version %s ###\n", getProgname(), getVersion());
178 free(logfilename);
179 }
180
181 /*
182 * va_list version of log
183 */
184 static void
185 vlog(const char *fmt, va_list arglist)
186 {
187 #if defined(WIN32)
188 struct timeb tb;
189 #else
190 struct timeval tv;
191 #endif
192 char timebuf[80]; /* more than big enough */
193 time_t t;
194
195 if (!logfile)
196 return;
197
198 #if defined(WIN32)
199 ftime(&tb);
200 t = (time_t)(tb.time);
201 strftime(timebuf, sizeof(timebuf), "\n\n*** %Y-%m-%d %H:%M:%S", localtime(&t));
202 fprintf(logfile, "%s.%03d ", timebuf, tb.millitm);
203 #else
204 gettimeofday(&tv, NULL);
205 t = (time_t)(tv.tv_sec);
206 strftime(timebuf, sizeof(timebuf), "\n\n*** %Y-%m-%d %H:%M:%S", localtime(&t));
207 fprintf(logfile, "%s.%06ld ", timebuf, (long)tv.tv_usec);
208 #endif
209 vfprintf(logfile, fmt, arglist);
210 fflush(logfile);
211 }
212
213 /*
214 * Debugging log function. Use like printf. Or, better yet, use the log()
215 * macro (but be sure to enclose the argument list in two parens)
216 */
217 void
218 dlog(const char *fmt, ...)
219 {
220 va_list arglist;
221
222 va_start(arglist, fmt);
223 vlog(fmt, arglist);
224 va_end(arglist);
225 }
226
227 /*
228 * Send message to log file and stderr
229 */
230 void
231 printLog(FILE *fp, const char *fmt, ...)
232 {
233 va_list arglist;
234
235 if (options.debug && logfile) {
236 va_start(arglist, fmt);
237 vlog(fmt, arglist);
238 va_end(arglist);
239 }
240 va_start(arglist, fmt);
241 vfprintf(fp, fmt, arglist);
242 va_end(arglist);
243 fflush(fp);
244 }
245
246 static const char ESNIPER_VERSION_URL[] = "http://esniper.sourceforge.net/version.txt";
247
248 /*
249 * Return current version from esniper.sf.net if it is different from
250 * program's version, otherwise return NULL.
251 */
252 const char *
253 checkVersion(void)
254 {
255 static int result = -1;
256 static char *newVersion = NULL;
257
258 if (result == -1) {
259 int i;
260 memBuf_t *mp = httpGet(ESNIPER_VERSION_URL, NULL);
261
262 /* not available */
263 if (mp == NULL)
264 return NULL;
265 newVersion = mp->memory;
266 for (i = 0; newVersion[i] && newVersion[i] != '\n'; ++i)
267 ;
268 newVersion[i] = '\0';
269 result = !strcmp(getVersion(), newVersion);
270 /* Don't use freeMembuf(), it will also free
271 * mp->memory, which we are using.
272 */
273 free(mp);
274 }
275 return result ? NULL : newVersion;
276 }
277
278 /*
279 * Request user to file a bug report.
280 */
281 void
282 bugReport(const char *func, const char *file, int line, auctionInfo *aip, memBuf_t *mp, const char *fmt, ...)
283 {
284 va_list arglist;
285 const char *version = getVersion();
286 const char *newVersion = checkVersion();
287
288 if (newVersion) {
289 printLog(stdout,
290 "esniper encountered a bug. "
291 "It looks like your esniper version is not\n"
292 "current. You have version %s, the "
293 "newest version is %s.\n"
294 "Please go to http://esniper.sf.net/ and update your "
295 "copy of esniper.\n"
296 "\n"
297 "If you want to report this bug, please go to:\n",
298 version, newVersion);
299 } else
300 printLog(stdout, "esniper encountered a bug. Please go to:\n");
301 printLog(stdout,
302 "\thttp://sourceforge.net/tracker/?func=add&group_id=45285&atid=442436\n"
303 "paste this into \"Detailed Description\":\n"
304 "\tAutomated esniper bug report.\n"
305 "\t%s version %s\n"
306 "\t%s\n"
307 "\tError encountered in function %s in %s line %d\n",
308 getProgname(), version, curl_version(), func, file, line);
309
310 if (aip) {
311 printLog(stdout,
312 "\tauction = %s, price = %s, remain = %d\n"
313 "\tlatency = %d, result = %d, error = %d\n",
314 nullStr(aip->auction), nullStr(aip->bidPriceStr),
315 aip->remain, aip->latency, aip->bidResult,
316 aip->auctionError);
317 }
318
319 if (mp) {
320 pageInfo_t *pp;
321
322 printLog(stdout,
323 "\tbuf = %p, size = %d, read = %p\n"
324 "\ttime = %d, offset = %d\n",
325 mp->memory, mp->size, mp->readptr,
326 mp->timeToFirstByte, mp->readptr - mp->memory);
327 mp->readptr = mp->memory;
328 if ((pp = getPageInfo(mp))) {
329 printLog(stdout,
330 "\tpagename = \"%s\", pageid = \"%s\", srcid = \"%s\"\n",
331 nullStr(pp->pageName), nullStr(pp->pageId),
332 nullStr(pp->srcId));
333 freePageInfo(pp);
334 }
335 }
336 printf("\t");
337 if (options.debug && logfile) {
338 va_start(arglist, fmt);
339 vlog(fmt, arglist);
340 va_end(arglist);
341 }
342 va_start(arglist, fmt);
343 vfprintf(stdout, fmt, arglist);
344 va_end(arglist);
345 printLog(stdout, "\n");
346 fflush(stdout); /* in case writing memory contents causes core dump */
347 if (mp && mp->memory && mp->size) {
348 static int bugNum = 0;
349 char tmp[40], *bugname;
350 FILE *fp;
351
352 sprintf(tmp, ".%d.%d.bug.html", (int)getpid(), ++bugNum);
353 bugname = myStrdup2(getProgname(), tmp);
354 if ((fp = fopen(bugname, "w"))) {
355 fwrite(mp->memory, 1, mp->size, fp);
356 fclose(fp);
357 printLog(stdout, "then upload and attach %s ", bugname);
358 } else
359 printLog(stdout, "\tFailed to create bug file %s: %s\n", bugname, strerror(errno));
360 free(bugname);
361 }
362 printLog(stdout, "and click submit.\n");
363 fflush(stdout);
364 }
365
366 /*
367 * log a single character
368 */
369 void
370 logChar(int c)
371 {
372 if (!logfile)
373 return;
374
375 if (c == EOF)
376 fflush(logfile);
377 else
378 putc(c, logfile);
379 }
380
381 /* read from file until you see the given character. */
382 char *
383 getUntil(memBuf_t *mp, int until)
384 {
385 static char *buf = NULL;
386 static size_t bufsize = 0;
387 size_t count = 0;
388 int c;
389
390 log(("\n\ngetUntil('%c')\n\n", until));
391
392 while ((c = memGetc(mp)) != EOF) {
393 if (options.debug)
394 logChar(c);
395 if ((char)c == until) {
396 term(buf, bufsize, count);
397 if (options.debug)
398 logChar(EOF);
399 return buf;
400 }
401 addchar(buf, bufsize, count, (char)c);
402 }
403 if (options.debug)
404 logChar(EOF);
405 return NULL;
406 }
407
408 /*
409 * Return a valid string, even if it is null
410 */
411 const char *
412 nullStr(const char *s)
413 {
414 return s ? s : "(null)";
415 }
416
417 /*
418 * Current date/time
419 */
420 char *
421 timestamp()
422 {
423 static char buf[80]; /* much larger than needed */
424 static time_t saveTime = 0;
425 time_t t = time(0);
426
427 if (t != saveTime) {
428 struct tm *tmp = localtime(&t);
429
430 strftime(buf, (size_t)sizeof(buf), "%c", tmp);
431 saveTime = t;
432 }
433 return buf;
434 }
435
436 /*
437 * skip rest of line, up to newline. Useful for handling comments.
438 */
439 int
440 skipline(FILE *fp)
441 {
442 int c;
443
444 for (c = getc(fp); c != EOF && c != '\n' && c != '\r'; c = getc(fp))
445 ;
446 return c;
447 }
448
449 /*
450 * Prompt, with or without echo. Returns malloc()'ed buffer containing
451 * response.
452 */
453 char *
454 prompt(const char *p, int noecho)
455 {
456 char *buf = NULL;
457 size_t size = 0, count = 0;
458 int c;
459 #if defined(WIN32)
460 HANDLE in = GetStdHandle(STD_INPUT_HANDLE);
461 DWORD save, tmp;
462
463 if (in == INVALID_HANDLE_VALUE || GetFileType (in) != FILE_TYPE_CHAR)
464 noecho = 0;
465 #else
466 struct termios save, tmp;
467 #endif
468
469 if (!isatty(fileno(stdin))) {
470 printLog(stderr, "Cannot prompt, stdin is not a terminal\n");
471 return NULL;
472 }
473
474 fputs(p, stdout);
475
476 if (noecho) { /* echo off */
477 #if defined(WIN32)
478 GetConsoleMode(in, &save);
479 tmp = save & (~ENABLE_ECHO_INPUT);
480 SetConsoleMode(in, tmp);
481 #else
482 tcgetattr(fileno(stdin), &save);
483 memcpy(&tmp, &save, sizeof(struct termios));
484 tmp.c_lflag &= (~ECHO);
485 tcsetattr(fileno(stdin), TCSANOW, &tmp);
486 #endif
487 }
488
489 /* read value */
490 for (c = getc(stdin); c != EOF && c != '\n' && c != '\r'; c = getc(stdin))
491 addcharinc(buf, size, count, (char)c, (size_t)20);
492 terminc(buf, size, count, (size_t)20);
493
494 if (noecho) { /* echo on */
495 #if defined(WIN32)
496 SetConsoleMode(in, save);
497 #else
498 tcsetattr(fileno(stdin), TCSANOW, &save);
499 #endif
500 putchar('\n');
501 }
502
503 return buf;
504 }
505
506 /*
507 * Converts string to boolean.
508 * returns 0 (false), 1 (true), or -1 (invalid). NULL is true.
509 */
510 int
511 boolValue(const char *value)
512 {
513 static const char* boolvalues[] = {
514 "0", "1",
515 "n", "y",
516 "no", "yes",
517 "off", "on",
518 "false", "true",
519 "disabled", "enabled",
520 NULL
521 };
522 int i;
523 char *buf;
524
525 if (!value)
526 return 1;
527
528 buf = myStrdup(value);
529 toLowerString(buf);
530 for (i = 0; boolvalues[i]; i++) {
531 if (!strcmp(buf, boolvalues[i]))
532 break;
533 }
534 free(buf);
535 return boolvalues[i] ? i % 2 : -1;
536 }
537
538 /*
539 * Fixup a price to something that atof() and eBay will accept.
540 * Final string must be in the form 1234.56. Strip off all non-numeric
541 * characters, convert ',' (non-english decimal) to '.'.
542 */
543 char *
544 priceFixup(char *price, auctionInfo *aip)
545 {
546 int len, i, j, start = 0, end, count = 0;
547
548 if (!price)
549 return price;
550 len = strlen(price);
551 if (aip && !aip->currency) {
552 char tmp;
553
554 for (; start < len && isalpha((int)price[start]); ++start)
555 ;
556 tmp = price[start];
557 price[start] = '\0';
558 aip->currency = myStrdup(price);
559 price[start] = tmp;
560 }
561 for (; start < len && !isdigit((int)price[start]) && price[start] != ',' && price[start] != '.'; ++start)
562 ;
563 for (i = start; i < len; ++i) {
564 if (isdigit((int)price[i]))
565 continue;
566 else if (price[i] == ',' || price[i] == '.')
567 ++count;
568 else
569 break;
570 }
571 end = i;
572
573 for (j = 0, i = start; i < end; ++i) {
574 if (price[i] == ',' || price[i] == '.') {
575 if (--count == 0)
576 price[j++] = '.';
577 } else
578 price[j++] = price[i];
579 }
580 price[j] = '\0';
581 return price;
582 }
583
584 static void
585 toLowerString(char *s)
586 {
587 for (; *s; ++s)
588 *s = (char)tolower((int)*s);
589 }
590
591 /*
592 * Password encrpytion/decryption. xor with pseudo-random one-time pad,
593 * so password isn't (usually) obvious in memory dump.
594 */
595 static char *passwordPad = NULL;
596 static size_t passwordLen = 0;
597 static int needSeed = 1;
598
599 static void
600 seedPasswordRandom(void)
601 {
602 if (needSeed) {
603 #if defined(WIN32)
604 srand(time(0));
605 #else
606 srandom((unsigned int)(getpid() * time(0)));
607 #endif
608 needSeed = 0;
609 }
610 }
611
612 /* create a malloc'ed string filled with '*' (to cover username/password
613 * in logs)
614 */
615 char *
616 stars(size_t len)
617 {
618 char *s = (char *)myMalloc(len + 1);
619
620 memset(s, '*', len);
621 s[len] = '\0';
622 return s;
623 }
624
625 void
626 setUsername(char *username)
627 {
628 toLowerString(username);
629 free(options.username);
630 options.username = username;
631 curl_free(options.usernameEscape);
632 options.usernameEscape = curl_escape(username, (int)strlen(username));
633 }
634
635 void
636 setPassword(char *password)
637 {
638 int i, len;
639 char *escapedPassword;
640
641 /* http escape password, clear original */
642 len = strlen(password);
643 toLowerString(password);
644 escapedPassword = curl_escape(password, len);
645 for (i = 0; i < len; ++i)
646 password[i] = '\0';
647 free(password);
648 password = escapedPassword;
649
650 /* crypt with one-time pad */
651 seedPasswordRandom();
652 free(passwordPad);
653 passwordLen = strlen(password) + 1;
654 passwordPad = (char *)myMalloc(passwordLen);
655 for (i = 0; i < (int)passwordLen; ++i)
656 #if defined(WIN32)
657 passwordPad[i] = (char)rand();
658 #else
659 passwordPad[i] = (char)random();
660 #endif
661 cryptPassword(password);
662 curl_free(options.password);
663 options.password = password;
664 }
665
666 static void
667 cryptPassword(char *password)
668 {
669 int i;
670
671 for (i = 0; i < (int)passwordLen; ++i)
672 password[i] ^= passwordPad[i];
673 }
674
675 char *
676 getPassword()
677 {
678 char *password = (char *)myMalloc(passwordLen);
679
680 memcpy(password, options.password, passwordLen);
681 cryptPassword(password);
682 return password;
683 }
684
685 void
686 freePassword(char *password)
687 {
688 memset(password, '\0', passwordLen);
689 free(password);
690 }
691
692 /*
693 * Cygwin doesn't provide basename and dirname?
694 *
695 * Windows-specific code wrapped in ifdefs below, just in case basename
696 * or dirname is needed on a non-windows system.
697 */
698 #if defined(__CYGWIN__) || defined(WIN32)
699 char *
700 basename(char *name)
701 {
702 int len;
703 char *cp;
704
705 if (!name)
706 return name;
707
708 len = strlen(name);
709 if (len == 0)
710 return (char *)"."; /* cast away const */
711 cp = name + len - 1;
712 #if defined(__CYGWIN__) || defined(WIN32)
713 if (*cp == '/' || *cp == '\\') {
714 for (; cp >= name && (*cp == '/' || *cp == '\\'); --cp)
715 #else
716 if (*cp == '/') {
717 for (; cp >= name && *cp == '/'; --cp)
718 #endif
719 *cp = '\0';
720 if (cp < name)
721 return (char *)"/"; /* cast away const */
722 }
723 #if defined(__CYGWIN__) || defined(WIN32)
724 for (; cp >= name && *cp != '/' && *cp != '\\'; --cp)
725 #else
726 for (; cp >= name && *cp != '/'; --cp)
727 #endif
728 ;
729 return cp + 1;
730 }
731
732 char *
733 dirname(char *name)
734 {
735 int len;
736 char *cp;
737
738 if (!name) return name;
739
740 len = strlen(name);
741 if (len == 0)
742 return (char *)"."; /* cast away const */
743 cp = name + len - 1;
744 #if defined(__CYGWIN__) || defined(WIN32)
745 if (*cp == '/' || *cp == '\\') {
746 for (; cp >= name && (*cp == '/' || *cp == '\\'); --cp)
747 #else
748 if (*cp == '/') {
749 for (; cp >= name && *cp == '/'; --cp)
750 #endif
751 *cp = '\0';
752 if (cp <= name)
753 return (char *)"/"; /* cast away const */
754 }
755 #if defined(__CYGWIN__) || defined(WIN32)
756 for (; cp >= name && *cp != '/' && *cp != '\\'; --cp)
757 #else
758 for (; cp >= name && *cp != '/'; --cp)
759 #endif
760 ;
761 if (cp < name)
762 return (char *)"."; /* cast away const */
763 if (cp == name)
764 return (char *)"/"; /* cast away const */
765 *cp = '\0';
766 return name;
767 }
768 #endif
769
770 #if defined(WIN32)
771 /*
772 ** GETOPT PROGRAM AND LIBRARY ROUTINE
773 **
774 ** I wrote main() and AT&T wrote getopt() and we both put our efforts into
775 ** the public domain via mod.sources.
776 ** Rich $alz
777 ** Mirror Systems
778 ** (mirror!rs, rs@mirror.TMC.COM)
779 ** August 10, 1986
780 **
781 ** This is the public-domain AT&T getopt(3) code. Hacked by Rich and by Jim.
782 */
783
784 /*
785 * Added to esniper to cover for Windows deficiency. Unix versions of esniper
786 * don't need to use this!
787 */
788
789 #define ERR(_s, _c) { if (opterr) fprintf (stderr, "%s%s%c\n", argv[0], _s, _c);}
790
791 int opterr = 1;
792 int optind = 1;
793 int optopt;
794 char *optarg;
795
796 int
797 getopt(int argc, char *const *argv, const char *opts)
798 {
799 static int sp = 1;
800 register int c;
801 register char *cp;
802
803 if (sp == 1) {
804 if (optind >= argc ||
805 argv[optind][0] != '-' || argv[optind][1] == '\0')
806 return(EOF);
807 else if (strcmp(argv[optind], "--") == 0) {
808 optind++;
809 return(EOF);
810 }
811 }
812 optopt = c = argv[optind][sp];
813 if (c == ':' || (cp=strchr(opts, c)) == NULL) {
814 ERR(": illegal option -- ", c);
815 if (argv[optind][++sp] == '\0') {
816 optind++;
817 sp = 1;
818 }
819 return('?');
820 }
821 if (*++cp == ':') {
822 if (argv[optind][sp+1] != '\0')
823 optarg = &argv[optind++][sp+1];
824 else if (++optind >= argc) {
825 ERR(": option requires an argument -- ", c);
826 sp = 1;
827 return('?');
828 } else
829 optarg = argv[optind++];
830 sp = 1;
831 } else {
832 if (argv[optind][++sp] == '\0') {
833 sp = 1;
834 optind++;
835 }
836 optarg = NULL;
837 }
838 return(c);
839 }
840 #endif
0 /*
1 * Copyright (c) 2002, 2003, Scott Nicol <esniper@users.sf.net>
2 * All rights reserved
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are met:
6 *
7 * - Redistributions of source code must retain the above copyright notice,
8 * this list of conditions and the following disclaimer.
9 * - Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 *
13 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
14 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
15 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
16 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
17 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
18 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
19 * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
20 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
21 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
22 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
23 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24 */
25
26 #ifndef UTIL_H_INCLUDED
27 #define UTIL_H_INCLUDED
28
29 #include "auctioninfo.h"
30 #include <stdarg.h>
31 #include <stdio.h>
32 #include "http.h"
33
34 extern void *myMalloc(size_t);
35 extern void *myRealloc(void *buf, size_t size);
36 extern char *myStrdup(const char *);
37 extern char *myStrndup(const char *, size_t len);
38 extern char *myStrdup2(const char *, const char *);
39 extern char *myStrdup3(const char *, const char *, const char *);
40 extern char *myStrdup4(const char *, const char *, const char *, const char *);
41
42 extern void logClose(void);
43 extern void logOpen(const auctionInfo *aip, const char *logdir);
44 extern void dlog(const char *fmt, ...);
45 extern void printLog(FILE *fp, const char *fmt, ...);
46 extern const char *checkVersion(void);
47 extern void bugReport(const char *func, const char *file, int line, auctionInfo *aip, memBuf_t *mp, const char *fmt, ...);
48 extern void logChar(int c);
49
50 extern char *getUntil(memBuf_t *mp, int until);
51
52 extern const char *nullStr(const char *);
53 extern char *timestamp(void);
54 extern int skipline(FILE *fp);
55 extern char *prompt(const char *p, int noecho);
56 extern int boolValue(const char *value);
57 extern char *priceFixup(char *price, auctionInfo *aip);
58
59 extern char *stars(size_t len);
60 extern void setUsername(char *username);
61 extern void setPassword(char *password);
62 extern char *getPassword(void);
63 extern void freePassword(char *password);
64
65 #if defined(__CYGWIN__) || defined(WIN32)
66 extern char *basename(char *);
67 extern char *dirname(char *);
68 #else
69 #include <libgen.h>
70 #endif
71
72 #if defined(WIN32)
73 extern int opterr;
74 extern int optind;
75 extern int optopt;
76 extern char *optarg;
77
78 extern int getopt(int argc, char *const *argv, const char *opts);
79 #endif
80
81 #endif /* UTIL_H_INCLUDED */