Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rework libeinfo #651

Closed
wants to merge 10 commits into from
Closed

rework libeinfo #651

wants to merge 10 commits into from

Commits on Sep 28, 2023

  1. start new libeinfo color handling

    Uses (n)curses/terminfo for "fancy" stuff. No env vars yet.
    
    These functions are not sent to syslog (yet):
    - ewarn
    - ewarnx
    - eerror
    - eerrorx
    
    The syslog id for elog(3) is currently hardcoded.
    
    Some intentional API/behavior differences:
    - ebracket(3) does the same negative column stuff as described in
      _move_col(). Pretty sick if you ask me.
    
    - the length of the "prefix|" string is counted as part of the total
      length returned by einfo(3) et al.
    xxc3nsoredxx committed Sep 28, 2023
    Configuration menu
    Copy the full SHA
    74dd769 View commit details
    Browse the repository at this point in the history
  2. some basic env vars

    Properly implement is_quiet(), is_really_quiet(), and is_verbose() by
    checking the truthyness of the EINFO_QUIET, EERROR_QUIET, EINFO_VERBOSE
    env vars, respectively.
    
    Use the EINFO_LOG env var to set the log id for syslog messages and send
    ewarn(3), ewarnx(3), eerror(3), and eerrorx(3) to syslog. Only happens
    if the env var is set tho.
    
    Behavior change for EINFO_INDENT:
    - integer overflow is treated as valid, but >INDENT_MAX (which it
      arguably is), and therefore chomped to INDENT_MAX
    
    API/behavior changes for EINFO_COLOR:
    - case insensitive on color names
    - more predictable error case (keep current on parse error)
    - use the last (valid) definition if multiple given for a single color
    xxc3nsoredxx committed Sep 28, 2023
    Configuration menu
    Copy the full SHA
    6178bb8 View commit details
    Browse the repository at this point in the history
  3. check setupterm errors, add prepare_term()

    Used to ensure that the terminal is actually good for curses use, and
    enables short circuiting functions that do curses stuff in case the
    terminal is not.
    xxc3nsoredxx committed Sep 28, 2023
    Configuration menu
    Copy the full SHA
    185501d View commit details
    Browse the repository at this point in the history
  4. remove strcat(3)

    Replaced with an array and two calls to tput(s). No need for "proper
    string concatenation" if there is no string concatenation :P
    xxc3nsoredxx committed Sep 28, 2023
    Configuration menu
    Copy the full SHA
    b38926b View commit details
    Browse the repository at this point in the history
  5. sorta check errors

    curses/terminfo errors are "basically handled" through:
    
    - tiparm() returning NULL on error
    - tputs() returning an error if the string is NULL
    
    We don't actually do anything with the tputs() error since all functions
    that call it are void.
    xxc3nsoredxx committed Sep 28, 2023
    Configuration menu
    Copy the full SHA
    6767815 View commit details
    Browse the repository at this point in the history
  6. handle EINFO_LASTCMD

    The rewrite should be "complete" as far as matching features goes. Still
    gotta do some small TODO's. As well as non-curses.
    xxc3nsoredxx committed Sep 28, 2023
    Configuration menu
    Copy the full SHA
    7a3abe8 View commit details
    Browse the repository at this point in the history
  7. eend_status: sane-ish default message

    Set the message in the brackets to "..." if the message is empty. Only
    possible with ebracket().
    xxc3nsoredxx committed Sep 28, 2023
    Configuration menu
    Copy the full SHA
    631f5ce View commit details
    Browse the repository at this point in the history
  8. _elog: make nonnull

    Ensure fmt arg is checked at the call site.
    xxc3nsoredxx committed Sep 28, 2023
    Configuration menu
    Copy the full SHA
    b581b49 View commit details
    Browse the repository at this point in the history
  9. minor cleanup

    xxc3nsoredxx committed Sep 28, 2023
    Configuration menu
    Copy the full SHA
    cdb0722 View commit details
    Browse the repository at this point in the history
  10. Configuration menu
    Copy the full SHA
    ca60832 View commit details
    Browse the repository at this point in the history