Hello.
On Sun, Apr 12, 2026 at 04:14:22PM +1000, Seth McDonald via isync-devel wrote:
> +/*
> + * Attempts to guess whether the file descriptor 'fd' supports display
> + * attributes via escape sequences. Returns one if supported, and zero
> + * otherwise.
> + */
> +int
> +detect_display_attrs( int fd )
> +{
> + errno = 0;
> + if (!isatty( fd )) {
> + if (errno != ENOTTY)
> + sys_error( "Cannot examine file descriptor %d", fd );
Absence of terminal is not an error, this is normal situation, such as run
in batch job or systemd service.
> + return 0;
> + }
> +
> + const char *term = getenv( "TERM" );
> + if (term && !strcmp( term, "dumb" ))
> + return 0;
You are assuming all terminals different from "dumb" do support vt100-like
escape sequences. This is almost true, because other terminals are
historical artefacts. Moreover, in case of undefined TERM this code produces
escape sequences. I think it should not be.
You have better to check explicitly at least for "xterm", "linux" and "vt100"
(with account for suffixes after "-" character, as term(7) and terminfo(5)
stated), and do not use vt100-like escapes for unknown/undefined terminals.
--
Eugene Berdnikov
_______________________________________________
isync-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/isync-devel