aboutsummaryrefslogtreecommitdiff
path: root/doc/gnunet-c-tutorial.tex
diff options
context:
space:
mode:
authorMatthias Wachs <wachs@net.in.tum.de>2013-06-24 09:27:07 +0000
committerMatthias Wachs <wachs@net.in.tum.de>2013-06-24 09:27:07 +0000
commitd42e0431346cfa1da13c9ac3156dcf1c96a97393 (patch)
treef837fc78603c4d77e5d3406fa1a9ba9425ff3be3 /doc/gnunet-c-tutorial.tex
parent9cc06d175c995c179728ea090e131d2e7319fce2 (diff)
downloadgnunet-d42e0431346cfa1da13c9ac3156dcf1c96a97393.tar.gz
gnunet-d42e0431346cfa1da13c9ac3156dcf1c96a97393.zip
Updating the tutorial section in the source and including
an updated version of the pdf about command line parsing. This update describes how a developer can check if a command line argument was set at all by initializing the variables storing the commandline arguments with a specific value and checking this value after the run function applied the commandline parsing.
Diffstat (limited to 'doc/gnunet-c-tutorial.tex')
-rw-r--r--doc/gnunet-c-tutorial.tex7
1 files changed, 6 insertions, 1 deletions
diff --git a/doc/gnunet-c-tutorial.tex b/doc/gnunet-c-tutorial.tex
index 8ad4d3019..86d68b84b 100644
--- a/doc/gnunet-c-tutorial.tex
+++ b/doc/gnunet-c-tutorial.tex
@@ -594,6 +594,8 @@ static int a_flag;
594 &GNUNET_GETOPT_set_one, &a_flag}, 594 &GNUNET_GETOPT_set_one, &a_flag},
595 GNUNET_GETOPT_OPTION_END 595 GNUNET_GETOPT_OPTION_END
596 }; 596 };
597 string_option = NULL;
598 a_flag = GNUNET_SYSERR;
597// ... 599// ...
598\end{lstlisting} 600\end{lstlisting}
599 601
@@ -602,7 +604,10 @@ the {\tt --help} argument and error handling are taken care of when
602using this approach. Other {\tt GNUNET\_GETOPT\_}-functions can be used 604using this approach. Other {\tt GNUNET\_GETOPT\_}-functions can be used
603to obtain integer value options, increment counters, etc. You can 605to obtain integer value options, increment counters, etc. You can
604even write custom option parsers for special circumstances not covered 606even write custom option parsers for special circumstances not covered
605by the available handlers. 607by the available handlers. To check if an argument was specified by the
608user you initialize the variable with a specific value (e.g. NULL for
609a string and GNUNET\_SYSERR for a integer) and check after parsing
610happened if the values were modified.
606 611
607Inside the {\tt run} method, the program would perform the 612Inside the {\tt run} method, the program would perform the
608application-specific logic, which typically involves initializing and 613application-specific logic, which typically involves initializing and