Just read through the code. Got a few comments:

These errors:
if( g.argc>4 ) fossil_fatal("to much arguments for delete method.");
if( g.argc>4 ) fossil_fatal("to much arguments for show method.");
if( g.argc>4 ) fossil_fatal("to much arguments for create method.");
if( g.argc>4 ) fossil_fatal("to much arguments for start method.");
if( g.argc>4 ) fossil_fatal("to much arguments for stop method.");

should read "Too many arguments for [method_name] method." or "[method_name]
does not take that many arguments.", if left in. However, I suggest removing
them altogether and promoting all input checking to the start of the
cmd_win32_service() method, because all the conditions (g.argc>4) are
identical.

In other words, I suggest re-factoring all of these checks higher up and
only doing it once, i.e., changing this block of code from:

+ void cmd_win32_service(void){
+ int n;
+ const char *zMethod;
+ const char *zSvcName = "Fossil-DSCM"; /* Default service name */
+
+ if( g.argc<3 ){
+    usage("create|delete|show|start|stop ...");
+ }
+ zMethod = g.argv[2];
+ n = strlen(zMethod);
+ if( g.argc==4 ){
+    zSvcName = g.argv[3];
+ }

to:

+ if( g.argc<3 || g.argc>4){
+    usage("create|delete|show|start|stop ...");
+ }
+ zMethod = g.argv[2];
+ n = strlen(zMethod);
+ zSvcName = g.argv[3];


(Note: I'm assuming the usage() function somehow aborts execution when it's
finished.)

-jer

On Mon, Jul 18, 2011 at 1:51 PM, Richard Hipp <d...@sqlite.org> wrote:

> Thomas Schnurrenberger's "fossil service" command - for running Fossil as a
> windows service - is now on the trunk.  But I wonder:  The name of this
> command is very similar to "fossil server" and might be confusing.  Do we
> need to change it to something more distinctive?  Perhaps "fossil wservice"
> or "fossil win-serve".  Other ideas?
>
> --
> D. Richard Hipp
> d...@sqlite.org
>
> _______________________________________________
> fossil-users mailing list
> fossil-users@lists.fossil-scm.org
> http://lists.fossil-scm.org:8080/cgi-bin/mailman/listinfo/fossil-users
>
>
_______________________________________________
fossil-users mailing list
fossil-users@lists.fossil-scm.org
http://lists.fossil-scm.org:8080/cgi-bin/mailman/listinfo/fossil-users

Reply via email to