diff options
author | 2019-06-12 18:21:07 +0000 | |
---|---|---|
committer | 2019-06-12 18:21:07 +0000 | |
commit | 5d19aa34807c4d15f4cfdc782c45526d7bdafde9 (patch) | |
tree | d64277d9c6ba378b07584e1c9f49ada4a5f6a10c | |
parent | change "ssl" to "tls" in various identifiers. (diff) | |
download | wireguard-openbsd-5d19aa34807c4d15f4cfdc782c45526d7bdafde9.tar.xz wireguard-openbsd-5d19aa34807c4d15f4cfdc782c45526d7bdafde9.zip |
The output of line info in the line.log file now contains the
character the cursor is over. This corresponds to the 'a' character
before the '|' character below:
>0x78898a94340 b^0x7889632b320 f.0x7889632b340 3 3 a|abc
Previously it would not have been shown:
>0x78898a94340 b^0x7889632b320 f.0x7889632b340 3 3 |abc
Also, a fake new-line character is shown with '-' before the '|' char.
>0x78898a94340 b^0x7889632b320 f.0x7889632b340 3 3 -|
-rw-r--r-- | usr.bin/mg/log.c | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/usr.bin/mg/log.c b/usr.bin/mg/log.c index 22072452f3e..dd9a6568a52 100644 --- a/usr.bin/mg/log.c +++ b/usr.bin/mg/log.c @@ -1,4 +1,4 @@ -/* $OpenBSD: log.c,v 1.4 2019/06/12 06:01:26 lum Exp $ */ +/* $OpenBSD: log.c,v 1.5 2019/06/12 18:21:07 lum Exp $ */ /* * This file is in the public domain. @@ -124,7 +124,7 @@ mglog_lines(PF funct) { struct line *lp; struct stat sb; - char *curline; + char *curline, *tmp, o; FILE *fd; int i; @@ -143,11 +143,22 @@ mglog_lines(PF funct) for(;;) { i++; curline = " "; - if (i == curwp->w_dotline) + o = ' '; + if (i == curwp->w_dotline) { curline = ">"; - if (fprintf(fd, "%s%p b^%p f.%p %d %d\t|%s\n", curline, + if (lp->l_used > 0 && curwp->w_doto < lp->l_used) + o = lp->l_text[curwp->w_doto]; + else + o = '-'; + } + if (lp->l_size == 0) + tmp = " "; + else + tmp = lp->l_text; + + if (fprintf(fd, "%s%p b^%p f.%p %d %d\t%c|%s\n", curline, lp, lp->l_bp, lp->l_fp, - lp->l_size, lp->l_used, lp->l_text) == -1) { + lp->l_size, lp->l_used, o, tmp) == -1) { fclose(fd); return (FALSE); } |