aboutsummaryrefslogtreecommitdiff
path: root/win32/mingw.c
diff options
context:
space:
mode:
authorRon Yorston <rmy@pobox.com>2020-08-13 11:36:29 +0100
committerRon Yorston <rmy@pobox.com>2020-08-13 14:58:01 +0100
commit258ad6a1d52f1811f9de1d6b976f3797f5b31a2b (patch)
treee195bfa9eccb187e3e83ef797f516a92b539787e /win32/mingw.c
parent5a48290d9bdb827657114c24aa75c67bb1bd0ea7 (diff)
downloadbusybox-w32-258ad6a1d52f1811f9de1d6b976f3797f5b31a2b.tar.gz
busybox-w32-258ad6a1d52f1811f9de1d6b976f3797f5b31a2b.tar.bz2
busybox-w32-258ad6a1d52f1811f9de1d6b976f3797f5b31a2b.zip
win32: code shrink
Add a new function, has_path(), to detect that an executable name doesn't require a path look-up. Also, since is_absolute_path() is now only used in shell/ash.c move its definition there from include/mingw.h. Saves 128 bytes.
Diffstat (limited to 'win32/mingw.c')
-rw-r--r--win32/mingw.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/win32/mingw.c b/win32/mingw.c
index faa9f2b57..d9bb6e973 100644
--- a/win32/mingw.c
+++ b/win32/mingw.c
@@ -1803,3 +1803,11 @@ void *get_proc_addr(const char *dll, const char *function,
1803 errno = ENOSYS; 1803 errno = ENOSYS;
1804 return proc->pfunction; 1804 return proc->pfunction;
1805} 1805}
1806
1807/* Return true if file is referenced using a path. This means a path
1808 * look-up isn't required. */
1809int has_path(const char *file)
1810{
1811 return strchr(file, '/') || strchr(file, '\\') ||
1812 has_dos_drive_prefix(file);
1813}