]> git.saurik.com Git - apple/libc.git/blobdiff - include/getopt.h
Libc-1353.100.2.tar.gz
[apple/libc.git] / include / getopt.h
index 2759ab2390530dd23ee34b4b4cf215f3fbd0b0db..3247fe01f3e56e5c461c12a9869778f8ffe7aeeb 100644 (file)
@@ -1,26 +1,5 @@
-/*
- * Copyright (c) 2003 Apple Computer, Inc. All rights reserved.
- *
- * @APPLE_LICENSE_HEADER_START@
- * 
- * This file contains Original Code and/or Modifications of Original Code
- * as defined in and that are subject to the Apple Public Source License
- * Version 2.0 (the 'License'). You may not use this file except in
- * compliance with the License. Please obtain a copy of the License at
- * http://www.opensource.apple.com/apsl/ and read it before using this
- * file.
- * 
- * The Original Code and all software distributed under the License are
- * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
- * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
- * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
- * Please see the License for the specific language governing rights and
- * limitations under the License.
- * 
- * @APPLE_LICENSE_HEADER_END@
- */
 /*     $NetBSD: getopt.h,v 1.4 2000/07/07 10:43:54 ad Exp $    */
+/*     $FreeBSD: src/include/getopt.h,v 1.6 2004/02/24 08:09:20 ache Exp $ */
 
 /*-
  * Copyright (c) 2000 The NetBSD Foundation, Inc.
@@ -65,9 +44,9 @@
 #include <unistd.h>
 
 /*
- * Gnu like getopt_long() and BSD4.4 getsubopt()/optreset extensions
+ * GNU-like getopt_long()/getopt_long_only() with 4.4BSD optreset extension.
+ * getopt() is declared here too for GNU programs.
  */
-#if !defined(_POSIX_SOURCE) && !defined(_XOPEN_SOURCE)
 #define no_argument        0
 #define required_argument  1
 #define optional_argument  2
@@ -87,8 +66,21 @@ struct option {
 };
 
 __BEGIN_DECLS
-int getopt_long(int, char * const *, const char *, const struct option *, int *);
-__END_DECLS
+int    getopt_long(int, char * const *, const char *,
+       const struct option *, int *);
+int    getopt_long_only(int, char * const *, const char *,
+       const struct option *, int *);
+#ifndef _GETOPT
+#define        _GETOPT
+int     getopt(int, char * const [], const char *) __DARWIN_ALIAS(getopt);
+
+extern char *optarg;                   /* getopt(3) external variables */
+extern int optind, opterr, optopt;
+#endif
+#ifndef _OPTRESET
+#define        _OPTRESET
+extern int optreset;                   /* getopt(3) external variable */
 #endif
+__END_DECLS
  
 #endif /* !_GETOPT_H_ */