getopt_long.3 (d50ff7de21069d65c972cb7d4e95d7fafc098117) | getopt_long.3 (d646513e57c9d59a7c0cc27a4d41518110db4359) |
---|---|
1.\" $OpenBSD: getopt_long.3,v 1.10 2004/01/06 23:44:28 fgsch Exp $ 2.\" $NetBSD: getopt_long.3,v 1.14 2003/08/07 16:43:40 agc Exp $ 3.\" 4.\" Copyright (c) 1988, 1991, 1993 5.\" The Regents of the University of California. All rights reserved. 6.\" 7.\" Redistribution and use in source and binary forms, with or without 8.\" modification, are permitted provided that the following conditions --- 17 unchanged lines hidden (view full) --- 26.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 27.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 28.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 29.\" SUCH DAMAGE. 30.\" 31.\" @(#)getopt.3 8.5 (Berkeley) 4/27/95 32.\" $FreeBSD$ 33.\" | 1.\" $OpenBSD: getopt_long.3,v 1.10 2004/01/06 23:44:28 fgsch Exp $ 2.\" $NetBSD: getopt_long.3,v 1.14 2003/08/07 16:43:40 agc Exp $ 3.\" 4.\" Copyright (c) 1988, 1991, 1993 5.\" The Regents of the University of California. All rights reserved. 6.\" 7.\" Redistribution and use in source and binary forms, with or without 8.\" modification, are permitted provided that the following conditions --- 17 unchanged lines hidden (view full) --- 26.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 27.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 28.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 29.\" SUCH DAMAGE. 30.\" 31.\" @(#)getopt.3 8.5 (Berkeley) 4/27/95 32.\" $FreeBSD$ 33.\" |
34.Dd May 2, 2018 | 34.Dd December 24, 2022 |
35.Dt GETOPT_LONG 3 36.Os 37.Sh NAME 38.Nm getopt_long , 39.Nm getopt_long_only 40.Nd get long options from command line argument list 41.Sh LIBRARY 42.Lb libc --- 498 unchanged lines hidden (view full) --- 541.Vt const 542as its elements may be permuted (unless 543.Ev POSIXLY_CORRECT 544is set). 545.Pp 546The implementation can completely replace 547.Xr getopt 3 , 548but right now we are using separate code. | 35.Dt GETOPT_LONG 3 36.Os 37.Sh NAME 38.Nm getopt_long , 39.Nm getopt_long_only 40.Nd get long options from command line argument list 41.Sh LIBRARY 42.Lb libc --- 498 unchanged lines hidden (view full) --- 541.Vt const 542as its elements may be permuted (unless 543.Ev POSIXLY_CORRECT 544is set). 545.Pp 546The implementation can completely replace 547.Xr getopt 3 , 548but right now we are using separate code. |
549.Pp 550.Nm 551makes the assumption that the first argument should always be skipped because 552it's typically the program name. 553As a result, setting 554.Va optind 555to 0 will indicate that 556.Nm 557should reset, and 558.Va optind 559will be set to 1 in the process. 560This behavior differs from 561.Xr getopt 3 , 562which will handle an 563.Va optind 564value of 0 as expected and process the first element. |
|