2005-09-20 21:26:39 +08:00
|
|
|
/** \file wutil.h
|
|
|
|
|
|
|
|
Prototypes for wide character equivalents of various standard unix
|
2011-12-27 11:18:46 +08:00
|
|
|
functions.
|
2005-09-20 21:26:39 +08:00
|
|
|
*/
|
2005-10-04 23:11:39 +08:00
|
|
|
#ifndef FISH_WUTIL_H
|
|
|
|
#define FISH_WUTIL_H
|
2005-09-20 21:26:39 +08:00
|
|
|
|
2006-02-06 21:45:32 +08:00
|
|
|
#include <stdlib.h>
|
|
|
|
#include <stdio.h>
|
2005-10-04 23:11:39 +08:00
|
|
|
#include <wchar.h>
|
2005-09-20 21:26:39 +08:00
|
|
|
#include <dirent.h>
|
|
|
|
#include <unistd.h>
|
2005-10-04 23:11:39 +08:00
|
|
|
#include <sys/stat.h>
|
2005-10-06 06:37:08 +08:00
|
|
|
#include <sys/types.h>
|
2006-01-26 17:57:06 +08:00
|
|
|
#include <stdarg.h>
|
2011-12-27 11:18:46 +08:00
|
|
|
#include <string>
|
|
|
|
|
|
|
|
|
2005-09-20 21:26:39 +08:00
|
|
|
|
2006-06-17 21:07:08 +08:00
|
|
|
/**
|
|
|
|
Wide version of the dirent data structure
|
|
|
|
*/
|
2006-02-08 22:58:47 +08:00
|
|
|
struct wdirent
|
|
|
|
{
|
2006-06-17 21:07:08 +08:00
|
|
|
/**
|
|
|
|
The name of the current directory
|
|
|
|
*/
|
2006-02-08 22:58:47 +08:00
|
|
|
wchar_t *d_name;
|
2011-12-27 11:18:46 +08:00
|
|
|
};
|
2006-02-08 22:58:47 +08:00
|
|
|
|
|
|
|
|
2005-11-02 23:41:59 +08:00
|
|
|
/**
|
|
|
|
Call this function on startup to create internal wutil
|
|
|
|
resources. This function doesn't do anything.
|
|
|
|
*/
|
|
|
|
void wutil_init();
|
|
|
|
|
2005-09-20 21:26:39 +08:00
|
|
|
/**
|
|
|
|
Call this function on exit to free internal wutil resources
|
|
|
|
*/
|
|
|
|
void wutil_destroy();
|
|
|
|
|
|
|
|
/**
|
|
|
|
Wide character version of fopen().
|
|
|
|
*/
|
|
|
|
FILE *wfopen(const wchar_t *path, const char *mode);
|
|
|
|
|
|
|
|
/**
|
|
|
|
Wide character version of freopen().
|
|
|
|
*/
|
|
|
|
FILE *wfreopen(const wchar_t *path, const char *mode, FILE *stream);
|
|
|
|
|
|
|
|
/**
|
|
|
|
Wide character version of open().
|
|
|
|
*/
|
|
|
|
int wopen(const wchar_t *pathname, int flags, ...);
|
|
|
|
|
|
|
|
/**
|
|
|
|
Wide character version of creat().
|
|
|
|
*/
|
|
|
|
int wcreat(const wchar_t *pathname, mode_t mode);
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
Wide character version of opendir().
|
|
|
|
*/
|
|
|
|
DIR *wopendir(const wchar_t *name);
|
|
|
|
|
|
|
|
/**
|
|
|
|
Wide character version of stat().
|
|
|
|
*/
|
|
|
|
int wstat(const wchar_t *file_name, struct stat *buf);
|
|
|
|
|
|
|
|
/**
|
|
|
|
Wide character version of lstat().
|
|
|
|
*/
|
|
|
|
int lwstat(const wchar_t *file_name, struct stat *buf);
|
|
|
|
|
|
|
|
/**
|
|
|
|
Wide character version of access().
|
|
|
|
*/
|
|
|
|
int waccess(const wchar_t *pathname, int mode);
|
|
|
|
|
|
|
|
/**
|
|
|
|
Wide character version of perror().
|
|
|
|
*/
|
|
|
|
void wperror(const wchar_t *s);
|
|
|
|
|
|
|
|
/**
|
|
|
|
Wide character version of getcwd().
|
|
|
|
*/
|
|
|
|
wchar_t *wgetcwd( wchar_t *buff, size_t sz );
|
|
|
|
|
|
|
|
/**
|
|
|
|
Wide character version of chdir()
|
|
|
|
*/
|
|
|
|
int wchdir( const wchar_t * dir );
|
|
|
|
|
2011-12-27 11:18:46 +08:00
|
|
|
/**
|
2006-02-02 23:33:30 +08:00
|
|
|
Wide character version of realpath function. Just like the GNU
|
2006-02-02 23:23:56 +08:00
|
|
|
version of realpath, wrealpath will accept 0 as the value for the
|
|
|
|
second argument, in which case the result will be allocated using
|
|
|
|
malloc, and must be free'd by the user.
|
|
|
|
*/
|
|
|
|
wchar_t *wrealpath(const wchar_t *pathname, wchar_t *resolved_path);
|
|
|
|
|
2006-06-17 21:07:08 +08:00
|
|
|
/**
|
|
|
|
Wide character version of readdir()
|
|
|
|
*/
|
2011-12-27 11:18:46 +08:00
|
|
|
std::wstring *wreaddir(DIR *dir, std::wstring &outPath);
|
2006-02-08 22:58:47 +08:00
|
|
|
|
2006-06-14 21:22:40 +08:00
|
|
|
/**
|
|
|
|
Wide character version of dirname()
|
|
|
|
*/
|
2011-12-27 11:18:46 +08:00
|
|
|
std::wstring wdirname( const std::wstring &path);
|
2006-06-14 21:22:40 +08:00
|
|
|
|
|
|
|
/**
|
|
|
|
Wide character version of basename()
|
|
|
|
*/
|
2011-12-27 11:18:46 +08:00
|
|
|
std::wstring wbasename( const std::wstring &path);
|
2006-06-14 21:22:40 +08:00
|
|
|
|
2006-07-20 06:55:49 +08:00
|
|
|
/**
|
|
|
|
Wide character wrapper around the gettext function. For historic
|
|
|
|
reasons, unlike the real gettext function, wgettext takes care of
|
|
|
|
setting the correct domain, etc. using the textdomain and
|
|
|
|
bindtextdomain functions. This should probably be moved out of
|
|
|
|
wgettext, so that wgettext will be nothing more than a wrapper
|
|
|
|
around gettext, like all other functions in this file.
|
|
|
|
*/
|
|
|
|
const wchar_t *wgettext( const wchar_t *in );
|
2006-06-14 21:22:40 +08:00
|
|
|
|
2006-08-11 22:55:28 +08:00
|
|
|
/**
|
|
|
|
Wide character version of getenv
|
|
|
|
*/
|
2012-02-10 11:26:44 +08:00
|
|
|
const wchar_t *wgetenv( const wchar_t *name );
|
2006-08-11 22:55:28 +08:00
|
|
|
|
2006-09-08 22:11:28 +08:00
|
|
|
/**
|
|
|
|
Wide character version of mkdir
|
|
|
|
*/
|
|
|
|
int wmkdir( const wchar_t *dir, int mode );
|
2006-08-11 22:55:28 +08:00
|
|
|
|
2006-10-21 06:33:47 +08:00
|
|
|
/**
|
|
|
|
Wide character version of rename
|
|
|
|
*/
|
2011-12-27 11:18:46 +08:00
|
|
|
int wrename( const wchar_t *oldName, const wchar_t *newName );
|
2006-10-21 06:33:47 +08:00
|
|
|
|
2005-09-20 21:26:39 +08:00
|
|
|
#endif
|