Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
TLMSP curl
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
CYBER - Cyber Security
TS 103 523 MSP
TLMSP
TLMSP curl
Commits
b0936b80
Commit
b0936b80
authored
25 years ago
by
Daniel Stenberg
Browse files
Options
Downloads
Patches
Plain Diff
Added -N, added a strdup() function for systems without it. suggested for
Ultrix by Damien Adant <dams@usa.net>.
parent
8ddd89a3
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/main.c
+35
-1
35 additions, 1 deletion
src/main.c
with
35 additions
and
1 deletion
src/main.c
+
35
−
1
View file @
b0936b80
...
...
@@ -67,6 +67,25 @@
#include
<unistd.h>
#endif
#ifndef HAVE_STRDUP
/* Ultrix doesn't have strdup(), so make a quick clone: */
char
*
strdup
(
char
*
str
)
{
int
len
;
char
*
newstr
;
len
=
strlen
(
str
);
newstr
=
(
char
*
)
malloc
((
len
+
1
)
*
sizeof
(
char
));
if
(
!
newstr
)
return
(
char
*
)
NULL
;
strcpy
(
newstr
,
str
);
return
newstr
;
}
#endif
extern
void
hugehelp
(
void
);
static
void
helpf
(
char
*
fmt
,
...)
...
...
@@ -109,6 +128,7 @@ static void help(void)
" -m/--max-time <seconds> Maximum time allowed for the transfer
\n
"
" -M/--manual Display huge help text
\n
"
" -n/--netrc Read .netrc for user name and password
\n
"
" -N/--no-buffer Disables the buffering of the output stream
\n
"
" -o/--output <file> Write output to <file> instead of stdout
\n
"
" -O/--remote-name Write output to a file named as the remote file
\n
"
#if 0
...
...
@@ -177,6 +197,7 @@ struct Configurable {
char
*
cookiefile
;
char
*
customrequest
;
bool
progressmode
;
bool
nobuffer
;
char
*
writeout
;
/* %-styled format string to output */
...
...
@@ -288,6 +309,7 @@ static int getparameter(char *flag, /* f or -long-flag */
{
"m"
,
"max-time"
,
TRUE
},
{
"M"
,
"manual"
,
FALSE
},
{
"n"
,
"netrc"
,
FALSE
},
{
"N"
,
"no-buffer"
,
FALSE
},
{
"o"
,
"output"
,
TRUE
},
{
"O"
,
"remote-name"
,
FALSE
},
#if 0
...
...
@@ -573,6 +595,10 @@ static int getparameter(char *flag, /* f or -long-flag */
automatically enfore user+password with the request */
config
->
conf
^=
CONF_NETRC
;
break
;
case
'N'
:
/* disable the output I/O buffering */
config
->
nobuffer
^=
1
;
break
;
case
'o'
:
/* output file */
GetStr
(
&
config
->
outfile
,
nextarg
);
/* write to this file */
...
...
@@ -806,6 +832,9 @@ struct OutStruct {
FILE
*
stream
;
};
/* having this global is a bit dirty, but hey, who said we weren't? ;-) */
struct
Configurable
config
;
int
my_fwrite
(
void
*
buffer
,
size_t
size
,
size_t
nmemb
,
FILE
*
stream
)
{
struct
OutStruct
*
out
=
(
struct
OutStruct
*
)
stream
;
...
...
@@ -814,6 +843,12 @@ int my_fwrite(void *buffer, size_t size, size_t nmemb, FILE *stream)
out
->
stream
=
fopen
(
out
->
filename
,
"wb"
);
if
(
!
out
->
stream
)
return
-
1
;
/* failure */
if
(
config
.
nobuffer
)
{
/* disable output buffering */
#ifdef HAVE_SETVBUF
setvbuf
(
out
->
stream
,
NULL
,
_IONBF
,
0
);
#endif
}
}
return
fwrite
(
buffer
,
size
,
nmemb
,
out
->
stream
);
}
...
...
@@ -841,7 +876,6 @@ int main(int argc, char *argv[])
int
res
=
URG_OK
;
int
i
;
struct
Configurable
config
;
outs
.
stream
=
stdout
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment