Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/dist/pdisk use getopt_long on netbsd as well as linux



details:   https://anonhg.NetBSD.org/src/rev/17c4cb81d282
branches:  trunk
changeset: 536131:17c4cb81d282
user:      dbj <dbj%NetBSD.org@localhost>
date:      Sun Sep 08 23:49:29 2002 +0000

description:
use getopt_long on netbsd as well as linux

diffstat:

 dist/pdisk/pdisk.c |  10 ++++++----
 1 files changed, 6 insertions(+), 4 deletions(-)

diffs (42 lines):

diff -r b62907d008c4 -r 17c4cb81d282 dist/pdisk/pdisk.c
--- a/dist/pdisk/pdisk.c        Sun Sep 08 23:44:09 2002 +0000
+++ b/dist/pdisk/pdisk.c        Sun Sep 08 23:49:29 2002 +0000
@@ -30,8 +30,10 @@
 // for printf()
 #include <stdio.h>
 
+#if defined(__linux__) || defined(__NetBSD__)
+#include <getopt.h>
+#endif
 #ifdef __linux__
-#include <getopt.h>
 #include <malloc.h>
 #else
 // for malloc() & free()
@@ -376,7 +378,7 @@
 get_options(int argc, char **argv)
 {
     int c;
-#ifdef __linux__
+#if defined(__linux__) || defined(__NetBSD__)
     static struct option long_options[] =
     {
        // name         has_arg                 &flag   val
@@ -414,7 +416,7 @@
     cflag = CFLAG_DEFAULT;
     fflag = FFLAG_DEFAULT;
 
-#ifdef __linux__
+#if defined(__linux__) || defined(__NetBSD__)
     optind = 0;        // reset option scanner logic
     while ((c = getopt_long(argc, argv, "hlvdricp", long_options,
            &option_index)) >= 0)
@@ -423,7 +425,7 @@
     while ((c = getopt(argc, argv, "hlvdraLicp")) != EOF)
 #endif
        {
-#ifndef __linux__
+#if !(defined(__linux__) || defined(__NetBSD__))
        if (c == '?') {
            getopt_error = 1;
            c = optopt;



Home | Main Index | Thread Index | Old Index