xref: /curl/docs/libcurl/opts/CURLOPT_PREQUOTE.md (revision c4ab3337)
1---
2c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
3SPDX-License-Identifier: curl
4Title: CURLOPT_PREQUOTE
5Section: 3
6Source: libcurl
7See-also:
8  - CURLOPT_POSTQUOTE (3)
9  - CURLOPT_QUOTE (3)
10Protocol:
11  - FTP
12Added-in: 7.9.5
13---
14
15# NAME
16
17CURLOPT_PREQUOTE - commands to run before an FTP transfer
18
19# SYNOPSIS
20
21~~~c
22#include <curl/curl.h>
23
24CURLcode curl_easy_setopt(CURL *handle, CURLOPT_PREQUOTE,
25                          struct curl_slist *cmds);
26~~~
27
28# DESCRIPTION
29
30Pass a pointer to a linked list of FTP commands to pass to the server after
31the transfer type is set. The linked list should be a fully valid list of
32struct curl_slist structs properly filled in as described for
33CURLOPT_QUOTE(3).
34
35Using this option multiple times makes the last set string override the
36previous ones. Set it to NULL to disable its use again.
37
38libcurl does not copy the list, it needs to be kept around until after the
39transfer has completed.
40
41These commands are not performed when a directory listing is performed, only
42for file transfers.
43
44While CURLOPT_QUOTE(3) and CURLOPT_POSTQUOTE(3) work for SFTP,
45this option does not.
46
47# DEFAULT
48
49NULL
50
51# %PROTOCOLS%
52
53# EXAMPLE
54
55~~~c
56int main(void)
57{
58  struct curl_slist *cmdlist = NULL;
59  cmdlist = curl_slist_append(cmdlist, "SYST");
60
61  CURL *curl = curl_easy_init();
62  if(curl) {
63    CURLcode res;
64    curl_easy_setopt(curl, CURLOPT_URL, "ftp://example.com/foo.bin");
65
66    /* pass in the FTP commands to run */
67    curl_easy_setopt(curl, CURLOPT_PREQUOTE, cmdlist);
68
69    res = curl_easy_perform(curl);
70
71    curl_easy_cleanup(curl);
72  }
73  curl_slist_free_all(cmdlist);
74}
75~~~
76
77# %AVAILABILITY%
78
79# RETURN VALUE
80
81Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not.
82