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`
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 \
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 \
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 \
Makefile.vc8.dist
Makefile.vc9.dist
version.h.dist
+tool_version.h.dist
Makefile.vc10.dist
config-win32.h
$(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 \
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 \
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 \
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 \
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)
!ENDIF\r
\r
RELEASE_OBJS= \\r
- curlutilr.obj \\r
- getpassr.obj \\r
- homedirr.obj \\r
hugehelpr.obj \\r
nonblockr.obj \\r
rawstrr.obj \\r
tool_easysrcr.obj \\r
tool_formparser.obj \\r
tool_getparamr.obj \\r
+ tool_getpassr.obj \\r
tool_helpr.obj \\r
tool_helpersr.obj \\r
+ tool_homedirr.obj \\r
tool_libinfor.obj \\r
tool_mainr.obj \\r
tool_mfilesr.obj \\r
tool_setoptr.obj \\r
tool_sleepr.obj \\r
tool_urlglobr.obj \\r
+ tool_utilr.obj \\r
tool_vmsr.obj \\r
- writeoutr.obj \\r
- xattrr.obj \\r
+ tool_writeenvr.obj \\r
+ tool_writeoutr.obj \\r
+ tool_xattrr.obj \\r
curlr.res\r
\r
DEBUG_OBJS= \\r
- curlutild.obj \\r
- getpassd.obj \\r
- homedird.obj \\r
hugehelpd.obj \\r
nonblockd.obj \\r
rawstrd.obj \\r
tool_easysrcd.obj \\r
tool_formparsed.obj \\r
tool_getparamd.obj \\r
+ tool_getpassd.obj \\r
tool_helpd.obj \\r
tool_helpersd.obj \\r
+ tool_homedird.obj \\r
tool_libinfod.obj \\r
tool_maind.obj \\r
tool_mfilesd.obj \\r
tool_setoptd.obj \\r
tool_sleepd.obj \\r
tool_urlglobd.obj \\r
+ tool_utild.obj \\r
tool_vmsd.obj \\r
- writeoutd.obj \\r
- xattrd.obj \\r
+ tool_writeenvd.obj \\r
+ tool_writeoutd.obj \\r
+ tool_xattrd.obj \\r
curld.res\r
\r
#################################################\r
## Release\r
hugehelpr.obj: hugehelp.c\r
$(CCR) $(CFLAGS) /Zm200 /Fo"$@" hugehelp.c\r
-writeoutr.obj: writeout.c\r
- $(CCR) $(CFLAGS) /Fo"$@" writeout.c\r
-getpassr.obj: getpass.c\r
- $(CCR) $(CFLAGS) /Fo"$@" getpass.c\r
-homedirr.obj: homedir.c\r
- $(CCR) $(CFLAGS) /Fo"$@" homedir.c\r
-curlutilr.obj: curlutil.c\r
- $(CCR) $(CFLAGS) /Fo"$@" curlutil.c\r
nonblockr.obj: ../lib/nonblock.c\r
$(CCR) $(CFLAGS) /Fo"$@" ../lib/nonblock.c\r
rawstrr.obj: ../lib/rawstr.c\r
$(CCR) $(CFLAGS) /Fo"$@" tool_formparse.c\r
tool_getparamr.obj: tool_getparam.c\r
$(CCR) $(CFLAGS) /Fo"$@" tool_getparam.c\r
+tool_getpassr.obj: tool_getpass.c\r
+ $(CCR) $(CFLAGS) /Fo"$@" tool_getpass.c\r
tool_helpr.obj: tool_help.c\r
$(CCR) $(CFLAGS) /Fo"$@" tool_help.c\r
tool_helpersr.obj: tool_helpers.c\r
$(CCR) $(CFLAGS) /Fo"$@" tool_helpers.c\r
+tool_homedirr.obj: tool_homedir.c\r
+ $(CCR) $(CFLAGS) /Fo"$@" tool_homedir.c\r
tool_libinfor.obj: tool_libinfo.c\r
$(CCR) $(CFLAGS) /Fo"$@" tool_libinfo.c\r
tool_mainr.obj: tool_main.c\r
$(CCR) $(CFLAGS) /Fo"$@" tool_sleep.c\r
tool_urlglobr.obj: tool_urlglob.c\r
$(CCR) $(CFLAGS) /Fo"$@" tool_urlglob.c\r
+tool_utilr.obj: tool_util.c\r
+ $(CCR) $(CFLAGS) /Fo"$@" tool_util.c\r
tool_vmsr.obj: tool_vms.c\r
$(CCR) $(CFLAGS) /Fo"$@" tool_vms.c\r
-xattrr.obj: xattr.c\r
- $(CCR) $(CFLAGS) /Fo"$@" xattr.c\r
+tool_writeenvr.obj: tool_writeenv.c\r
+ $(CCR) $(CFLAGS) /Fo"$@" tool_writeenv.c\r
+tool_writeoutr.obj: tool_writeout.c\r
+ $(CCR) $(CFLAGS) /Fo"$@" tool_writeout.c\r
+tool_xattrr.obj: tool_xattr.c\r
+ $(CCR) $(CFLAGS) /Fo"$@" tool_xattr.c\r
curlr.res : curl.rc\r
$(RCR) $(RESFLAGS) /Fo"$@" curl.rc\r
\r
## Debug\r
hugehelpd.obj: hugehelp.c\r
$(CCD) $(CFLAGS) /Zm200 /Fo"$@" hugehelp.c\r
-writeoutd.obj: writeout.c\r
- $(CCD) $(CFLAGS) /Fo"$@" writeout.c\r
-getpassd.obj: getpass.c\r
- $(CCD) $(CFLAGS) /Fo"$@" getpass.c\r
-homedird.obj: homedir.c\r
- $(CCD) $(CFLAGS) /Fo"$@" homedir.c\r
-curlutild.obj: curlutil.c\r
- $(CCD) $(CFLAGS) /Fo"$@" curlutil.c\r
nonblockd.obj: ../lib/nonblock.c\r
$(CCD) $(CFLAGS) /Fo"$@" ../lib/nonblock.c\r
rawstrd.obj: ../lib/rawstr.c\r
$(CCD) $(CFLAGS) /Fo"$@" tool_formparse.c\r
tool_getparamd.obj: tool_getparam.c\r
$(CCD) $(CFLAGS) /Fo"$@" tool_getparam.c\r
+tool_getpassd.obj: tool_getpass.c\r
+ $(CCD) $(CFLAGS) /Fo"$@" tool_getpass.c\r
tool_helpd.obj: tool_help.c\r
$(CCD) $(CFLAGS) /Fo"$@" tool_help.c\r
tool_helpersd.obj: tool_helpers.c\r
$(CCD) $(CFLAGS) /Fo"$@" tool_helpers.c\r
+tool_homedird.obj: tool_homedir.c\r
+ $(CCD) $(CFLAGS) /Fo"$@" tool_homedir.c\r
tool_libinfod.obj: tool_libinfo.c\r
$(CCD) $(CFLAGS) /Fo"$@" tool_libinfo.c\r
tool_maind.obj: tool_main.c\r
$(CCD) $(CFLAGS) /Fo"$@" tool_sleep.c\r
tool_urlglobd.obj: tool_urlglob.c\r
$(CCD) $(CFLAGS) /Fo"$@" tool_urlglob.c\r
+tool_utild.obj: tool_util.c\r
+ $(CCD) $(CFLAGS) /Fo"$@" tool_util.c\r
tool_vmsd.obj: tool_vms.c\r
$(CCD) $(CFLAGS) /Fo"$@" tool_vms.c\r
-xattrd.obj: xattr.c\r
- $(CCD) $(CFLAGS) /Fo"$@" xattr.c\r
+tool_writeenvd.obj: tool_writeenv.c\r
+ $(CCD) $(CFLAGS) /Fo"$@" tool_writeenv.c\r
+tool_writeoutd.obj: tool_writeout.c\r
+ $(CCD) $(CFLAGS) /Fo"$@" tool_writeout.c\r
+tool_xattrd.obj: tool_xattr.c\r
+ $(CCD) $(CFLAGS) /Fo"$@" tool_xattr.c\r
curld.res : curl.rc\r
$(RCD) $(RESFLAGS) /Fo"$@" curl.rc\r
\r
*
***************************************************************************/
#include <winver.h>
-#include "version.h"
+#include "tool_version.h"
LANGUAGE 0x09,0x01
/* 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 */
(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;
# include "hugehelp.h"
#endif
-#include "version.h"
-
#include "tool_binmode.h"
#include "tool_cfgable.h"
#include "tool_cb_prg.h"
#include "tool_msgs.h"
#include "tool_paramhlp.h"
#include "tool_parsecfg.h"
+#include "tool_version.h"
#include "memdebug.h" /* keep this as LAST include */
/* 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
# endif
#endif
-#include "getpass.h"
+#define _MPRINTF_REPLACE
+#include <curl/mprintf.h>
+
+#include "tool_getpass.h"
#include "memdebug.h" /* keep this as LAST include */
$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);
#endif /* __VMS */
#ifdef __SYMBIAN32__
-#define getch() getchar()
+# define getch() getchar()
#endif
#if defined(WIN32) || defined(__SYMBIAN32__)
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 */
}
putchar('*');
} while((buffer[i-1] != 13) && (i < buflen));
- buffer[i-1] = 0;
+ buffer[i-1] = '\0';
printf("\r\n");
return buffer;
}
#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)
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 {
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 */
}
}
{
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 */
-#ifndef HEADER_CURL_GETPASS_H
-#define HEADER_CURL_GETPASS_H
+#ifndef HEADER_CURL_TOOL_GETPASS_H
+#define HEADER_CURL_TOOL_GETPASS_H
/***************************************************************************
* _ _ ____ _
* Project ___| | | | _ \| |
/*
* 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 */
#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
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 */
-#ifndef HEADER_CURL_HOMEDIR_H
-#define HEADER_CURL_HOMEDIR_H
+#ifndef HEADER_CURL_TOOL_HOMEDIR_H
+#define HEADER_CURL_TOOL_HOMEDIR_H
/***************************************************************************
* _ _ ____ _
* Project ___| | | | _ \| |
char *homedir(void);
-#endif /* HEADER_CURL_HOMEDIR_H */
+#endif /* HEADER_CURL_TOOL_HOMEDIR_H */
/* 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"
#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"
#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 */
retry_numretries = config->req_retry;
retry_sleep = retry_sleep_default; /* ms */
- retrystart = cutil_tvnow();
+ retrystart = tvnow();
for(;;) {
res = curl_easy_perform(curl);
time */
if(retry_numretries &&
(!config->retry_maxtime ||
- (cutil_tvdiff(cutil_tvnow(), retrystart)<
+ (tvdiff(tvnow(), retrystart) <
config->retry_maxtime*1000L)) ) {
enum {
RETRY_NO,
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'
/* 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 */
/* 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"
/* 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"
***************************************************************************/
#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
#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
#elif defined(HAVE_GETTIMEOFDAY)
-struct timeval cutil_tvnow(void)
+struct timeval tool_tvnow(void)
{
/*
** gettimeofday() is not granted to be increased monotonically, due to
#else
-struct timeval cutil_tvnow(void)
+struct timeval tool_tvnow(void)
{
/*
** time() returns the value of time in seconds since the Epoch.
*
* 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;
}
-#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 ___| | | | _ \| |
***************************************************************************/
#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
*
* 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 */
#ifdef USE_ENVIRONMENT
#ifdef __riscos__
-#include <kernel.h>
+# include <kernel.h>
#endif
#include <curl/curl.h>
#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 */
-#ifndef HEADER_CURL_WRITEENV_H
-#define HEADER_CURL_WRITEENV_H
+#ifndef HEADER_CURL_TOOL_WRITEENV_H
+#define HEADER_CURL_TOOL_WRITEENV_H
/***************************************************************************
* _ _ ____ _
* Project ___| | | | _ \| |
***************************************************************************/
#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 */
+
***************************************************************************/
#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 */
void ourWriteOut(CURL *curl, const char *writeinfo)
{
FILE *stream = stdout;
- const char *ptr=writeinfo;
+ const char *ptr = writeinfo;
char *stringp;
long longinfo;
double doubleinfo;
if('%' == ptr[1]) {
/* an escaped %-letter */
fputc('%', stream);
- ptr+=2;
+ ptr += 2;
}
else {
/* this is meant as a variable to output */
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) {
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;
}
}
}
fputc(ptr[1], stream);
break;
}
- ptr+=2;
+ ptr += 2;
}
else {
fputc(*ptr, stream);
-#ifndef HEADER_CURL_WRITEOUT_H
-#define HEADER_CURL_WRITEOUT_H
+#ifndef HEADER_CURL_TOOL_WRITEOUT_H
+#define HEADER_CURL_TOOL_WRITEOUT_H
/***************************************************************************
* _ _ ____ _
* Project ___| | | | _ \| |
void ourWriteOut(CURL *curl, const char *out);
-#endif /* HEADER_CURL_WRITEOUT_H */
+#endif /* HEADER_CURL_TOOL_WRITEOUT_H */
#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 */
* 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
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++;
-#ifndef HEADER_CURL_XATTR_H
-#define HEADER_CURL_XATTR_H
+#ifndef HEADER_CURL_TOOL_XATTR_H
+#define HEADER_CURL_TOOL_XATTR_H
/***************************************************************************
* _ _ ____ _
* Project ___| | | | _ \| |
int fwrite_xattr(CURL *curl, int fd);
-#endif /* HEADER_CURL_XATTR_H */
+#endif /* HEADER_CURL_TOOL_XATTR_H */
# PROP Default_Filter ""\r
# Begin Source File\r
\r
-SOURCE=.\curlutil.c\r
-# End Source File\r
-# Begin Source File\r
-\r
-SOURCE=.\getpass.c\r
-# End Source File\r
-# Begin Source File\r
-\r
-SOURCE=.\homedir.c\r
-# End Source File\r
-# Begin Source File\r
-\r
SOURCE=.\hugehelp.c\r
# End Source File\r
# Begin Source File\r
# End Source File\r
# Begin Source File\r
\r
+SOURCE=.\tool_getpass.c\r
+# End Source File\r
+# Begin Source File\r
+\r
SOURCE=.\tool_help.c\r
# End Source File\r
# Begin Source File\r
# End Source File\r
# Begin Source File\r
\r
+SOURCE=.\tool_homedir.c\r
+# End Source File\r
+# Begin Source File\r
+\r
SOURCE=.\tool_libinfo.c\r
# End Source File\r
# Begin Source File\r
# End Source File\r
# Begin Source File\r
\r
+SOURCE=.\tool_util.c\r
+# End Source File\r
+# Begin Source File\r
+\r
SOURCE=.\tool_vms.c\r
# End Source File\r
# Begin Source File\r
\r
-SOURCE=.\writeenv.c\r
+SOURCE=.\tool_writeenv.c\r
# End Source File\r
# Begin Source File\r
\r
-SOURCE=.\writeout.c\r
+SOURCE=.\tool_writeout.c\r
# End Source File\r
# Begin Source File\r
\r
-SOURCE=.\xattr.c\r
+SOURCE=.\tool_xattr.c\r
# End Source File\r
# End Group\r
# Begin Group "Header Files"\r
# End Source File\r
# Begin Source File\r
\r
-SOURCE=.\curlutil.h\r
-# End Source File\r
-# Begin Source File\r
-\r
-SOURCE=.\getpass.h\r
-# End Source File\r
-# Begin Source File\r
-\r
-SOURCE=.\homedir.h\r
-# End Source File\r
-# Begin Source File\r
-\r
SOURCE=.\hugehelp.h\r
# End Source File\r
# Begin Source File\r
# End Source File\r
# Begin Source File\r
\r
+SOURCE=.\tool_getpass.h\r
+# End Source File\r
+# Begin Source File\r
+\r
SOURCE=.\tool_help.h\r
# End Source File\r
# Begin Source File\r
# End Source File\r
# Begin Source File\r
\r
+SOURCE=.\tool_homedir.h\r
+# End Source File\r
+# Begin Source File\r
+\r
SOURCE=.\tool_libinfo.h\r
# End Source File\r
# Begin Source File\r
# End Source File\r
# Begin Source File\r
\r
-SOURCE=.\tool_vms.h\r
+SOURCE=.\tool_util.h\r
# End Source File\r
# Begin Source File\r
\r
-SOURCE=.\version.h\r
+SOURCE=.\tool_version.h\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=.\tool_vms.h\r
# End Source File\r
# Begin Source File\r
\r
-SOURCE=.\writeenv.h\r
+SOURCE=.\tool_writeenv.h\r
# End Source File\r
# Begin Source File\r
\r
-SOURCE=.\writeout.h\r
+SOURCE=.\tool_writeout.h\r
# End Source File\r
# Begin Source File\r
\r
-SOURCE=.\xattr.h\r
+SOURCE=.\tool_xattr.h\r
# End Source File\r
# End Group\r
# Begin Group "Resource Files"\r