bug-ncurses
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

getattrs() may return 0 when window pointer is null


From: Midolikawa H.
Subject: getattrs() may return 0 when window pointer is null
Date: Mon, 13 Nov 2017 23:41:43 +0900
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.4.0

Thank you for developing, maintaining and supporting ncurses.

...And I have noticed that
the manual page sais getattrs() returns ERR when window pointer is null,
but in fact, this routine may return 0.

Test code (legacy_test2.c) is here:
----------------------------------------
#include <curses.h>
#include <locale.h>
#include <stdlib.h>

//compile:
// gcc -I/usr/include/ncursesw/ -D_XOPEN_SOURCE_EXTENDED legacy_test2.c -lncursesw

int main()
{
int ret, ret2, ret3;
//int ret4, ret5, ret6, ret7, ret8, ret9, ret10, ret11;

setlocale(LC_ALL,"");
initscr();
start_color();
cbreak(); noecho(); halfdelay(100);

printw("%s\n\n", curses_version() );

printw("sizeof(int)   %ld\n", sizeof(int));
printw("sizeof(short) %ld\n", sizeof(short));
printw("sizeof(long)  %ld\n", sizeof(long));
printw("sizeof(char)  %ld\n\n", sizeof(char));

printw("TRUE  %d\n", TRUE);
printw("FALSE %d\n", FALSE);
printw("OK    %d\n", OK);
printw("ERR   %d\n\n", ERR);

printw("attrset(...) :%d\n", ret = attrset(WA_UNDERLINE | WA_REVERSE | WA_BOLD )); printw("getattrs(stdscr) : %d (%08X)\n", ret2 = getattrs(stdscr), ret2); printw("getattrs((WINDOW *)NULL) : %d (%08X)\n", ret3 = getattrs((WINDOW *)NULL), ret3); //printw("getbegx((WINDOW *)NULL) : %d (%08X)\n", ret4 = getbegx((WINDOW *)NULL), ret4 ); //printw("getbegy((WINDOW *)NULL) : %d (%08X)\n", ret5 = getbegy((WINDOW *)NULL), ret5 ); //printw("getcurx((WINDOW *)NULL) : %d (%08X)\n", ret6 = getcurx((WINDOW *)NULL), ret6 ); //printw("getcury((WINDOW *)NULL) : %d (%08X)\n", ret7 = getcury((WINDOW *)NULL), ret7 ); //printw("getmaxx((WINDOW *)NULL) : %d (%08X)\n", ret8 = getmaxx((WINDOW *)NULL), ret8 ); //printw("getmaxy((WINDOW *)NULL) : %d (%08X)\n", ret9 = getmaxy((WINDOW *)NULL), ret9 ); //printw("getparx((WINDOW *)NULL) : %d (%08X)\n", ret10 = getparx((WINDOW *)NULL), ret10); //printw("getpary((WINDOW *)NULL) : %d (%08X)\n", ret11 = getpary((WINDOW *)NULL), ret11);

refresh();
getch();

endwin();

//printf("attrset(...) %d\n", ret);
//printf("getattrs(stdscr)         : %d (%08X)\n", ret2, ret2);
//printf("getattrs((WINDOW *)NULL) : %d (%08X)\n", ret3, ret3);

return(0);
}
----------------------------------------

PC:  DELL OPTIPLEX780
OS:  Ubuntu 16.04 LTS 64bit (Japanese Remix by Japanese Team)
APP: GNOME Terminal 3.18.3 / XTerm
VER: ncurses 6.0.20160213

Thanks foward,

--
(^v^) (.. )(o^< >^o)
(( ))//^ ))(( ))(( ))
//mm //mm //mm //mm ================================^
.                        yaneno-suzume (as handle) // \



reply via email to

[Prev in Thread] Current Thread [Next in Thread]