X-Git-Url: http://git.iain.cx/?a=blobdiff_plain;f=nssm.cpp;h=781a228fc153be31cc2d2357964176e7aac77cbc;hb=da3d37ae16f1af9735699ae444128b1224a7103f;hp=02ad21f28c2000040f093367265a4dbddec7e47d;hpb=8754d6de6c36a1859ad0adfef1e456b4a2ebd3a6;p=nssm.git diff --git a/nssm.cpp b/nssm.cpp index 02ad21f..781a228 100644 --- a/nssm.cpp +++ b/nssm.cpp @@ -12,6 +12,17 @@ int str_equiv(const TCHAR *a, const TCHAR *b) { return 1; } +/* Convert a string to a number. */ +int str_number(const TCHAR *string, unsigned long *number) { + if (! string) return 1; + + TCHAR *bogus; + *number = _tcstoul(string, &bogus, 0); + if (*bogus) return 2; + + return 0; +} + /* Remove basename of a path. */ void strip_basename(TCHAR *buffer) { size_t len = _tcslen(buffer);