scroll

scrollbackbuffer program for st
git clone git://git.suckless.org//gitrepos
Log | Files | Refs

commit e518f5e35e1e98ac4e573b8378ece6b00185fab5
parent 8222f08c35b18f20e42175ea008cf3c727e8df7c
Author: Jan Klemkow <j.klemkow@wemelug.de>
Date:   Mon,  3 Feb 2020 23:02:11 +0100

rename str to buf

Diffstat:
Mscroll.c | 18+++++++++---------
1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/scroll.c b/scroll.c @@ -29,7 +29,7 @@ struct line { TAILQ_ENTRY(line) entries; size_t size; size_t len; - char *str; + char *buf; } *bottom; pid_t child; @@ -84,13 +84,13 @@ reset(void) } size_t -strelen(const char *str, size_t size) +strelen(const char *buf, size_t size) { enum {CHAR, BREK, ESC} state = CHAR; size_t len = 0; for (size_t i = 0; i < size; i++) { - char c = str[i]; + char c = buf[i]; switch (state) { case CHAR: @@ -118,7 +118,7 @@ strelen(const char *str, size_t size) } void -addline(char *str, size_t size) +addline(char *buf, size_t size) { struct line *line = malloc(sizeof *line); @@ -126,11 +126,11 @@ addline(char *str, size_t size) die("malloc:"); line->size = size; - line->len = strelen(str, size); - line->str = malloc(size); - if (line->str == NULL) + line->len = strelen(buf, size); + line->buf = malloc(size); + if (line->buf == NULL) die("malloc:"); - memcpy(line->str, str, size); + memcpy(line->buf, buf, size); bottom = line; @@ -167,7 +167,7 @@ scrollup(void) if (line == NULL) return; - write(STDOUT_FILENO, line->str, line->size); + write(STDOUT_FILENO, line->buf, line->size); return; }