1303 files changed, 32187 insertions, 57138 deletions
diff --git a/editors/ed.c b/editors/ed.c index 3087fb0..c028b78 100644 --- a/editors/ed.c +++ b/editors/ed.c @@ -23,6 +23,7 @@ //usage:#define ed_full_usage "" #include "libbb.h" +#include "common_bufsiz.h" typedef struct LINE { struct LINE *next; @@ -35,8 +36,8 @@ typedef struct LINE { #define searchString bb_common_bufsiz1 enum { - USERSIZE = sizeof(searchString) > 1024 ? 1024 - : sizeof(searchString) - 1, /* max line length typed in by user */ + USERSIZE = COMMON_BUFSIZE > 1024 ? 1024 + : COMMON_BUFSIZE - 1, /* max line length typed in by user */ INITBUF_SIZE = 1024, /* initial buffer size */ }; @@ -66,6 +67,7 @@ struct globals { #define lines (G.lines ) #define marks (G.marks ) #define INIT_G() do { \ + setup_common_bufsiz(); \ SET_PTR_TO_GLOBALS(xzalloc(sizeof(G))); \ } while (0) @@ -206,7 +208,7 @@ static void doCommands(void) if (fileName) printf("\"%s\"\n", fileName); else - printf("No file name\n"); + puts("No file name"); break; } free(fileName); @@ -732,7 +734,6 @@ static int readLines(const char *file, int num) cc = safe_read(fd, bufPtr, bufSize - bufUsed); bufUsed += cc; bufPtr = bufBase; - } while (cc > 0); if (cc < 0) { |