Talk:Getopt
This is the talk page for discussing improvements to the Getopt article. This is not a forum for general discussion of the article's subject. |
Article policies
|
Find sources: Google (books · news · scholar · free images · WP refs) · FENS · JSTOR · TWL |
This article was nominated for deletion on 30 October 2009 (UTC). The result of the discussion was Withdrawn. |
This article is rated C-class on Wikipedia's content assessment scale. It is of interest to the following WikiProjects: | |||||||||||||||||||||||||||||||||||||
|
Header Section
[edit]How did this article come to be flagged as having a header section which does not adequately summarise the contents? Did somebody add it or is it based on some ratio of header size to article size? Anyway I have been thinking about how it might be improved but have not come up with anything as the purpose of getopt is fundamentally simple even if the details of its use are slightly less simple. Does anyone else have any ideas here or could we just remove that flag? Steve James (talk)
Return Value
[edit]Re https://en.wikipedia.org/w/index.php?title=Getopt&curid=24881187&diff=664142126&oldid=664136673 :
-1 is the return value document by POSIX; EOF was historically documented by many platforms, e.g. 4.3BSD, Solaris 2.9. Since EOF is guaranteed to be -ve the portable approach is to write 'getopt(...) >= 0'. Ewx (talk) 07:55, 27 May 2015 (UTC)
You are mistaken, here is the relevant part of the man page from Solaris 9:
... Otherwise, getopt() returns -1 when all command line options are parsed.
Here is a relevant BSD related SCCS delta comment:
Thu Apr 27 13:52:32 1995 bostic * getopt.c 8.3 POSIX.2 has changed getopt to return -1 instead of EOF (to decouple getopt() from standard i/o). This change is more pedantic than functional as EOF is defined to be -1. Also, POSIX.2 says that getopt lives in unistd.h , not stdlib.h. From: "J.T. Conklin" <jtc@sun-lamp.cs.berkeley.edu>
You see, even on BSD, EOF is history since more than 20 years. Schily (talk) 10:23, 27 May 2015 (UTC)
Ewx's comment matches Oracle's documentation, which can be found here:
The quote (still need a verifiable source) from Keith Bostic is irrelevant, because the date puts it in 4.4BSD (Ewx did say 4.3). Along those lines, a link to Ultrix's manpage agrees with Ewx. Finally, the rationale in POSIX is the appropriate place to start from, rather than a couple of unverifiable statements. Even if you find a verifiable source (for Solaris 9), the existing one for Solaris 9 says that Sun had not modified this detail as of 6 years after Bostic's comment. TEDickey (talk) 21:15, 27 May 2015 (UTC)
FWIW https://www.freebsd.org/cgi/man.cgi?query=getopt&apropos=0&sektion=3&manpath=SunOS+5.9&arch=default&format=html was my source for Solaris 9.
Rationale: "The getopt() function shall return -1, rather than EOF, so that <stdio.h> is not required." - that's a pretty silly reason for changing the interface, IMO. Ewx (talk) 08:23, 28 May 2015 (UTC)
- The so called quoted Solaris 9 documentation from above is outdated. The official man page for Solaris 9 says: "Last change: 13 Sep 2002" and does not mention EOF.
- Regarding methods to avoid include files, this is indeed a goal for POSIX and the typical error indication on UNIX is return -1. Only stdio is an exception and getopt() is not related to stdio. Also note that SUSv2 (from 1997) mentions -1 as return code for getopt() errors. Schily (talk) 11:28, 28 May 2015 (UTC)
I see. Oracle's webpages are not official (Oracle owns Solaris), but you are providing the official documentation? You probably are again attempting to make a joke, because the statement is absurd. As I suggested previously, you could possibly improve your comment before (by providing a verifiable source), but it would be pointless, since the point you were attempting to make cannot be made with the existing sources. TEDickey (talk) 23:23, 28 May 2015 (UTC)
- As mentioned many times in the past: You need to learn how to interpret sources... and as mentioned already, the documentation you pointed to is outdated and I don't care to discuss why....Schily (talk) 10:03, 1 June 2015 (UTC)
Since you do not provide a verifiable source, there is no date to discuss, even if you had a point to make. TEDickey (talk) 00:12, 2 June 2015 (UTC)
- You again verified that you still have to learn how Wikipedia works... I of course provided a verifiable source as I identified the document that you need to read. It is your duty to get hold of that document since verifiable sources do not need to exist in the internet. Schily (talk) 09:35, 2 June 2015 (UTC)
As interesting as the debate about the Solaris documentation is, given this function has been standardised by POSIX it seems right that the article should concentrate on the POSIX standard version. Though there would be no harm in noting implementation difference this should be after having described the standard behaviour. Steve James (talk)
Equal chances for Vendor specific enhancements
[edit]In order to give different Vendors equal chances, we need to either remove the GNU getopt related example in the article, or add an example that helps to understand the OpenSolaris enhancements for long options. Schily (talk) 13:29, 6 February 2017 (UTC)
With reference to the above it seems to me to be a backward step to remove the GNU example. If you or someone familiar with Solaris were to add a Solaris example then surely just go ahead and add it. Steve James (talk)
Footnoted link to a .NET Framework implementation may be a malware site
[edit]Footnote #11 contains a link to a web site the footnote says has a .NET implementation of Getopt. Clicking on that link in Chrome (latest version as of 2019-12-13) brings up a Chrome warning that Codeplex is a possible malware host. Given that the Wikipedia article says Microsoft discontinued/archived the site in 2017, I suggest that link be removed or replaced. I found several alternatives with a web search, including at least one from Nuget, but since I have not personally tried any of these (yet), I did not proactively update the link today. — Preceding unsigned comment added by 107.218.184.189 (talk) 17:20, 13 December 2019 (UTC)
- C-Class Computing articles
- Low-importance Computing articles
- C-Class software articles
- Mid-importance software articles
- C-Class software articles of Mid-importance
- All Software articles
- All Computing articles
- C-Class Linux articles
- Mid-importance Linux articles
- WikiProject Linux articles
- C-Class C/C++ articles
- High-importance C/C++ articles
- C articles
- WikiProject C/C++ articles