realpath() syntax?

2012-04-11 Thread Paul Gilmartin
z/OS 1.12.  The source:

/* Doc: Print the resolved pathname of each argument
*/
#include stdlib.h
/* appears to contain:
char*realpath(const char * __restrict__,
char * __restrict__);
*/

int main( int argc, char ** argv ) {

char *resolved_name;

/* This is OK.  */
realpath( xyzzy, NULL );

/* This is OK.  */
resolved_name = wombat;

/* this gets:
   ERROR CCN3068 realpath3.c:22
   Operation between types char* and int is not allowed. */
resolved_name = realpath( xyzzy, NULL );

}

My compile command is:

user@MVS:167$ gmake realpath3   
LC_CTYPE= c89 -I.. -D_XOPEN_SOURCE -D_OE_SOCKETS -Wa,ASA,RENT 
-DPLATFORM=OS390  -o realpath3 ../source/realpath3.c  /usr/lib/Xaw.x 
/usr/lib/SM.x /usr/lib/ICE.x /usr/lib/X11.x  -lcurses -lm
in $ENV: /bin/sh -h $
ERROR CCN3068 ./../source/realpath3.c:22Operation between types char* and 
int is not allowed.
CCN0793(I) Compilation failed for file ./../source/realpath3.c.  Object file 
not created.
FSUM3065 The COMPILE step ended with return code 12.
FSUM3017 Could not compile ../source/realpath3.c. Correct the errors and try 
again.

Help!

Thanks,
gil

--
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@bama.ua.edu with the message: INFO IBM-MAIN


Re: realpath() syntax?

2012-04-11 Thread McKown, John
before the

#include stdlib.h

insert the line:

#define _XOPEN_SOURCE_EXTENDED 1

as shown here:
http://publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/EDCLB1B0/3.791

or include the compile parm: -D_XOPEN_SOURCE_EXTENDED=1


--
John McKown 
Systems Engineer IV
IT

Administrative Services Group

HealthMarkets(r)

9151 Boulevard 26 * N. Richland Hills * TX 76010
(817) 255-3225 phone * 
john.mck...@healthmarkets.com * www.HealthMarkets.com

Confidentiality Notice: This e-mail message may contain confidential or 
proprietary information. If you are not the intended recipient, please contact 
the sender by reply e-mail and destroy all copies of the original message. 
HealthMarkets(r) is the brand name for products underwritten and issued by the 
insurance subsidiaries of HealthMarkets, Inc. -The Chesapeake Life Insurance 
Company(r), Mid-West National Life Insurance Company of TennesseeSM and The 
MEGA Life and Health Insurance Company.SM

 

 -Original Message-
 From: IBM Mainframe Discussion List 
 [mailto:IBM-MAIN@bama.ua.edu] On Behalf Of Paul Gilmartin
 Sent: Wednesday, April 11, 2012 12:07 PM
 To: IBM-MAIN@bama.ua.edu
 Subject: realpath() syntax?
 
 z/OS 1.12.  The source:
 
 /* Doc: Print the resolved pathname of each argument
 */
 #include stdlib.h
 /* appears to contain:
   char*realpath(const char * __restrict__,
 char * __restrict__);
 */
 
 int main( int argc, char ** argv ) {
 
 char *resolved_name;
 
 /* This is OK.  */
 realpath( xyzzy, NULL );
 
 /* This is OK.  */
 resolved_name = wombat;
 
 /* this gets:
ERROR CCN3068 realpath3.c:22
Operation between types char* and int is not allowed. */
 resolved_name = realpath( xyzzy, NULL );
 
 }
 
 My compile command is:
 
 user@MVS:167$ gmake realpath3 
   
 LC_CTYPE= c89 -I.. -D_XOPEN_SOURCE -D_OE_SOCKETS 
 -Wa,ASA,RENT -DPLATFORM=OS390  -o realpath3 
 ../source/realpath3.c  /usr/lib/Xaw.x /usr/lib/SM.x 
 /usr/lib/ICE.x /usr/lib/X11.x  -lcurses -lm
 in $ENV: /bin/sh -h $
 ERROR CCN3068 ./../source/realpath3.c:22Operation between 
 types char* and int is not allowed.
 CCN0793(I) Compilation failed for file 
 ./../source/realpath3.c.  Object file not created.
 FSUM3065 The COMPILE step ended with return code 12.
 FSUM3017 Could not compile ../source/realpath3.c. Correct the 
 errors and try again.
 
 Help!
 
 Thanks,
 gil
 
 --
 For IBM-MAIN subscribe / signoff / archive access instructions,
 send email to lists...@bama.ua.edu with the message: INFO IBM-MAIN
 
 

--
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@bama.ua.edu with the message: INFO IBM-MAIN


Re: realpath() syntax?

2012-04-11 Thread Kirk Wolf
Right.  And I would have expected that you should have gotten a compiler
warning about the assumed type of realpath being int, since a
declaration wasn't found without #define _XOPEN_SOURCE_EXTENDED 1

Also, according to the documentation you will get an EINVAL error if the
second argument (the buffer) is NULL.

Kirk Wolf
Dovetailed Technologies
http://dovetail.com

On Wed, Apr 11, 2012 at 12:40 PM, McKown, John 
john.mck...@healthmarkets.com wrote:

 before the

 #include stdlib.h

 insert the line:

 #define _XOPEN_SOURCE_EXTENDED 1

 as shown here:
 http://publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/EDCLB1B0/3.791

 or include the compile parm: -D_XOPEN_SOURCE_EXTENDED=1


 --
 John McKown
 Systems Engineer IV
 IT

 Administrative Services Group

 HealthMarkets(r)

 9151 Boulevard 26 * N. Richland Hills * TX 76010
 (817) 255-3225 phone *
 john.mck...@healthmarkets.com * www.HealthMarkets.com

 Confidentiality Notice: This e-mail message may contain confidential or
 proprietary information. If you are not the intended recipient, please
 contact the sender by reply e-mail and destroy all copies of the original
 message. HealthMarkets(r) is the brand name for products underwritten and
 issued by the insurance subsidiaries of HealthMarkets, Inc. -The Chesapeake
 Life Insurance Company(r), Mid-West National Life Insurance Company of
 TennesseeSM and The MEGA Life and Health Insurance Company.SM



  -Original Message-
  From: IBM Mainframe Discussion List
  [mailto:IBM-MAIN@bama.ua.edu] On Behalf Of Paul Gilmartin
  Sent: Wednesday, April 11, 2012 12:07 PM
  To: IBM-MAIN@bama.ua.edu
  Subject: realpath() syntax?
 
  z/OS 1.12.  The source:
 
  /* Doc: Print the resolved pathname of each argument
  */
  #include stdlib.h
  /* appears to contain:
char*realpath(const char * __restrict__,
  char * __restrict__);
  */
 
  int main( int argc, char ** argv ) {
 
  char *resolved_name;
 
  /* This is OK.  */
  realpath( xyzzy, NULL );
 
  /* This is OK.  */
  resolved_name = wombat;
 
  /* this gets:
 ERROR CCN3068 realpath3.c:22
 Operation between types char* and int is not allowed. */
  resolved_name = realpath( xyzzy, NULL );
 
  }
 
  My compile command is:
 
  user@MVS:167$ gmake realpath3
 
  LC_CTYPE= c89 -I.. -D_XOPEN_SOURCE -D_OE_SOCKETS
  -Wa,ASA,RENT -DPLATFORM=OS390  -o realpath3
  ../source/realpath3.c  /usr/lib/Xaw.x /usr/lib/SM.x
  /usr/lib/ICE.x /usr/lib/X11.x  -lcurses -lm
  in $ENV: /bin/sh -h $
  ERROR CCN3068 ./../source/realpath3.c:22Operation between
  types char* and int is not allowed.
  CCN0793(I) Compilation failed for file
  ./../source/realpath3.c.  Object file not created.
  FSUM3065 The COMPILE step ended with return code 12.
  FSUM3017 Could not compile ../source/realpath3.c. Correct the
  errors and try again.
 
  Help!
 
  Thanks,
  gil
 
  --
  For IBM-MAIN subscribe / signoff / archive access instructions,
  send email to lists...@bama.ua.edu with the message: INFO IBM-MAIN
 
 

 --
 For IBM-MAIN subscribe / signoff / archive access instructions,
 send email to lists...@bama.ua.edu with the message: INFO IBM-MAIN


--
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@bama.ua.edu with the message: INFO IBM-MAIN


Re: realpath() syntax?

2012-04-11 Thread Paul Gilmartin
On Wed, 11 Apr 2012 12:52:16 -0500, Kirk Wolf wrote:

Also, according to the documentation you will get an EINVAL error if the
second argument (the buffer) is NULL.
  
I thought I saw that this had changed, perhaps at 1.13, to
implement a POSIX future direction.  Alas, no; I must have
been reading the OS X man page and displaced by wishful
thinking.

On Wed, Apr 11, 2012 at 12:40 PM, McKown, John wrote:

 #define _XOPEN_SOURCE_EXTENDED 1

 as shown here:
 http://publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/EDCLB1B0/3.791

 or include the compile parm: -D_XOPEN_SOURCE_EXTENDED=1

Works.  Thanks.  I failed to note in POSIX the dependency on
an option.  OS X, Linux, and Solaris all compile it with no such
special action.

-- gil

--
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@bama.ua.edu with the message: INFO IBM-MAIN