ELinks 0.16.1.1
cdf_hop Struct Reference

Data saved by create_download_file() for the create_download_file_do() callback. More...

Data Fields

char ** real_file
 Where to save the name of the file that was actually opened.
cdf_callback_Tcallback
 This function will be called when the file has been opened, or when it is known that the file will not be opened.
void * data
 A pointer to be passed to callback.

(Note that these are not member symbols.)

typedef void cdf_callback_T(struct terminal *term, int fd, void *data, download_flags_T flags)
 Type of the callback function that will be called when the file has been opened, or when it is known that the file will not be opened.
static void create_download_file_do (struct terminal *term, char *file, void *data, download_flags_T flags)
 Now that the final name of the download file has been chosen, open the file and call the cdf_callback_T that was originally given to create_download_file().
void create_download_file (struct terminal *term, char *fi, char **real_file, download_flags_T flags, cdf_callback_T *callback, void *data)
 Create a file to which data can be downloaded.

Detailed Description

Data saved by create_download_file() for the create_download_file_do() callback.

◆ cdf_callback_T

typedef void cdf_callback_T(struct terminal *term, int fd, void *data, download_flags_T flags)
related

Type of the callback function that will be called when the file has been opened, or when it is known that the file will not be opened.

Parameters
termThe terminal on which the callback should display any windows. Comes directly from the term argument of create_download_file().
fdA file descriptor to the opened file, or -1 if the file will not be opened. If the real_file argument of create_download_file() was not NULL, the callback may read the name of this file from *real_file.
dataA pointer to any data that the callback cares about. Comes directly from the data argument of create_download_file().
flagsThe same as the flags argument of create_download_file(), except the DOWNLOAD_RESUME_SELECTED bit will be changed to match what the user chose.

◆ create_download_file()

void create_download_file ( struct terminal * term,
char * fi,
char ** real_file,
download_flags_T flags,
cdf_callback_T * callback,
void * data )
related

Create a file to which data can be downloaded.

This function constructs a struct cdf_hop that will be freed when callback returns.

Parameters
termIf any dialog boxes are needed, show them in this terminal.
fiA proposed name for the local file to which the data would be downloaded. "~" here refers to the home directory. create_download_file() treats this original string as read-only.
real_fileIf non-NULL, prepare to save in *real_file the name of the local file that was eventually opened. callback must then arrange for this string to be freed with mem_free().
flagsFlags controlling how to download the file. DOWNLOAD_RESUME_ALLOWED adds a "Resume" button to the dialog. DOWNLOAD_RESUME_SELECTED skips the dialog entirely. DOWNLOAD_EXTERNAL causes the file to be created with settings suitable for a temporary file: give only the user herself access to the file (even if the umask is looser), and create the file with O_EXCL unless resuming.
callbackThis function will be called when the file has been opened, or when it is known that the file will not be opened.
dataA pointer to be passed to callback.

◆ create_download_file_do()

void create_download_file_do ( struct terminal * term,
char * file,
void * data,
download_flags_T flags )
related

Now that the final name of the download file has been chosen, open the file and call the cdf_callback_T that was originally given to create_download_file().

create_download_file() passes this function as a ::lun_callback_T to lookup_unique_name().

Field Documentation

◆ callback

cdf_callback_T* cdf_hop::callback

This function will be called when the file has been opened, or when it is known that the file will not be opened.

◆ data

void* cdf_hop::data

A pointer to be passed to callback.

◆ real_file

char** cdf_hop::real_file

Where to save the name of the file that was actually opened.

One of the arguments of callback is a file descriptor for this file. real_file can be NULL if callback does not care about the name.


The documentation for this struct was generated from the following files: