зеркало из https://github.com/github/ruby.git
dln.c: extra arguments
* dln.h (DLN_FIND_EXTRA_ARG, DLN_FIND_EXTRA_ARG_DECL): allow extra arguments to dln_find_{exe,file}_r(). * dln_find.c (dln_find_exe_r, dln_find_file_r): add extract arguments. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41702 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
Родитель
69bbcbe4c1
Коммит
1f500f0368
|
@ -1,4 +1,9 @@
|
||||||
Sun Jun 30 10:57:13 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
Sun Jun 30 10:58:47 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||||
|
|
||||||
|
* dln.h (DLN_FIND_EXTRA_ARG, DLN_FIND_EXTRA_ARG_DECL): allow extra
|
||||||
|
arguments to dln_find_{exe,file}_r().
|
||||||
|
|
||||||
|
* dln_find.c (dln_find_exe_r, dln_find_file_r): add extract arguments.
|
||||||
|
|
||||||
* process.c (EXPORT_STR, EXPORT_DUP): convert to default process
|
* process.c (EXPORT_STR, EXPORT_DUP): convert to default process
|
||||||
encoding if defined.
|
encoding if defined.
|
||||||
|
|
11
dln.h
11
dln.h
|
@ -30,8 +30,15 @@
|
||||||
|
|
||||||
RUBY_SYMBOL_EXPORT_BEGIN
|
RUBY_SYMBOL_EXPORT_BEGIN
|
||||||
|
|
||||||
char *dln_find_exe_r(const char*,const char*,char*,size_t);
|
#ifndef DLN_FIND_EXTRA_ARG
|
||||||
char *dln_find_file_r(const char*,const char*,char*,size_t);
|
#define DLN_FIND_EXTRA_ARG
|
||||||
|
#endif
|
||||||
|
#ifndef DLN_FIND_EXTRA_ARG_DECL
|
||||||
|
#define DLN_FIND_EXTRA_ARG_DECL
|
||||||
|
#endif
|
||||||
|
|
||||||
|
char *dln_find_exe_r(const char*,const char*,char*,size_t DLN_FIND_EXTRA_ARG_DECL);
|
||||||
|
char *dln_find_file_r(const char*,const char*,char*,size_t DLN_FIND_EXTRA_ARG_DECL);
|
||||||
|
|
||||||
#ifdef USE_DLN_A_OUT
|
#ifdef USE_DLN_A_OUT
|
||||||
extern char *dln_argv0;
|
extern char *dln_argv0;
|
||||||
|
|
16
dln_find.c
16
dln_find.c
|
@ -63,10 +63,12 @@ char *dln_argv0;
|
||||||
char *getenv();
|
char *getenv();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static char *dln_find_1(const char *fname, const char *path, char *buf, size_t size, int exe_flag);
|
static char *dln_find_1(const char *fname, const char *path, char *buf, size_t size, int exe_flag
|
||||||
|
DLN_FIND_EXTRA_ARG_DECL);
|
||||||
|
|
||||||
char *
|
char *
|
||||||
dln_find_exe_r(const char *fname, const char *path, char *buf, size_t size)
|
dln_find_exe_r(const char *fname, const char *path, char *buf, size_t size
|
||||||
|
DLN_FIND_EXTRA_ARG_DECL)
|
||||||
{
|
{
|
||||||
char *envpath = 0;
|
char *envpath = 0;
|
||||||
|
|
||||||
|
@ -82,21 +84,23 @@ dln_find_exe_r(const char *fname, const char *path, char *buf, size_t size)
|
||||||
path = "/usr/local/bin:/usr/ucb:/usr/bin:/bin:.";
|
path = "/usr/local/bin:/usr/ucb:/usr/bin:/bin:.";
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
buf = dln_find_1(fname, path, buf, size, 1);
|
buf = dln_find_1(fname, path, buf, size, 1 DLN_FIND_EXTRA_ARG);
|
||||||
if (envpath) free(envpath);
|
if (envpath) free(envpath);
|
||||||
return buf;
|
return buf;
|
||||||
}
|
}
|
||||||
|
|
||||||
char *
|
char *
|
||||||
dln_find_file_r(const char *fname, const char *path, char *buf, size_t size)
|
dln_find_file_r(const char *fname, const char *path, char *buf, size_t size
|
||||||
|
DLN_FIND_EXTRA_ARG_DECL)
|
||||||
{
|
{
|
||||||
if (!path) path = ".";
|
if (!path) path = ".";
|
||||||
return dln_find_1(fname, path, buf, size, 0);
|
return dln_find_1(fname, path, buf, size, 0 DLN_FIND_EXTRA_ARG);
|
||||||
}
|
}
|
||||||
|
|
||||||
static char *
|
static char *
|
||||||
dln_find_1(const char *fname, const char *path, char *fbuf, size_t size,
|
dln_find_1(const char *fname, const char *path, char *fbuf, size_t size,
|
||||||
int exe_flag /* non 0 if looking for executable. */)
|
int exe_flag /* non 0 if looking for executable. */
|
||||||
|
DLN_FIND_EXTRA_ARG_DECL)
|
||||||
{
|
{
|
||||||
register const char *dp;
|
register const char *dp;
|
||||||
register const char *ep;
|
register const char *ep;
|
||||||
|
|
Загрузка…
Ссылка в новой задаче