OSDN Git Service

Use the getopt function in compliance with the standard.
authorDavid Gumberg <davidzgumberg@gmail.com>
Sun, 2 Mar 2014 17:59:19 +0000 (09:59 -0800)
committerDavid Gumberg <davidzgumberg@gmail.com>
Sun, 2 Mar 2014 18:35:49 +0000 (18:35 +0000)
This is a simple change to the use of getopt in reboot.c, as per the standard,
getopt does NOT return an EOF, it returns a -1, (this was done to remove
getopt's dependence on stdio.h), and since the standard does not guarantee
that EOF is -1, and the documentation tells us that getopt returns -1,
in my judgement it would be best to test for -1, rather than EOF.

Change-Id: I63a3bb7011eb60753eb910221bbe8ce0a71e6679
Signed-off-by: David Gumberg <davidzgumberg@gmail.com>
reboot/reboot.c

index d9a4227..007dfba 100644 (file)
@@ -35,7 +35,7 @@ int main(int argc, char *argv[])
 
         c = getopt(argc, argv, "p");
 
-        if (c == EOF) {
+        if (c == -1) {
             break;
         }