LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   Understanding source code (https://www.linuxquestions.org/questions/linux-software-2/understanding-source-code-656969/)

Ashkan_s 07-20-2008 06:50 AM

Understanding source code
 
Hi
I want to read the source code of firestarter firewall. I can't understand the meaning and syntax of the below line:

FIRESTARTER_RULES_DIR "/firestarter"

it use in many places in code such as this instruction:

g_spawn_sync (FIRESTARTER_RULES_DIR "/firestarter",
arg, NULL,
G_SPAWN_STDERR_TO_DEV_NULL,
NULL, NULL,
&output,NULL,&retval, &error)

please help me
thanks

pixellany 07-20-2008 07:12 AM

Just guessing...
It looks like this:
Quote:

FIRESTARTER_RULES_DIR
is a variable that gets set somewhere, and is perhaps the path. Thus, the expression would decode to--e.g.-- /usr/share/firestarter.

It will help if you know what the function "g_spawn_sync" does.

pinniped 07-20-2008 07:14 AM

In that case, you will probably see a line like this elsewhere:

#define FIRESTARTER_RULES_DIR "/blah/blah/blah"

When the preprocessor runs through the code and sees this:
g_spawn_sync (FIRESTARTER_RULES_DIR "/firestarter",

It will expand the variable FIRESTARTER_RULES_DIR to obtain:
g_spawn_sync ("/blah/blah/blah" "/firestarter",

which is equivalent to:
g_spawn_sync ("/blah/blah/blah/firestarter",

So 'FIRESTARTER_RULES_DIR' is simply a directory path; presumably it holds rules for firestarter.

Ashkan_s 07-20-2008 08:39 AM

thanks for your help


All times are GMT -5. The time now is 09:46 AM.