tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lar...@apache.org
Subject cvs commit: jakarta-tomcat/src/native/mod_jk/nt_service jk_nt_service.c
Date Thu, 28 Feb 2002 03:32:00 GMT
larryi      02/02/27 19:32:00

  Modified:    src/native/mod_jk/nt_service jk_nt_service.c
  Log:
  Add a -n option to specify the display name separately from the service name.
  
  Submitted by: David Schreibmain
  
  Revision  Changes    Path
  1.7       +23 -14    jakarta-tomcat/src/native/mod_jk/nt_service/jk_nt_service.c
  
  Index: jk_nt_service.c
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/src/native/mod_jk/nt_service/jk_nt_service.c,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- jk_nt_service.c	21 Sep 2001 19:51:44 -0000	1.6
  +++ jk_nt_service.c	28 Feb 2002 03:32:00 -0000	1.7
  @@ -57,7 +57,7 @@
    * Description: NT System service for Jakarta/Tomcat                       *
    * Author:      Gal Shachor <shachor@il.ibm.com>                           *
    *              Dave Oxley <Dave@JungleMoss.com>                           *
  - * Version:     $Revision: 1.6 $                                           *
  + * Version:     $Revision: 1.7 $                                           *
    ***************************************************************************/
   
   #include "jk_global.h"
  @@ -114,7 +114,8 @@
   static void WINAPI service_main(DWORD dwArgc, 
                                   char **lpszArgv);
   static void install_service(char *name, 
  -                            char *user, 
  +                            char *dname, 
  +                            char *user,
                               char *password, 
                               char *deps, 
                               BOOL bAutomatic, 
  @@ -156,21 +157,22 @@
       printf("%s - Usage:\n\n", name);
       printf("To install the service:\n");
       printf("%s -i <service name> {optional params} <config properties file>\n",
name);
  -    printf("    Optional parameters\n");
  -    printf("        -u <user name> - In the form DomainName\\UserName (.\\UserName
for local)\n");
  -    printf("        -p <user password>\n");
  -    printf("        -a - Set startup type to automatic\n");
  -    printf("        -d <service dependency> - Can be entered multiple times\n\n");
  +    printf("   Optional parameters\n");
  +    printf("      -n <service display name> - In quotes if contains non-alphanumeric
chars\n");
  +    printf("      -u <user name> - In the form DomainName\\UserName (.\\UserName
for local)\n");
  +    printf("      -p <user password>\n");
  +    printf("      -a - Set startup type to automatic\n");
  +    printf("      -d <service dependency> - Can be entered multiple times\n\n");
       printf("To remove the service:\n");
       printf("%s -r <service name>\n\n", name);
       printf("To start the service:\n");
       printf("%s -s <service name> {optional params}\n", name);
  -    printf("    Optional parameters\n");
  -    printf("        -m <machine>\n\n");
  +    printf("   Optional parameters\n");
  +    printf("      -m <machine>\n\n");
       printf("To stop the service:\n");
       printf("%s -t <service name> {optional params}\n", name);
  -    printf("    Optional parameters\n");
  -    printf("        -m <machine>\n");
  +    printf("   Optional parameters\n");
  +    printf("      -m <machine>\n");
   }
   
   void main(int argc, char **argv)
  @@ -182,6 +184,7 @@
       int count;
       int iAction = acNoAction;
       char *pServiceName = NULL;
  +    char *pServiceDisplayName = NULL;
       char *pUserName = NULL;
       char *pPassword = NULL;
       char *pMachine = NULL;
  @@ -240,12 +243,17 @@
                       } else if(0 == stricmp("d", cmd)) {
                           memcpy(strDependancy+count, argv[i+1], strlen(argv[i+1]));
                           count+= strlen(argv[i+1])+1;
  +                    } else if(0 == stricmp("n", cmd)) {
  +                        pServiceDisplayName = argv[i+1];
                       }
                   }
               }
               switch (iAction) {
               case acInstall:
  -                install_service(pServiceName, pUserName, pPassword, strDependancy, bAutomatic,
argv[i-1]);
  +	        if (pServiceDisplayName == NULL) {
  +		  pServiceDisplayName = pServiceName;
  +		}
  +                install_service(pServiceName, pServiceDisplayName, pUserName, pPassword,
strDependancy, bAutomatic, argv[i-1]);
                   return;
               case acRemove:
                   remove_service(pServiceName);
  @@ -374,7 +382,8 @@
       return fResult;
   }
   
  -void install_service(char *name, 
  +void install_service(char *name,
  +                     char *dname,
                        char *user, 
                        char *password, 
                        char *deps, 
  @@ -417,7 +426,7 @@
       if(schSCManager) {
           schService = CreateService(schSCManager, // SCManager database
                                      name,         // name of service
  -                                   name,         // name to display
  +                                   dname,        // name to display
                                      SERVICE_ALL_ACCESS, // desired access
                                      SERVICE_WIN32_OWN_PROCESS,  // service type
                                      bAutomatic ? SERVICE_AUTO_START : SERVICE_DEMAND_START,
      // start type
  
  
  

--
To unsubscribe, e-mail:   <mailto:tomcat-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:tomcat-dev-help@jakarta.apache.org>


Mime
View raw message