File: globus_ftp_client_debug_plugin.example

package info (click to toggle)
globus-ftp-client 5.3-3
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 3,492 kB
  • ctags: 1,763
  • sloc: ansic: 25,084; sh: 8,562; makefile: 340
file content (35 lines) | stat: -rw-r--r-- 1,227 bytes parent folder | download | duplicates (10)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
int main(int argc, char *argv[])
{
    globus_ftp_client_plugin_t restart_plugin;
    globus_ftp_client_handleattr_t handleattr;
    globus_ftp_client_handle_t handle;
    FILE * log;
    char text[256];

    /* Activate the necessary modules */
    globus_module_activate(GLOBUS_FTP_CLIENT_MODULE);
    globus_module_activate(GLOBUS_FTP_CLIENT_DEBUG_PLUGIN_MODULE);

    /* Configure plugin to show custom text, and send plugin data to
     * a custom log file
     */
    log = fopen("gridftp.log", "a");
    sprintf(text, "%s:%ld", argv[0], (long) getpid());

    globus_ftp_client_debug_plugin_init(&debug_plugin, log, text);

    /* Set up our client handle to use the new plugin */
    globus_ftp_client_handleattr_init(&handleattr);
    globus_ftp_client_handleattr_add_plugin(&handleattr, &debug_plugin);
    globus_ftp_client_handle_init(&handle, &handleattr);

    /* As this get is processed, data will be appended to our gridftp.log
     * file
     */
    globus_ftp_client_get(&handle,
                          "ftp://ftp.globus.org/pub/globus/README",
                          GLOBUS_NULL,
                          GLOBUS_NULL,
                          callback_fn,
                          GLOBUS_NULL);
}