mturk       2004/09/05 00:16:53

  Modified:    daemon/src/native/nt/procrun/apps/prunsrv prunsrv.c
  Log:
  Use return values.
  
  Revision  Changes    Path
  1.7       +18 -7     
jakarta-commons/daemon/src/native/nt/procrun/apps/prunsrv/prunsrv.c
  
  Index: prunsrv.c
  ===================================================================
  RCS file: 
/home/cvs/jakarta-commons/daemon/src/native/nt/procrun/apps/prunsrv/prunsrv.c,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- prunsrv.c 11 Aug 2004 06:36:43 -0000      1.6
  +++ prunsrv.c 5 Sep 2004 07:16:53 -0000       1.7
  @@ -1140,6 +1140,8 @@
   
   void __cdecl main(int argc, char **argv)
   {
  +    UINT rv = 0;
  +
       LPAPXCMDLINE lpCmdline;
   
       apxHandleManagerInitialize();
  @@ -1149,12 +1151,14 @@
       /* Parse the command line */
       if ((lpCmdline = apxCmdlineParse(gPool, _options, _commands)) == NULL) {
           apxLogWrite(APXLOG_MARK_ERROR "Invalid command line arguments");
  +        rv = 1;
           goto cleanup;
       }
       apxCmdlineLoadEnvVars(lpCmdline);
       if (lpCmdline->dwCmdIndex < 5 &&
           !loadConfiguration(lpCmdline)) {
           apxLogWrite(APXLOG_MARK_ERROR "Load configuration failed");
  +        rv = 2;
           goto cleanup;
       }
       /* Set console handler to capture CTRL events */
  @@ -1171,27 +1175,34 @@
       redirectStdStreams(&gStdwrap);
       switch (lpCmdline->dwCmdIndex) {
           case 1: /* Run Service as console application */
  -            docmdDebugService(lpCmdline);
  +            if (!docmdDebugService(lpCmdline))
  +                rv = 3;
           break;
           case 2: /* Run Service */
  -            docmdRunService(lpCmdline);
  +            if (!docmdRunService(lpCmdline))
  +                rv = 4;
           break;
           case 3: /* Stop Service */
  -            docmdStopService(lpCmdline);
  +            if (!docmdStopService(lpCmdline))
  +                rv = 5;
           break;
           case 4: /* Update Service parameters */
  -            docmdUpdateService(lpCmdline);
  +            if (!docmdUpdateService(lpCmdline))
  +                rv = 6;
           break;
           case 5: /* Install Service */
  -            docmdInstallService(lpCmdline);
  +            if (!docmdInstallService(lpCmdline))
  +                rv = 7;
           break;
           case 6: /* Delete Service */
  -            docmdDeleteService(lpCmdline);
  +            if (!docmdDeleteService(lpCmdline))
  +                rv = 8;
           break;
           default:
               /* Unknow command option */
               apxLogWrite(APXLOG_MARK_ERROR "Unknown command line option");
               printUsage(lpCmdline);
  +            rv = 99;
           break;
       }
   
  @@ -1202,5 +1213,5 @@
       apxLogClose(NULL);
       apxHandleManagerDestroy();
       cleanupStdStreams(&gStdwrap);
  -    ExitProcess(0);
  +    ExitProcess(rv);
   }
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to