]> git.deb.at Git - pkg/abook.git/blobdiff - getopt.c
ldif: support parsing from stdin
[pkg/abook.git] / getopt.c
index 0f41fb692366816f1ac535b714c75cbca4ff9a8f..0a24ce5ea69455cae1424b91bbc783924e21c260 100644 (file)
--- a/getopt.c
+++ b/getopt.c
@@ -23,7 +23,7 @@
    License along with the GNU C Library; see the file COPYING.LIB.  If not,
    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
-\f
+
 /* This tells Alpha OSF/1 not to define a getopt prototype in <stdio.h>.
    Ditto for AIX 3.2 and <stdlib.h>.  */
 #ifndef _NO_PROTO
@@ -43,6 +43,7 @@
 #endif
 
 #include <stdio.h>
+#include <strings.h>
 
 /* Comment out all this code if we are using the GNU C Library, and are not
    actually compiling the library itself.  This code is part of the GNU C
@@ -197,7 +198,7 @@ ordering;
 
 /* Value of POSIXLY_CORRECT environment variable.  */
 static char *posixly_correct;
-\f
+
 #ifdef __GNU_LIBRARY__
 /* We want to avoid inclusion of string.h with non-GNU libraries
    because there are many ways it can cause trouble.
@@ -240,7 +241,7 @@ extern int strlen(const char *);
 #endif /* __GNUC__ */
 
 #endif /* not __GNU_LIBRARY__ */
-\f
+
 /* Handle permutation of arguments.  */
 
 /* Describe the part of ARGV that contains non-options that have
@@ -407,7 +408,7 @@ static const char *
 
        return optstring;
 }
-\f
+
 /* Scan elements of ARGV (whose length is ARGC) for option characters
    given in OPTSTRING.
 
@@ -650,6 +651,7 @@ int
                                else
                                {
                                        if (opterr)
+                                       {
                                                if (argv[optind - 1][1] == '-')
                                                        /* --option */
                                                        fprintf(stderr,
@@ -660,6 +662,7 @@ int
                                                        fprintf(stderr,
                                                                _("%s: option `%c%s' doesn't allow an argument\n"),
                                                                argv[0], argv[optind - 1][0], pfound->name);
+                                       }
 
                                        nextchar += strlen(nextchar);
 
@@ -930,7 +933,7 @@ int
 }
 
 #endif /* Not ELIDE_CODE.  */
-\f
+
 #ifdef TEST
 
 /* Compile with -DTEST to make an executable for use in testing