Operating System - HP-UX
1833555 Members
3061 Online
110061 Solutions
New Discussion

Re: Help! Wrong /usr/include/stdio.h in HP-UX 11.00

 
SOLVED
Go to solution
Lev Assinovsky
Frequent Advisor

Help! Wrong /usr/include/stdio.h in HP-UX 11.00

Hi!
/usr/include/stdio.h contains the prototype:
extern int snprintf(char *, __size_t, char *,...);
According to man page the 3rd parameter must be of type "const char *"
C-standard, Solaris, Linux have "const char *".
Because of that bug I can't compile my portable app.
I tried to apply patch PHCO_26111 - with no
fix.
Any help will be appreciated.
Sincerely,
Lev
7 REPLIES 7
harry d brown jr
Honored Contributor

Re: Help! Wrong /usr/include/stdio.h in HP-UX 11.00

Have you tried this patch??

http://www2.itrc.hp.com/service/patch/patchDetail.do?patchid=PHCO_28425&context=hpux:800:11:00


and my 11.00 systems don't have "const char" either, though my 11.11 (11i) systems do. I've haven't heard of any issues from our developers, though they might not be using snprintf.

live free or die
harry
Live Free or Die
Alex Glennie
Honored Contributor
Solution

Re: Help! Wrong /usr/include/stdio.h in HP-UX 11.00

this took some finding ....

a) it is a bug, 11.11 reflects the man page correctly.

b) I've been unable to find an internal defect ID but suspect no patch is available as yet ... it was reported recently.

c) advise : raise a call with HP support in case there is a more recent update : 3201730260 is a good internal ref to quote.

OR

Correct the stdio.h snprintf definition to add the "const" in front of "char *format" but be aware any C header files patch may return the format filed definition to it's original incorrect state
Lev Assinovsky
Frequent Advisor

Re: Help! Wrong /usr/include/stdio.h in HP-UX 11.00

Thank you guys!
Are you sure snprintf 11.0 doesn't destroy
char * format ?

Lev
Alex Glennie
Honored Contributor

Re: Help! Wrong /usr/include/stdio.h in HP-UX 11.00

I haven't tried it but a Programming support colleague seems to think it should work.

Also since this has made it into 11.11 it would imply it may not get fixed at 11.00.

I presume your application complained of warnings .... or did it actual error ?
Lev Assinovsky
Frequent Advisor

Re: Help! Wrong /usr/include/stdio.h in HP-UX 11.00

Yes, in my case it is an error
"Can't convert const char * to char *":
const char fmt = "%d...";
snprintf(buf, size, fmt);

Thanks a lot again!
Lev
P.S. Does hpux 11i provides more
support for wchar?
Does it have swscanf for example?
James R. Ferguson
Acclaimed Contributor

Re: Help! Wrong /usr/include/stdio.h in HP-UX 11.00

Hi Lev:

Yes, 'swscanf' and 'wconv' provide wide-character support. See the man pages for 'fwscan(3C)', 'fwprintf', 'fwide(3C)' and 'wconv(3C)' for more information.

Regards!

...JRF...
Lev Assinovsky
Frequent Advisor

Re: Help! Wrong /usr/include/stdio.h in HP-UX 11.00

Hi James:
Well, hp-ux 11.0 doesn't have
fwprintf and man fwprintf as well.
Could you please tell me do you have any
statistics what the majority of HP customers
use: 10.xx, 11.00 or 11.i?

Best regards,
Lev