Commit Graph

12 Commits

Author SHA1 Message Date
Alex Richardson
0348c8fcfa getopt: Fix conversion from string-literal to non-const char *
Define a non-const static char EMSG[] = "" to avoid having to add
__DECONST() to all uses of EMSG. Also make current_dash a const char *
to fix this warning.
2021-01-19 21:23:25 +00:00
Pedro F. Giffuni
8a16b7a18f General further adoption of SPDX licensing ID tags.
Mainly focus on files that use BSD 3-Clause license.

The Software Package Data Exchange (SPDX) group provides a specification
to make it easier for automated tools to detect and summarize well known
opensource licenses. We are gradually adopting the specification, noting
that the tags are considered only advisory and do not, in any way,
superceed or replace the license texts.

Special thanks to Wind River for providing access to "The Duke of
Highlander" tool: an older (2014) run over FreeBSD tree was useful as a
starting point.
2017-11-20 19:49:47 +00:00
Pedro F. Giffuni
6aa225165f getopt(3): recognize option:: as GNU extension for "optional options".
Also ANSIfy a function declaration.

While here update the OpenBSD patch level in getopt_long.c as we
already have the corresponding change.

Obtained from:	NetBSD
MFC after:	2 weeks
2014-06-22 20:13:57 +00:00
Ed Maste
3fb3b97c4d Renumber clauses to reduce diffs to other versions
NetBSD, OpenBSD, and Android's Bionic number the clauses 1 through 3,
so follow suit to make comparison easier.
2013-05-28 20:57:40 +00:00
Warner Losh
c879ae3536 Per Regents of the University of Calfornia letter, remove advertising
clause.

# If I've done so improperly on a file, please let me know.
2007-01-09 00:28:16 +00:00
Andrey A. Chernov
9109761318 Merge some fixes from NetBSD's getopt.c v1.26:
cleanups, handling 'ls -l-', handling '--*'

Note this is in the same time back out of our v1.3
"Don't print an error message if the bad option is '?'"
because it directly violates POSIX.
2004-03-06 17:05:45 +00:00
Mark Murray
4cd0119367 Do not use __progname directly (except in [gs]etprogname(3)).
Also, make an internal _getprogname() that is used only inside
libc. For libc, getprogname(3) is a weak symbol in case a
function of the same name is defined in userland.
2002-03-29 22:43:43 +00:00
David E. O'Brien
333fc21e3c Fix the style of the SCM ID's.
I believe have made all of libc .c's as consistent as possible.
2002-03-22 21:53:29 +00:00
Joseph Koshy
2f46ebcdb7 If the string specifying the allowed options starts with a leading `:',
`getopt(3)' should not print a warning for missing argument values.

PR:		bin/29625
Reviewed by:	mikeh
MFC after:	1 week
2001-08-16 03:27:03 +00:00
Warner Losh
e9d918edb6 Don't print an error message if the bad option is '?'. This has been
in my tree for a long time.  bde reviewed this once upon a time and
said it was OK, iirc.  This also obviates the need to put ? in the
optstring argument to preclude the extra warning message which some
people think confuses users.  When I made my getopt cleanups of a long
time ago, this was the compromise reached.  I just neglected to commit
it until now.
2000-09-04 03:49:22 +00:00
Jordan K. Hubbard
f8d7aff7a0 Fix handling of trailing :'s to match what other OSes do (spit out
a diagnostis).

Submitted by:	Guy Harris <gharris@flashcom.net>
1999-12-17 01:52:15 +00:00
Peter Wemm
662909a780 Import CSRG 4.4BSD-Lite2 lib/libc onto vendor branch 1997-03-11 11:29:42 +00:00