\begin{lstlisting}
$ export CPPFLAGS="-I/path/to/gnunet/headers"
$ export LDFLAGS="-L/path/to/gnunet/libraries"
-$ gcc -o testbed-test testbed_test.c -lgnunettestbed -lgnunetdht -lgnunetutil
+$ gcc $CPPFLAGS $LDFLAGS -o testbed-test testbed_test.c -lgnunettestbed -lgnunetdht -lgnunetutil
\end{lstlisting}
The \texttt{CPPFLAGS} and \texttt{LDFLAGS} are necessary if GNUnet is installed
into a different directory other than \texttt{/usr/local}.
&GNUNET_GETOPT_set_one, &a_flag},
GNUNET_GETOPT_OPTION_END
};
+ string_option = NULL;
+ a_flag = GNUNET_SYSERR;
// ...
\end{lstlisting}
using this approach. Other {\tt GNUNET\_GETOPT\_}-functions can be used
to obtain integer value options, increment counters, etc. You can
even write custom option parsers for special circumstances not covered
-by the available handlers.
+by the available handlers. To check if an argument was specified by the
+user you initialize the variable with a specific value (e.g. NULL for
+a string and GNUNET\_SYSERR for a integer) and check after parsing
+happened if the values were modified.
Inside the {\tt run} method, the program would perform the
application-specific logic, which typically involves initializing and
transmit_cb (void *cls, size_t size, void *buf)
{
// ...
- if (NULL == buf) { handle_error(); return 0; }
+ if (NULL == buf) { /* handle error here */; return 0; }
GNUNET_assert (size >= msg_size);
memcpy (buf, my_msg, msg_size);
// ...