Understanding the code

Werner Koch wk at gnupg.org
Mon Jan 6 14:02:01 CET 2003


On Mon, 06 Jan 2003 12:03:32 +0000, Noel D Torres Taño said:

> Which places must I touch in the code to allow a new command or option
> to be recognized and coded?

There is a big enum in g10/g10.c, add "oFoo" if you want to implement
the option --foo. Then add an appropriate line into the array of
commands, the format is descriped in utils/argparse.c.  Add a label to
the option parsing switch in main() and set the option; e.g

  case oFoo:  opt.foo = 1; break;

and in g10/options.h add "int foo" to the structre named opt.

For commands it is quite similar, except that you need to do the
actual work in another large switch statement in main.  set_cmd() is
used to make sure that there is only one command set and for some
kludges. 



Shalom-Salam,

   Werner





More information about the Gnupg-devel mailing list