bug-ncurses
[Top][All Lists]
Advanced

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

slk_label() doesn't remove trailing blanks


From: Alexey Miheev
Subject: slk_label() doesn't remove trailing blanks
Date: Thu, 19 Apr 2007 15:51:46 +0400

LSB 3.1 refers to SUSv2 (The Single UNIX Specification, Version 2) for the
description of the libncurses functions.
According to this standard, upon successful completion, slk_label() returns the 
requested label with
leading and trailing blanks stripped. But in the following example
slk_label() returns strings that have unstripped trailing blanks.

The bug was originally found on Red Hat 4 on x86_64 architecture
(ncurses-5.4-13 library version). But it occurs on other systems as
well.

#include <ncurses.h>

int main(int argc, char* argv[])
{
    WINDOW * win;
    char test1[] = "test1";
    char test2[] = "    test2";
    char test3[] = "test3    ";
    char test4[] = "    test4    ";
    char test5[] = "        ";
    
    slk_init(0); // before initscr
    
    win = initscr();
    
    slk_set(1, test1, 0);
    slk_set(2, test2, 0);
    slk_set(3, test3, 0);
    slk_set(4, test4, 0);
    slk_set(5, test5, 0);
    
    mvprintw(3, 1, "slk_set: ");
        mvprintw(3, 12, "\"%s\",", test1);
        mvprintw(3, 22, "\"%s\",", test2);
        mvprintw(3, 36, "\"%s\",", test3);
        mvprintw(3, 50, "\"%s\",", test4);
        mvprintw(3, 68, "\"%s\"", test5);
    
    mvprintw(5, 1, "slk_label: ");
        mvprintw(5, 12, "\"%s\",", slk_label(1) );
        mvprintw(5, 22, "\"%s\",", slk_label(2) );
        mvprintw(5, 36, "\"%s\",", slk_label(3) );
        mvprintw(5, 50, "\"%s\",", slk_label(4) );
        mvprintw(5, 68, "\"%s\"", slk_label(5) );
    
    slk_refresh();
    
    getch();
    
    endwin();
    
    printf("\n");
    
        return 0;
}

Regards, Miheev Alexey
from Institute of System Programming (ISP RAS), Russia.






reply via email to

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