mutt-kz
mutt-kz copied to clipboard
sidebar.c fails with lvalue error
sidebar.c: In function ‘make_sidebar_entry’:
sidebar.c:313:7: error: lvalue required as left operand of assignment
COLS = width + SidebarWidth;
^
sidebar.c:315:7: error: lvalue required as left operand of assignment
COLS = oc;
^
I changed
/* Temporarily lie about the screen width */
int oc = COLS;
COLS = width + SidebarWidth;
mutt_FormatString (buf, buflen, 0, NONULL(SidebarFormat), cb_format_str, (unsigned long) &sbe, 0);
COLS = oc;
to
/* Temporarily lie about the screen width */
int oc;
oc = width + SidebarWidth;
mutt_FormatString (buf, buflen, 0, NONULL(SidebarFormat), cb_format_str, (unsigned long) &sbe, 0);
and things seem to work.
Oh dear. That's worrying. The COLS variable is part of ncurses and is hard-coded throughout mutt. Sidebar temporarily changes its value so that mutt_FormatString gets the width right.
I shall go away and have a think about what to do...
@LMariachi OK, I searched through the ncurses headers and found what the problem is. Your version of ncurses is reentrant. In the non-reentrant (single-threaded) version COLS is an integer (which I can set). In the reentrant (multithreaded) version COLS is a function (which obviously can't be set).
Please try adding this near the top of mutt_curses.h and let me know if it makes a difference.
#if defined (__CYGWIN__)
#define NCURSES_REENTRANT 0
#endif
Bedtime, now.
Nope, same error as before.
Hmm... Starting again with clean source, please try:
autoreconf -i; ./configure --enable-sidebar CFLAGS="-DNCURSES_REENTRANT=0"; make
Had to add --with-homespool=~/mbox to the configure line, but the build failed anyway. Output attached.
OK, this isn't going to work. Thanks for your debugging. I'll keep thinking...