static HWND tablist[NSSM_NUM_TABS];\r
static int selected_tab;\r
\r
-static void strip_basename(char *buffer) {\r
- size_t len = strlen(buffer);\r
- size_t i;\r
- for (i = len; i && buffer[i] != '\\' && buffer[i] != '/'; i--);\r
- /* X:\ is OK. */\r
- if (i && buffer[i-1] == ':') i++;\r
- buffer[i] = '\0';\r
-}\r
-\r
int nssm_gui(int resource, char *name) {\r
/* Create window */\r
HWND dlg = CreateDialog(0, MAKEINTRESOURCE(resource), 0, install_dlg);\r
}\r
}\r
\r
+/* Remove basename of a path. */\r
+void strip_basename(char *buffer) {\r
+ size_t len = strlen(buffer);\r
+ size_t i;\r
+ for (i = len; i && buffer[i] != '\\' && buffer[i] != '/'; i--);\r
+ /* X:\ is OK. */\r
+ if (i && buffer[i-1] == ':') i++;\r
+ buffer[i] = '\0';\r
+}\r
+\r
/* How to use me correctly */\r
int usage(int ret) {\r
print_message(stderr, NSSM_MESSAGE_USAGE, NSSM_VERSION, NSSM_DATE);\r
#include "gui.h"\r
\r
int str_equiv(const char *, const char *);\r
+void strip_basename(char *);\r
\r
#define NSSM "nssm"\r
#define NSSM_VERSION "2.18"\r
/* Arguments are optional */\r
size_t flagslen = 0;\r
size_t s = 0;\r
- size_t i;\r
+ int i;\r
for (i = 2; i < argc; i++) flagslen += strlen(argv[i]) + 1;\r
if (! flagslen) flagslen = 1;\r
\r
}\r
\r
/* Work out directory name */\r
- size_t len = strlen(service->exe);\r
- for (i = len; i && service->exe[i] != '\\' && service->exe[i] != '/'; i--);\r
- memmove(service->dir, service->exe, i);\r
- service->dir[i] = '\0';\r
+ memmove(service->dir, service->exe, sizeof(service->dir));\r
+ strip_basename(service->dir);\r
\r
int ret = install_service(service);\r
cleanup_nssm_service(service);\r