473,399 Members | 4,192 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,399 software developers and data experts.

Help porting app from HP-UX to Linux

I'm porting a legacy application from HP-UX to Linux. The va_start macro
takes one argument under HP-UX, but takes two under Linux:

va_start under HP-UX takes only one var:

hp:/home/fredgrep va_start
/ndata1/scratch/gcc-3.2/binutils/include/mpw/>
#define va_start(list) list = (char *) &va_alist
va_start under linux takes two:

linux:/home/fredgrep -i va_start
/usr/lib/gcc/i386-redhat-linux/4.1.1/include/stdarg.h
#define va_start(v,l) __builtin_va_start(v,l)
The errors I'm seeing are listed below. What would be the best way to
handle the discrepancy in va_start between the two systems?

>make
lprintf.c: In function 'lprintf':
lprintf.c:73: error: expected declaration specifiers before 'va_dcl'
lprintf.c:89:13: error: macro "va_start" requires 2 arguments, but only
1 given
lprintf.c:145: error: expected '=', ',', ';', 'asm' or '__attribute__'
before 'va_dcl'
lprintf.c:161:13: error: macro "va_start" requires 2 arguments, but only
1 given
lprintf.c:218: error: expected '=', ',', ';', 'asm' or '__attribute__'
before 'va_dcl'
lprintf.c:234:13: error: macro "va_start" requires 2 arguments, but only
1 given
lprintf.c:284: error: expected '{' at end of input
make[1]: *** [lprintf.o] Error 1
make: *** [upper] Error 2

Mar 25 '08 #1
3 5385
James Egan said:
I'm porting a legacy application from HP-UX to Linux. The va_start macro
takes one argument under HP-UX, but takes two under Linux:
In standard C, va_start takes two arguments, the first being the name of
the object with type 'va_list', and the second being the name of the
last-named parameter in the function parameter list.

One possibility is to invoke your HP-UX compiler in conforming mode (in
which case it must accept the two arguments, because otherwise it doesn't
conform). If that won't wash for you, you could try conditional
compilation, I guess.

<snip>

--
Richard Heathfield <http://www.cpax.org.uk>
Email: -http://www. +rjh@
Google users: <http://www.cpax.org.uk/prg/writings/googly.php>
"Usenet is a strange place" - dmr 29 July 1999
Mar 25 '08 #2
On Mar 24, 8:24*pm, James Egan <jegan...@comcast.netwrote:
I'm porting a legacy application from HP-UX to Linux. *The va_start macro
takes one argument under HP-UX, but takes two under Linux:

va_start under HP-UX takes only one var:

hp:/home/fredgrep va_start
/ndata1/scratch/gcc-3.2/binutils/include/mpw/>
#define va_start(list) list = (char *) &va_alist

va_start under linux takes two:

linux:/home/fredgrep -i va_start
/usr/lib/gcc/i386-redhat-linux/4.1.1/include/stdarg.h
#define va_start(v,l) * __builtin_va_start(v,l)

The errors I'm seeing are listed below. *What would be the best way to
handle the discrepancy in va_start between the two systems?
make

lprintf.c: In function 'lprintf':
lprintf.c:73: error: expected declaration specifiers before 'va_dcl'
lprintf.c:89:13: error: macro "va_start" requires 2 arguments, but only
1 given
lprintf.c:145: error: expected '=', ',', ';', 'asm' or '__attribute__'
before 'va_dcl'
lprintf.c:161:13: error: macro "va_start" requires 2 arguments, but only
1 given
lprintf.c:218: error: expected '=', ',', ';', 'asm' or '__attribute__'
before 'va_dcl'
lprintf.c:234:13: error: macro "va_start" requires 2 arguments, but only
1 given
lprintf.c:284: error: expected '{' at end of input
make[1]: *** [lprintf.o] Error 1
make: *** [upper] Error 2
To see an example of how to portably write a varadic function (for
instance to print stuff to a log file) see the C-FAQ starting at
section 15.4 and running over the next few items.
Mar 25 '08 #3
James Egan <je******@comcast.netwrites:
I'm porting a legacy application from HP-UX to Linux. The va_start macro
takes one argument under HP-UX, but takes two under Linux:

va_start under HP-UX takes only one var:

hp:/home/fredgrep va_start
/ndata1/scratch/gcc-3.2/binutils/include/mpw/>
#define va_start(list) list = (char *) &va_alist
va_start under linux takes two:

linux:/home/fredgrep -i va_start
/usr/lib/gcc/i386-redhat-linux/4.1.1/include/stdarg.h
#define va_start(v,l) __builtin_va_start(v,l)
[snip]

The old pre-standard <varargs.hinterface defines a va_start macro
that takes one argument ("man varargs" on your HP-UX system for
details).

The <stdarg.hinterface was introduced in the 1989 ANSI C standard,
if not earlier. In that interface, va_start is a macro that takes
two arguments.

The <varargs.hinterface is still supported on some systems to
support legacy programs, but <stdarg.his the right interface to use.

If at all possible, I suggest modifying the application so it uses
<stdarg.h>, which I'm 99.9% sure you'll find is supported on HP-UX.

If that's not practical, you *might* be able to find an implementation
of the old <varargs.hfor Linux, probably one built on top of
<stdarg.h>. If that's what you need, a Linux newsgroup would be more
likely to help you find it.

--
Keith Thompson (The_Other_Keith) <ks***@mib.org>
Nokia
"We must do something. This is something. Therefore, we must do this."
-- Antony Jay and Jonathan Lynn, "Yes Minister"
Mar 25 '08 #4

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

Similar topics

0
by: rbt | last post by:
Hello there, Depending on the firmware version of the HP printer and the model type, one will encounter a myriad of combinations of the following strings while reading the index page: hp HP...
19
by: Mel | last post by:
i would like to have: ...................................... .. . .. . ...................................... .. . ...
0
by: Raymond L. Buvel | last post by:
I am preparing to release an extension module that interfaces Python to the Class Library for Numbers (http://www.ginac.de/CLN/). This module will provide Python types for arbitrary precision...
4
by: Chris Travers | last post by:
Hi all; A few years ago, I set about porting a PHP application from MySQL to PostgreSQL, after realizing that MySQL wasn't going to be able to handle it. In order to do this, I built a light,...
5
by: xchong.zhou | last post by:
I have a question when I work on Linkedserver The Linkedserver name is ,the Datebase name is Newexec,the Table name is Customers_CoypTest The SQLScript is below: Update ...
7
by: therod | last post by:
I am running Windows Server 2003 SP1 and .Net Framework 1.1 I want to upgrade to .Net 2.0 and I'm pretty sure I should uninstall 1.1 first. Problem is that .NET 1.1 doesn't show up in Control...
1
by: apacheutara | last post by:
hai.. i juz started learning C++ language & started to try creating a program. its a simple contacts list. here's the code: ========================================================= ...
2
by: UnderCoverGuy | last post by:
Hello. I am trying to produce a SQL report query that determines the type (model) of system a user has and based off of that information, CASE selects to determine the amount of and type of memory...
0
by: =?Utf-8?B?RGVs?= | last post by:
Hello I need help I have a 1998 hp and have installed windows xp I can't seem to install a printer driver to make my computer communicate with my old hp 722c printer..I've installed the ones from...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
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...
0
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.