yellowman / nsh

OpenBSD networking configuration shell
http://www.nmedia.net/nsh/
Other
177 stars 27 forks source link

move definition of ctl daemons , ctl programs and config file definitions from ctl.c and externs.h to ctl.h #101

Closed smytht closed 1 year ago

smytht commented 1 year ago

move definition of ctl daemons from ctl.c to externs.h move ctl tests for daemon config syntax from ctl.c to externs.h this is to facilitate using ctl tests from other files such as commands.c modify function declaration to include static to avoid duplicate symbols at compile time ...

smytht commented 1 year ago

Chris has requested that a new header file ctl.h be created and the functions and declarations be moved into that ... I will re-draft the pull request... on this basis...

smytht commented 1 year ago

Folks I moved all ctl.c references in externs.h to ctl.h and updated files(with #include ctl.h) that relied on functions or declarations that were moved from externs.h to ctl.ch

smytht commented 1 year ago

sorry some edits did not make it into my revised pull request I have resolved this now Thanks

smytht commented 1 year ago

removed unnecessary modification of route.c as it does not need to include ctl.h

stspdotname commented 1 year ago

Using 'static' declarations in a head file means every .c file which includes the header will contain a copy of the data in the compiled .o file.

Instead I would suggest to keep the definitions in ctl.c and declare the symbols as extern in ctl.h. Like I have done here:

https://github.com/stspdotname/nsh/commit/4d42d8625eca5fc3319383ab3b075a38c70bf7a1

smytht commented 1 year ago

Ok I have implemented both Chris and Stefans Feedback and tested build and ctl test functionality