Github user andrzejdoro commented on a diff in the pull request:

    https://github.com/apache/guacamole-server/pull/205#discussion_r236648814
  
    --- Diff: src/guacd/conf-args.c ---
    @@ -122,3 +128,15 @@ int guacd_conf_parse_args(guacd_config* config, int 
argc, char** argv) {
     
     }
     
    +const char* guacd_conf_get_path(int argc, char** argv) {
    +
    +    /* Find -c option */
    +    int i;
    +    for(i=1; i<argc-1; i++) {
    +        if(strcmp("-c", argv[i]) == 0) return argv[i+1];
    --- End diff --
    
    > Why not parse within `guacd_conf_parse_args()` fully leveraging 
`getopt()`?
    
    We need to find out what is the path to the configuration file before we 
parse command line arguments, since we have to apply any settings from config 
file before we apply any settings from command line (the latter overrides the 
former).
    
    Running `while(getopt(...)...)` may cause permutation of arguments, that's 
why I've decided to manually parse arguments list.
    
    > Couldn't this setting live on the `guacd_config` struct like the others?
    
    I believe that `guacd_config` struct should store contents of a guacd 
configuration file so storing path to the configuration file is not needed 
inside it. We use it only once - when loading configuration file.


---

Reply via email to