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