Greetings!

I wanted to add a new subcommand to CVS for the fun of it.  For now, let's 
assume it's a "cvs ls" command to list the contents of a module/directory.  I 
was given the attached instructions by KJ Paradise at SourceGear.  I followed 
them exactly, and 
added my command to the 2 lists under lookup_command_attribute to indicate 
that it (1) will not require a working directory and (2) will not modify the 
repository.

My problem is that it appears to run the subcommand locally, and does not 
contact the pserver.  So I started looking through diff.c and saw things like 
"fire up the server" if we were on the client.  Ok, that made sense, but I 
have to believe that someone has written down which functions to call when on 
the client vs. the server.  I'll go snorkeling through the code some more, 
but if anyone knows of some good hints somewhere, I would surely appreciate 
it!  :)

:)hal mahaffey

--------------------------------------------------------  Attachment 
----------------------------------------
> There are several steps. 
>  
>  1.  In main.c, there is a cmds[] structure.  There is a list of commands 
here. 
>  you will need to create an entry in this table for your function. 
>  
>  There is also a section for documenting your function in one line.  It 
> begins with 
>  
>  static const char *const cmd_usage[] =
>  
>  There is the command lookup function.  You'll probably need to add an 
entry 
>  there as well: 
>  
>  unsigned long int
>  lookup_command_attribute (cmd_name)
>       char *cmd_name;
>  
>  2.  In cvs.h, you will need to put a prototype for your function.  
>  (The PROTO macro is there so that cvs builds with K&R compilers as well as 
> ANSI)
>  
>  3.  Create your file with your function in it. 
>  4.  Modify the Makefile so that your file gets compiled and linked in. 
>  5.  make, fixing any problems. 
>  6.  Replace cvs with the one you just built. 
>  
>  here is a sample foobar.c that you can look at. 
>  
>  --------------------------------------------------------------------
>  foobar.c
>  --------------------------------------------------------------------
>  #include "cvs.h"
>  
>  static const char *const foobar_usage[]=
>  {
>      "\n\tUsage: integer character \n\n",
>      "\t    foobar takes an integer and a character, \n",
>      "\t    and prints a small formatted string\n\n",
>      NULL
>  };
>  
>  int 
>  foobar(argc, argv)
>      int argc;
>      char** argv;
>  {
>      int argone;
>      char argtwo;
>      
>      if(argc != 3)
>          usage (foobar_usage);
>  
>      argone = atoi(argv[1]);
>      argtwo = *argv[2];
>  
>      if ( argone > 0 && argone <10 && 
>          ( ( argtwo >= 'a' && argtwo <='z') ||
>            ( argtwo >= 'A' && argtwo <='Z') ) )
>      {
>          printf("You entered integer \'%d\' and character \'%c\' \n", 
>              argone, argtwo );
>          return (0);
>      }else
>      {
>          usage (foobar_usage);
>   return (-1);
>      }
>  }
>  --------------------------------------------------------------------
>  

Reply via email to