Hi tech@ -- The diff below removes unused defines and functions in mg. I went through everything in def.h one by one, so hopefully this removes everything unused.
OK? ~Brian Index: def.h =================================================================== RCS file: /cvs/src/usr.bin/mg/def.h,v retrieving revision 1.146 diff -u -p -r1.146 def.h --- def.h 8 May 2015 12:35:08 -0000 1.146 +++ def.h 3 Jun 2015 02:57:05 -0000 @@ -21,13 +21,13 @@ typedef int (*PF)(int, int); /* generall #define NBUFN NFILEN /* Length, buffer name. */ #define NLINE 256 /* Length, line. */ #define PBMODES 4 /* modes per buffer */ -#define NKBDM 256 /* Length, keyboard macro. */ #define NPAT 80 /* Length, pattern. */ #define HUGE 1000 /* A rather large number. */ #define NSRCH 128 /* Undoable search commands. */ #define NXNAME 64 /* Length, extended command. */ #define NKNAME 20 /* Length, key names. */ #define NTIME 50 /* Length, timestamp string. */ + /* * Universal. */ @@ -61,13 +61,6 @@ typedef int (*PF)(int, int); /* generall #define FIODIR 5 /* File is a directory */ /* - * Directory I/O. - */ -#define DIOSUC 0 /* Success. */ -#define DIOEOF 1 /* End of file. */ -#define DIOERR 2 /* Error. */ - -/* * Display colors. */ #define CNONE 0 /* Unknown color. */ @@ -388,7 +381,6 @@ struct line *lalloc(int); int lrealloc(struct line *, int); void lfree(struct line *); void lchange(int); -int linsert_str(const char *, int); int linsert(int, int); int lnewline_at(struct line *, int); int lnewline(void); @@ -408,7 +400,6 @@ int yank(int, int); /* window.c X */ struct mgwin *new_window(struct buffer *); -void free_window(struct mgwin *); int reposition(int, int); int redraw(int, int); int do_redraw(int, int, int); @@ -654,7 +645,6 @@ int executemacro(int, int); /* modes.c X */ int indentmode(int, int); int fillmode(int, int); -int blinkparen(int, int); #ifdef NOTAB int notabmode(int, int); #endif /* NOTAB */ Index: line.c =================================================================== RCS file: /cvs/src/usr.bin/mg/line.c,v retrieving revision 1.55 diff -u -p -r1.55 line.c --- line.c 19 Mar 2015 21:22:15 -0000 1.55 +++ line.c 3 Jun 2015 02:57:05 -0000 @@ -131,100 +131,6 @@ lchange(int flag) } /* - * Insert "n" bytes from "s" at the current location of dot. - * In the easy case all that happens is the text is stored in the line. - * In the hard case, the line has to be reallocated. When the window list - * is updated, take special care; I screwed it up once. You always update - * dot in the current window. You update mark and a dot in another window - * if it is greater than the place where you did the insert. Return TRUE - * if all is well, and FALSE on errors. - */ -int -linsert_str(const char *s, int n) -{ - struct line *lp1; - struct mgwin *wp; - RSIZE i; - int doto, k; - - if ((k = checkdirty(curbp)) != TRUE) - return (k); - - if (curbp->b_flag & BFREADONLY) { - dobeep(); - ewprintf("Buffer is read only"); - return (FALSE); - } - - if (!n) - return (TRUE); - - lchange(WFFULL); - - /* current line */ - lp1 = curwp->w_dotp; - - /* special case for the end */ - if (lp1 == curbp->b_headp) { - struct line *lp2, *lp3; - - /* now should only happen in empty buffer */ - if (curwp->w_doto != 0) - panic("bug: linsert_str"); - /* allocate a new line */ - if ((lp2 = lalloc(n)) == NULL) - return (FALSE); - /* previous line */ - lp3 = lp1->l_bp; - /* link in */ - lp3->l_fp = lp2; - lp2->l_fp = lp1; - lp1->l_bp = lp2; - lp2->l_bp = lp3; - for (i = 0; i < n; ++i) - lp2->l_text[i] = s[i]; - for (wp = wheadp; wp != NULL; wp = wp->w_wndp) { - if (wp->w_linep == lp1) - wp->w_linep = lp2; - if (wp->w_dotp == lp1) - wp->w_dotp = lp2; - if (wp->w_markp == lp1) - wp->w_markp = lp2; - } - undo_add_insert(lp2, 0, n); - curwp->w_doto = n; - return (TRUE); - } - /* save for later */ - doto = curwp->w_doto; - - if ((lp1->l_used + n) > lp1->l_size) { - if (lrealloc(lp1, lp1->l_used + n) == FALSE) - return (FALSE); - } - lp1->l_used += n; - if (lp1->l_used != n) - memmove(&lp1->l_text[doto + n], &lp1->l_text[doto], - lp1->l_used - n - doto); - - /* Add the characters */ - for (i = 0; i < n; ++i) - lp1->l_text[doto + i] = s[i]; - for (wp = wheadp; wp != NULL; wp = wp->w_wndp) { - if (wp->w_dotp == lp1) { - if (wp == curwp || wp->w_doto > doto) - wp->w_doto += n; - } - if (wp->w_markp == lp1) { - if (wp->w_marko > doto) - wp->w_marko += n; - } - } - undo_add_insert(curwp->w_dotp, doto, n); - return (TRUE); -} - -/* * Insert "n" copies of the character "c" at the current location of dot. * In the easy case all that happens is the text is stored in the line. * In the hard case, the line has to be reallocated. When the window list Index: match.c =================================================================== RCS file: /cvs/src/usr.bin/mg/match.c,v retrieving revision 1.18 diff -u -p -r1.18 match.c --- match.c 19 Mar 2015 21:22:15 -0000 1.18 +++ match.c 3 Jun 2015 02:57:05 -0000 @@ -81,8 +81,7 @@ balance(void) /* * Move behind the inserted character. We are always guaranteed - * that there is at least one character on the line, since one was - * just self-inserted by blinkparen. + * that there is at least one character on the line. */ clp = curwp->w_dotp; cbo = curwp->w_doto - 1;