aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNguyễn Thái Ngọc Duy <pclouds@gmail.com>2010-04-14 07:03:20 +0200
committerNguyễn Thái Ngọc Duy <pclouds@gmail.com>2010-09-10 18:40:34 +1000
commit292c51299c94985316049c2b2ad7727e33f8faf1 (patch)
tree8d4801af40c6de39cf791b39acd935e09ff6d3b9
parent4fc9774cb660ea99f90466c4253413447e23e2d0 (diff)
downloadbusybox-w32-292c51299c94985316049c2b2ad7727e33f8faf1.tar.gz
busybox-w32-292c51299c94985316049c2b2ad7727e33f8faf1.tar.bz2
busybox-w32-292c51299c94985316049c2b2ad7727e33f8faf1.zip
win32: add get_busybox_exec_path(), which is bb_busybox_exec_path
This function will become bb_busybox_exec_path because there is no fixed installation location on Windows.
-rw-r--r--include/libbb.h4
-rw-r--r--libbb/messages.c4
-rw-r--r--win32/mingw.c9
3 files changed, 17 insertions, 0 deletions
diff --git a/include/libbb.h b/include/libbb.h
index 0933f5385..11d7f27d3 100644
--- a/include/libbb.h
+++ b/include/libbb.h
@@ -1562,7 +1562,11 @@ extern const char bb_path_group_file[];
1562extern const char bb_path_motd_file[]; 1562extern const char bb_path_motd_file[];
1563extern const char bb_path_wtmp_file[]; 1563extern const char bb_path_wtmp_file[];
1564extern const char bb_dev_null[]; 1564extern const char bb_dev_null[];
1565#if ENABLE_PLATFORM_MINGW32
1566#define bb_busybox_exec_path get_busybox_exec_path()
1567#else
1565extern const char bb_busybox_exec_path[]; 1568extern const char bb_busybox_exec_path[];
1569#endif
1566/* util-linux manpage says /sbin:/bin:/usr/sbin:/usr/bin, 1570/* util-linux manpage says /sbin:/bin:/usr/sbin:/usr/bin,
1567 * but I want to save a few bytes here */ 1571 * but I want to save a few bytes here */
1568extern const char bb_PATH_root_path[]; /* "PATH=/sbin:/usr/sbin:/bin:/usr/bin" */ 1572extern const char bb_PATH_root_path[]; /* "PATH=/sbin:/usr/sbin:/bin:/usr/bin" */
diff --git a/libbb/messages.c b/libbb/messages.c
index 07b522bf4..ffa8d00cd 100644
--- a/libbb/messages.c
+++ b/libbb/messages.c
@@ -44,7 +44,11 @@ const char bb_path_group_file[] ALIGN1 = "/etc/group";
44const char bb_path_gshadow_file[] ALIGN1 = "/etc/gshadow"; 44const char bb_path_gshadow_file[] ALIGN1 = "/etc/gshadow";
45const char bb_path_motd_file[] ALIGN1 = "/etc/motd"; 45const char bb_path_motd_file[] ALIGN1 = "/etc/motd";
46const char bb_dev_null[] ALIGN1 = "/dev/null"; 46const char bb_dev_null[] ALIGN1 = "/dev/null";
47#if ENABLE_PLATFORM_MINGW32
48/* bb_busybox_exec_path is redefined to get_busybox_exec_path() in libbb.h */
49#else
47const char bb_busybox_exec_path[] ALIGN1 = CONFIG_BUSYBOX_EXEC_PATH; 50const char bb_busybox_exec_path[] ALIGN1 = CONFIG_BUSYBOX_EXEC_PATH;
51#endif
48const char bb_default_login_shell[] ALIGN1 = LIBBB_DEFAULT_LOGIN_SHELL; 52const char bb_default_login_shell[] ALIGN1 = LIBBB_DEFAULT_LOGIN_SHELL;
49/* util-linux manpage says /sbin:/bin:/usr/sbin:/usr/bin, 53/* util-linux manpage says /sbin:/bin:/usr/sbin:/usr/bin,
50 * but I want to save a few bytes here. Check libbb.h before changing! */ 54 * but I want to save a few bytes here. Check libbb.h before changing! */
diff --git a/win32/mingw.c b/win32/mingw.c
index b879bfbae..57573bf60 100644
--- a/win32/mingw.c
+++ b/win32/mingw.c
@@ -372,3 +372,12 @@ char *realpath(const char *path, char *resolved_path)
372 /* FIXME: need normalization */ 372 /* FIXME: need normalization */
373 return strcpy(resolved_path, path); 373 return strcpy(resolved_path, path);
374} 374}
375
376const char *get_busybox_exec_path(void)
377{
378 static char path[PATH_MAX] = "";
379
380 if (!*path)
381 GetModuleFileName(NULL, path, PATH_MAX);
382 return path;
383}