ed

simple ed
git clone git://git.2f30.org/ed
Log | Files | Refs | LICENSE

commit a109a4ad3ad34d3318ebca644595fbd261c4980b
parent dfd6f87114f705e830ccc6bb621424840ef7b65c
Author: FRIGN <dev@frign.de>
Date:   Mon, 30 Nov 2015 23:17:44 +0100

Some stylistic stuff

and trailing whitespace

Diffstat:
Med.c | 25++++++++++---------------
1 file changed, 10 insertions(+), 15 deletions(-)

diff --git a/ed.c b/ed.c @@ -1,4 +1,4 @@ - +/* See LICENSE file for copyright and license details. */ #include <sys/stat.h> #include <fcntl.h> #include <regex.h> @@ -12,19 +12,18 @@ #include <stdlib.h> #include <string.h> -#define CMDSIZE 100 -#define REGEXSIZE 100 +#define CMDSIZE 100 +#define REGEXSIZE 100 #define LINESIZE 80 #define NUMLINES 32 #define CACHESIZ 4096 struct hline { off_t seek; - char global; - int next, prev; + char global; + int next, prev; }; - char *cmdp; char *prompt = "*"; regex_t *pattern; @@ -178,11 +177,7 @@ setglobal(int i, int dir) int lnk = getindex(i); int m = regexec(pattern, gettxt(i), 0, NULL, 0) == 0; - - if (m == dir && i >= line1 && i <= line2) - zero[lnk].global = 1; - else - zero[lnk].global = 0; + zero[lnk].global = (m == dir && i >= line1 && i <= line2); } static void @@ -571,7 +566,7 @@ getfname(char *s) ++s; if (*s) { for (p = s; *p && *p != '\n'; ++p) - /* nothing */; + ; *p = '\0'; return s; } else if (savfname) { @@ -871,10 +866,10 @@ docmd() unexpected: error("unexpected addres"); } - + if (!pflag) continue; - + line1 = line2 = curln; print: doprint(); @@ -1027,6 +1022,6 @@ main(int argc, char *argv[]) docmd(); } - /* NOTREACHED */ + /* not reached */ return 0; }