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
b6fa2f88
Commit
b6fa2f88
authored
24 years ago
by
Daniel Stenberg
Browse files
Options
Downloads
Patches
Plain Diff
moved the slist-functions here from FTP since they're more generic than simply
for FTP-stuff
parent
b6c5da33
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
lib/sendf.c
+74
-1
74 additions, 1 deletion
lib/sendf.c
with
74 additions
and
1 deletion
lib/sendf.c
+
74
−
1
View file @
b6fa2f88
...
...
@@ -50,6 +50,76 @@
#include
"memdebug.h"
#endif
/* returns last node in linked list */
static
struct
curl_slist
*
slist_get_last
(
struct
curl_slist
*
list
)
{
struct
curl_slist
*
item
;
/* if caller passed us a NULL, return now */
if
(
!
list
)
return
NULL
;
/* loop through to find the last item */
item
=
list
;
while
(
item
->
next
)
{
item
=
item
->
next
;
}
return
item
;
}
/* append a struct to the linked list. It always retunrs the address of the
* first record, so that you can sure this function as an initialization
* function as well as an append function. If you find this bothersome,
* then simply create a separate _init function and call it appropriately from
* within the proram. */
struct
curl_slist
*
curl_slist_append
(
struct
curl_slist
*
list
,
const
char
*
data
)
{
struct
curl_slist
*
last
;
struct
curl_slist
*
new_item
;
new_item
=
(
struct
curl_slist
*
)
malloc
(
sizeof
(
struct
curl_slist
));
if
(
new_item
)
{
new_item
->
next
=
NULL
;
new_item
->
data
=
strdup
(
data
);
}
else
{
fprintf
(
stderr
,
"Cannot allocate memory for QUOTE list.
\n
"
);
return
NULL
;
}
if
(
list
)
{
last
=
slist_get_last
(
list
);
last
->
next
=
new_item
;
return
list
;
}
/* if this is the first item, then new_item *is* the list */
return
new_item
;
}
/* be nice and clean up resources */
void
curl_slist_free_all
(
struct
curl_slist
*
list
)
{
struct
curl_slist
*
next
;
struct
curl_slist
*
item
;
if
(
!
list
)
return
;
item
=
list
;
do
{
next
=
item
->
next
;
if
(
item
->
data
)
{
free
(
item
->
data
);
}
free
(
item
);
item
=
next
;
}
while
(
next
);
}
/* infof() is for info message along the way */
void
Curl_infof
(
struct
UrlData
*
data
,
char
*
fmt
,
...)
...
...
@@ -72,8 +142,11 @@ void Curl_failf(struct UrlData *data, char *fmt, ...)
va_start
(
ap
,
fmt
);
if
(
data
->
errorbuffer
)
vsnprintf
(
data
->
errorbuffer
,
CURL_ERROR_SIZE
,
fmt
,
ap
);
else
/* no errorbuffer receives this, write to data->err instead */
else
{
/* no errorbuffer receives this, write to data->err instead */
vfprintf
(
data
->
err
,
fmt
,
ap
);
fprintf
(
data
->
err
,
"
\n
"
);
}
va_end
(
ap
);
}
...
...
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