Unix Programming - struct winsize on OSF1?

This is Interesting: Free IT Magazines  
Home > Archive > Unix Programming > March 2005 > struct winsize on OSF1?





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author struct winsize on OSF1?
Michael B Allen

2005-03-26, 6:05 pm

/usr/include/sys/ioctl.h has:

#if !defined(_XOPEN_SOURCE_EXTENDED) || defined(_OSF_SOURCE)
struct winsize {
unsigned short ws_row; /* rows, in characters */
unsigned short ws_col; /* columns, in characters */
unsigned short ws_xpixel; /* horizontal size, pixels */
unsigned short ws_ypixel; /* vertical size, pixels */
};

and yet I get the following error:

$ make
cc -g -D_XOPEN_SOURCE=500 -DVARRAY_INIT_SIZE=3 \
-Isrc -c -o src/shellout.o src/shellout.c
cc: Error: src/shellout.c, line 159: In this declaration, "win"
has no linkage and is of an incomplete type. (incompnolink)
struct winsize win;
-----------------------^
cc: Error: src/shellout.c, line 193: In this statement,
"TIOCGWINSZ" is not declared. (undeclared)
if (ioctl(STDIN_FILENO, TIOCGWINSZ, (char *)&win) < 0) {
-----------------------------^
*** Exit 1
Stop.

If I define _OSF_SOURCE it works. Why? Isn't TIOCGWINSZ a standard
ioctl?

Is there a way to print the macros defined like gcc -E -dM file.c on
OSF1? The -source_listing option doesn't work becuase it trips up the
error too.

Mike
Bjorn Reese

2005-03-27, 7:47 am

Michael B Allen wrote:

> #if !defined(_XOPEN_SOURCE_EXTENDED) || defined(_OSF_SOURCE)


> cc -g -D_XOPEN_SOURCE=500 -DVARRAY_INIT_SIZE=3 \


> If I define _OSF_SOURCE it works. Why? Isn't TIOCGWINSZ a standard
> ioctl?


I presume that setting _XOPEN_SOURCE to 500 does not cause the macro
_XOPEN_SOURCE_EXTENDED to be defined.

> Is there a way to print the macros defined like gcc -E -dM file.c on
> OSF1? The -source_listing option doesn't work becuase it trips up the
> error too.


I think -source_listing is your best bet. Try to combine it with -E or
-show.

--
mail1dotstofanetdotdk
Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com