1
0
mirror of https://github.com/moparisthebest/curl synced 2024-11-10 11:35:07 -05:00

curl tool: reviewed code moved to tool_*.[ch] files

This commit is contained in:
Yang Tse 2011-10-06 17:39:00 +02:00
parent 7afccf7a1e
commit f7bfdbabf2
26 changed files with 220 additions and 205 deletions

View File

@ -43,7 +43,7 @@ patch=`echo $libversion |cut -d. -f3 | cut -d- -f1 | sed -e "s/[^0-9]//g"`
numeric=`perl -e 'printf("%02x%02x%02x\n", '"$major, $minor, $patch);"`
HEADER=include/curl/curlver.h
CHEADER=src/version.h
CHEADER=src/tool_version.h
# requires a date command that knows -u for UTC time zone
datestamp=`date -u`

View File

@ -8,8 +8,7 @@ UID 0x00000000 0xF0206442
SOURCEPATH ../../../src
SOURCE \
hugehelp.c writeout.c writeenv.c \
getpass.c homedir.c curlutil.c xattr.c \
hugehelp.c \
tool_binmode.c \
tool_bname.c \
tool_cb_dbg.c \
@ -26,8 +25,10 @@ SOURCE \
tool_easysrc.c \
tool_formparse.c \
tool_getparam.c \
tool_getpass.c \
tool_help.c \
tool_helpers.c \
tool_homedir.c \
tool_libinfo.c \
tool_main.c \
tool_mfiles.c \
@ -40,7 +41,11 @@ SOURCE \
tool_setopt.c \
tool_sleep.c \
tool_urlglob.c \
tool_vms.c
tool_util.c \
tool_vms.c \
tool_writeenv.c \
tool_writeout.c \
tool_xattr.c
SOURCEPATH ../../../lib
SOURCE \

1
src/.gitignore vendored
View File

@ -6,5 +6,6 @@ stamp-h2
Makefile.vc8.dist
Makefile.vc9.dist
version.h.dist
tool_version.h.dist
Makefile.vc10.dist
config-win32.h

View File

@ -14,8 +14,7 @@ CURLX_ONES = $(top_srcdir)/lib/strtoofft.c \
$(top_srcdir)/lib/rawstr.c \
$(top_srcdir)/lib/nonblock.c
CURL_CFILES = hugehelp.c writeout.c writeenv.c \
getpass.c homedir.c curlutil.c xattr.c \
CURL_CFILES = hugehelp.c \
tool_binmode.c \
tool_bname.c \
tool_cb_dbg.c \
@ -32,8 +31,10 @@ CURL_CFILES = hugehelp.c writeout.c writeenv.c \
tool_easysrc.c \
tool_formparse.c \
tool_getparam.c \
tool_getpass.c \
tool_help.c \
tool_helpers.c \
tool_homedir.c \
tool_libinfo.c \
tool_main.c \
tool_mfiles.c \
@ -46,11 +47,14 @@ CURL_CFILES = hugehelp.c writeout.c writeenv.c \
tool_setopt.c \
tool_sleep.c \
tool_urlglob.c \
tool_vms.c
tool_util.c \
tool_vms.c \
tool_writeenv.c \
tool_writeout.c \
tool_xattr.c
CURL_HFILES = hugehelp.h setup.h config-win32.h config-mac.h \
config-riscos.h version.h xattr.h \
writeout.h writeenv.h getpass.h homedir.h curlutil.h \
config-riscos.h \
tool_binmode.h \
tool_bname.h \
tool_cb_dbg.h \
@ -67,8 +71,10 @@ CURL_HFILES = hugehelp.h setup.h config-win32.h config-mac.h \
tool_easysrc.h \
tool_formparse.h \
tool_getparam.h \
tool_getpass.h \
tool_help.h \
tool_helpers.h \
tool_homedir.h \
tool_libinfo.h \
tool_main.h \
tool_mfiles.h \
@ -82,7 +88,12 @@ CURL_HFILES = hugehelp.h setup.h config-win32.h config-mac.h \
tool_setopt.h \
tool_sleep.h \
tool_urlglob.h \
tool_vms.h
tool_util.h \
tool_version.h \
tool_vms.h \
tool_writeenv.h \
tool_writeout.h \
tool_xattr.h
curl_SOURCES = $(CURL_CFILES) $(CURLX_ONES) $(CURL_HFILES)

View File

@ -133,9 +133,6 @@ CFLAGS = $(CFLAGS) /DUSE_WINDOWS_SSPI /I$(WINDOWS_SDK_PATH)\include
!ENDIF
RELEASE_OBJS= \
curlutilr.obj \
getpassr.obj \
homedirr.obj \
hugehelpr.obj \
nonblockr.obj \
rawstrr.obj \
@ -156,8 +153,10 @@ RELEASE_OBJS= \
tool_easysrcr.obj \
tool_formparser.obj \
tool_getparamr.obj \
tool_getpassr.obj \
tool_helpr.obj \
tool_helpersr.obj \
tool_homedirr.obj \
tool_libinfor.obj \
tool_mainr.obj \
tool_mfilesr.obj \
@ -170,15 +169,14 @@ RELEASE_OBJS= \
tool_setoptr.obj \
tool_sleepr.obj \
tool_urlglobr.obj \
tool_utilr.obj \
tool_vmsr.obj \
writeoutr.obj \
xattrr.obj \
tool_writeenvr.obj \
tool_writeoutr.obj \
tool_xattrr.obj \
curlr.res
DEBUG_OBJS= \
curlutild.obj \
getpassd.obj \
homedird.obj \
hugehelpd.obj \
nonblockd.obj \
rawstrd.obj \
@ -199,8 +197,10 @@ DEBUG_OBJS= \
tool_easysrcd.obj \
tool_formparsed.obj \
tool_getparamd.obj \
tool_getpassd.obj \
tool_helpd.obj \
tool_helpersd.obj \
tool_homedird.obj \
tool_libinfod.obj \
tool_maind.obj \
tool_mfilesd.obj \
@ -213,9 +213,11 @@ DEBUG_OBJS= \
tool_setoptd.obj \
tool_sleepd.obj \
tool_urlglobd.obj \
tool_utild.obj \
tool_vmsd.obj \
writeoutd.obj \
xattrd.obj \
tool_writeenvd.obj \
tool_writeoutd.obj \
tool_xattrd.obj \
curld.res
#################################################
@ -340,14 +342,6 @@ debug: $(DEBUG_OBJS)
## Release
hugehelpr.obj: hugehelp.c
$(CCR) $(CFLAGS) /Zm200 /Fo"$@" hugehelp.c
writeoutr.obj: writeout.c
$(CCR) $(CFLAGS) /Fo"$@" writeout.c
getpassr.obj: getpass.c
$(CCR) $(CFLAGS) /Fo"$@" getpass.c
homedirr.obj: homedir.c
$(CCR) $(CFLAGS) /Fo"$@" homedir.c
curlutilr.obj: curlutil.c
$(CCR) $(CFLAGS) /Fo"$@" curlutil.c
nonblockr.obj: ../lib/nonblock.c
$(CCR) $(CFLAGS) /Fo"$@" ../lib/nonblock.c
rawstrr.obj: ../lib/rawstr.c
@ -386,10 +380,14 @@ tool_formparser.obj: tool_formparse.c
$(CCR) $(CFLAGS) /Fo"$@" tool_formparse.c
tool_getparamr.obj: tool_getparam.c
$(CCR) $(CFLAGS) /Fo"$@" tool_getparam.c
tool_getpassr.obj: tool_getpass.c
$(CCR) $(CFLAGS) /Fo"$@" tool_getpass.c
tool_helpr.obj: tool_help.c
$(CCR) $(CFLAGS) /Fo"$@" tool_help.c
tool_helpersr.obj: tool_helpers.c
$(CCR) $(CFLAGS) /Fo"$@" tool_helpers.c
tool_homedirr.obj: tool_homedir.c
$(CCR) $(CFLAGS) /Fo"$@" tool_homedir.c
tool_libinfor.obj: tool_libinfo.c
$(CCR) $(CFLAGS) /Fo"$@" tool_libinfo.c
tool_mainr.obj: tool_main.c
@ -414,24 +412,22 @@ tool_sleepr.obj: tool_sleep.c
$(CCR) $(CFLAGS) /Fo"$@" tool_sleep.c
tool_urlglobr.obj: tool_urlglob.c
$(CCR) $(CFLAGS) /Fo"$@" tool_urlglob.c
tool_utilr.obj: tool_util.c
$(CCR) $(CFLAGS) /Fo"$@" tool_util.c
tool_vmsr.obj: tool_vms.c
$(CCR) $(CFLAGS) /Fo"$@" tool_vms.c
xattrr.obj: xattr.c
$(CCR) $(CFLAGS) /Fo"$@" xattr.c
tool_writeenvr.obj: tool_writeenv.c
$(CCR) $(CFLAGS) /Fo"$@" tool_writeenv.c
tool_writeoutr.obj: tool_writeout.c
$(CCR) $(CFLAGS) /Fo"$@" tool_writeout.c
tool_xattrr.obj: tool_xattr.c
$(CCR) $(CFLAGS) /Fo"$@" tool_xattr.c
curlr.res : curl.rc
$(RCR) $(RESFLAGS) /Fo"$@" curl.rc
## Debug
hugehelpd.obj: hugehelp.c
$(CCD) $(CFLAGS) /Zm200 /Fo"$@" hugehelp.c
writeoutd.obj: writeout.c
$(CCD) $(CFLAGS) /Fo"$@" writeout.c
getpassd.obj: getpass.c
$(CCD) $(CFLAGS) /Fo"$@" getpass.c
homedird.obj: homedir.c
$(CCD) $(CFLAGS) /Fo"$@" homedir.c
curlutild.obj: curlutil.c
$(CCD) $(CFLAGS) /Fo"$@" curlutil.c
nonblockd.obj: ../lib/nonblock.c
$(CCD) $(CFLAGS) /Fo"$@" ../lib/nonblock.c
rawstrd.obj: ../lib/rawstr.c
@ -470,10 +466,14 @@ tool_formparsed.obj: tool_formparse.c
$(CCD) $(CFLAGS) /Fo"$@" tool_formparse.c
tool_getparamd.obj: tool_getparam.c
$(CCD) $(CFLAGS) /Fo"$@" tool_getparam.c
tool_getpassd.obj: tool_getpass.c
$(CCD) $(CFLAGS) /Fo"$@" tool_getpass.c
tool_helpd.obj: tool_help.c
$(CCD) $(CFLAGS) /Fo"$@" tool_help.c
tool_helpersd.obj: tool_helpers.c
$(CCD) $(CFLAGS) /Fo"$@" tool_helpers.c
tool_homedird.obj: tool_homedir.c
$(CCD) $(CFLAGS) /Fo"$@" tool_homedir.c
tool_libinfod.obj: tool_libinfo.c
$(CCD) $(CFLAGS) /Fo"$@" tool_libinfo.c
tool_maind.obj: tool_main.c
@ -498,10 +498,16 @@ tool_sleepd.obj: tool_sleep.c
$(CCD) $(CFLAGS) /Fo"$@" tool_sleep.c
tool_urlglobd.obj: tool_urlglob.c
$(CCD) $(CFLAGS) /Fo"$@" tool_urlglob.c
tool_utild.obj: tool_util.c
$(CCD) $(CFLAGS) /Fo"$@" tool_util.c
tool_vmsd.obj: tool_vms.c
$(CCD) $(CFLAGS) /Fo"$@" tool_vms.c
xattrd.obj: xattr.c
$(CCD) $(CFLAGS) /Fo"$@" xattr.c
tool_writeenvd.obj: tool_writeenv.c
$(CCD) $(CFLAGS) /Fo"$@" tool_writeenv.c
tool_writeoutd.obj: tool_writeout.c
$(CCD) $(CFLAGS) /Fo"$@" tool_writeout.c
tool_xattrd.obj: tool_xattr.c
$(CCD) $(CFLAGS) /Fo"$@" tool_xattr.c
curld.res : curl.rc
$(RCD) $(RESFLAGS) /Fo"$@" curl.rc

View File

@ -20,7 +20,7 @@
*
***************************************************************************/
#include <winver.h>
#include "version.h"
#include "tool_version.h"
LANGUAGE 0x09,0x01

View File

@ -27,11 +27,10 @@
/* use our own printf() functions */
#include "curlx.h"
#include "curlutil.h"
#include "tool_cfgable.h"
#include "tool_msgs.h"
#include "tool_cb_dbg.h"
#include "tool_util.h"
#include "memdebug.h" /* keep this as LAST include */
@ -60,7 +59,7 @@ int tool_debug_cb(CURL *handle, curl_infotype type,
(void)handle; /* not used */
if(config->tracetime) {
tv = cutil_tvnow();
tv = tvnow();
if(!known_offset) {
epoch_offset = time(NULL) - tv.tv_sec;
known_offset = 1;

View File

@ -33,8 +33,6 @@
# include "hugehelp.h"
#endif
#include "version.h"
#include "tool_binmode.h"
#include "tool_cfgable.h"
#include "tool_cb_prg.h"
@ -46,6 +44,7 @@
#include "tool_msgs.h"
#include "tool_paramhlp.h"
#include "tool_parsecfg.h"
#include "tool_version.h"
#include "memdebug.h" /* keep this as LAST include */

View File

@ -31,13 +31,12 @@
#ifdef HAVE_FCNTL_H
# include <fcntl.h>
#endif
#ifdef HAVE_TERMIOS_H
# include <termios.h>
#else
#ifdef HAVE_TERMIO_H
#elif defined(HAVE_TERMIO_H)
# include <termio.h>
#endif
#endif
#ifdef __VMS
# include descrip
@ -57,7 +56,10 @@
# endif
#endif
#include "getpass.h"
#define _MPRINTF_REPLACE
#include <curl/mprintf.h>
#include "tool_getpass.h"
#include "memdebug.h" /* keep this as LAST include */
@ -112,14 +114,14 @@ char *getpass_r(const char *prompt, char *buffer, size_t buflen)
for(i = 0; i < buflen; i++) {
buffer[i] = (char)getch();
if(buffer[i] == '\r' || buffer[i] == '\n') {
buffer[i] = 0;
buffer[i] = '\0';
break;
}
else
if(buffer[i] == '\b')
/* remove this letter and if this is not the first key, remove the
previous one as well */
i = i - (i>=1?2:1);
i = i - (i >= 1) ? 2 : 1;
}
#ifndef __SYMBIAN32__
/* since echo is disabled, print a newline */
@ -127,7 +129,7 @@ char *getpass_r(const char *prompt, char *buffer, size_t buflen)
#endif
/* if user didn't hit ENTER, terminate buffer */
if(i == buflen)
buffer[buflen-1]=0;
buffer[buflen-1] = '\0';
return buffer; /* we always return success */
}
@ -165,7 +167,7 @@ char *getpass_r(const char *prompt, char *buffer, size_t buflen)
putchar('*');
} while((buffer[i-1] != 13) && (i < buflen));
buffer[i-1] = 0;
buffer[i-1] = '\0';
printf("\r\n");
return buffer;
}
@ -177,13 +179,11 @@ char *getpass_r(const char *prompt, char *buffer, size_t buflen)
#ifdef HAVE_TERMIOS_H
# define struct_term struct termios
#else
#ifdef HAVE_TERMIO_H
#elif defined(HAVE_TERMIO_H)
# define struct_term struct termio
#else
# undef struct_term
#endif
#endif
static bool ttyecho(bool enable, int fd)
{
@ -199,17 +199,15 @@ static bool ttyecho(bool enable, int fd)
noecho = withecho;
noecho.c_lflag &= ~ECHO;
tcsetattr(fd, TCSANOW, &noecho);
#else /* HAVE_TERMIOS_H */
#ifdef HAVE_TERMIO_H
#elif defined(HAVE_TERMIO_H)
ioctl(fd, TCGETA, &withecho);
noecho = withecho;
noecho.c_lflag &= ~ECHO;
ioctl(fd, TCSETA, &noecho);
#else /* HAVE_TERMIO_H */
#else
/* neither HAVE_TERMIO_H nor HAVE_TERMIOS_H, we can't disable echo! */
(void)fd; /* prevent compiler warning on unused variable */
(void)fd;
return FALSE; /* not disabled */
#endif
#endif
return TRUE; /* disabled */
}
@ -218,13 +216,10 @@ static bool ttyecho(bool enable, int fd)
now use to reset the terminal status) */
#ifdef HAVE_TERMIOS_H
tcsetattr(fd, TCSAFLUSH, &withecho);
#else /* HAVE_TERMIOS_H */
#ifdef HAVE_TERMIO_H
#elif defined(HAVE_TERMIO_H)
ioctl(fd, TCSETA, &withecho);
#else
/* neither HAVE_TERMIO_H nor HAVE_TERMIOS_H */
return FALSE; /* not enabled */
#endif
#endif
return TRUE; /* enabled */
}
@ -245,9 +240,9 @@ char *getpass_r(const char *prompt, /* prompt to display */
fputs(prompt, stderr);
nread = read(fd, password, buflen);
if(nread > 0)
password[--nread]=0; /* zero terminate where enter is stored */
password[--nread] = '\0'; /* zero terminate where enter is stored */
else
password[0]=0; /* got nothing */
password[0] = '\0'; /* got nothing */
if(disabled) {
/* if echo actually was disabled, add a newline */

View File

@ -1,5 +1,5 @@
#ifndef HEADER_CURL_GETPASS_H
#define HEADER_CURL_GETPASS_H
#ifndef HEADER_CURL_TOOL_GETPASS_H
#define HEADER_CURL_TOOL_GETPASS_H
/***************************************************************************
* _ _ ____ _
* Project ___| | | | _ \| |
@ -33,4 +33,4 @@
char* getpass_r(const char *prompt, char* buffer, size_t buflen);
#endif
#endif /* HEADER_CURL_GETPASS_H */
#endif /* HEADER_CURL_TOOL_GETPASS_H */

View File

@ -31,12 +31,11 @@
# include <unixlib.h>
#endif
#include "homedir.h"
#include "tool_homedir.h"
#include "memdebug.h" /* keep this as LAST include */
static
char *GetEnv(const char *variable, char do_expand)
static char *GetEnv(const char *variable, char do_expand)
{
char *env = NULL;
#ifdef WIN32

View File

@ -1,5 +1,5 @@
#ifndef HEADER_CURL_HOMEDIR_H
#define HEADER_CURL_HOMEDIR_H
#ifndef HEADER_CURL_TOOL_HOMEDIR_H
#define HEADER_CURL_TOOL_HOMEDIR_H
/***************************************************************************
* _ _ ____ _
* Project ___| | | | _ \| |
@ -25,4 +25,4 @@
char *homedir(void);
#endif /* HEADER_CURL_HOMEDIR_H */
#endif /* HEADER_CURL_TOOL_HOMEDIR_H */

View File

@ -47,15 +47,6 @@
/* use our own printf() functions */
#include "curlx.h"
#include "curlutil.h"
#include "homedir.h"
#include "writeout.h"
#include "xattr.h"
#ifdef USE_ENVIRONMENT
# include "writeenv.h"
#endif
#include "tool_binmode.h"
#include "tool_cfgable.h"
#include "tool_cb_dbg.h"
@ -70,6 +61,7 @@
#include "tool_easysrc.h"
#include "tool_getparam.h"
#include "tool_helpers.h"
#include "tool_homedir.h"
#include "tool_libinfo.h"
#include "tool_main.h"
#include "tool_msgs.h"
@ -79,6 +71,10 @@
#include "tool_setopt.h"
#include "tool_sleep.h"
#include "tool_urlglob.h"
#include "tool_util.h"
#include "tool_writeenv.h"
#include "tool_writeout.h"
#include "tool_xattr.h"
#include "memdebug.h" /* keep this as LAST include */
@ -1210,7 +1206,7 @@ int operate(struct Configurable *config, int argc, argv_item_t argv[])
retry_numretries = config->req_retry;
retry_sleep = retry_sleep_default; /* ms */
retrystart = cutil_tvnow();
retrystart = tvnow();
for(;;) {
res = curl_easy_perform(curl);
@ -1227,7 +1223,7 @@ int operate(struct Configurable *config, int argc, argv_item_t argv[])
time */
if(retry_numretries &&
(!config->retry_maxtime ||
(cutil_tvdiff(cutil_tvnow(), retrystart)<
(tvdiff(tvnow(), retrystart) <
config->retry_maxtime*1000L)) ) {
enum {
RETRY_NO,
@ -1349,10 +1345,9 @@ int operate(struct Configurable *config, int argc, argv_item_t argv[])
if(config->writeout)
ourWriteOut(curl, config->writeout);
#ifdef USE_ENVIRONMENT
if(config->writeenv)
ourWriteEnv(curl);
#endif
/*
** Code within this loop may jump directly here to label 'show_error'

View File

@ -29,11 +29,10 @@
/* use our own printf() functions */
#include "curlx.h"
#include "version.h"
#include "tool_cfgable.h"
#include "tool_convert.h"
#include "tool_operhlp.h"
#include "tool_version.h"
#include "memdebug.h" /* keep this as LAST include */

View File

@ -29,11 +29,10 @@
/* use our own printf() functions */
#include "curlx.h"
#include "homedir.h"
#include "getpass.h"
#include "tool_cfgable.h"
#include "tool_getparam.h"
#include "tool_getpass.h"
#include "tool_homedir.h"
#include "tool_msgs.h"
#include "tool_paramhlp.h"

View File

@ -27,11 +27,10 @@
/* use our own printf() functions */
#include "curlx.h"
#include "homedir.h"
#include "tool_cfgable.h"
#include "tool_getparam.h"
#include "tool_helpers.h"
#include "tool_homedir.h"
#include "tool_msgs.h"
#include "tool_parsecfg.h"

View File

@ -21,13 +21,13 @@
***************************************************************************/
#include "setup.h"
#include "curlutil.h"
#include "tool_util.h"
#include "memdebug.h" /* keep this as LAST include */
#if defined(WIN32) && !defined(MSDOS)
struct timeval cutil_tvnow(void)
struct timeval tool_tvnow(void)
{
/*
** GetTickCount() is available on _all_ Windows versions from W95 up
@ -43,7 +43,7 @@ struct timeval cutil_tvnow(void)
#elif defined(HAVE_CLOCK_GETTIME_MONOTONIC)
struct timeval cutil_tvnow(void)
struct timeval tool_tvnow(void)
{
/*
** clock_gettime() is granted to be increased monotonically when the
@ -77,7 +77,7 @@ struct timeval cutil_tvnow(void)
#elif defined(HAVE_GETTIMEOFDAY)
struct timeval cutil_tvnow(void)
struct timeval tool_tvnow(void)
{
/*
** gettimeofday() is not granted to be increased monotonically, due to
@ -91,7 +91,7 @@ struct timeval cutil_tvnow(void)
#else
struct timeval cutil_tvnow(void)
struct timeval tool_tvnow(void)
{
/*
** time() returns the value of time in seconds since the Epoch.
@ -110,25 +110,25 @@ struct timeval cutil_tvnow(void)
*
* Returns: the time difference in number of milliseconds.
*/
long cutil_tvdiff(struct timeval newer, struct timeval older)
long tool_tvdiff(struct timeval newer, struct timeval older)
{
return (newer.tv_sec-older.tv_sec)*1000+
(newer.tv_usec-older.tv_usec)/1000;
}
/*
* Same as cutil_tvdiff but with full usec resolution.
* Same as tool_tvdiff but with full usec resolution.
*
* Returns: the time difference in seconds with subsecond resolution.
*/
double cutil_tvdiff_secs(struct timeval newer, struct timeval older)
double tool_tvdiff_secs(struct timeval newer, struct timeval older)
{
return (double)(newer.tv_sec-older.tv_sec)+
(double)(newer.tv_usec-older.tv_usec)/1000000.0;
}
/* return the number of seconds in the given input timeval struct */
long cutil_tvlong(struct timeval t1)
long tool_tvlong(struct timeval t1)
{
return t1.tv_sec;
}

View File

@ -1,5 +1,5 @@
#ifndef HEADER_CURL_SRC_UTIL_H
#define HEADER_CURL_SRC_UTIL_H
#ifndef HEADER_CURL_TOOL_UTIL_H
#define HEADER_CURL_TOOL_UTIL_H
/***************************************************************************
* _ _ ____ _
* Project ___| | | | _ \| |
@ -23,8 +23,7 @@
***************************************************************************/
#include "setup.h"
struct timeval cutil_tvnow(void);
struct timeval tool_tvnow(void);
/*
* Make sure that the first argument (t1) is the more recent time and t2 is
@ -32,17 +31,26 @@ struct timeval cutil_tvnow(void);
*
* Returns: the time difference in number of milliseconds.
*/
long cutil_tvdiff(struct timeval t1, struct timeval t2);
long tool_tvdiff(struct timeval t1, struct timeval t2);
/*
* Same as cutil_tvdiff but with full usec resolution.
* Same as tool_tvdiff but with full usec resolution.
*
* Returns: the time difference in seconds with subsecond resolution.
*/
double cutil_tvdiff_secs(struct timeval t1, struct timeval t2);
double tool_tvdiff_secs(struct timeval t1, struct timeval t2);
long cutil_tvlong(struct timeval t1);
long tool_tvlong(struct timeval t1);
#undef tvnow
#undef tvdiff
#undef tvdiff_secs
#undef tvlong
#endif /* HEADER_CURL_SRC_UTIL_H */
#define tvnow() tool_tvnow()
#define tvdiff(a,b) tool_tvdiff((a), (b))
#define tvdiff_secs(a,b) tool_tvdiff_secs((a), (b))
#define tvlong(a) tool_tvlong((a))
#endif /* HEADER_CURL_TOOL_UTIL_H */

View File

@ -32,7 +32,7 @@
#define _MPRINTF_REPLACE /* use our functions only */
#include <curl/mprintf.h>
#include "writeenv.h"
#include "tool_writeenv.h"
#include "memdebug.h" /* keep this as LAST include */

View File

@ -1,5 +1,5 @@
#ifndef HEADER_CURL_WRITEENV_H
#define HEADER_CURL_WRITEENV_H
#ifndef HEADER_CURL_TOOL_WRITEENV_H
#define HEADER_CURL_TOOL_WRITEENV_H
/***************************************************************************
* _ _ ____ _
* Project ___| | | | _ \| |
@ -23,6 +23,13 @@
***************************************************************************/
#include "setup.h"
#ifdef USE_ENVIRONMENT
void ourWriteEnv(CURL *curl);
#endif /* HEADER_CURL_WRITEENV_H */
#else
# define ourWriteEnv(x) Curl_nop_stmt
#endif
#endif /* HEADER_CURL_TOOL_WRITEENV_H */

View File

@ -21,19 +21,12 @@
***************************************************************************/
#include "setup.h"
#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
#ifdef HAVE_SYS_SELECT_H
#include <sys/select.h>
#endif
#include <curl/curl.h>
#define _MPRINTF_REPLACE /* we want curl-functions instead of native ones */
#include <curl/mprintf.h>
#include "writeout.h"
#include "tool_writeout.h"
#include "memdebug.h" /* keep this as LAST include */

View File

@ -1,5 +1,5 @@
#ifndef HEADER_CURL_WRITEOUT_H
#define HEADER_CURL_WRITEOUT_H
#ifndef HEADER_CURL_TOOL_WRITEOUT_H
#define HEADER_CURL_TOOL_WRITEOUT_H
/***************************************************************************
* _ _ ____ _
* Project ___| | | | _ \| |
@ -25,4 +25,4 @@
void ourWriteOut(CURL *curl, const char *out);
#endif /* HEADER_CURL_WRITEOUT_H */
#endif /* HEADER_CURL_TOOL_WRITEOUT_H */

View File

@ -22,12 +22,12 @@
#include "setup.h"
#ifdef HAVE_FSETXATTR
#include <sys/types.h>
#include <sys/xattr.h> /* include header from libc, not from libattr */
# include <sys/xattr.h> /* header from libc, not from libattr */
#endif
#include <curl/curl.h>
#include "xattr.h"
#include "tool_xattr.h"
#include "memdebug.h" /* keep this as LAST include */

View File

@ -1,5 +1,5 @@
#ifndef HEADER_CURL_XATTR_H
#define HEADER_CURL_XATTR_H
#ifndef HEADER_CURL_TOOL_XATTR_H
#define HEADER_CURL_TOOL_XATTR_H
/***************************************************************************
* _ _ ____ _
* Project ___| | | | _ \| |
@ -25,4 +25,4 @@
int fwrite_xattr(CURL *curl, int fd);
#endif /* HEADER_CURL_XATTR_H */
#endif /* HEADER_CURL_TOOL_XATTR_H */

View File

@ -139,18 +139,6 @@ LINK32=link.exe
# PROP Default_Filter ""
# Begin Source File
SOURCE=.\curlutil.c
# End Source File
# Begin Source File
SOURCE=.\getpass.c
# End Source File
# Begin Source File
SOURCE=.\homedir.c
# End Source File
# Begin Source File
SOURCE=.\hugehelp.c
# End Source File
# Begin Source File
@ -231,6 +219,10 @@ SOURCE=.\tool_getparam.c
# End Source File
# Begin Source File
SOURCE=.\tool_getpass.c
# End Source File
# Begin Source File
SOURCE=.\tool_help.c
# End Source File
# Begin Source File
@ -239,6 +231,10 @@ SOURCE=.\tool_helpers.c
# End Source File
# Begin Source File
SOURCE=.\tool_homedir.c
# End Source File
# Begin Source File
SOURCE=.\tool_libinfo.c
# End Source File
# Begin Source File
@ -287,19 +283,23 @@ SOURCE=.\tool_urlglob.c
# End Source File
# Begin Source File
SOURCE=.\tool_util.c
# End Source File
# Begin Source File
SOURCE=.\tool_vms.c
# End Source File
# Begin Source File
SOURCE=.\writeenv.c
SOURCE=.\tool_writeenv.c
# End Source File
# Begin Source File
SOURCE=.\writeout.c
SOURCE=.\tool_writeout.c
# End Source File
# Begin Source File
SOURCE=.\xattr.c
SOURCE=.\tool_xattr.c
# End Source File
# End Group
# Begin Group "Header Files"
@ -311,18 +311,6 @@ SOURCE=".\config-win32.h"
# End Source File
# Begin Source File
SOURCE=.\curlutil.h
# End Source File
# Begin Source File
SOURCE=.\getpass.h
# End Source File
# Begin Source File
SOURCE=.\homedir.h
# End Source File
# Begin Source File
SOURCE=.\hugehelp.h
# End Source File
# Begin Source File
@ -407,6 +395,10 @@ SOURCE=.\tool_getparam.h
# End Source File
# Begin Source File
SOURCE=.\tool_getpass.h
# End Source File
# Begin Source File
SOURCE=.\tool_help.h
# End Source File
# Begin Source File
@ -415,6 +407,10 @@ SOURCE=.\tool_helpers.h
# End Source File
# Begin Source File
SOURCE=.\tool_homedir.h
# End Source File
# Begin Source File
SOURCE=.\tool_libinfo.h
# End Source File
# Begin Source File
@ -467,23 +463,27 @@ SOURCE=.\tool_urlglob.h
# End Source File
# Begin Source File
SOURCE=.\tool_util.h
# End Source File
# Begin Source File
SOURCE=.\tool_version.h
# End Source File
# Begin Source File
SOURCE=.\tool_vms.h
# End Source File
# Begin Source File
SOURCE=.\version.h
SOURCE=.\tool_writeenv.h
# End Source File
# Begin Source File
SOURCE=.\writeenv.h
SOURCE=.\tool_writeout.h
# End Source File
# Begin Source File
SOURCE=.\writeout.h
# End Source File
# Begin Source File
SOURCE=.\xattr.h
SOURCE=.\tool_xattr.h
# End Source File
# End Group
# Begin Group "Resource Files"