You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by mt...@apache.org on 2008/04/03 06:33:14 UTC

svn commit: r644160 - /commons/proper/daemon/trunk/src/native/nt/procrun/src/cmdline.c

Author: mturk
Date: Wed Apr  2 21:33:12 2008
New Revision: 644160

URL: http://svn.apache.org/viewvc?rev=644160&view=rev
Log:
Allow CPU embedded suffixes in executable name. The CPU extensing will be stripped when determining the service name if not provided on the command line

Modified:
    commons/proper/daemon/trunk/src/native/nt/procrun/src/cmdline.c

Modified: commons/proper/daemon/trunk/src/native/nt/procrun/src/cmdline.c
URL: http://svn.apache.org/viewvc/commons/proper/daemon/trunk/src/native/nt/procrun/src/cmdline.c?rev=644160&r1=644159&r2=644160&view=diff
==============================================================================
--- commons/proper/daemon/trunk/src/native/nt/procrun/src/cmdline.c (original)
+++ commons/proper/daemon/trunk/src/native/nt/procrun/src/cmdline.c Wed Apr  2 21:33:12 2008
@@ -20,6 +20,10 @@
 #define EXE_SUFFIX      L".EXE"
 #define EXE_SUFFIXLEN   (sizeof(EXE_SUFFIX) / sizeof(WCHAR) - 1)
 
+#define X86_SUFFIX      L".X86"
+#define X64_SUFFIX      L".X64"
+#define A64_SUFFIX      L".I64"
+
 /* Those two are declared in handles.c */
 extern LPWSTR   *_st_sys_argvw;
 extern int      _st_sys_argc;
@@ -84,6 +88,20 @@
     p = _st_sys_argvw[0] + l - EXE_SUFFIXLEN;
     if (lstrcmpiW(p, EXE_SUFFIX) == 0)
         *p = L'\0';
+    /* Strip CPU specific suffixes */
+    l = lstrlenW(_st_sys_argvw[0]);
+    if (l > EXE_SUFFIXLEN) {
+        p = _st_sys_argvw[0] + l - EXE_SUFFIXLEN;
+        if (lstrcmpiW(p, X86_SUFFIX) == 0) {
+            *p = L'\0';
+        }
+        else if (lstrcmpiW(p, X64_SUFFIX) == 0) {
+            *p = L'\0';
+        }
+        else if (lstrcmpiW(p, A64_SUFFIX) == 0) {
+            *p = L'\0';
+        }
+    }
     if (lpszCommands && _st_sys_argc > 1 && lstrlenW(_st_sys_argvw[1]) > 5) {
         if (_st_sys_argvw[1][0] == L'/' &&
             _st_sys_argvw[1][1] == L'/' &&