quickjs-tart

quickjs-based runtime for wallet-core logic
Log | Files | Refs | README | LICENSE

CURLOPT_SEEKDATA.md (1258B)


      1 ---
      2 c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
      3 SPDX-License-Identifier: curl
      4 Title: CURLOPT_SEEKDATA
      5 Section: 3
      6 Source: libcurl
      7 See-also:
      8   - CURLOPT_DEBUGFUNCTION (3)
      9   - CURLOPT_IOCTLFUNCTION (3)
     10   - CURLOPT_SEEKFUNCTION (3)
     11   - CURLOPT_STDERR (3)
     12 Protocol:
     13   - FTP
     14   - HTTP
     15   - SFTP
     16 Added-in: 7.18.0
     17 ---
     18 
     19 # NAME
     20 
     21 CURLOPT_SEEKDATA - pointer passed to the seek callback
     22 
     23 # SYNOPSIS
     24 
     25 ~~~c
     26 #include <curl/curl.h>
     27 
     28 CURLcode curl_easy_setopt(CURL *handle, CURLOPT_SEEKDATA, void *pointer);
     29 ~~~
     30 
     31 # DESCRIPTION
     32 
     33 Data *pointer* to pass to the seek callback function. If you use the
     34 CURLOPT_SEEKFUNCTION(3) option, this is the pointer you get as input.
     35 
     36 # DEFAULT
     37 
     38 If you do not set this, NULL is passed to the callback.
     39 
     40 # %PROTOCOLS%
     41 
     42 # EXAMPLE
     43 
     44 ~~~c
     45 #include <unistd.h> /* for lseek() */
     46 
     47 struct data {
     48   int our_fd;
     49 };
     50 
     51 static int seek_cb(void *clientp, curl_off_t offset, int origin)
     52 {
     53   struct data *d = (struct data *)clientp;
     54   lseek(d->our_fd, offset, origin);
     55   return CURL_SEEKFUNC_OK;
     56 }
     57 
     58 int main(void)
     59 {
     60   struct data seek_data;
     61   CURL *curl = curl_easy_init();
     62   if(curl) {
     63     curl_easy_setopt(curl, CURLOPT_SEEKFUNCTION, seek_cb);
     64     curl_easy_setopt(curl, CURLOPT_SEEKDATA, &seek_data);
     65   }
     66 }
     67 ~~~
     68 
     69 # %AVAILABILITY%
     70 
     71 # RETURN VALUE