9
0
Fork 0

getopt: change optstring to const char*

Change getopt optstring parameter type to const char *.
Also change type to const char * of tmp variable which
pointed to optstring. This will only handle readonly.

Signed-off-by: Alexander Aring <alex.aring@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
This commit is contained in:
Alexander Aring 2013-02-07 22:31:39 +01:00 committed by Sascha Hauer
parent c7a9534359
commit 9d90e219c1
2 changed files with 3 additions and 3 deletions

View File

@ -35,7 +35,7 @@ extern char *optarg;
* - options can be mixed with nonoptions (like ls /bin -R) * - options can be mixed with nonoptions (like ls /bin -R)
*/ */
int getopt(int argc, char *argv[], char *optstring); int getopt(int argc, char *argv[], const char *optstring);
struct getopt_context { struct getopt_context {
int opterr; int opterr;

View File

@ -56,10 +56,10 @@ void getopt_context_restore(struct getopt_context *gc)
} }
EXPORT_SYMBOL(getopt_context_restore); EXPORT_SYMBOL(getopt_context_restore);
int getopt(int argc, char *argv[], char *optstring) int getopt(int argc, char *argv[], const char *optstring)
{ {
char curopt; /* current option character */ char curopt; /* current option character */
char *curoptp; /* pointer to the current option in optstring */ const char *curoptp; /* pointer to the current option in optstring */
while(1) { while(1) {
debug("optindex: %d nonopts: %d optind: %d\n", optindex, nonopts, optind); debug("optindex: %d nonopts: %d optind: %d\n", optindex, nonopts, optind);