Logo Search packages:      
Sourcecode: rapple version File versions  Download package

rpl_str_t rpl_fs_get_cwd ( void   ) 

Returns current working directory.

current working directory.

Definition at line 326 of file fsutil.c.

References rpl_log_fatal(), rpl_me_free(), rpl_me_malloc(), and rpl_message_get().

Referenced by rpl_fs_mkdir(), and rpl_fs_normalize_path().

    int         buf_size = RPL_FS_CWD_BUF_SIZE;
    rpl_str_t    cwd;

    /* buffer size required to hold the current working directory must be determined dynamically */
    while(1) {
        errno = 0;
        if((cwd = (rpl_str_t) rpl_me_malloc(buf_size)) == NULL)
            rpl_log_fatal(rpl_message_get("OUT_OF_MEMORY", strerror(errno), RPL_EOM));
        errno = 0;
        if(getcwd(cwd, buf_size-1) != NULL)
            return cwd;

        if(errno != ERANGE)
            rpl_log_fatal(rpl_message_get("FS_UNABLE_TO_DETERMINE_CWD", strerror(errno), RPL_EOM));
        buf_size += RPL_FS_CWD_BUF_SIZE;

Generated by  Doxygen 1.6.0   Back to index