Hello.
  
On Mon, Apr 13, 2026 at 03:02:08PM +1000, Seth McDonald wrote:
> On Sun, 12 Apr 2026 at 19:56:41 +0300, Evgeniy Berdnikov wrote:
> >  Absence of terminal is not an error, this is normal situation, such as run
> >  in batch job or systemd service.
> 
> Indeed.  That's why it's checking if errno is _not_ ENOTTY.

 Sorry, you're right, I misread the code.

> >  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.
> 
> So you're saying we should default to not using escape sequences unless
> the terminal is known to support them (as opposed to defaulting to using
> them unless the terminal is known to not support them)?  I'd imagine
> we'd have to cover a lot of cases to be portable, which is possible, but
> IMO not really the best use of time.

 Yes, I think good approach is to do things right, if implementation is
 not very complex. For this case code may be like this:

 int detect_display_attrs(..) {
     ...
     char *term_names[] = { "vt100", "xterm", "linux", NULL };
     int prefix_len;
     char *minus_ptr, *n;
     ...
     minus_ptr = strchrnul(term, '-');
     prefix_len = (int)(minus_ptr - term);
    
     for (n = term_names[0]; n; n++) {
             if (!strncmp(term, n, prefix_len))
                        return 1;
     }
     return 0;
 }
-- 
 Eugene Berdnikov


_______________________________________________
isync-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/isync-devel

Reply via email to