aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xmaketgz2
-rw-r--r--packages/Symbian/group/curl.mmp11
-rw-r--r--src/.gitignore1
-rw-r--r--src/Makefile.inc23
-rw-r--r--src/Makefile.vc666
-rw-r--r--src/curl.rc2
-rw-r--r--src/tool_cb_dbg.c5
-rw-r--r--src/tool_getparam.c3
-rw-r--r--src/tool_getpass.c (renamed from src/getpass.c)71
-rw-r--r--src/tool_getpass.h (renamed from src/getpass.h)8
-rw-r--r--src/tool_homedir.c (renamed from src/homedir.c)13
-rw-r--r--src/tool_homedir.h (renamed from src/homedir.h)6
-rw-r--r--src/tool_operate.c21
-rw-r--r--src/tool_operhlp.c3
-rw-r--r--src/tool_paramhlp.c5
-rw-r--r--src/tool_parsecfg.c3
-rw-r--r--src/tool_util.c (renamed from src/curlutil.c)18
-rw-r--r--src/tool_util.h (renamed from src/curlutil.h)26
-rw-r--r--src/tool_version.h (renamed from src/version.h)0
-rw-r--r--src/tool_writeenv.c (renamed from src/writeenv.c)4
-rw-r--r--src/tool_writeenv.h (renamed from src/writeenv.h)13
-rw-r--r--src/tool_writeout.c (renamed from src/writeout.c)27
-rw-r--r--src/tool_writeout.h (renamed from src/writeout.h)6
-rw-r--r--src/tool_xattr.c (renamed from src/xattr.c)14
-rw-r--r--src/tool_xattr.h (renamed from src/xattr.h)6
-rw-r--r--src/vc6curlsrc.dsp64
26 files changed, 218 insertions, 203 deletions
diff --git a/maketgz b/maketgz
index 9cf95a132..9c639f964 100755
--- a/maketgz
+++ b/maketgz
@@ -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`
diff --git a/packages/Symbian/group/curl.mmp b/packages/Symbian/group/curl.mmp
index 22bb5c05e..3c47db3de 100644
--- a/packages/Symbian/group/curl.mmp
+++ b/packages/Symbian/group/curl.mmp
@@ -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 \
diff --git a/src/.gitignore b/src/.gitignore
index eca86f94d..d99cc3f7c 100644
--- a/src/.gitignore
+++ b/src/.gitignore
@@ -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
diff --git a/src/Makefile.inc b/src/Makefile.inc
index d2ee0e679..1660bc403 100644
--- a/src/Makefile.inc
+++ b/src/Makefile.inc
@@ -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)
diff --git a/src/Makefile.vc6 b/src/Makefile.vc6
index fe03afe52..dbd32f175 100644
--- a/src/Makefile.vc6
+++ b/src/Makefile.vc6
@@ -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
diff --git a/src/curl.rc b/src/curl.rc
index 58e439d3b..3db59bd3c 100644
--- a/src/curl.rc
+++ b/src/curl.rc
@@ -20,7 +20,7 @@
*
***************************************************************************/
#include <winver.h>
-#include "version.h"
+#include "tool_version.h"
LANGUAGE 0x09,0x01
diff --git a/src/tool_cb_dbg.c b/src/tool_cb_dbg.c
index 7b20a0c01..7ac9a7339 100644
--- a/src/tool_cb_dbg.c
+++ b/src/tool_cb_dbg.c
@@ -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;
diff --git a/src/tool_getparam.c b/src/tool_getparam.c
index f18c9168e..bb36b4246 100644
--- a/src/tool_getparam.c
+++ b/src/tool_getparam.c
@@ -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 */
diff --git a/src/getpass.c b/src/tool_getpass.c
index a154d107c..b6aa5dd5e 100644
--- a/src/getpass.c
+++ b/src/tool_getpass.c
@@ -25,18 +25,17 @@
/* this file is only for systems without getpass_r() */
#ifdef HAVE_UNISTD_H
-#include <unistd.h>
+# include <unistd.h>
#endif
#ifdef HAVE_FCNTL_H
-#include <fcntl.h>
+# include <fcntl.h>
#endif
+
#ifdef HAVE_TERMIOS_H
-#include <termios.h>
-#else
-#ifdef HAVE_TERMIO_H
-#include <termio.h>
-#endif
+# include <termios.h>
+#elif defined(HAVE_TERMIO_H)
+# include <termio.h>
#endif
#ifdef __VMS
@@ -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 */
@@ -80,15 +82,15 @@ char *getpass_r(const char *prompt, char *buffer, size_t buflen)
$DESCRIPTOR(ttdesc, "TT");
- buffer[0]='\0';
- sts = sys$assign(&ttdesc, &chan,0,0);
+ buffer[0] = '\0';
+ sts = sys$assign(&ttdesc, &chan, 0, 0);
if(sts & 1) {
sts = sys$qiow(0, chan,
IO$_READPROMPT | IO$M_NOECHO,
&iosb, 0, 0, buffer, buflen, 0, 0,
prompt, strlen(prompt));
- if((sts & 1) && (iosb.iosb$w_status&1))
+ if((sts & 1) && (iosb.iosb$w_status & 1))
buffer[iosb.iosb$w_bcnt] = '\0';
sts = sys$dassgn(chan);
@@ -99,7 +101,7 @@ char *getpass_r(const char *prompt, char *buffer, size_t buflen)
#endif /* __VMS */
#ifdef __SYMBIAN32__
-#define getch() getchar()
+# define getch() getchar()
#endif
#if defined(WIN32) || defined(__SYMBIAN32__)
@@ -109,25 +111,25 @@ char *getpass_r(const char *prompt, char *buffer, size_t buflen)
size_t i;
fputs(prompt, stderr);
- for(i=0; i<buflen; i++) {
+ 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 */
fputs("\n", stderr);
#endif
/* if user didn't hit ENTER, terminate buffer */
- if(i==buflen)
- buffer[buflen-1]=0;
+ if(i == buflen)
+ 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;
}
@@ -176,13 +178,11 @@ char *getpass_r(const char *prompt, char *buffer, size_t buflen)
#ifndef DONE /* not previously provided */
#ifdef HAVE_TERMIOS_H
-#define struct_term struct termios
-#else
-#ifdef HAVE_TERMIO_H
-#define struct_term struct termio
+# define struct_term struct termios
+#elif defined(HAVE_TERMIO_H)
+# define struct_term struct termio
#else
-#undef struct_term
-#endif
+# undef struct_term
#endif
static bool ttyecho(bool enable, int fd)
@@ -199,18 +199,16 @@ 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 */
-/* neither HAVE_TERMIO_H nor HAVE_TERMIOS_H, we can't disable echo! */
- (void)fd; /* prevent compiler warning on unused variable */
+#else
+ /* neither HAVE_TERMIO_H nor HAVE_TERMIOS_H, we can't disable echo! */
+ (void)fd;
return FALSE; /* not disabled */
#endif
-#endif
return TRUE; /* disabled */
}
else {
@@ -218,14 +216,11 @@ 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 */
}
}
@@ -236,18 +231,18 @@ char *getpass_r(const char *prompt, /* prompt to display */
{
ssize_t nread;
bool disabled;
- int fd=open("/dev/tty", O_RDONLY);
+ int fd = open("/dev/tty", O_RDONLY);
if(-1 == fd)
fd = 1; /* use stdin if the tty couldn't be used */
disabled = ttyecho(FALSE, fd); /* disable terminal echo */
fputs(prompt, stderr);
- nread=read(fd, password, buflen);
+ 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 */
diff --git a/src/getpass.h b/src/tool_getpass.h
index 7d714fcf3..506d0feef 100644
--- a/src/getpass.h
+++ b/src/tool_getpass.h
@@ -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 ___| | | | _ \| |
@@ -30,7 +30,7 @@
/*
* Returning NULL will abort the continued operation!
*/
-char* getpass_r(const char *prompt, char* buffer, size_t buflen );
+char* getpass_r(const char *prompt, char* buffer, size_t buflen);
#endif
-#endif /* HEADER_CURL_GETPASS_H */
+#endif /* HEADER_CURL_TOOL_GETPASS_H */
diff --git a/src/homedir.c b/src/tool_homedir.c
index 80ffe0752..95d25c74f 100644
--- a/src/homedir.c
+++ b/src/tool_homedir.c
@@ -22,21 +22,20 @@
#include "setup.h"
#ifdef HAVE_PWD_H
-#include <pwd.h>
+# include <pwd.h>
#endif
#ifdef HAVE_UNISTD_H
-#include <unistd.h>
+# include <unistd.h>
#endif
#ifdef __VMS
-#include <unixlib.h>
+# 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
@@ -70,7 +69,7 @@ char *GetEnv(const char *variable, char do_expand)
env = getenv(variable);
#endif
#endif
- return (env && env[0])?strdup(env):NULL;
+ return (env && env[0]) ? strdup(env) : NULL;
}
/* return the home directory of the current user as an allocated string */
diff --git a/src/homedir.h b/src/tool_homedir.h
index 252fd0ecc..109c1f282 100644
--- a/src/homedir.h
+++ b/src/tool_homedir.h
@@ -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 */
diff --git a/src/tool_operate.c b/src/tool_operate.c
index 9a06098a0..3ee1d10d2 100644
--- a/src/tool_operate.c
+++ b/src/tool_operate.c
@@ -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'
diff --git a/src/tool_operhlp.c b/src/tool_operhlp.c
index d7dbe13c1..808d2d564 100644
--- a/src/tool_operhlp.c
+++ b/src/tool_operhlp.c
@@ -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 */
diff --git a/src/tool_paramhlp.c b/src/tool_paramhlp.c
index 97681c1bd..adb12ce70 100644
--- a/src/tool_paramhlp.c
+++ b/src/tool_paramhlp.c
@@ -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"
diff --git a/src/tool_parsecfg.c b/src/tool_parsecfg.c
index 44d077e37..b60d31830 100644
--- a/src/tool_parsecfg.c
+++ b/src/tool_parsecfg.c
@@ -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"
diff --git a/src/curlutil.c b/src/tool_util.c
index a524b65b4..79c998295 100644
--- a/src/curlutil.c
+++ b/src/tool_util.c
@@ -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;
}
diff --git a/src/curlutil.h b/src/tool_util.h
index e0d9cb167..7c2a2978a 100644
--- a/src/curlutil.h
+++ b/src/tool_util.h
@@ -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 tool_tvlong(struct timeval t1);
-long cutil_tvlong(struct timeval t1);
+#undef tvnow
+#undef tvdiff
+#undef tvdiff_secs
+#undef tvlong
+#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_SRC_UTIL_H */
+#endif /* HEADER_CURL_TOOL_UTIL_H */
diff --git a/src/version.h b/src/tool_version.h
index 569526bfe..569526bfe 100644
--- a/src/version.h
+++ b/src/tool_version.h
diff --git a/src/writeenv.c b/src/tool_writeenv.c
index b509449e2..232ab697c 100644
--- a/src/writeenv.c
+++ b/src/tool_writeenv.c
@@ -24,7 +24,7 @@
#ifdef USE_ENVIRONMENT
#ifdef __riscos__
-#include <kernel.h>
+# include <kernel.h>
#endif
#include <curl/curl.h>
@@ -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 */
diff --git a/src/writeenv.h b/src/tool_writeenv.h
index 0816c34f9..74fdc97d9 100644
--- a/src/writeenv.h
+++ b/src/tool_writeenv.h
@@ -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 */
+
diff --git a/src/writeout.c b/src/tool_writeout.c
index 7e4105067..1ea1c9881 100644
--- a/src/writeout.c
+++ b/src/tool_writeout.c
@@ -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 */
@@ -100,7 +93,7 @@ static const struct variable replacements[]={
void ourWriteOut(CURL *curl, const char *writeinfo)
{
FILE *stream = stdout;
- const char *ptr=writeinfo;
+ const char *ptr = writeinfo;
char *stringp;
long longinfo;
double doubleinfo;
@@ -110,7 +103,7 @@ void ourWriteOut(CURL *curl, const char *writeinfo)
if('%' == ptr[1]) {
/* an escaped %-letter */
fputc('%', stream);
- ptr+=2;
+ ptr += 2;
}
else {
/* this is meant as a variable to output */
@@ -119,10 +112,10 @@ void ourWriteOut(CURL *curl, const char *writeinfo)
int i;
if(('{' == ptr[1]) && ((end = strchr(ptr, '}')) != NULL)) {
bool match = FALSE;
- ptr+=2; /* pass the % and the { */
- keepit=*end;
- *end=0; /* zero terminate */
- for(i=0; replacements[i].name; i++) {
+ ptr += 2; /* pass the % and the { */
+ keepit = *end;
+ *end = 0; /* zero terminate */
+ for(i = 0; replacements[i].name; i++) {
if(curl_strequal(ptr, replacements[i].name)) {
match = TRUE;
switch(replacements[i].id) {
@@ -258,14 +251,14 @@ void ourWriteOut(CURL *curl, const char *writeinfo)
if(!match) {
fprintf(stderr, "curl: unknown --write-out variable: '%s'\n", ptr);
}
- ptr=end+1; /* pass the end */
+ ptr = end + 1; /* pass the end */
*end = keepit;
}
else {
/* illegal syntax, then just output the characters that are used */
fputc('%', stream);
fputc(ptr[1], stream);
- ptr+=2;
+ ptr += 2;
}
}
}
@@ -286,7 +279,7 @@ void ourWriteOut(CURL *curl, const char *writeinfo)
fputc(ptr[1], stream);
break;
}
- ptr+=2;
+ ptr += 2;
}
else {
fputc(*ptr, stream);
diff --git a/src/writeout.h b/src/tool_writeout.h
index 92d8ea5a9..815cfcfff 100644
--- a/src/writeout.h
+++ b/src/tool_writeout.h
@@ -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 */
diff --git a/src/xattr.c b/src/tool_xattr.c
index 146acf94c..1f3883fa6 100644
--- a/src/xattr.c
+++ b/src/tool_xattr.c
@@ -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 */
@@ -42,8 +42,8 @@ static const struct xattr_mapping {
* http://freedesktop.org/wiki/CommonExtendedAttributes
*/
{ "user.xdg.origin.url", CURLINFO_EFFECTIVE_URL },
- { "user.mime_type", CURLINFO_CONTENT_TYPE },
- { NULL, CURLINFO_NONE } /* last element, abort loop here */
+ { "user.mime_type", CURLINFO_CONTENT_TYPE },
+ { NULL, CURLINFO_NONE } /* last element, abort loop here */
};
/* store metadata from the curl request alongside the downloaded
@@ -59,9 +59,9 @@ int fwrite_xattr(CURL *curl, int fd)
CURLcode rc = curl_easy_getinfo(curl, mappings[i].info, &value);
if(rc == CURLE_OK && value) {
#ifdef HAVE_FSETXATTR_6
- err = fsetxattr( fd, mappings[i].attr, value, strlen(value), 0, 0 );
+ err = fsetxattr(fd, mappings[i].attr, value, strlen(value), 0, 0);
#elif defined(HAVE_FSETXATTR_5)
- err = fsetxattr( fd, mappings[i].attr, value, strlen(value), 0 );
+ err = fsetxattr(fd, mappings[i].attr, value, strlen(value), 0);
#endif
}
i++;
diff --git a/src/xattr.h b/src/tool_xattr.h
index ef528eafa..14c8c944b 100644
--- a/src/xattr.h
+++ b/src/tool_xattr.h
@@ -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 */
diff --git a/src/vc6curlsrc.dsp b/src/vc6curlsrc.dsp
index d2f6a2fa0..4711703bc 100644
--- a/src/vc6curlsrc.dsp
+++ b/src/vc6curlsrc.dsp
@@ -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_vms.h
+SOURCE=.\tool_util.h
# End Source File
# Begin Source File
-SOURCE=.\version.h
+SOURCE=.\tool_version.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\tool_vms.h
# End Source File
# Begin Source File
-SOURCE=.\writeenv.h
+SOURCE=.\tool_writeenv.h
# End Source File
# Begin Source File
-SOURCE=.\writeout.h
+SOURCE=.\tool_writeout.h
# End Source File
# Begin Source File
-SOURCE=.\xattr.h
+SOURCE=.\tool_xattr.h
# End Source File
# End Group
# Begin Group "Resource Files"