Problem with getsubopt on AIX

J

Jason Kilgrow

Does anyone have a simple working example of how AIX implements
getsubopt? I have a program that runs on lots of different platforms
(linux, tru64, hp9000) and getsubopt works the same on all of those
but, for some reason, it refuses to work when I port it to AIX. I've
done a lot of debugging and I've determined that I have a problem when
I try to use getsubopt.

Here is a sample of what I'm doing:

tester.c
========
#include <stdlib.h>

int main(int argc, char* argv[])
{
int optFlag = 0;
char *args = "hp:m:s:";
char *subOpts[] = {'\0'};
extern int optind;
extern char *optarg;
char *options;
char *value;

while ( (optFlag = getopt(argc, argv, args)) != -1 )
{
switch (optFlag)
{
case 'p':
options = optarg;
while (*options != '\0')
{
getsubopt(&options, subOpts, &value);
printf("value: %s\n", value);
}
break;
}
}

return 0;
}


When I run this on my AIX platform, value is null. I'm pretty new to
AIX but it seems to me that it should work the same way no matter
where I run it.

Does anyone have any suggestions?

Thanks.
 
C

Christopher Benson-Manica

Jason Kilgrow said:
Does anyone have a simple working example of how AIX implements
getsubopt? I have a program that runs on lots of different platforms
(linux, tru64, hp9000) and getsubopt works the same on all of those

How about on a Windows platform? That's your clue that getsubopt
isn't standard C, and is thus not discussed on this newsgroup.

http://www.ungerhu.com/jxh/clc.welcome.txt
http://www.eskimo.com/~scs/C-faq/top.html
http://benpfaff.org/writings/clc/off-topic.html
 
J

Jason Kilgrow

All right then. Where can I find documentation on wtf this group is
about? What the posts SHOULD be? Sorry for biting back, but this is
the second time I've been scolded for this post. So, tell me, where
are the rules documented?

"I came here looking for help. And all I found was the barrel of a gun
pointed in my direction."

Excuse me. If I wasn't desperate, would I really post to a newsgroup?
I've actually cross-posted this question in another newsgroup. So,
thanks for nothing everybody.

out.
 
E

Eric Sosman

Jason said:
All right then. Where can I find documentation on wtf this group is
about? What the posts SHOULD be? Sorry for biting back, but this is
the second time I've been scolded for this post. So, tell me, where
are the rules documented?

Um, er, just a little further along in the message
to which you replied with such outrage, one finds

Reviewing your message in light of this information:
All right then.

Then all's right. That's good.
Where can I find documentation on wtf this group is
about?

In the three links you were given.
What the posts SHOULD be?

In the three links you were given.
Sorry for biting back, but this is
the second time I've been scolded for this post.

A slow learner, it appears.
So, tell me, where
are the rules documented?

In the three links you were given. Once again, just
in case you still haven't seen them:

http://www.ungerhu.com/jxh/clc.welcome.txt
http://www.eskimo.com/~scs/C-faq/top.html
http://benpfaff.org/writings/clc/off-topic.html

If you need help learning how to click your mouse, just
ask -- but somewhere else, please.
 
J

Joona I Palaste

Jason Kilgrow said:
All right then. Where can I find documentation on wtf this group is
about? What the posts SHOULD be? Sorry for biting back, but this is
the second time I've been scolded for this post. So, tell me, where
are the rules documented?

I suggest you read the links Christopher posted.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,141
Messages
2,570,817
Members
47,367
Latest member
mahdiharooniir

Latest Threads

Top