[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v2 2/8] findcmd: define find_in_path_var function
From: |
Matheus Afonso Martins Moreira |
Subject: |
[PATCH v2 2/8] findcmd: define find_in_path_var function |
Date: |
Mon, 13 May 2024 07:37:20 -0300 |
It works just like the find_in_path function
but takes a PATH-like variable name instead.
This allows defining and using more PATH-like
variables much more easily.
Signed-off-by: Matheus Afonso Martins Moreira <matheus@matheusmoreira.com>
---
findcmd.c | 7 +++++++
findcmd.h | 1 +
2 files changed, 8 insertions(+)
diff --git a/findcmd.c b/findcmd.c
index fbcc0451..9d64317a 100644
--- a/findcmd.c
+++ b/findcmd.c
@@ -703,3 +703,10 @@ find_in_path (const char *name, char *path_list, int flags)
{
return (find_user_command_in_path (name, path_list, flags, (int *)0));
}
+
+/* Like find_in_path but takes a PATH-like variable instead. */
+char *
+find_in_path_var (const char *name, char *path_var, int flags)
+{
+ return (_find_user_command_internal (name, path_var, flags));
+}
diff --git a/findcmd.h b/findcmd.h
index 6dbded4c..4976e422 100644
--- a/findcmd.h
+++ b/findcmd.h
@@ -34,6 +34,7 @@ extern int is_directory (const char *);
extern int executable_or_directory (const char *);
extern char *find_user_command (const char *);
extern char *find_in_path (const char *, char *, int);
+extern char *find_in_path_var (const char *, char *, int);
extern char *find_path_file (const char *);
extern char *path_value (const char *, int);
extern char *search_for_command (const char *, int);
--
2.44.0
- Re: [PATCH v2 1/8] findcmd: parameterize path variable in functions, (continued)
- Re: Re: [PATCH v2 1/8] findcmd: parameterize path variable in functions, Koichi Murase, 2024/05/14
- Re: Re: [PATCH v2 1/8] findcmd: parameterize path variable in functions, Matheus Afonso Martins Moreira, 2024/05/14
- Re: [PATCH v2 1/8] findcmd: parameterize path variable in functions, Chet Ramey, 2024/05/15
- Re: [PATCH v2 1/8] findcmd: parameterize path variable in functions, Chet Ramey, 2024/05/14
- Re: [PATCH v2 1/8] findcmd: parameterize path variable in functions, Chet Ramey, 2024/05/14
- Re: [PATCH v2 1/8] findcmd: parameterize path variable in functions, Matheus Afonso Martins Moreira, 2024/05/14
- Re: [PATCH v2 1/8] findcmd: parameterize path variable in functions, Matheus Afonso Martins Moreira, 2024/05/14
- Re: [PATCH v2 1/8] findcmd: parameterize path variable in functions, Chet Ramey, 2024/05/15
[PATCH v2 2/8] findcmd: define find_in_path_var function,
Matheus Afonso Martins Moreira <=
[PATCH v2 3/8] builtins/source: extract file executor function, Matheus Afonso Martins Moreira, 2024/05/13
[PATCH v2 4/8] builtins/source: refactor file searching function, Matheus Afonso Martins Moreira, 2024/05/13
[PATCH v2 5/8] builtins/source: parse the -i option, Matheus Afonso Martins Moreira, 2024/05/13
- Re: [PATCH v2 5/8] builtins/source: parse the -i option, Chet Ramey, 2024/05/14
- Re: [PATCH v2 5/8] builtins/source: parse the -i option, Greg Wooledge, 2024/05/14
- Re: [PATCH v2 5/8] builtins/source: parse the -i option, Lawrence Velázquez, 2024/05/14
- Re: [PATCH v2 5/8] builtins/source: parse the -i option, Koichi Murase, 2024/05/14
- Re: [PATCH v2 5/8] builtins/source: parse the -i option, Koichi Murase, 2024/05/14
- Re: [PATCH v2 5/8] builtins/source: parse the -i option, Chet Ramey, 2024/05/15