X-Git-Url: http://git.iain.cx/?a=blobdiff_plain;f=nssm.cpp;h=a60c3784ff4fffea7862aee852e943fc496396ca;hb=cba3331a303deccf228fec50f30a87ed9ec784ce;hp=f412579aa9a463e4339dbac1b1761c15daf7aafb;hpb=167b3e74003ed8f2b61bda7037f31447c488c29b;p=nssm.git diff --git a/nssm.cpp b/nssm.cpp index f412579..a60c378 100644 --- a/nssm.cpp +++ b/nssm.cpp @@ -1,5 +1,9 @@ #include "nssm.h" +extern unsigned long tls_index; +extern bool is_admin; +extern imports_t imports; + /* String function */ int str_equiv(const char *a, const char *b) { int i; @@ -9,45 +13,89 @@ int str_equiv(const char *a, const char *b) { } } +/* Remove basename of a path. */ +void strip_basename(char *buffer) { + size_t len = strlen(buffer); + size_t i; + for (i = len; i && buffer[i] != '\\' && buffer[i] != '/'; i--); + /* X:\ is OK. */ + if (i && buffer[i-1] == ':') i++; + buffer[i] = '\0'; +} + /* How to use me correctly */ int usage(int ret) { - fprintf(stderr, "NSSM: The non-sucking service manager\n"); - fprintf(stderr, "Version %s, %s\n", NSSM_VERSION, NSSM_DATE); - fprintf(stderr, "Usage: nssm