Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

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
  • Loading branch information...
commit 1f500f03685c9e6de1d44e0fef858b066b3cdf8b 1 parent 69bbcbe
@nobu nobu authored
Showing with 25 additions and 9 deletions.
  1. +6 −1 ChangeLog
  2. +9 −2 dln.h
  3. +10 −6 dln_find.c
View
7 ChangeLog
@@ -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
encoding if defined.
View
11 dln.h
@@ -30,8 +30,15 @@
RUBY_SYMBOL_EXPORT_BEGIN
-char *dln_find_exe_r(const char*,const char*,char*,size_t);
-char *dln_find_file_r(const char*,const char*,char*,size_t);
+#ifndef DLN_FIND_EXTRA_ARG
+#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
extern char *dln_argv0;
View
16 dln_find.c
@@ -63,10 +63,12 @@ char *dln_argv0;
char *getenv();
#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 *
-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;
@@ -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:.";
#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);
return buf;
}
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 = ".";
- return dln_find_1(fname, path, buf, size, 0);
+ return dln_find_1(fname, path, buf, size, 0 DLN_FIND_EXTRA_ARG);
}
static char *
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 *ep;
Please sign in to comment.
Something went wrong with that request. Please try again.