Quantcast

[SOLVED] How to pass my own command line argument which fuse should ignore?

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

[SOLVED] How to pass my own command line argument which fuse should ignore?

kingsmasher1
This post was updated on .
I wish to pass some command line argument, and wish that fuse should not process it:-

Our main function, whatever is passed, is sent to fuse_main

int main(int argc, char* argv[ ])
{
   return fuse_main(argc, argv, &ifm_oper, NULL);

}

Now, argv can have some of my own options, native to my code but not-recognized by fuse like "-noRename"
if this is passed to fuse, it will say "fuse: unknown option".

Is there any way to make fuse ignore my own command-line arguments?

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: How to pass my own command line argument which fuse should ignore?

kingsmasher1
This post was updated on .
Thanks. Seems like i got the solution:

This is what i did:-

{{{

    struct fuse_args args = FUSE_ARGS_INIT(0, NULL);
    for (i = 0;   i < argc;    i++) {
        if(strcmp(argv[i], "noRename") == 0) {
            doIrename = 1;
            ErrLog("%s() - Setting doIrename flag\n",__FUNCTION__);
        }
        else {
            fuse_opt_add_arg(&args, argv[i]);
        }
        ErrLog("Arg %d %s\n",i, argv[i]);
    }
    return fuse_main(args.argc, args.argv, &ifm_oper, NULL);
}}}
Loading...