Introduction
Introduction Statistics Contact Development Disclaimer Help
fix escape regression in gphtextnl() and simplify the code - stagit-gopher - st…
git clone git://git.codemadness.org/stagit-gopher
Log
Files
Refs
README
LICENSE
---
commit f3d448a743143b22dcb9ab7e20dc16149d55907b
parent b5cdcadb391b8f27bced0273013ae5ba2189cde9
Author: Hiltjo Posthuma <[email protected]>
Date: Sat, 27 Jan 2018 16:24:38 +0100
fix escape regression in gphtextnl() and simplify the code
Thanks Christoph for the report!
Diffstat:
M stagit-gopher.c | 11 +++--------
1 file changed, 3 insertions(+), 8 deletions(-)
---
diff --git a/stagit-gopher.c b/stagit-gopher.c
@@ -299,21 +299,16 @@ gphtextnl(FILE *fp, const char *s, size_t len)
size_t i, n = 0;
for (i = 0; s[i] && i < len; i++) {
- if (s[i] == '\n')
- n = 0;
-
/* escape with 't' at the start of a line */
- if (!n && (s[i] == 't' || s[i] == '[')) {
+ if (!n && (s[i] == 't' || s[i] == '['))
fputc('t', fp);
- n = 1;
- }
switch (s[i]) {
+ case '\t': fputs(" ", fp);
case '\r': break;
- case '\t': fputs(" ", fp); break;
default: fputc(s[i], fp);
}
- n++;
+ n = (s[i] != '\n');
}
}
You are viewing proxied material from codemadness.org. The copyright of proxied material belongs to its original authors. Any comments or complaints in relation to proxied material should be directed to the original authors of the content concerned. Please see the disclaimer for more details.