1
0
mirror of https://github.com/moparisthebest/curl synced 2024-12-21 23:58:49 -05:00

new binary stdout approach for win32 systems

This commit is contained in:
Daniel Stenberg 2000-06-14 12:50:38 +00:00
parent 2dbadc6405
commit 5da5cfa33e
4 changed files with 38 additions and 11 deletions

11
CHANGES
View File

@ -6,6 +6,17 @@
History of Changes
Daniel (14 June 2000)
- Applied Luong Dinh Dung's comments about a few win32 compile problems.
- Applied Björn Stenberg's suggested fix that turns the win32 stdout to
binary. It won't do it if the -B / --use-ascii option is used. That option
is now an extended version of the previous -B /--ftp--ascii. The flag was
already in use be the ldap as well so the new name fits pretty good. The
libcyrl CURLOPT_TRANSFERTEXT was also introduced as an alias to the now
obsolete CURLOPT_FTPASCII. Can't verify this fix myself as I have no win32
compiler around.
Daniel (13 June 2000)
- Luong Dinh Dung <dung at sch.bme.hu> found a problem in curl_easy_cleanup()
since it free()ed the main curl struct *twice*. This is now corrected.

View File

@ -137,11 +137,13 @@ server sends as part of a HTTP header. NOTE that this means that the library
will resend the same request on the new location and follow new Location:
headers all the way until no more such headers are returned.
.TP
.B CURLOPT_FTPASCII
.B CURLOPT_TRANSFERTEXT
A non-zero parameter tells the library to use ASCII mode for ftp transfers,
instead of the default binary transfer. This will only be useable when
transfering text data between system with different views on certain
characters, such as newlines or similar.
instead of the default binary transfer. For LDAP transfers it gets the data in
plain text instead of HTML and for win32 systems it does not set the stdout to
binary mode. This option can be useable when transfering text data between
system with different views on certain characters, such as newlines or
similar.
.TP
.B CURLOPT_PUT
A non-zero parameter tells the library to use HTTP PUT a file. The file to put

View File

@ -345,7 +345,12 @@ typedef enum {
T(FTPAPPEND, LONG, 50), /* Append instead of overwrite on upload! */
T(NETRC, LONG, 51), /* read user+password from .netrc */
T(FOLLOWLOCATION, LONG, 52), /* use Location: Luke! */
/* This FTPASCII name is now obsolete, to be removed, use the TRANSFERTEXT
instead. It goes for more protocols than just ftp... */
T(FTPASCII, LONG, 53), /* use TYPE A for transfer */
T(TRANSFERTEXT, LONG, 53), /* transfer data in text/ASCII format */
T(PUT, LONG, 54), /* PUT the input file */
T(MUTE, LONG, 55), /* force NOPROGRESS */

View File

@ -89,12 +89,11 @@
#define CONF_FTPAPPEND (1<<20) /* Append instead of overwrite on upload! */
#define CONF_NETRC (1<<22) /* read user+password from .netrc */
#define CONF_FOLLOWLOCATION (1<<23) /* use Location: Luke! */
#define CONF_FTPASCII (1<<24) /* use TYPE A for transfer */
#define CONF_GETTEXT (1<<24) /* use ASCII/text for transfer */
#define CONF_HTTPPOST (1<<25) /* multipart/form-data HTTP POST */
#define CONF_PUT (1<<27) /* PUT the input file */
#define CONF_MUTE (1<<28) /* force NOPROGRESS */
#ifndef HAVE_STRDUP
/* Ultrix doesn't have strdup(), so make a quick clone: */
char *strdup(char *str)
@ -202,7 +201,7 @@ static void help(void)
" -a/--append Append to target file when uploading (F)\n"
" -A/--user-agent <string> User-Agent to send to server (H)\n"
" -b/--cookie <name=string/file> Cookie string or file to read cookies from (H)\n"
" -B/--ftp-ascii Use ASCII transfer (F)\n"
" -B/--use-ascii Use ASCII/text transfer\n"
" -c/--continue Resume a previous transfer where we left it\n"
" -C/--continue-at <offset> Specify absolute resume offset\n"
" -d/--data POST data (H)\n"
@ -384,7 +383,8 @@ static int getparameter(char *flag, /* f or -long-flag */
{"a", "append", FALSE},
{"A", "user-agent", TRUE},
{"b", "cookie", TRUE},
{"B", "ftp-ascii", FALSE},
{"B", "ftp-ascii", FALSE}, /* this long format is OBSOLETEE now! */
{"B", "use-ascii", FALSE},
{"c", "continue", FALSE},
{"C", "continue-at", TRUE},
{"d", "data", TRUE},
@ -572,8 +572,8 @@ static int getparameter(char *flag, /* f or -long-flag */
GetStr(&config->cookiefile, nextarg);
break;
case 'B':
/* use type ASCII when transfering ftp files */
config->conf ^= CONF_FTPASCII;
/* use ASCII/text when transfering */
config->conf ^= CONF_GETTEXT;
break;
case 'c':
/* This makes us continue an ftp transfer */
@ -1194,6 +1194,15 @@ int main(int argc, char *argv[])
if(!config.errors)
config.errors = stderr;
#ifdef WIN32
if(!config.outfile && !(config.flags & CONF_GETTEXT)) {
/* We get the output to stdout and we have not got the ASCII/text flag,
then set stdout to be binary */
setmode( 1, O_BINARY );
}
#endif
main_init();
#if 0
@ -1262,7 +1271,7 @@ int main(int argc, char *argv[])
curl_easy_setopt(curl, CURLOPT_FTPAPPEND, config.conf&CONF_FTPAPPEND);
curl_easy_setopt(curl, CURLOPT_NETRC, config.conf&CONF_NETRC);
curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, config.conf&CONF_FOLLOWLOCATION);
curl_easy_setopt(curl, CURLOPT_FTPASCII, config.conf&CONF_FTPASCII);
curl_easy_setopt(curl, CURLOPT_TRANSFERTEXT, config.conf&CONF_GETTEXT);
curl_easy_setopt(curl, CURLOPT_PUT, config.conf&CONF_PUT);
curl_easy_setopt(curl, CURLOPT_MUTE, config.conf&CONF_MUTE);