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