Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F98797689
D37867.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
813 B
Referenced Files
None
Subscribers
None
D37867.diff
View Options
diff --git a/lib/libc/stdlib/getopt_long.3 b/lib/libc/stdlib/getopt_long.3
--- a/lib/libc/stdlib/getopt_long.3
+++ b/lib/libc/stdlib/getopt_long.3
@@ -31,7 +31,7 @@
.\" @(#)getopt.3 8.5 (Berkeley) 4/27/95
.\" $FreeBSD$
.\"
-.Dd May 2, 2018
+.Dd December 24, 2022
.Dt GETOPT_LONG 3
.Os
.Sh NAME
@@ -546,3 +546,19 @@
The implementation can completely replace
.Xr getopt 3 ,
but right now we are using separate code.
+.Pp
+.Nm
+makes the assumption that the first argument should always be skipped because
+it's typically the program name.
+As a result, setting
+.Va optind
+to 0 will indicate that
+.Nm
+should reset, and
+.Va optind
+will be set to 1 in the process.
+This behavior differs from
+.Xr getopt 3 ,
+which will handle an
+.Va optind
+value of 0 as expected and process the first element.
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, Oct 5, 7:20 PM (22 h, 1 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
13668457
Default Alt Text
D37867.diff (813 B)
Attached To
Mode
D37867: getopt_long(3): note an inconsistency with getopt(3) in BUGS
Attached
Detach File
Event Timeline
Log In to Comment