Skip to content

Conversation

alarixnia
Copy link
Contributor

@alarixnia alarixnia commented Apr 24, 2021

Previously, irssi defined its own tparm() prototype, so passing a variable number of arguments worked.

However, since 0b82f14, <term.h> in included, which on systems using NetBSD's libcurses instead of ncurses, gives the X/Open compliant definition of tparm, which does not work with a variable number of arguments, resulting in a build error.

tiparm() is a variable-argument version of tparm() supported by both ncurses and NetBSD's libcurses. It was added to the X/Open Curses standard in Issue 7, the final version of which was released in November 2009.

from the ncurses man page:

X/Open Curses prototypes tparm with a fixed number of parameters,
rather than a variable argument list.

This implementation uses a variable argument list, but can be con-
figured to use the fixed-parameter list. Portable applications
should provide 9 parameters after the format; zeroes are fine for
this purpose.

In response to review comments by Thomas E. Dickey, X/Open Curses
Issue 7 proposed the tiparm function in mid-2009.

from the ncurses man page:

>X/Open Curses  prototypes tparm with a fixed number of parameters,
>rather than a variable argument list.
>
>This implementation uses a variable argument list, but can be  con-
>figured  to  use  the  fixed-parameter list.  Portable applications
>should provide 9 parameters after the format; zeroes are  fine  for
>this purpose.
>
>In  response  to review comments by Thomas E. Dickey, X/Open Curses
>Issue 7 proposed the tiparm function in mid-2009.

Previously, irssi defined its own tparm prototype, so passing
a variable number of arguments worked.

However, since this change:

irssi@0b82f14

<term.h> in included, which on systems using NetBSD libcurses, gives
the X/Open compliant definition of tparm, which does not work with
a variable number of arguments.
@ailin-nemui
Copy link
Contributor

that's what you get from trying to fix apple :(

@ailin-nemui
Copy link
Contributor

nb we don't have tiparm on Solaris 5.10

@alarixnia
Copy link
Contributor Author

alarixnia commented Apr 24, 2021

@ailin-nemui does irssi compile using solaris 10 curses? i'd expect it not to because their tparm is also fixed-argument

@ailin-nemui
Copy link
Contributor

maybe we have to revert the apple patch and go back to not including term.h

@alarixnia
Copy link
Contributor Author

alarixnia commented Apr 24, 2021

that's fine by me, I'd only worry about it breaking again in the future because of people being unaware of this ncurses vs. other quirk (or being unaware that there's an other to ncurses tbh)

@ailin-nemui
Copy link
Contributor

@mistydemeo any ideas?

@alarixnia
Copy link
Contributor Author

FWIW my first version of this patch just added the missing arguments to tparm(), but it does add a lot of noise to the code.

@ailin-nemui
Copy link
Contributor

for the time being I have attached a no-term.h.patch to the releases page. sorry for the inconvenience

@mistydemeo
Copy link
Contributor

I wonder if we can add a check for tiparm and set a macro which decides whether to use tparm or tiparm based on that?

FWIW my first version of this patch just added the missing arguments to tparm(), but it does add a lot of noise to the code.

How ugly is it? Sounds like it might actually be a good solution.

alarixnia added a commit to alarixnia/irssi that referenced this pull request Apr 26, 2021
Add the missing arguments to tparm. X/Open Curses specifies
tparm takes a fixed number of 10 arguments, while ncurses
has implemented it as a varargs function. tiparm is a standardized
version of varargs tparm, support in both NetBSD libcurses and
ncurses, but not by older versions of Solaris.

This is an alternate fix to the one proposed in irssi/irssi/irssi#1305
that should keep compatibility with older versions of Solaris by
avoiding tiparm.
@ailin-nemui
Copy link
Contributor

@irssi/developers

@alarixnia alarixnia closed this May 2, 2021
@ailin-nemui ailin-nemui added this to the 1.3.0 milestone Oct 11, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants