Author: dpage
Date: 2005-05-23 09:29:14 +0100 (Mon, 23 May 2005)
New Revision: 4230

Modified:
   trunk/pgadmin3/xtra/pgagent/unix.cpp
   trunk/pgadmin3/xtra/pgagent/win32.cpp
Log:
Display filename correctly in usage(), per Raphael Enrici

Modified: trunk/pgadmin3/xtra/pgagent/unix.cpp
===================================================================
--- trunk/pgadmin3/xtra/pgagent/unix.cpp        2005-05-20 21:49:23 UTC (rev 
4229)
+++ trunk/pgadmin3/xtra/pgagent/unix.cpp        2005-05-23 08:29:14 UTC (rev 
4230)
@@ -17,10 +17,12 @@
 #error this file is for unix only!
 #endif
 
-void usage()
+void usage(const wxString &executable)
 {
+       wxFileName *fn = new wxFileName(executable);
+
     wxPrintf(_("Usage:\n"));
-    wxPrintf(_("pgAgent INSTALL [options] <connect-string>\n"));
+    wxPrintf(fn->GetName() + _(" [options] <connect-string>\n"));
     wxPrintf(_("options:\n"));
     wxPrintf(_("-t <poll time interval in seconds (default 10)>\n"));
     wxPrintf(_("-r <retry period after connection abort in seconds (>=10, 
default 30)>\n"));
@@ -76,9 +78,12 @@
        // Statup wx
        wxInitialize();
     
+    wxString executable;
+       executable = wxString::FromAscii(argv[0]);
+
     if (argc < 2)
     {
-        usage();
+        usage(executable);
         return 1;
     }
 

Modified: trunk/pgadmin3/xtra/pgagent/win32.cpp
===================================================================
--- trunk/pgadmin3/xtra/pgagent/win32.cpp       2005-05-20 21:49:23 UTC (rev 
4229)
+++ trunk/pgadmin3/xtra/pgagent/win32.cpp       2005-05-23 08:29:14 UTC (rev 
4230)
@@ -15,6 +15,7 @@
 #error this file is for win32 only!
 #endif
 
+#include <wx/filename.h>
 #include <process.h>
 
 // for debugging purposes, we can start the service paused
@@ -314,11 +315,13 @@
 
 
 
-void usage()
+void usage(const wxString &executable)
 {
+       wxFileName *fn = new wxFileName(executable);
+
     wxPrintf(_("Usage:\n"));
-    wxPrintf(_("pgAgent REMOVE <serviceName>\n"));
-    wxPrintf(_("pgAgent INSTALL <serviceName> [options] <connect-string>\n"));
+    wxPrintf(fn->GetName() + _(" REMOVE <serviceName>\n"));
+    wxPrintf(fn->GetName() + _(" INSTALL <serviceName> [options] 
<connect-string>\n"));
     wxPrintf(_("options:\n"));
     wxPrintf(_("-u <user>\n"));
     wxPrintf(_("-p <password>\n"));
@@ -350,15 +353,15 @@
        // Statup wx
        wxInitialize();
     
+    wxString executable;
+       executable = wxString::FromAscii(*argv++);
+
     if (argc < 3)
     {
-        usage();
+        usage(executable);
         return;
     }
 
-    wxString executable;
-       executable = wxString::FromAscii(*argv++);
-
     wxString command;
        command = wxString::FromAscii(*argv++);
 
@@ -441,7 +444,7 @@
     }
     else
     {
-        usage();
+        usage(executable);
     }
 
     return;


---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?

               http://archives.postgresql.org

Reply via email to