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.
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.