473,772 Members | 3,731 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

getopt()

What is the correct format of getopt() and how does it work? I looked
at the man page; it doesn't really clarify things. What's a program
that uses it, maybe I could figure it out from that.

Note: This is on-topic. getopt is part of the standard library.

Andrew Usher

Nov 15 '05 #1
18 3240

[fups set to c.p]

On Sun, 5 Nov 2005 k_**********@ya hoo.com wrote:

What is the correct format of getopt() and how does it work? I looked
at the man page; it doesn't really clarify things. What's a program
that uses it, maybe I could figure it out from that.
man 3 getopt
(is not the same as)
man getopt
Note: This is on-topic. getopt is part of the standard library.


Note: getopt is certainly *NOT* part of the standard library; I don't
know where you got that idea. Questions such as yours which are not
related to ISO standard C should be directed to a group where they'd be
on-topic, such as comp.programmin g, one of the gnu. hierarchy, or perhaps
a Linux programming group.

-Arthur
Nov 15 '05 #2
k_**********@ya hoo.com writes:
getopt is part of the standard library.


No it isn't.
--
"...deficie nt support can be a virtue.
It keeps the amateurs off."
--Bjarne Stroustrup
Nov 15 '05 #3
Ben Pfaff wrote:
k_**********@ya hoo.com writes:
getopt is part of the standard library.


No it isn't.


??? It is in libc. Maybe it's Unix-specific, but C is Unix.

Andrew Usher

Nov 15 '05 #4
k_**********@ya hoo.com writes:
Ben Pfaff wrote:
k_**********@ya hoo.com writes:
> getopt is part of the standard library.


No it isn't.


??? It is in libc. Maybe it's Unix-specific, but C is Unix.


libc is not the standard C library (i.e., the library defined by the C
language standard).

C is a language; Unix is an operating system. C is not Unix; Unix is
not C.

--
Keith Thompson (The_Other_Keit h) ks***@mib.org <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <*> <http://users.sdsc.edu/~kst>
We must do something. This is something. Therefore, we must do this.
Nov 15 '05 #5
Keith Thompson wrote:
??? It is in libc. Maybe it's Unix-specific, but C is Unix.
libc is not the standard C library (i.e., the library defined by the C
language standard).


That library doesn't exist! The only C is the one people actually use.
I don't care for bureaucratic s*** here more than anywhere else.
C is a language; Unix is an operating system. C is not Unix; Unix is
not C.


I know that, obviously. But C is written for Unix and vice versa.

Andrew Usher

P.S. As far as getopt(), I wrote some test programs and I think I have
figured it out. It doesn't really work well with a ':' other than at
the end, though. I think anyone who's serious about processing command
lines would write his own modification.

Nov 15 '05 #6
k_**********@ya hoo.com writes:
Keith Thompson wrote:
> ??? It is in libc. Maybe it's Unix-specific, but C is Unix.


libc is not the standard C library (i.e., the library defined by the C
language standard).


That library doesn't exist! The only C is the one people actually use.
I don't care for bureaucratic s*** here more than anywhere else.


The topic of this newsgroup is the C language as defined by the
standard (which doesn't include getopt). If you want to discuss
something else, there are other newsgroups; in comp.unix.progr ammer,
for example, they're far more likely to be able to answer your
questions than we are.

--
Keith Thompson (The_Other_Keit h) ks***@mib.org <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <*> <http://users.sdsc.edu/~kst>
We must do something. This is something. Therefore, we must do this.
Nov 15 '05 #7
k_**********@ya hoo.com wrote:
but C is Unix.


So what do you call Windows3.1 then? Unix??? It certainly was written
in C as much as any variant of Unix were.

I've written on systems where their libc includes support for CANbus
and ARCnet but I recognise that they were vendor specific additions to
libc. Just because gcc has its own extended libc doesn't mean that ALL
C compilers need to emulate it to conform to C standards (ANSI, C99,
etc).

Nov 15 '05 #8
k_**********@ya hoo.com wrote:
I don't care for bureaucratic s*** here more than anywhere else.


I think the problem with this newgroup,
is that "comp.lang. c" is too easy to spell.

http://www.csclub.uwaterloo.ca/u/dj3...lc-welcome.txt

news:comp.unix. programmer

--
pete
Nov 15 '05 #9
k_**********@ya hoo.com wrote:
Note: This is on-topic. getopt is part of the standard library.


On what do you base this obviously false assertion?
Nov 15 '05 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
2790
by: David Bear | last post by:
I'm stumped. Trying to follow the docs and .. failure. here's the args >>> args '-Middwb@mainex1.asu.edu -AKHAAM@prlinux+898 -CA --D2003-08-20-09:28:13.417 -Ff -Hprlinux --JTCPIP_NPF_TEST_DARS_PORTRAIT -NTCPIP_NPF_TEST_DARS_PORTRAIT --Pholdqueue -Qholdqueue -aacct -b2895 -d/var/spool/lpd/holdqueue -edfA898prlinux -fTCPIP_NPF_TEST_DARS_PORTRAIT -hprlinux -j898 -kcfA898prlinux -l66 -nKHAAM -sstatus -t2003-08-20-09:28:13.000 -w80 -x0 -y0...
4
2296
by: Dan Rawson | last post by:
Is there any way to force getopt to process one option first?? I'd like to be able to pass in the name of a configuration file for my application, then have the remaining command-line parameters over-ride the configuration file if they are present. For the moment, I'm restricted to 2.2 versions. TIA . . . . Dan
3
2320
by: Dominik Kaspar | last post by:
I tried to use getopt and copied the example from: http://www.python.org/doc/current/lib/module-getopt.html but nothing is working... getopt.GetoptError doesn't seem to exist and when i run the program commenting this out, none of "-v", "-h" and "-o" wants to be recognized... what's the matter?! Dominik
3
7029
by: Don Low | last post by:
Hi, I'm going over a script that demonstrates the getopt function. I include the script here: #! /usr/bin/python import sys, getopt, string
6
3695
by: Frans Englich | last post by:
Hello, In my use of getopt.getopt, I would like to make a certain parameter mandatory. I know how to specify such that a parameter must have a value if it's specified, but I also want to make the parameter itself mandatory(combined with a mandatory value, the result is that the user must specify a value). Here's code illustrating my point(see the TODO):
1
13706
by: Andrew | last post by:
Dear Experts, I have a perl program that using Getopt:Std module, when I try to run the GetOpt program, the following error returned: Can’t locate Getopt.pm in @INC (@INC contains: /opt/perl5/lib/5.00502/PA-RISC1.1 /opt/perl5/lib/5.00502 /opt/perl5/lib/site_perl/5.005/PA-RISC1.1 /opt/perl5 I am using Perl 5.6.1 in HPUX 11. Any hints?
14
3873
by: José de Paula | last post by:
Is getopt() and its companions, commonly found in GNU libc and other Unices libc, part of the C standard? Another doubt: I have a switch inside a while loop; is there a way to break out of the loop from the switch without using goto? I mean: start: while(chr = fgetc(inputfile)) { switch(chr)
4
5676
by: pinkfloydhomer | last post by:
I want to be able to do something like: myscript.py * -o outputfile and then have the shell expand the * as usual, perhaps to hundreds of filenames. But as far as I can see, getopt can only get one argument with each option. In the above case, there isn't even an option string before the *, but even if there was, I don't know how to get getopt to give me all the expanded filenames in an option.
1
2311
by: Daniel Mark | last post by:
Hello all: I am using getopt package in Python and found a problem that I can not figure out an easy to do . // Correct input D:\>python AddArrowOnImage.py --imageDir=c:/ // Incorrect input D:\>python AddArrowOnImage.py --imageDi
2
6257
by: auditory | last post by:
I have sources written on linux quite long ago. They are compiled good on current linux machine. but not in VS2005. The cause of problem is #include<getopt.h>. Is there any correspoinding files which can be used instead of getopt.h?? I tried xgetopt.h from codeproject http://www.codeproject.com/cpp/xgetopt.asp
0
9454
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10104
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10038
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9912
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6715
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5354
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4007
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3609
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2850
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.