uemacs: Fix return statements

Return statement is not a function so remove superfluous use of parenthesis.

Cc: Thiago Farina <tfransosi@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
Pekka Enberg 2010-08-29 13:03:55 +03:00 committed by Linus Torvalds
parent 3246438f73
commit 0f05e53f99
28 changed files with 760 additions and 760 deletions

4
ansi.c
View File

@ -176,7 +176,7 @@ void ansirev(int state)
/* Change screen resolution. */
int ansicres()
{
return (TRUE);
return TRUE;
}
/* Change pallette settings. */
@ -252,7 +252,7 @@ void ansikclose(void)
int fnclabel(int f, int n)
{
/* On machines with no function keys...don't bother. */
return (TRUE);
return TRUE;
}
#endif
#endif

View File

@ -68,7 +68,7 @@ int backchar(int f, int n)
while (n--) {
if (curwp->w_doto == 0) {
if ((lp = lback(curwp->w_dotp)) == curbp->b_linep)
return (FALSE);
return FALSE;
curwp->w_dotp = lp;
curwp->w_doto = llength(lp);
curwp->w_flag |= WFMOVE;
@ -100,7 +100,7 @@ int forwchar(int f, int n)
while (n--) {
if (curwp->w_doto == llength(curwp->w_dotp)) {
if (curwp->w_dotp == curbp->b_linep)
return (FALSE);
return FALSE;
curwp->w_dotp = lforw(curwp->w_dotp);
curwp->w_doto = 0;
curwp->w_flag |= WFMOVE;
@ -125,7 +125,7 @@ int gotoline(int f, int n)
if ((status =
mlreply("Line to GOTO: ", arg, NSTRING)) != TRUE) {
mlwrite("(Aborted)");
return (status);
return status;
}
n = atoi(arg);
}

78
bind.c
View File

@ -29,18 +29,18 @@ int help(int f, int n)
fname = flook(pathname[1], FALSE);
if (fname == NULL) {
mlwrite("(Help file is not online)");
return (FALSE);
return FALSE;
}
}
/* split the current window to make room for the help stuff */
if (splitwind(FALSE, 1) == FALSE)
return (FALSE);
return FALSE;
if (bp == NULL) {
/* and read the stuff in */
if (getfile(fname, FALSE) == FALSE)
return (FALSE);
return FALSE;
} else
swbuffer(bp);
@ -52,7 +52,7 @@ int help(int f, int n)
wp->w_flag |= WFMODE;
wp = wp->w_wndp;
}
return (TRUE);
return TRUE;
}
int deskey(int f, int n)
@ -78,7 +78,7 @@ int deskey(int f, int n)
/* output the command sequence */
ostring(ptr);
return (TRUE);
return TRUE;
}
/*
@ -102,7 +102,7 @@ int bindtokey(int f, int n)
kfunc = getname();
if (kfunc == NULL) {
mlwrite("(No such function)");
return (FALSE);
return FALSE;
}
ostring(" ");
@ -157,7 +157,7 @@ int bindtokey(int f, int n)
/* if we run out of binding room, bitch */
if (ktp >= &keytab[NBINDS]) {
mlwrite("Binding table FULL!");
return (FALSE);
return FALSE;
}
ktp->k_code = c; /* add keycode */
@ -166,7 +166,7 @@ int bindtokey(int f, int n)
ktp->k_code = 0;
ktp->k_fp = NULL;
}
return (TRUE);
return TRUE;
}
/*
@ -195,9 +195,9 @@ int unbindkey(int f, int n)
/* if it isn't bound, bitch */
if (unbindchar(c) == FALSE) {
mlwrite("(Key not bound)");
return (FALSE);
return FALSE;
}
return (TRUE);
return TRUE;
}
@ -225,7 +225,7 @@ int unbindchar(int c)
/* if it isn't bound, bitch */
if (!found)
return (FALSE);
return FALSE;
/* save the pointer and scan to the end of the table */
sktp = ktp;
@ -240,7 +240,7 @@ int unbindchar(int c)
/* null out the last one */
ktp->k_code = 0;
ktp->k_fp = NULL;
return (TRUE);
return TRUE;
}
/* describe bindings
@ -251,7 +251,7 @@ int desbind(int f, int n)
#if APROP
{
buildlist(TRUE, "");
return (TRUE);
return TRUE;
}
int apro(int f, int n)
@ -261,9 +261,9 @@ int apro(int f, int n)
status = mlreply("Apropos string: ", mstring, NSTRING - 1);
if (status != TRUE)
return (status);
return status;
return (buildlist(FALSE, mstring));
return buildlist(FALSE, mstring);
}
/*
@ -284,13 +284,13 @@ int buildlist(int type, char *mstring)
/* split the current window to make room for the binding list */
if (splitwind(FALSE, 1) == FALSE)
return (FALSE);
return FALSE;
/* and get a buffer for it */
bp = bfind("*Binding list*", TRUE, 0);
if (bp == NULL || bclear(bp) == FALSE) {
mlwrite("Can not display binding list");
return (FALSE);
return FALSE;
}
/* let us know this is in progress */
@ -346,7 +346,7 @@ int buildlist(int type, char *mstring)
/* and add it as a line into the buffer */
if (linstr(outseq) != TRUE)
return (FALSE);
return FALSE;
cpos = 0; /* and clear the line */
}
@ -358,7 +358,7 @@ int buildlist(int type, char *mstring)
outseq[cpos++] = '\n';
outseq[cpos] = 0;
if (linstr(outseq) != TRUE)
return (FALSE);
return FALSE;
}
fail: /* and on to the next name */
@ -375,7 +375,7 @@ int buildlist(int type, char *mstring)
wp = wp->w_wndp;
}
mlwrite(""); /* clear the mode line */
return (TRUE);
return TRUE;
}
#if APROP
@ -408,12 +408,12 @@ int strinc(char *source, char *sub)
/* yes, return a success */
if (*tp == 0)
return (TRUE);
return TRUE;
/* no, onward */
sp++;
}
return (FALSE);
return FALSE;
}
#endif
@ -430,7 +430,7 @@ unsigned int getckey(int mflag)
/* check to see if we are executing a command line */
if (clexec) {
macarg(tok); /* get the next token */
return (stock(tok));
return stock(tok);
}
/* or the normal way */
@ -438,7 +438,7 @@ unsigned int getckey(int mflag)
c = get1key();
else
c = getcmd();
return (c);
return c;
}
/*
@ -458,10 +458,10 @@ int startup(char *sfname)
/* if it isn't around, don't sweat it */
if (fname == NULL)
return (TRUE);
return TRUE;
/* otherwise, execute the sucker */
return (dofile(fname));
return dofile(fname);
}
/*
@ -493,7 +493,7 @@ char *flook(char *fname, int hflag)
/* and try it out */
if (ffropen(fspec) == FIOSUC) {
ffclose();
return (fspec);
return fspec;
}
}
}
@ -502,7 +502,7 @@ char *flook(char *fname, int hflag)
/* always try the current directory first */
if (ffropen(fname) == FIOSUC) {
ffclose();
return (fname);
return fname;
}
#if ENVFUNC
/* get the PATH variable */
@ -524,7 +524,7 @@ char *flook(char *fname, int hflag)
/* and try it out */
if (ffropen(fspec) == FIOSUC) {
ffclose();
return (fspec);
return fspec;
}
if (*path == PATHCHR)
@ -540,11 +540,11 @@ char *flook(char *fname, int hflag)
/* and try it out */
if (ffropen(fspec) == FIOSUC) {
ffclose();
return (fspec);
return fspec;
}
}
return (NULL); /* no such luck */
return NULL; /* no such luck */
}
/*
@ -601,12 +601,12 @@ int (*getbind(int c))(int, int)
ktp = &keytab[0]; /* Look in key table. */
while (ktp->k_fp != NULL) {
if (ktp->k_code == c)
return (ktp->k_fp);
return ktp->k_fp;
++ktp;
}
/* no such binding */
return (NULL);
return NULL;
}
/*
@ -622,10 +622,10 @@ char *getfname(fn_t func)
nptr = &names[0];
while (nptr->n_func != NULL) {
if (nptr->n_func == func)
return (nptr->n_name);
return nptr->n_name;
++nptr;
}
return (NULL);
return NULL;
}
/*
@ -642,10 +642,10 @@ int (*fncmatch(char *fname)) (int, int)
ffp = &names[0];
while (ffp->n_func != NULL) {
if (strcmp(fname, ffp->n_name) == 0)
return (ffp->n_func);
return ffp->n_func;
++ffp;
}
return (NULL);
return NULL;
}
/*
@ -696,7 +696,7 @@ unsigned int stock(char *keyname)
/* the final sequence... */
c |= *keyname;
return (c);
return c;
}
/*
@ -712,5 +712,5 @@ char *transbind(char *skey)
if (bindname == NULL)
bindname = "ERROR";
return (bindname);
return bindname;
}

View File

@ -27,10 +27,10 @@ int usebuffer(int f, int n)
char bufn[NBUFN];
if ((s = mlreply("Use buffer: ", bufn, NBUFN)) != TRUE)
return (s);
return s;
if ((bp = bfind(bufn, TRUE, 0)) == NULL)
return (FALSE);
return (swbuffer(bp));
return FALSE;
return swbuffer(bp);
}
/*
@ -47,7 +47,7 @@ int nextbuffer(int f, int n)
if (f == FALSE)
n = 1;
if (n < 1)
return (FALSE);
return FALSE;
bbp = curbp;
while (n-- > 0) {
@ -63,14 +63,14 @@ int nextbuffer(int f, int n)
/* don't get caught in an infinite loop! */
if (bp == bbp)
return (FALSE);
return FALSE;
}
bbp = bp;
}
return (swbuffer(bp));
return swbuffer(bp);
}
/*
@ -104,7 +104,7 @@ int swbuffer(struct buffer *bp)
curwp->w_markp = bp->b_markp;
curwp->w_marko = bp->b_marko;
cknewwindow();
return (TRUE);
return TRUE;
}
wp = wheadp; /* Look for old. */
while (wp != NULL) {
@ -118,7 +118,7 @@ int swbuffer(struct buffer *bp)
wp = wp->w_wndp;
}
cknewwindow();
return (TRUE);
return TRUE;
}
/*
@ -136,12 +136,12 @@ int killbuffer(int f, int n)
char bufn[NBUFN];
if ((s = mlreply("Kill buffer: ", bufn, NBUFN)) != TRUE)
return (s);
return s;
if ((bp = bfind(bufn, FALSE, 0)) == NULL) /* Easy if unknown. */
return (TRUE);
return TRUE;
if (bp->b_flag & BFINVS) /* Deal with special buffers */
return (TRUE); /* by doing nothing. */
return (zotbuf(bp));
return TRUE; /* by doing nothing. */
return zotbuf(bp);
}
/*
@ -155,10 +155,10 @@ int zotbuf(struct buffer *bp)
if (bp->b_nwnd != 0) { /* Error if on screen. */
mlwrite("Buffer is being displayed");
return (FALSE);
return FALSE;
}
if ((s = bclear(bp)) != TRUE) /* Blow text away. */
return (s);
return s;
free((char *) bp->b_linep); /* Release header line. */
bp1 = NULL; /* Find the header. */
bp2 = bheadp;
@ -172,7 +172,7 @@ int zotbuf(struct buffer *bp)
else
bp1->b_bufp = bp2;
free((char *) bp); /* Release buffer block */
return (TRUE);
return TRUE;
}
/*
@ -188,7 +188,7 @@ int namebuffer(int f, int n)
/* prompt for and get the new buffer name */
ask:if (mlreply("Change buffer name to: ", bufn, NBUFN) !=
TRUE)
return (FALSE);
return FALSE;
/* and check for duplicates */
bp = bheadp;
@ -204,7 +204,7 @@ int namebuffer(int f, int n)
strcpy(curbp->b_bname, bufn); /* copy buffer name to structure */
curwp->w_flag |= WFMODE; /* make mode line replot */
mlerase();
return (TRUE);
return TRUE;
}
/*
@ -224,10 +224,10 @@ int listbuffers(int f, int n)
int s;
if ((s = makelist(f)) != TRUE)
return (s);
return s;
if (blistp->b_nwnd == 0) { /* Not on screen yet. */
if ((wp = wpopup()) == NULL)
return (FALSE);
return FALSE;
bp = wp->w_bufp;
if (--bp->b_nwnd == 0) {
bp->b_dotp = wp->w_dotp;
@ -250,7 +250,7 @@ int listbuffers(int f, int n)
}
wp = wp->w_wndp;
}
return (TRUE);
return TRUE;
}
/*
@ -280,12 +280,12 @@ int makelist(int iflag)
blistp->b_flag &= ~BFCHG; /* Don't complain! */
if ((s = bclear(blistp)) != TRUE) /* Blow old text away */
return (s);
return s;
strcpy(blistp->b_fname, "");
if (addline("ACT MODES Size Buffer File") == FALSE
|| addline("--- ----- ---- ------ ----") ==
FALSE)
return (FALSE);
return FALSE;
bp = bheadp; /* For all buffers */
/* build line to report global mode settings */
@ -303,7 +303,7 @@ int makelist(int iflag)
*cp1++ = '.';
strcpy(cp1, " Global Modes");
if (addline(line) == FALSE)
return (FALSE);
return FALSE;
/* output the list of buffers */
while (bp != NULL) {
@ -367,10 +367,10 @@ int makelist(int iflag)
}
*cp1 = 0; /* Add to the buffer. */
if (addline(line) == FALSE)
return (FALSE);
return FALSE;
bp = bp->b_bufp;
}
return (TRUE); /* All done */
return TRUE; /* All done */
}
void ltoa(char *buf, int width, long num)
@ -400,7 +400,7 @@ int addline(char *text)
ntext = strlen(text);
if ((lp = lalloc(ntext)) == NULL)
return (FALSE);
return FALSE;
for (i = 0; i < ntext; ++i)
lputc(lp, i, text[i]);
blistp->b_linep->l_bp->l_fp = lp; /* Hook onto the end */
@ -409,7 +409,7 @@ int addline(char *text)
lp->l_fp = blistp->b_linep;
if (blistp->b_dotp == blistp->b_linep) /* If "." is at the end */
blistp->b_dotp = lp; /* move it to new line */
return (TRUE);
return TRUE;
}
/*
@ -430,10 +430,10 @@ int anycb(void)
while (bp != NULL) {
if ((bp->b_flag & BFINVS) == 0
&& (bp->b_flag & BFCHG) != 0)
return (TRUE);
return TRUE;
bp = bp->b_bufp;
}
return (FALSE);
return FALSE;
}
/*
@ -452,15 +452,15 @@ struct buffer *bfind(char *bname, int cflag, int bflag)
bp = bheadp;
while (bp != NULL) {
if (strcmp(bname, bp->b_bname) == 0)
return (bp);
return bp;
bp = bp->b_bufp;
}
if (cflag != FALSE) {
if ((bp = (struct buffer *)malloc(sizeof(struct buffer))) == NULL)
return (NULL);
return NULL;
if ((lp = lalloc(0)) == NULL) {
free((char *) bp);
return (NULL);
return NULL;
}
/* find the place in the list to insert this buffer */
if (bheadp == NULL || strcmp(bheadp->b_bname, bname) > 0) {
@ -498,7 +498,7 @@ struct buffer *bfind(char *bname, int cflag, int bflag)
lp->l_fp = lp;
lp->l_bp = lp;
}
return (bp);
return bp;
}
/*
@ -519,7 +519,7 @@ int bclear(struct buffer *bp)
if ((bp->b_flag & BFINVS) == 0 /* Not scratch buffer. */
&& (bp->b_flag & BFCHG) != 0 /* Something changed */
&& (s = mlyesno("Discard changes")) != TRUE)
return (s);
return s;
bp->b_flag &= ~BFCHG; /* Not changed */
while ((lp = lforw(bp->b_linep)) != bp->b_linep)
lfree(lp);
@ -527,7 +527,7 @@ int bclear(struct buffer *bp)
bp->b_doto = 0;
bp->b_markp = NULL; /* Invalidate "mark" */
bp->b_marko = 0;
return (TRUE);
return TRUE;
}
/*
@ -539,5 +539,5 @@ int unmark(int f, int n)
{
curbp->b_flag &= ~BFCHG;
curwp->w_flag |= WFMODE;
return (TRUE);
return TRUE;
}

View File

@ -34,7 +34,7 @@ int set_encryption_key(int f, int n)
status = mlreply("Encryption String: ", key, NPAT - 1);
disinp = odisinp;
if (status != TRUE)
return (status);
return status;
/* and encrypt it */
myencrypt((char *) NULL, 0);
@ -43,7 +43,7 @@ int set_encryption_key(int f, int n)
/* and save it off */
strcpy(curbp->b_key, key);
mlwrite(" "); /* clear it off the bottom line */
return (TRUE);
return TRUE;
}
/**********
@ -214,7 +214,7 @@ static int mod95(int val)
val -= 95;
while (val < 0)
val += 95;
return (val);
return val;
}
#else
static void myennocrypt(void)

View File

@ -242,7 +242,7 @@ static void vteeol(void)
int upscreen(int f, int n)
{
update(TRUE);
return (TRUE);
return TRUE;
}
#if SCROLLCODE
@ -264,11 +264,11 @@ int update(int force)
#if TYPEAH && ! PKCODE
if (force == FALSE && typahead())
return (TRUE);
return TRUE;
#endif
#if VISMAC == 0
if (force == FALSE && kbdmode == PLAY)
return (TRUE);
return TRUE;
#endif
displaying = TRUE;
@ -352,7 +352,7 @@ int update(int force)
while (chg_width || chg_height)
newscreensize(chg_height, chg_width);
#endif
return (TRUE);
return TRUE;
}
/*
@ -395,7 +395,7 @@ static int reframe(struct window *wp)
break;
}
#endif
return (TRUE);
return TRUE;
}
/* if we are at the end of the file, reframe */
@ -441,7 +441,7 @@ static int reframe(struct window *wp)
wp->w_linep = lp;
wp->w_flag |= WFHARD;
wp->w_flag &= ~WFFORCE;
return (TRUE);
return TRUE;
}
/*
@ -657,7 +657,7 @@ int updupd(int force)
if ((vp1->v_flag & VFCHG) != 0) {
#if TYPEAH && ! PKCODE
if (force == FALSE && typahead())
return (TRUE);
return TRUE;
#endif
#if MEMMAP && ! SCROLLCODE
updateline(i, vp1);
@ -666,7 +666,7 @@ int updupd(int force)
#endif
}
}
return (TRUE);
return TRUE;
}
#if SCROLLCODE
@ -774,7 +774,7 @@ static int scrolls(int inserts)
}
#endif
if (2 * count < abs(from - to))
return (FALSE);
return FALSE;
scrscroll(from, to, count);
for (i = 0; i < count; i++) {
vpp = pscreen[to + i];
@ -805,9 +805,9 @@ static int scrolls(int inserts)
vscreen[i]->v_flag |= VFCHG;
}
#endif
return (TRUE);
return TRUE;
}
return (FALSE);
return FALSE;
}
/* move the "count" lines starting at "from" to "to" */
@ -827,7 +827,7 @@ static int texttest(int vrow, int prow)
struct video *vpv = vscreen[vrow]; /* virtual screen image */
struct video *vpp = pscreen[prow]; /* physical screen image */
return (!memcmp(vpv->v_text, vpp->v_text, term.t_ncol));
return !memcmp(vpv->v_text, vpp->v_text, term.t_ncol);
}
/*
@ -838,8 +838,8 @@ static int endofline(char *s, int n)
int i;
for (i = n - 1; i >= 0; i--)
if (s[i] != ' ')
return (i + 1);
return (0);
return i + 1;
return 0;
}
#endif /* SCROLLCODE */
@ -1009,7 +1009,7 @@ static int updateline(int row, struct video *vp1, struct video *vp2)
vp1->v_fcolor = vp1->v_rfcolor;
vp1->v_bcolor = vp1->v_rbcolor;
#endif
return (TRUE);
return TRUE;
}
#endif
@ -1028,7 +1028,7 @@ static int updateline(int row, struct video *vp1, struct video *vp2)
/* if both lines are the same, no update needs to be done */
if (cp1 == &vp1->v_text[term.t_ncol]) {
vp1->v_flag &= ~VFCHG; /* flag this line is changed */
return (TRUE);
return TRUE;
}
/* find out if there is a match on the right */
@ -1074,7 +1074,7 @@ static int updateline(int row, struct video *vp1, struct video *vp2)
TTrev(FALSE);
#endif
vp1->v_flag &= ~VFCHG; /* flag this line as updated */
return (TRUE);
return TRUE;
#endif
}
#endif

272
eval.c
View File

@ -46,22 +46,22 @@ char *gtfun(char *fname)
/* return errorm on a bad reference */
if (fnum == ARRAY_SIZE(funcs))
return (errorm);
return errorm;
/* if needed, retrieve the first argument */
if (funcs[fnum].f_type >= MONAMIC) {
if ((status = macarg(arg1)) != TRUE)
return (errorm);
return errorm;
/* if needed, retrieve the second argument */
if (funcs[fnum].f_type >= DYNAMIC) {
if ((status = macarg(arg2)) != TRUE)
return (errorm);
return errorm;
/* if needed, retrieve the third argument */
if (funcs[fnum].f_type >= TRINAMIC)
if ((status = macarg(arg3)) != TRUE)
return (errorm);
return errorm;
}
}
@ -69,22 +69,22 @@ char *gtfun(char *fname)
/* and now evaluate it! */
switch (fnum) {
case UFADD:
return (itoa(atoi(arg1) + atoi(arg2)));
return itoa(atoi(arg1) + atoi(arg2));
case UFSUB:
return (itoa(atoi(arg1) - atoi(arg2)));
return itoa(atoi(arg1) - atoi(arg2));
case UFTIMES:
return (itoa(atoi(arg1) * atoi(arg2)));
return itoa(atoi(arg1) * atoi(arg2));
case UFDIV:
return (itoa(atoi(arg1) / atoi(arg2)));
return itoa(atoi(arg1) / atoi(arg2));
case UFMOD:
return (itoa(atoi(arg1) % atoi(arg2)));
return itoa(atoi(arg1) % atoi(arg2));
case UFNEG:
return (itoa(-atoi(arg1)));
return itoa(-atoi(arg1));
case UFCAT:
strcpy(result, arg1);
return (strcat(result, arg2));
return strcat(result, arg2);
case UFLEFT:
return (strncpy(result, arg1, atoi(arg2)));
return strncpy(result, arg1, atoi(arg2));
case UFRIGHT:
return (strcpy(result,
&arg1[(strlen(arg1) - atoi(arg2))]));
@ -92,73 +92,73 @@ char *gtfun(char *fname)
return (strncpy(result, &arg1[atoi(arg2) - 1],
atoi(arg3)));
case UFNOT:
return (ltos(stol(arg1) == FALSE));
return ltos(stol(arg1) == FALSE);
case UFEQUAL:
return (ltos(atoi(arg1) == atoi(arg2)));
return ltos(atoi(arg1) == atoi(arg2));
case UFLESS:
return (ltos(atoi(arg1) < atoi(arg2)));
return ltos(atoi(arg1) < atoi(arg2));
case UFGREATER:
return (ltos(atoi(arg1) > atoi(arg2)));
return ltos(atoi(arg1) > atoi(arg2));
case UFSEQUAL:
return (ltos(strcmp(arg1, arg2) == 0));
return ltos(strcmp(arg1, arg2) == 0);
case UFSLESS:
return (ltos(strcmp(arg1, arg2) < 0));
return ltos(strcmp(arg1, arg2) < 0);
case UFSGREAT:
return (ltos(strcmp(arg1, arg2) > 0));
return ltos(strcmp(arg1, arg2) > 0);
case UFIND:
return (strcpy(result, getval(arg1)));
return strcpy(result, getval(arg1));
case UFAND:
return (ltos(stol(arg1) && stol(arg2)));
return ltos(stol(arg1) && stol(arg2));
case UFOR:
return (ltos(stol(arg1) || stol(arg2)));
return ltos(stol(arg1) || stol(arg2));
case UFLENGTH:
return (itoa(strlen(arg1)));
return itoa(strlen(arg1));
case UFUPPER:
return (mkupper(arg1));
return mkupper(arg1);
case UFLOWER:
return (mklower(arg1));
return mklower(arg1);
case UFTRUTH:
return (ltos(atoi(arg1) == 42));
return ltos(atoi(arg1) == 42);
case UFASCII:
return (itoa((int) arg1[0]));
return itoa((int) arg1[0]);
case UFCHR:
result[0] = atoi(arg1);
result[1] = 0;
return (result);
return result;
case UFGTKEY:
result[0] = tgetc();
result[1] = 0;
return (result);
return result;
case UFRND:
return (itoa((ernd() % abs(atoi(arg1))) + 1));
return itoa((ernd() % abs(atoi(arg1))) + 1);
case UFABS:
return (itoa(abs(atoi(arg1))));
return itoa(abs(atoi(arg1)));
case UFSINDEX:
return (itoa(sindex(arg1, arg2)));
return itoa(sindex(arg1, arg2));
case UFENV:
#if ENVFUNC
tsp = getenv(arg1);
return (tsp == NULL ? "" : tsp);
return tsp == NULL ? "" : tsp;
#else
return ("");
return "";
#endif
case UFBIND:
return (transbind(arg1));
return transbind(arg1);
case UFEXIST:
return (ltos(fexist(arg1)));
return ltos(fexist(arg1));
case UFFIND:
tsp = flook(arg1, TRUE);
return (tsp == NULL ? "" : tsp);
return tsp == NULL ? "" : tsp;
case UFBAND:
return (itoa(atoi(arg1) & atoi(arg2)));
return itoa(atoi(arg1) & atoi(arg2));
case UFBOR:
return (itoa(atoi(arg1) | atoi(arg2)));
return itoa(atoi(arg1) | atoi(arg2));
case UFBXOR:
return (itoa(atoi(arg1) ^ atoi(arg2)));
return itoa(atoi(arg1) ^ atoi(arg2));
case UFBNOT:
return (itoa(~atoi(arg1)));
return itoa(~atoi(arg1));
case UFXLATE:
return (xlat(arg1, arg2, arg3));
return xlat(arg1, arg2, arg3);
}
exit(-11); /* never should get here */
@ -177,13 +177,13 @@ char *gtusr(char *vname)
/* scan the list looking for the user var name */
for (vnum = 0; vnum < MAXVARS; vnum++) {
if (uv[vnum].u_name[0] == 0)
return (errorm);
return errorm;
if (strcmp(vname, uv[vnum].u_name) == 0)
return (uv[vnum].u_value);
return uv[vnum].u_value;
}
/* return errorm if we run off the end */
return (errorm);
return errorm;
}
extern char *getkill(void);
@ -209,109 +209,109 @@ char *gtenv(char *vname)
char *ename = getenv(vname);
if (ename != NULL)
return (ename);
return ename;
else
return (errorm);
return errorm;
}
#else
return (errorm);
return errorm;
#endif
/* otherwise, fetch the appropriate value */
switch (vnum) {
case EVFILLCOL:
return (itoa(fillcol));
return itoa(fillcol);
case EVPAGELEN:
return (itoa(term.t_nrow + 1));
return itoa(term.t_nrow + 1);
case EVCURCOL:
return (itoa(getccol(FALSE)));
return itoa(getccol(FALSE));
case EVCURLINE:
return (itoa(getcline()));
return itoa(getcline());
case EVRAM:
return (itoa((int) (envram / 1024l)));
return itoa((int) (envram / 1024l));
case EVFLICKER:
return (ltos(flickcode));
return ltos(flickcode);
case EVCURWIDTH:
return (itoa(term.t_ncol));
return itoa(term.t_ncol);
case EVCBUFNAME:
return (curbp->b_bname);
return curbp->b_bname;
case EVCFNAME:
return (curbp->b_fname);
return curbp->b_fname;
case EVSRES:
return (sres);
return sres;
case EVDEBUG:
return (ltos(macbug));
return ltos(macbug);
case EVSTATUS:
return (ltos(cmdstatus));
return ltos(cmdstatus);
case EVPALETTE:
return (palstr);
return palstr;
case EVASAVE:
return (itoa(gasave));
return itoa(gasave);
case EVACOUNT:
return (itoa(gacount));
return itoa(gacount);
case EVLASTKEY:
return (itoa(lastkey));
return itoa(lastkey);
case EVCURCHAR:
return (curwp->w_dotp->l_used ==
curwp->w_doto ? itoa('\n') :
itoa(lgetc(curwp->w_dotp, curwp->w_doto)));
case EVDISCMD:
return (ltos(discmd));
return ltos(discmd);
case EVVERSION:
return (VERSION);
return VERSION;
case EVPROGNAME:
return (PROGRAM_NAME_LONG);
return PROGRAM_NAME_LONG;
case EVSEED:
return (itoa(seed));
return itoa(seed);
case EVDISINP:
return (ltos(disinp));
return ltos(disinp);
case EVWLINE:
return (itoa(curwp->w_ntrows));
return itoa(curwp->w_ntrows);
case EVCWLINE:
return (itoa(getwpos()));
return itoa(getwpos());
case EVTARGET:
saveflag = lastflag;
return (itoa(curgoal));
return itoa(curgoal);
case EVSEARCH:
return (pat);
return pat;
case EVREPLACE:
return (rpat);
return rpat;
case EVMATCH:
return ((patmatch == NULL) ? "" : patmatch);
return (patmatch == NULL) ? "" : patmatch;
case EVKILL:
return (getkill());
return getkill();
case EVCMODE:
return (itoa(curbp->b_mode));
return itoa(curbp->b_mode);
case EVGMODE:
return (itoa(gmode));
return itoa(gmode);
case EVTPAUSE:
return (itoa(term.t_pause));
return itoa(term.t_pause);
case EVPENDING:
#if TYPEAH
return (ltos(typahead()));
return ltos(typahead());
#else
return (falsem);
return falsem;
#endif
case EVLWIDTH:
return (itoa(llength(curwp->w_dotp)));
return itoa(llength(curwp->w_dotp));
case EVLINE:
return (getctext());
return getctext();
case EVGFLAGS:
return (itoa(gflags));
return itoa(gflags);
case EVRVAL:
return (itoa(rval));
return itoa(rval);
case EVTAB:
return (itoa(tabmask + 1));
return itoa(tabmask + 1);
case EVOVERLAP:
return (itoa(overlap));
return itoa(overlap);
case EVSCROLLCOUNT:
return (itoa(scrollcount));
return itoa(scrollcount);
#if SCROLLCODE
case EVSCROLL:
return (ltos(term.t_scroll != NULL));
return ltos(term.t_scroll != NULL);
#else
case EVSCROLL:
return (ltos(0));
return ltos(0);
#endif
}
exit(-12); /* again, we should never get here */
@ -338,7 +338,7 @@ char *getkill(void)
}
/* and return the constructed value */
return (value);
return value;
}
/*
@ -362,7 +362,7 @@ int setvar(int f, int n)
if (clexec == FALSE) {
status = mlreply("Variable to set: ", &var[0], NVSIZE);
if (status != TRUE)
return (status);
return status;
} else { /* macro line argument */
/* grab token and skip it */
execstr = token(execstr, var, NVSIZE + 1);
@ -374,7 +374,7 @@ int setvar(int f, int n)
/* if its not legal....bitch */
if (vd.v_type == -1) {
mlwrite("%%No such variable as '%s'", var);
return (FALSE);
return FALSE;
}
/* get the value for that variable */
@ -383,7 +383,7 @@ int setvar(int f, int n)
else {
status = mlreply("Value: ", &value[0], NSTRING);
if (status != TRUE)
return (status);
return status;
}
/* and set the appropriate value */
@ -438,7 +438,7 @@ int setvar(int f, int n)
#endif
/* and return it */
return (status);
return status;
}
/*
@ -526,7 +526,7 @@ int svar(VDESC *var, char *value)
free(uv[vnum].u_value);
sp = malloc(strlen(value) + 1);
if (sp == NULL)
return (FALSE);
return FALSE;
strcpy(sp, value);
uv[vnum].u_value = sp;
break;
@ -672,7 +672,7 @@ int svar(VDESC *var, char *value)
}
break;
}
return (status);
return status;
}
/*
@ -710,7 +710,7 @@ char *itoa(int i)
*(--sp) = '-'; /* and install the minus sign */
}
return (sp);
return sp;
}
/*
@ -727,33 +727,33 @@ int gettyp(char *token)
/* no blanks!!! */
if (c == 0)
return (TKNUL);
return TKNUL;
/* a numeric literal? */
if (c >= '0' && c <= '9')
return (TKLIT);
return TKLIT;
switch (c) {
case '"':
return (TKSTR);
return TKSTR;
case '!':
return (TKDIR);
return TKDIR;
case '@':
return (TKARG);
return TKARG;
case '#':
return (TKBUF);
return TKBUF;
case '$':
return (TKENV);
return TKENV;
case '%':
return (TKVAR);
return TKVAR;
case '&':
return (TKFUN);
return TKFUN;
case '*':
return (TKLBL);
return TKLBL;
default:
return (TKCMD);
return TKCMD;
}
}
@ -772,7 +772,7 @@ char *getval(char *token)
switch (gettyp(token)) {
case TKNUL:
return ("");
return "";
case TKARG: /* interactive argument */
strcpy(token, getval(&token[1]));
@ -781,8 +781,8 @@ char *getval(char *token)
status = getstring(token, buf, NSTRING, ctoec('\n'));
discmd = distmp;
if (status == ABORT)
return (errorm);
return (buf);
return errorm;
return buf;
case TKBUF: /* buffer contents fetch */
@ -790,7 +790,7 @@ char *getval(char *token)
strcpy(token, getval(&token[1]));
bp = bfind(token, FALSE, 0);
if (bp == NULL)
return (errorm);
return errorm;
/* if the buffer is displayed, get the window
vars instead of the buffer vars */
@ -801,7 +801,7 @@ char *getval(char *token)
/* make sure we are not at the end */
if (bp->b_linep == bp->b_dotp)
return (errorm);
return errorm;
/* grab the line as an argument */
blen = bp->b_dotp->l_used - bp->b_doto;
@ -822,26 +822,26 @@ char *getval(char *token)
}
/* and return the spoils */
return (buf);
return buf;
case TKVAR:
return (gtusr(token + 1));
return gtusr(token + 1);
case TKENV:
return (gtenv(token + 1));
return gtenv(token + 1);
case TKFUN:
return (gtfun(token + 1));
return gtfun(token + 1);
case TKDIR:
return (errorm);
return errorm;
case TKLBL:
return (errorm);
return errorm;
case TKLIT:
return (token);
return token;
case TKSTR:
return (token + 1);
return token + 1;
case TKCMD:
return (token);
return token;
}
return (errorm);
return errorm;
}
/*
@ -853,12 +853,12 @@ int stol(char *val)
{
/* check for logical values */
if (val[0] == 'F')
return (FALSE);
return FALSE;
if (val[0] == 'T')
return (TRUE);
return TRUE;
/* check for numeric truth (!= 0) */
return ((atoi(val) != 0));
return (atoi(val) != 0);
}
/*
@ -869,9 +869,9 @@ int stol(char *val)
char *ltos(int val)
{
if (val)
return (truem);
return truem;
else
return (falsem);
return falsem;
}
/*
@ -889,7 +889,7 @@ char *mkupper(char *str)
*sp += 'A' - 'a';
++sp;
}
return (str);
return str;
}
/*
@ -907,7 +907,7 @@ char *mklower(char *str)
*sp += 'a' - 'A';
++sp;
}
return (str);
return str;
}
/*
@ -915,7 +915,7 @@ char *mklower(char *str)
*/
int abs(int x)
{
return (x < 0 ? -x : x);
return x < 0 ? -x : x;
}
/*
@ -924,7 +924,7 @@ int abs(int x)
int ernd(void)
{
seed = abs(seed * 1721 + 10007);
return (seed);
return seed;
}
/*
@ -954,12 +954,12 @@ int sindex(char *source, char *pattern)
/* was it a match? */
if (*cp == 0)
return ((int) (sp - source) + 1);
return (int) (sp - source) + 1;
++sp;
}
/* no match at all.. */
return (0);
return 0;
}
/*
@ -998,5 +998,5 @@ char *xlat(char *source, char *lookup, char *trans)
/* terminate and return the result */
*rp = 0;
return (result);
return result;
}

98
exec.c
View File

@ -29,7 +29,7 @@ int namedcmd(int f, int n)
kfunc = getname();
if (kfunc == NULL) {
mlwrite("(No such function)");
return (FALSE);
return FALSE;
}
/* and then execute the command */
@ -50,10 +50,10 @@ int execcmd(int f, int n)
/* get the line wanted */
if ((status = mlreply(": ", cmdstr, NSTRING)) != TRUE)
return (status);
return status;
execlevel = 0;
return (docmd(cmdstr));
return docmd(cmdstr);
}
/*
@ -81,7 +81,7 @@ int docmd(char *cline)
/* if we are scanning and not executing..go back here */
if (execlevel)
return (TRUE);
return TRUE;
oldestr = execstr; /* save last ptr to string to execute */
execstr = cline; /* and set this one as current */
@ -94,7 +94,7 @@ int docmd(char *cline)
if ((status = macarg(tkn)) != TRUE) { /* and grab the first token */
execstr = oldestr;
return (status);
return status;
}
/* process leadin argument */
@ -106,7 +106,7 @@ int docmd(char *cline)
/* and now get the command to execute */
if ((status = macarg(tkn)) != TRUE) {
execstr = oldestr;
return (status);
return status;
}
}
@ -114,7 +114,7 @@ int docmd(char *cline)
if ((fnc = fncmatch(tkn)) == NULL) {
mlwrite("(No such Function)");
execstr = oldestr;
return (FALSE);
return FALSE;
}
/* save the arguments and go execute the command */
@ -124,7 +124,7 @@ int docmd(char *cline)
cmdstatus = status; /* save the status */
clexec = oldcle; /* restore clexec flag */
execstr = oldestr;
return (status);
return status;
}
/*
@ -199,7 +199,7 @@ char *token(char *src, char *tok, int size)
if (*src)
++src;
*tok = 0;
return (src);
return src;
}
/*
@ -216,7 +216,7 @@ int macarg(char *tok)
clexec = TRUE; /* get the argument */
status = nextarg("", tok, NSTRING, ctoec('\n'));
clexec = savcle; /* restore execution mode */
return (status);
return status;
}
/*
@ -232,14 +232,14 @@ int nextarg(char *prompt, char *buffer, int size, int terminator)
{
/* if we are interactive, go get it! */
if (clexec == FALSE)
return (getstring(prompt, buffer, size, terminator));
return getstring(prompt, buffer, size, terminator);
/* grab token and advance past */
execstr = token(execstr, buffer, size);
/* evaluate it */
strcpy(buffer, getval(buffer));
return (TRUE);
return TRUE;
}
/*
@ -258,13 +258,13 @@ int storemac(int f, int n)
/* must have a numeric argument to this function */
if (f == FALSE) {
mlwrite("No macro specified");
return (FALSE);
return FALSE;
}
/* range check the macro number */
if (n < 1 || n > 40) {
mlwrite("Macro number out of range");
return (FALSE);
return FALSE;
}
/* construct the macro buffer name */
@ -275,7 +275,7 @@ int storemac(int f, int n)
/* set up the new macro buffer */
if ((bp = bfind(bname, TRUE, BFINVS)) == NULL) {
mlwrite("Can not create macro");
return (FALSE);
return FALSE;
}
/* and make sure it is empty */
@ -284,7 +284,7 @@ int storemac(int f, int n)
/* and set the macro store pointers to it */
mstore = TRUE;
bstore = bp;
return (TRUE);
return TRUE;
}
#if PROC
@ -304,12 +304,12 @@ int storeproc(int f, int n)
/* a numeric argument means its a numbered macro */
if (f == TRUE)
return (storemac(f, n));
return storemac(f, n);
/* get the name of the procedure */
if ((status =
mlreply("Procedure name: ", &bname[1], NBUFN - 2)) != TRUE)
return (status);
return status;
/* construct the macro buffer name */
bname[0] = '*';
@ -318,7 +318,7 @@ int storeproc(int f, int n)
/* set up the new macro buffer */
if ((bp = bfind(bname, TRUE, BFINVS)) == NULL) {
mlwrite("Can not create macro");
return (FALSE);
return FALSE;
}
/* and make sure it is empty */
@ -327,7 +327,7 @@ int storeproc(int f, int n)
/* and set the macro store pointers to it */
mstore = TRUE;
bstore = bp;
return (TRUE);
return TRUE;
}
/*
@ -345,7 +345,7 @@ int execproc(int f, int n)
/* find out what buffer the user wants to execute */
if ((status =
mlreply("Execute procedure: ", &bufn[1], NBUFN)) != TRUE)
return (status);
return status;
/* construct the buffer name */
bufn[0] = '*';
@ -354,14 +354,14 @@ int execproc(int f, int n)
/* find the pointer to that buffer */
if ((bp = bfind(bufn, FALSE, 0)) == NULL) {
mlwrite("No such procedure");
return (FALSE);
return FALSE;
}
/* and now execute it as asked */
while (n-- > 0)
if ((status = dobuf(bp)) != TRUE)
return (status);
return (TRUE);
return status;
return TRUE;
}
#endif
@ -379,19 +379,19 @@ int execbuf(int f, int n)
/* find out what buffer the user wants to execute */
if ((status = mlreply("Execute buffer: ", bufn, NBUFN)) != TRUE)
return (status);
return status;
/* find the pointer to that buffer */
if ((bp = bfind(bufn, FALSE, 0)) == NULL) {
mlwrite("No such buffer");
return (FALSE);
return FALSE;
}
/* and now execute it as asked */
while (n-- > 0)
if ((status = dobuf(bp)) != TRUE)
return (status);
return (TRUE);
return status;
return TRUE;
}
/*
@ -472,7 +472,7 @@ int dobuf(struct buffer *bp)
failexit:freewhile
(scanner);
freewhile(whlist);
return (FALSE);
return FALSE;
}
whtemp->w_begin = lp;
whtemp->w_type = BTWHILE;
@ -539,7 +539,7 @@ int dobuf(struct buffer *bp)
if ((einit = eline = malloc(linlen + 1)) == NULL) {
mlwrite("%%Out of Memory during macro execution");
freewhile(whlist);
return (FALSE);
return FALSE;
}
strncpy(eline, lp->l_text, linlen);
eline[linlen] = 0; /* make sure it ends */
@ -597,7 +597,7 @@ int dobuf(struct buffer *bp)
if ((c = get1key()) == abortc) {
mlforce("(Macro aborted)");
freewhile(whlist);
return (FALSE);
return FALSE;
}
if (c == metac)
@ -619,7 +619,7 @@ int dobuf(struct buffer *bp)
if (dirnum == NUMDIRS) {
mlwrite("%%Unknown Directive");
freewhile(whlist);
return (FALSE);
return FALSE;
}
/* service only the !ENDM macro here */
@ -640,7 +640,7 @@ int dobuf(struct buffer *bp)
if ((mp = lalloc(linlen)) == NULL) {
mlwrite
("Out of memory while storing macro");
return (FALSE);
return FALSE;
}
/* copy the text into the new line */
@ -708,7 +708,7 @@ int dobuf(struct buffer *bp)
mlwrite
("%%Internal While loop error");
freewhile(whlist);
return (FALSE);
return FALSE;
}
/* reset the line pointer back.. */
@ -749,7 +749,7 @@ int dobuf(struct buffer *bp)
}
mlwrite("%%No such label");
freewhile(whlist);
return (FALSE);
return FALSE;
}
goto onward;
@ -777,7 +777,7 @@ int dobuf(struct buffer *bp)
mlwrite
("%%Internal While loop error");
freewhile(whlist);
return (FALSE);
return FALSE;
}
/* reset the line pointer back.. */
@ -815,7 +815,7 @@ int dobuf(struct buffer *bp)
free(einit);
execlevel = 0;
freewhile(whlist);
return (status);
return status;
}
onward: /* on to the next line */
@ -826,7 +826,7 @@ int dobuf(struct buffer *bp)
eexec: /* exit the current function */
execlevel = 0;
freewhile(whlist);
return (TRUE);
return TRUE;
}
/*
@ -856,7 +856,7 @@ int execfile(int f, int n)
if ((status =
mlreply("File to execute: ", fname, NSTRING - 1)) != TRUE)
return (status);
return status;
#if 1
/* look up the path for the file */
@ -864,15 +864,15 @@ int execfile(int f, int n)
/* if it isn't around */
if (fspec == NULL)
return (FALSE);
return FALSE;
#endif
/* otherwise, execute it */
while (n-- > 0)
if ((status = dofile(fspec)) != TRUE)
return (status);
return status;
return (TRUE);
return TRUE;
}
/*
@ -892,7 +892,7 @@ int dofile(char *fname)
makename(bname, fname); /* derive the name of the buffer */
unqname(bname); /* make sure we don't stomp things */
if ((bp = bfind(bname, TRUE, 0)) == NULL) /* get the needed buffer */
return (FALSE);
return FALSE;
bp->b_mode = MDVIEW; /* mark the buffer as read only */
cb = curbp; /* save the old buffer */
@ -900,18 +900,18 @@ int dofile(char *fname)
/* and try to read in the file to execute */
if ((status = readin(fname, FALSE)) != TRUE) {
curbp = cb; /* restore the current buffer */
return (status);
return status;
}
/* go execute it! */
curbp = cb; /* restore the current buffer */
if ((status = dobuf(bp)) != TRUE)
return (status);
return status;
/* if not displayed, remove the now unneeded buffer and exit */
if (bp->b_nwnd == 0)
zotbuf(bp);
return (TRUE);
return TRUE;
}
/*
@ -934,14 +934,14 @@ int cbuf(int f, int n, int bufnum)
/* find the pointer to that buffer */
if ((bp = bfind(bufname, FALSE, 0)) == NULL) {
mlwrite("Macro not defined");
return (FALSE);
return FALSE;
}
/* and now execute it as asked */
while (n-- > 0)
if ((status = dobuf(bp)) != TRUE)
return (status);
return (TRUE);
return status;
return TRUE;
}
int cbuf1(int f, int n)

88
file.c
View File

@ -26,10 +26,10 @@ int fileread(int f, int n)
char fname[NFILEN];
if (restflag) /* don't allow this command if restricted */
return (resterr());
return resterr();
if ((s = mlreply("Read file: ", fname, NFILEN)) != TRUE)
return (s);
return (readin(fname, TRUE));
return s;
return readin(fname, TRUE);
}
/*
@ -45,14 +45,14 @@ int insfile(int f, int n)
char fname[NFILEN];
if (restflag) /* don't allow this command if restricted */
return (resterr());
return resterr();
if (curbp->b_mode & MDVIEW) /* don't allow this command if */
return (rdonly()); /* we are in read only mode */
return rdonly(); /* we are in read only mode */
if ((s = mlreply("Insert file: ", fname, NFILEN)) != TRUE)
return (s);
return s;
if ((s = ifile(fname)) != TRUE)
return (s);
return (reposition(TRUE, -1));
return s;
return reposition(TRUE, -1);
}
/*
@ -70,10 +70,10 @@ int filefind(int f, int n)
int s; /* status return */
if (restflag) /* don't allow this command if restricted */
return (resterr());
return resterr();
if ((s = mlreply("Find file: ", fname, NFILEN)) != TRUE)
return (s);
return (getfile(fname, TRUE));
return s;
return getfile(fname, TRUE);
}
int viewfile(int f, int n)
@ -83,9 +83,9 @@ int viewfile(int f, int n)
struct window *wp; /* scan for windows that need updating */
if (restflag) /* don't allow this command if restricted */
return (resterr());
return resterr();
if ((s = mlreply("View file: ", fname, NFILEN)) != TRUE)
return (s);
return s;
s = getfile(fname, FALSE);
if (s) { /* if we succeed, put it in view mode */
curwp->w_bufp->b_mode |= MDVIEW;
@ -97,7 +97,7 @@ int viewfile(int f, int n)
wp = wp->w_wndp;
}
}
return (s);
return s;
}
#if CRYPT
@ -113,7 +113,7 @@ static int resetkey(void)
if (curbp->b_key[0] == 0) {
s = set_encryption_key(FALSE, 0);
if (s != TRUE)
return (s);
return s;
}
/* let others know... */
@ -129,7 +129,7 @@ static int resetkey(void)
myencrypt(curbp->b_key, strlen(curbp->b_key));
}
return (TRUE);
return TRUE;
}
#endif
@ -162,7 +162,7 @@ int getfile(char *fname, int lockfl)
curwp->w_flag |= WFMODE | WFHARD;
cknewwindow();
mlwrite("(Old buffer)");
return (TRUE);
return TRUE;
}
}
makename(bname, fname); /* New buffer name. */
@ -170,7 +170,7 @@ int getfile(char *fname, int lockfl)
/* old buffer name conflict code */
s = mlreply("Buffer name: ", bname, NBUFN);
if (s == ABORT) /* ^G to just quit */
return (s);
return s;
if (s == FALSE) { /* CR to clobber it */
makename(bname, fname);
break;
@ -178,7 +178,7 @@ int getfile(char *fname, int lockfl)
}
if (bp == NULL && (bp = bfind(bname, TRUE, 0)) == NULL) {
mlwrite("Cannot create buffer");
return (FALSE);
return FALSE;
}
if (--curbp->b_nwnd == 0) { /* Undisplay. */
curbp->b_dotp = curwp->w_dotp;
@ -228,17 +228,17 @@ int readin(char *fname, int lockfl)
goto out;
}
#else
return (ABORT);
return ABORT;
#endif
#endif
#if CRYPT
s = resetkey();
if (s != TRUE)
return (s);
return s;
#endif
bp = curbp; /* Cheap. */
if ((s = bclear(bp)) != TRUE) /* Might be old. */
return (s);
return s;
bp->b_flag &= ~(BFINVS | BFCHG);
strcpy(bp->b_fname, fname);
@ -310,12 +310,12 @@ int readin(char *fname, int lockfl)
}
}
if (s == FIOERR || s == FIOFNF) /* False if error. */
return (FALSE);
return FALSE;
#if 0
if (s == ABORT)
return (ABORT);
return ABORT;
#endif
return (TRUE);
return TRUE;
}
/*
@ -398,9 +398,9 @@ int filewrite(int f, int n)
char fname[NFILEN];
if (restflag) /* don't allow this command if restricted */
return (resterr());
return resterr();
if ((s = mlreply("Write file: ", fname, NFILEN)) != TRUE)
return (s);
return s;
if ((s = writeout(fname)) == TRUE) {
strcpy(curbp->b_fname, fname);
curbp->b_flag &= ~BFCHG;
@ -411,7 +411,7 @@ int filewrite(int f, int n)
wp = wp->w_wndp;
}
}
return (s);
return s;
}
/*
@ -428,19 +428,19 @@ int filesave(int f, int n)
int s;
if (curbp->b_mode & MDVIEW) /* don't allow this command if */
return (rdonly()); /* we are in read only mode */
return rdonly(); /* we are in read only mode */
if ((curbp->b_flag & BFCHG) == 0) /* Return, no changes. */
return (TRUE);
return TRUE;
if (curbp->b_fname[0] == 0) { /* Must have a name. */
mlwrite("No file name");
return (FALSE);
return FALSE;
}
/* complain about truncated files */
if ((curbp->b_flag & BFTRUNC) != 0) {
if (mlyesno("Truncated file ... write it out") == FALSE) {
mlwrite("(Aborted)");
return (FALSE);
return FALSE;
}
}
@ -453,7 +453,7 @@ int filesave(int f, int n)
wp = wp->w_wndp;
}
}
return (s);
return s;
}
/*
@ -473,14 +473,14 @@ int writeout(char *fn)
#if CRYPT
s = resetkey();
if (s != TRUE)
return (s);
return s;
#endif
/* turn off ALL keyboard translation in case we get a dos error */
TTkclose();
if ((s = ffwopen(fn)) != FIOSUC) { /* Open writes message. */
TTkopen();
return (FALSE);
return FALSE;
}
mlwrite("(Writing...)"); /* tell us were writing */
lp = lforw(curbp->b_linep); /* First line. */
@ -503,8 +503,8 @@ int writeout(char *fn)
ffclose(); /* if a write error. */
TTkopen();
if (s != FIOSUC) /* Some sort of error. */
return (FALSE);
return (TRUE);
return FALSE;
return TRUE;
}
/*
@ -523,9 +523,9 @@ int filename(int f, int n)
char fname[NFILEN];
if (restflag) /* don't allow this command if restricted */
return (resterr());
return resterr();
if ((s = mlreply("Name: ", fname, NFILEN)) == ABORT)
return (s);
return s;
if (s == FALSE)
strcpy(curbp->b_fname, "");
else
@ -537,7 +537,7 @@ int filename(int f, int n)
wp = wp->w_wndp;
}
curbp->b_mode &= ~MDVIEW; /* no longer read only mode */
return (TRUE);
return TRUE;
}
/*
@ -565,14 +565,14 @@ int ifile(char *fname)
goto out;
if (s == FIOFNF) { /* File not found. */
mlwrite("(No such file)");
return (FALSE);
return FALSE;
}
mlwrite("(Inserting file)");
#if CRYPT
s = resetkey();
if (s != TRUE)
return (s);
return s;
#endif
/* back up a line and save the mark here */
curwp->w_dotp = lback(curwp->w_dotp);
@ -632,6 +632,6 @@ int ifile(char *fname)
curbp->b_marko = curwp->w_marko;
if (s == FIOERR) /* False if error. */
return (FALSE);
return (TRUE);
return FALSE;
return TRUE;
}

View File

@ -20,9 +20,9 @@ static int eofflag; /* end-of-file flag */
int ffropen(char *fn)
{
if ((ffp = fopen(fn, "r")) == NULL)
return (FIOFNF);
return FIOFNF;
eofflag = FALSE;
return (FIOSUC);
return FIOSUC;
}
/*
@ -40,9 +40,9 @@ int ffwopen(char *fn)
if ((ffp = fopen(fn, "w")) == NULL) {
#endif
mlwrite("Cannot open file for writing");
return (FIOERR);
return FIOERR;
}
return (FIOSUC);
return FIOSUC;
}
/*
@ -64,12 +64,12 @@ int ffclose(void)
#if V7 | USG | BSD | (MSDOS & (MSC | TURBO))
if (fclose(ffp) != FALSE) {
mlwrite("Error closing file");
return (FIOERR);
return FIOERR;
}
return (FIOSUC);
return FIOSUC;
#else
fclose(ffp);
return (FIOSUC);
return FIOSUC;
#endif
}
@ -102,10 +102,10 @@ int ffputline(char *buf, int nbuf)
if (ferror(ffp)) {
mlwrite("Write I/O error");
return (FIOERR);
return FIOERR;
}
return (FIOSUC);
return FIOSUC;
}
/*
@ -122,7 +122,7 @@ int ffgetline(void)
/* if we are at the end...return it */
if (eofflag)
return (FIOEOF);
return FIOEOF;
/* dump fline if it ended up too big */
if (flen > NSTRING) {
@ -133,7 +133,7 @@ int ffgetline(void)
/* if we don't have an fline, allocate one */
if (fline == NULL)
if ((fline = malloc(flen = NSTRING)) == NULL)
return (FIOMEM);
return FIOMEM;
/* read the line in */
#if PKCODE
@ -166,7 +166,7 @@ int ffgetline(void)
if (i >= flen) {
if ((tmpline =
malloc(flen + NSTRING)) == NULL)
return (FIOMEM);
return FIOMEM;
strncpy(tmpline, fline, flen);
flen += NSTRING;
free(fline);
@ -182,13 +182,13 @@ int ffgetline(void)
if (c == EOF) {
if (ferror(ffp)) {
mlwrite("File read error");
return (FIOERR);
return FIOERR;
}
if (i != 0)
eofflag = TRUE;
else
return (FIOEOF);
return FIOEOF;
}
/* terminate and decrypt the string */
@ -197,7 +197,7 @@ int ffgetline(void)
if (cryptflag)
myencrypt(fline, strlen(fline));
#endif
return (FIOSUC);
return FIOSUC;
}
/*
@ -214,9 +214,9 @@ int fexist(char *fname)
/* if it fails, just return false! */
if (fp == NULL)
return (FALSE);
return FALSE;
/* otherwise, close it and report true */
fclose(fp);
return (TRUE);
return TRUE;
}

View File

@ -348,11 +348,11 @@ static int scinit(int type)
/* if we have nothing to do....don't do it */
if (dtype == type)
return (TRUE);
return TRUE;
/* if we try to switch to EGA and there is none, don't */
if (type == CDEGA && egaexist != TRUE)
return (FALSE);
return FALSE;
/* if we had the EGA open... close it */
if (dtype == CDEGA)
@ -395,7 +395,7 @@ static int scinit(int type)
addr.laddr = scadd + (long) (NCOL * i * 2);
scptr[i] = addr.paddr;
}
return (TRUE);
return TRUE;
}
/* getboard: Determine which type of display board is attached.
@ -425,7 +425,7 @@ int getboard(void)
rg.x.bx = 0xff10;
int86(0x10, &rg, &rg); /* If EGA, bh=0-1 and bl=0-3 */
egaexist = !(rg.x.bx & 0xfefc); /* Yes, it's EGA */
return (type);
return type;
}
/* init the computer to work with the EGA */

52
input.c
View File

@ -44,13 +44,13 @@ int mlyesno(char *prompt)
c = tgetc();
if (c == ectoc(abortc)) /* Bail out! */
return (ABORT);
return ABORT;
if (c == 'y' || c == 'Y')
return (TRUE);
return TRUE;
if (c == 'n' || c == 'N')
return (FALSE);
return FALSE;
}
}
@ -64,12 +64,12 @@ int mlyesno(char *prompt)
int mlreply(char *prompt, char *buf, int nbuf)
{
return (nextarg(prompt, buf, nbuf, ctoec('\n')));
return nextarg(prompt, buf, nbuf, ctoec('\n'));
}
int mlreplyt(char *prompt, char *buf, int nbuf, int eolchar)
{
return (nextarg(prompt, buf, nbuf, eolchar));
return nextarg(prompt, buf, nbuf, eolchar);
}
/*
@ -83,7 +83,7 @@ int ectoc(int c)
c = c & ~(CONTROL | 0x40);
if (c & SPEC)
c = c & 255;
return (c);
return c;
}
/*
@ -95,7 +95,7 @@ int ctoec(int c)
{
if (c >= 0x00 && c <= 0x1F)
c = CONTROL | (c + '@');
return (c);
return c;
}
/*
@ -120,7 +120,7 @@ fn_t getname(void)
if (clexec) {
if (macarg(buf) != TRUE)
return NULL;
return (fncmatch(&buf[0]));
return fncmatch(&buf[0]);
}
/* build a name string from the keyboard */
@ -132,7 +132,7 @@ fn_t getname(void)
buf[cpos] = 0;
/* and match it off */
return (fncmatch(&buf[0]));
return fncmatch(&buf[0]);
} else if (c == ectoc(abortc)) { /* Bell, abort */
ctrlg(FALSE, 0);
@ -178,7 +178,7 @@ fn_t getname(void)
while (*sp)
TTputc(*sp++);
TTflush();
return (ffp->n_func);
return ffp->n_func;
} else {
/* << << << << << << << << << << << << << << << << << */
/* try for a partial match against the list */
@ -258,7 +258,7 @@ int tgetc(void)
/* if there is some left... */
if (kbdptr < kbdend)
return ((int) *kbdptr++);
return (int) *kbdptr++;
/* at the end of last repitition? */
if (--kbdrep < 1) {
@ -271,7 +271,7 @@ int tgetc(void)
/* reset the macro to the begining for the next rep */
kbdptr = &kbdm[0];
return ((int) *kbdptr++);
return (int) *kbdptr++;
}
}
@ -294,7 +294,7 @@ int tgetc(void)
}
/* and finally give the char back */
return (c);
return c;
}
/* GET1KEY: Get one keystroke. The only prefixs legal here
@ -313,13 +313,13 @@ int get1key(void)
c = tgetc();
if (c >= 0x00 && c <= 0x1F) /* control key? */
c = CONTROL | (c + '@');
return (SPEC | c);
return SPEC | c;
}
#endif
if (c >= 0x00 && c <= 0x1F) /* C0 control -> C- */
c = CONTROL | (c + '@');
return (c);
return c;
}
/* GETCMD: Get a command from the keyboard. Process all applicable
@ -348,12 +348,12 @@ int getcmd(void)
handle_CSI:
c = get1key();
if (c >= 'A' && c <= 'D')
return (SPEC | c | cmask);
return SPEC | c | cmask;
if (c >= 'E' && c <= 'z' && c != 'i' && c != 'c')
return (SPEC | c | cmask);
return SPEC | c | cmask;
d = get1key();
if (d == '~') /* ESC [ n ~ P.K. */
return (SPEC | c | cmask);
return SPEC | c | cmask;
switch (c) { /* ESC [ n n ~ P.K. */
case '1':
c = d + 32;
@ -376,7 +376,7 @@ handle_CSI:
} else if (c == 'c') /* ESC key P.K. */
c = get1key();
else
return (SPEC | c | cmask);
return SPEC | c | cmask;
}
#endif
#if VT220
@ -389,7 +389,7 @@ handle_CSI:
c ^= DIFCASE;
if (c >= 0x00 && c <= 0x1F) /* control key */
c = CONTROL | (c + '@');
return (META | c);
return META | c;
}
#if PKCODE
else if (c == metac) {
@ -404,7 +404,7 @@ handle_CSI:
c ^= DIFCASE;
if (c >= 0x00 && c <= 0x1F) /* control key */
c = CONTROL | (c + '@');
return (META | c);
return META | c;
}
#endif
@ -425,11 +425,11 @@ handle_CSI:
c -= 0x20;
if (c >= 0x00 && c <= 0x1F) /* control key */
c = CONTROL | (c + '@');
return (CTLX | c);
return CTLX | c;
}
/* otherwise, just return it */
return (c);
return c;
}
/* A more generalized prompt/reply function allowing the caller
@ -492,9 +492,9 @@ int getstring(char *prompt, char *buf, int nbuf, int eolchar)
/* if we default the buffer, return FALSE */
if (buf[0] == 0)
return (FALSE);
return FALSE;
return (TRUE);
return TRUE;
}
/* change from command form back to character form */
@ -504,7 +504,7 @@ int getstring(char *prompt, char *buf, int nbuf, int eolchar)
/* Abort the input? */
ctrlg(FALSE, 0);
TTflush();
return (ABORT);
return ABORT;
} else if ((c == 0x7F || c == 0x08) && quotef == FALSE) {
/* rubout/erase */
if (cpos != 0) {

View File

@ -75,7 +75,7 @@ int risearch(int f, int n)
#if PKCODE
matchlen = strlen(pat);
#endif
return (TRUE);
return TRUE;
}
/*
@ -107,7 +107,7 @@ int fisearch(int f, int n)
#if PKCODE
matchlen = strlen(pat);
#endif
return (TRUE);
return TRUE;
}
/*
@ -193,11 +193,11 @@ int isearch(int f, int n)
/* Most cases here change the search */
if (expc == metac) /* Want to quit searching? */
return (TRUE); /* Quit searching now */
return TRUE; /* Quit searching now */
switch (c) { /* dispatch on the input char */
case IS_ABORT: /* If abort search request */
return (FALSE); /* Quit searching again */
return FALSE; /* Quit searching again */
case IS_REVERSE: /* If backward search */
case IS_FORWARD: /* If forward search */
@ -225,7 +225,7 @@ int isearch(int f, int n)
case IS_BACKSP: /* If a backspace: */
case IS_RUBOUT: /* or if a Rubout: */
if (cmd_offset <= 1) /* Anything to delete? */
return (TRUE); /* No, just exit */
return TRUE; /* No, just exit */
--cmd_offset; /* Back up over the Rubout */
cmd_buff[--cmd_offset] = '\0'; /* Yes, delete last char */
curwp->w_dotp = curline; /* Reset the line pointer */
@ -240,7 +240,7 @@ int isearch(int f, int n)
default: /* All other chars */
if (c < ' ') { /* Is it printable? *//* Nope. */
reeat(c); /* Re-eat the char */
return (TRUE); /* And return the last status */
return TRUE; /* And return the last status */
}
} /* Switch */
@ -249,7 +249,7 @@ int isearch(int f, int n)
pat[cpos++] = c; /* put the char in the buffer */
if (cpos >= NPAT) { /* too many chars in string? *//* Yup. Complain about it */
mlwrite("? Search string too long");
return (TRUE); /* Return an error */
return TRUE; /* Return an error */
}
pat[cpos] = 0; /* null terminate the buffer */
col = echo_char(c, col); /* Echo the character */
@ -293,7 +293,7 @@ int checknext(char chr, char *patrn, int dir) /* Check next character in search
if (curoff == llength(curline)) { /* If at end of line */
curline = lforw(curline); /* Skip to the next line */
if (curline == curbp->b_linep)
return (FALSE); /* Abort if at end of buffer */
return FALSE; /* Abort if at end of buffer */
curoff = 0; /* Start at the beginning of the line */
buffchar = '\n'; /* And say the next char is NL */
} else
@ -303,9 +303,9 @@ int checknext(char chr, char *patrn, int dir) /* Check next character in search
curwp->w_doto = curoff; /* to the matched character */
curwp->w_flag |= WFMOVE; /* Say that we've moved */
}
return (status); /* And return the status */
return status; /* And return the status */
} else /* Else, if reverse search: */
return (match_pat(patrn)); /* See if we're in the right place */
return match_pat(patrn); /* See if we're in the right place */
}
/*
@ -335,7 +335,7 @@ int scanmore(char *patrn, int dir) /* search forward or back for a pattern
TTflush(); /* see that the feep feeps */
}
return (sts); /* else, don't even try */
return sts; /* else, don't even try */
}
/*
@ -368,14 +368,14 @@ int match_pat(char *patrn) /* See if the pattern string matches string at "."
curline = lforw(curline); /* Skip to the next line */
curoff = 0; /* Start at the beginning of the line */
if (curline == curbp->b_linep)
return (FALSE); /* Abort if at end of buffer */
return FALSE; /* Abort if at end of buffer */
buffchar = '\n'; /* And say the next char is NL */
} else
buffchar = lgetc(curline, curoff++); /* Get the next char */
if (!eq(buffchar, patrn[i])) /* Is it what we're looking for? */
return (FALSE); /* Nope, just punt it then */
return FALSE; /* Nope, just punt it then */
}
return (TRUE); /* Everything matched? Let's celebrate */
return TRUE; /* Everything matched? Let's celebrate */
}
/*
@ -394,7 +394,7 @@ int promptpattern(char *prompt)
if (!clexec) {
mlwrite(tpat);
}
return (strlen(tpat));
return strlen(tpat);
}
/*
@ -439,7 +439,7 @@ static int echo_char(int c, int col)
} else
TTputc(c); /* Otherwise, output raw char */
TTflush(); /* Flush the output */
return (++col); /* return the new column no */
return ++col; /* return the new column no */
}
/*
@ -456,7 +456,7 @@ int get_char(void)
if (cmd_reexecute >= 0) /* Is there an offset? */
if ((c = cmd_buff[cmd_reexecute++]) != 0)
return (c); /* Yes, return any character */
return c; /* Yes, return any character */
/* We're not re-executing (or aren't any more). Try for a real char */
@ -464,12 +464,12 @@ int get_char(void)
update(FALSE); /* Pretty up the screen */
if (cmd_offset >= CMDBUFLEN - 1) { /* If we're getting too big ... */
mlwrite("? command too long"); /* Complain loudly and bitterly */
return (metac); /* And force a quit */
return metac; /* And force a quit */
}
c = get1key(); /* Get the next character */
cmd_buff[cmd_offset++] = c; /* Save the char for next time */
cmd_buff[cmd_offset] = '\0'; /* And terminate the buffer */
return (c); /* Return the character */
return c; /* Return the character */
}
/*
@ -486,7 +486,7 @@ int uneat(void)
term.t_getchar = saved_get_char; /* restore the routine address */
c = eaten_char; /* Get the re-eaten char */
eaten_char = -1; /* Clear the old char */
return (c); /* and return the last char */
return c; /* and return the last char */
}
void reeat(int c)

74
line.c
View File

@ -34,11 +34,11 @@ struct line *lalloc(int used)
size = NBLOCK; /* line is for type-in. */
if ((lp = (struct line *)malloc(sizeof(struct line) + size)) == NULL) {
mlwrite("(OUT OF MEMORY)");
return (NULL);
return NULL;
}
lp->l_size = size;
lp->l_used = used;
return (lp);
return lp;
}
/*
@ -119,7 +119,7 @@ int insspace(int f, int n)
{
linsert(n, ' ');
backchar(f, n);
return (TRUE);
return TRUE;
}
/*
@ -143,7 +143,7 @@ int linstr(char *instr)
}
instr++;
}
return (status);
return status;
}
/*
@ -168,16 +168,16 @@ int linsert(int n, int c)
struct window *wp;
if (curbp->b_mode & MDVIEW) /* don't allow this command if */
return (rdonly()); /* we are in read only mode */
return rdonly(); /* we are in read only mode */
lchange(WFEDIT);
lp1 = curwp->w_dotp; /* Current line */
if (lp1 == curbp->b_linep) { /* At the end: special */
if (curwp->w_doto != 0) {
mlwrite("bug: linsert");
return (FALSE);
return FALSE;
}
if ((lp2 = lalloc(n)) == NULL) /* Allocate new line */
return (FALSE);
return FALSE;
lp3 = lp1->l_bp; /* Previous line */
lp3->l_fp = lp2; /* Link in */
lp2->l_fp = lp1;
@ -187,12 +187,12 @@ int linsert(int n, int c)
lp2->l_text[i] = c;
curwp->w_dotp = lp2;
curwp->w_doto = n;
return (TRUE);
return TRUE;
}
doto = curwp->w_doto; /* Save for later. */
if (lp1->l_used + n > lp1->l_size) { /* Hard: reallocate */
if ((lp2 = lalloc(lp1->l_used + n)) == NULL)
return (FALSE);
return FALSE;
cp1 = &lp1->l_text[0];
cp2 = &lp2->l_text[0];
while (cp1 != &lp1->l_text[doto])
@ -231,7 +231,7 @@ int linsert(int n, int c)
}
wp = wp->w_wndp;
}
return (TRUE);
return TRUE;
}
/*
@ -245,7 +245,7 @@ int lowrite(int c)
(lgetc(curwp->w_dotp, curwp->w_doto) != '\t' ||
((curwp->w_doto) & tabmask) == tabmask))
ldelete(1L, FALSE);
return (linsert(1, c));
return linsert(1, c);
}
/*
@ -269,7 +269,7 @@ int lover(char *ostr)
}
ostr++;
}
return (status);
return status;
}
/*
@ -290,7 +290,7 @@ int lnewline(void)
struct window *wp;
if (curbp->b_mode & MDVIEW) /* don't allow this command if */
return (rdonly()); /* we are in read only mode */
return rdonly(); /* we are in read only mode */
#if SCROLLCODE
lchange(WFHARD | WFINS);
#else
@ -299,7 +299,7 @@ int lnewline(void)
lp1 = curwp->w_dotp; /* Get the address and */
doto = curwp->w_doto; /* offset of "." */
if ((lp2 = lalloc(doto)) == NULL) /* New first half line */
return (FALSE);
return FALSE;
cp1 = &lp1->l_text[0]; /* Shuffle text around */
cp2 = &lp2->l_text[0];
while (cp1 != &lp1->l_text[doto])
@ -330,7 +330,7 @@ int lnewline(void)
}
wp = wp->w_wndp;
}
return (TRUE);
return TRUE;
}
/*
@ -352,12 +352,12 @@ int ldelete(long n, int kflag)
struct window *wp;
if (curbp->b_mode & MDVIEW) /* don't allow this command if */
return (rdonly()); /* we are in read only mode */
return rdonly(); /* we are in read only mode */
while (n != 0) {
dotp = curwp->w_dotp;
doto = curwp->w_doto;
if (dotp == curbp->b_linep) /* Hit end of buffer. */
return (FALSE);
return FALSE;
chunk = dotp->l_used - doto; /* Size of chunk. */
if (chunk > n)
chunk = n;
@ -369,7 +369,7 @@ int ldelete(long n, int kflag)
#endif
if (ldelnewline() == FALSE
|| (kflag != FALSE && kinsert('\n') == FALSE))
return (FALSE);
return FALSE;
--n;
continue;
}
@ -379,7 +379,7 @@ int ldelete(long n, int kflag)
if (kflag != FALSE) { /* Kill? */
while (cp1 != cp2) {
if (kinsert(*cp1) == FALSE)
return (FALSE);
return FALSE;
++cp1;
}
cp1 = &dotp->l_text[doto];
@ -403,7 +403,7 @@ int ldelete(long n, int kflag)
}
n -= chunk;
}
return (TRUE);
return TRUE;
}
/*
@ -430,7 +430,7 @@ char *getctext(void)
while (size--)
*dp++ = *sp++;
*dp = 0;
return (rline);
return rline;
}
/*
@ -446,14 +446,14 @@ int putctext(char *iline)
/* delete the current line */
curwp->w_doto = 0; /* starting at the beginning of the line */
if ((status = killtext(TRUE, 1)) != TRUE)
return (status);
return status;
/* insert the new line */
if ((status = linstr(iline)) != TRUE)
return (status);
return status;
status = lnewline();
backline(TRUE, 1);
return (status);
return status;
}
/*
@ -475,13 +475,13 @@ int ldelnewline(void)
struct window *wp;
if (curbp->b_mode & MDVIEW) /* don't allow this command if */
return (rdonly()); /* we are in read only mode */
return rdonly(); /* we are in read only mode */
lp1 = curwp->w_dotp;
lp2 = lp1->l_fp;
if (lp2 == curbp->b_linep) { /* At the buffer end. */
if (lp1->l_used == 0) /* Blank line. */
lfree(lp1);
return (TRUE);
return TRUE;
}
if (lp2->l_used <= lp1->l_size - lp1->l_used) {
cp1 = &lp1->l_text[lp1->l_used];
@ -506,10 +506,10 @@ int ldelnewline(void)
lp1->l_fp = lp2->l_fp;
lp2->l_fp->l_bp = lp1;
free((char *) lp2);
return (TRUE);
return TRUE;
}
if ((lp3 = lalloc(lp1->l_used + lp2->l_used)) == NULL)
return (FALSE);
return FALSE;
cp1 = &lp1->l_text[0];
cp2 = &lp3->l_text[0];
while (cp1 != &lp1->l_text[lp1->l_used])
@ -541,7 +541,7 @@ int ldelnewline(void)
}
free((char *) lp1);
free((char *) lp2);
return (TRUE);
return TRUE;
}
/*
@ -582,7 +582,7 @@ int kinsert(int c)
/* check to see if we need a new chunk */
if (kused >= KBLOCK) {
if ((nchunk = (struct kill *)malloc(sizeof(struct kill))) == NULL)
return (FALSE);
return FALSE;
if (kbufh == NULL) /* set head ptr if first time */
kbufh = nchunk;
if (kbufp != NULL) /* point the current to this new one */
@ -594,7 +594,7 @@ int kinsert(int c)
/* and now insert the character */
kbufp->d_chunk[kused++] = c;
return (TRUE);
return TRUE;
}
/*
@ -610,12 +610,12 @@ int yank(int f, int n)
struct kill *kp; /* pointer into kill buffer */
if (curbp->b_mode & MDVIEW) /* don't allow this command if */
return (rdonly()); /* we are in read only mode */
return rdonly(); /* we are in read only mode */
if (n < 0)
return (FALSE);
return FALSE;
/* make sure there is something to yank */
if (kbufh == NULL)
return (TRUE); /* not an error, just nothing */
return TRUE; /* not an error, just nothing */
/* for each time.... */
while (n--) {
@ -629,14 +629,14 @@ int yank(int f, int n)
while (i--) {
if ((c = *sp++) == '\n') {
if (lnewline() == FALSE)
return (FALSE);
return FALSE;
} else {
if (linsert(1, c) == FALSE)
return (FALSE);
return FALSE;
}
}
kp = kp->d_next;
}
}
return (TRUE);
return TRUE;
}

26
lock.c
View File

@ -31,20 +31,20 @@ int lockchk(char *fname)
if (numlocks > 0)
for (i = 0; i < numlocks; ++i)
if (strcmp(fname, lname[i]) == 0)
return (TRUE);
return TRUE;
/* if we have a full locking table, bitch and leave */
if (numlocks == NLOCKS) {
mlwrite("LOCK ERROR: Lock table full");
return (ABORT);
return ABORT;
}
/* next, try to lock it */
status = lock(fname);
if (status == ABORT) /* file is locked, no override */
return (ABORT);
return ABORT;
if (status == FALSE) /* locked, overriden, dont add to table */
return (TRUE);
return TRUE;
/* we have now locked it, add it to our table */
lname[++numlocks - 1] = (char *) malloc(strlen(fname) + 1);
@ -52,12 +52,12 @@ int lockchk(char *fname)
undolock(fname); /* free the lock */
mlwrite("Cannot lock, out of memory");
--numlocks;
return (ABORT);
return ABORT;
}
/* everthing is cool, add it to the table */
strcpy(lname[numlocks - 1], fname);
return (TRUE);
return TRUE;
}
/*
@ -78,7 +78,7 @@ int lockrel(void)
free(lname[i]);
}
numlocks = 0;
return (status);
return status;
}
/*
@ -99,12 +99,12 @@ int lock(char *fname)
/* attempt to lock the file */
locker = dolock(fname);
if (locker == NULL) /* we win */
return (TRUE);
return TRUE;
/* file failed...abort */
if (strncmp(locker, "LOCK", 4) == 0) {
lckerror(locker);
return (ABORT);
return ABORT;
}
/* someone else has it....override? */
@ -113,9 +113,9 @@ int lock(char *fname)
strcat(msg, ", override?");
status = mlyesno(msg); /* ask them */
if (status == TRUE)
return (FALSE);
return FALSE;
else
return (ABORT);
return ABORT;
}
/*
@ -132,11 +132,11 @@ int unlock(char *fname)
/* unclock and return */
locker = undolock(fname);
if (locker == NULL)
return (TRUE);
return TRUE;
/* report the error and come back */
lckerror(locker);
return (FALSE);
return FALSE;
}
/*

48
main.c
View File

@ -313,7 +313,7 @@ int main(int argc, char **argv)
#if CALLED
/* if we were called as a subroutine and want to leave, do so */
if (eexitflag)
return (eexitval);
return eexitval;
#endif
/* execute the "command" macro...normally null */
@ -494,7 +494,7 @@ int execute(int c, int f, int n)
thisflag = 0;
status = (*execfunc) (f, n);
lastflag = thisflag;
return (status);
return status;
}
/*
@ -523,7 +523,7 @@ int execute(int c, int f, int n)
#endif
if (n <= 0) { /* Fenceposts. */
lastflag = 0;
return (n < 0 ? FALSE : TRUE);
return n < 0 ? FALSE : TRUE;
}
thisflag = 0; /* For the future. */
@ -561,12 +561,12 @@ int execute(int c, int f, int n)
}
lastflag = thisflag;
return (status);
return status;
}
TTbeep();
mlwrite("(Key not bound)"); /* complain */
lastflag = 0; /* Fake last flags. */
return (FALSE);
return FALSE;
}
/*
@ -594,13 +594,13 @@ int quickexit(int f, int n)
#endif
if ((status = filesave(f, n)) != TRUE) {
curbp = oldcb; /* restore curbp */
return (status);
return status;
}
}
bp = bp->b_bufp; /* on to the next buffer */
}
quit(f, n); /* conditionally quit */
return (TRUE);
return TRUE;
}
static void emergencyexit(int signr)
@ -638,7 +638,7 @@ int quit(int f, int n)
exit(GOOD);
}
mlwrite("");
return (s);
return s;
}
/*
@ -650,13 +650,13 @@ int ctlxlp(int f, int n)
{
if (kbdmode != STOP) {
mlwrite("%%Macro already active");
return (FALSE);
return FALSE;
}
mlwrite("(Start macro)");
kbdptr = &kbdm[0];
kbdend = kbdptr;
kbdmode = RECORD;
return (TRUE);
return TRUE;
}
/*
@ -667,13 +667,13 @@ int ctlxrp(int f, int n)
{
if (kbdmode == STOP) {
mlwrite("%%Macro not active");
return (FALSE);
return FALSE;
}
if (kbdmode == RECORD) {
mlwrite("(End macro)");
kbdmode = STOP;
}
return (TRUE);
return TRUE;
}
/*
@ -685,14 +685,14 @@ int ctlxe(int f, int n)
{
if (kbdmode != STOP) {
mlwrite("%%Macro already active");
return (FALSE);
return FALSE;
}
if (n <= 0)
return (TRUE);
return TRUE;
kbdrep = n; /* remember how many times to execute */
kbdmode = PLAY; /* start us in play mode */
kbdptr = &kbdm[0]; /* at the beginning */
return (TRUE);
return TRUE;
}
/*
@ -705,7 +705,7 @@ int ctrlg(int f, int n)
TTbeep();
kbdmode = STOP;
mlwrite("(Aborted)");
return (ABORT);
return ABORT;
}
/*
@ -716,38 +716,38 @@ int rdonly(void)
{
TTbeep();
mlwrite("(Key illegal in VIEW mode)");
return (FALSE);
return FALSE;
}
int resterr(void)
{
TTbeep();
mlwrite("(That command is RESTRICTED)");
return (FALSE);
return FALSE;
}
/* user function that does NOTHING */
int nullproc(int f, int n)
{
return (TRUE);
return TRUE;
}
/* dummy function for binding to meta prefix */
int metafn(int f, int n)
{
return (TRUE);
return TRUE;
}
/* dummy function for binding to control-x prefix */
int cex(int f, int n)
{
return (TRUE);
return TRUE;
}
/* dummy function for binding to universal-argument */
int unarg(int f, int n)
{
return (TRUE);
return TRUE;
}
/***** Compiler specific Library functions ****/
@ -781,7 +781,7 @@ unsigned nbytes; /* # of bytes to allocate */
#endif
}
return (mp);
return mp;
}
release(mp)
@ -869,7 +869,7 @@ int cexit(int status)
#if CALLED
eexitflag = TRUE; /* flag a program exit */
eexitval = status;
return (status);
return status;
#else
#undef exit
exit(status);

View File

@ -28,7 +28,7 @@
int gethostname(char *name, int namelen)
{
return (sysinfo(SI_HOSTNAME, name, namelen));
return sysinfo(SI_HOSTNAME, name, namelen);
}
#endif

View File

@ -130,7 +130,7 @@ int ttputc(int c)
}
}
fputc(c, stdout);
return (TRUE);
return TRUE;
}
/*

154
random.c
View File

@ -20,7 +20,7 @@ int setfillcol(int f, int n)
{
fillcol = n;
mlwrite("(Fill column is %d)", n);
return (TRUE);
return TRUE;
}
/*
@ -92,7 +92,7 @@ int showcpos(int f, int n)
mlwrite("Line %d/%d Col %d/%d Char %D/%D (%d%%) char = 0x%x",
predlines + 1, numlines + 1, col, ecol,
predchars, numchars, ratio, curchar);
return (TRUE);
return TRUE;
}
int getcline(void)
@ -114,7 +114,7 @@ int getcline(void)
}
/* and return the resulting count */
return (numlines + 1);
return numlines + 1;
}
/*
@ -134,7 +134,7 @@ int getccol(int bflg)
++col;
++col;
}
return (col);
return col;
}
/*
@ -171,7 +171,7 @@ int setccol(int pos)
curwp->w_doto = i;
/* and tell weather we made it */
return (col >= pos);
return col >= pos;
}
/*
@ -189,19 +189,19 @@ int twiddle(int f, int n)
int cr;
if (curbp->b_mode & MDVIEW) /* don't allow this command if */
return (rdonly()); /* we are in read only mode */
return rdonly(); /* we are in read only mode */
dotp = curwp->w_dotp;
doto = curwp->w_doto;
if (doto == llength(dotp) && --doto < 0)
return (FALSE);
return FALSE;
cr = lgetc(dotp, doto);
if (--doto < 0)
return (FALSE);
return FALSE;
cl = lgetc(dotp, doto);
lputc(dotp, doto + 0, cr);
lputc(dotp, doto + 1, cl);
lchange(WFEDIT);
return (TRUE);
return TRUE;
}
/*
@ -216,19 +216,19 @@ int quote(int f, int n)
int c;
if (curbp->b_mode & MDVIEW) /* don't allow this command if */
return (rdonly()); /* we are in read only mode */
return rdonly(); /* we are in read only mode */
c = tgetc();
if (n < 0)
return (FALSE);
return FALSE;
if (n == 0)
return (TRUE);
return TRUE;
if (c == '\n') {
do {
s = lnewline();
} while (s == TRUE && --n);
return (s);
return s;
}
return (linsert(n, c));
return linsert(n, c);
}
/*
@ -241,14 +241,14 @@ int quote(int f, int n)
int insert_tab(int f, int n)
{
if (n < 0)
return (FALSE);
return FALSE;
if (n == 0 || n > 1) {
tabsize = n;
return (TRUE);
return TRUE;
}
if (!tabsize)
return (linsert(1, '\t'));
return (linsert(tabsize - (getccol(FALSE) % tabsize), ' '));
return linsert(1, '\t');
return linsert(tabsize - (getccol(FALSE) % tabsize), ' ');
}
#if AEDIT
@ -262,7 +262,7 @@ int detab(int f, int n)
int inc; /* increment to next line [sgn(n)] */
if (curbp->b_mode & MDVIEW) /* don't allow this command if */
return (rdonly()); /* we are in read only mode */
return rdonly(); /* we are in read only mode */
if (f == FALSE)
n = 1;
@ -291,7 +291,7 @@ int detab(int f, int n)
curwp->w_doto = 0; /* to the begining of the line */
thisflag &= ~CFCPCN; /* flag that this resets the goal column */
lchange(WFEDIT); /* yes, we have made at least an edit */
return (TRUE);
return TRUE;
}
/*
@ -307,7 +307,7 @@ int entab(int f, int n)
char cchar; /* current character */
if (curbp->b_mode & MDVIEW) /* don't allow this command if */
return (rdonly()); /* we are in read only mode */
return rdonly(); /* we are in read only mode */
if (f == FALSE)
n = 1;
@ -365,7 +365,7 @@ int entab(int f, int n)
curwp->w_doto = 0; /* to the begining of the line */
thisflag &= ~CFCPCN; /* flag that this resets the goal column */
lchange(WFEDIT); /* yes, we have made at least an edit */
return (TRUE);
return TRUE;
}
/*
@ -381,7 +381,7 @@ int trim(int f, int n)
int inc; /* increment to next line [sgn(n)] */
if (curbp->b_mode & MDVIEW) /* don't allow this command if */
return (rdonly()); /* we are in read only mode */
return rdonly(); /* we are in read only mode */
if (f == FALSE)
n = 1;
@ -408,7 +408,7 @@ int trim(int f, int n)
}
lchange(WFEDIT);
thisflag &= ~CFCPCN; /* flag that this resets the goal column */
return (TRUE);
return TRUE;
}
#endif
@ -423,18 +423,18 @@ int openline(int f, int n)
int s;
if (curbp->b_mode & MDVIEW) /* don't allow this command if */
return (rdonly()); /* we are in read only mode */
return rdonly(); /* we are in read only mode */
if (n < 0)
return (FALSE);
return FALSE;
if (n == 0)
return (TRUE);
return TRUE;
i = n; /* Insert newlines. */
do {
s = lnewline();
} while (s == TRUE && --i);
if (s == TRUE) /* Then back up overtop */
s = backchar(f, n); /* of them all. */
return (s);
return s;
}
/*
@ -446,14 +446,14 @@ int insert_newline(int f, int n)
int s;
if (curbp->b_mode & MDVIEW) /* don't allow this command if */
return (rdonly()); /* we are in read only mode */
return rdonly(); /* we are in read only mode */
if (n < 0)
return (FALSE);
return FALSE;
/* if we are in C mode and this is a default <NL> */
if (n == 1 && (curbp->b_mode & MDCMOD) &&
curwp->w_dotp != curbp->b_linep)
return (cinsert());
return cinsert();
/*
* If a newline was typed, fill column is defined, the argument is non-
@ -468,12 +468,12 @@ int insert_newline(int f, int n)
/* insert some lines */
while (n--) {
if ((s = lnewline()) != TRUE)
return (s);
return s;
#if SCROLLCODE
curwp->w_flag |= WFINS;
#endif
}
return (TRUE);
return TRUE;
}
int cinsert(void)
@ -502,7 +502,7 @@ int cinsert(void)
/* put in the newline */
if (lnewline() == FALSE)
return (FALSE);
return FALSE;
/* and the saved indentation */
linstr(ichar);
@ -514,7 +514,7 @@ int cinsert(void)
#if SCROLLCODE
curwp->w_flag |= WFINS;
#endif
return (TRUE);
return TRUE;
}
#if NBRACE
@ -540,7 +540,7 @@ int insbrace(int n, int c)
for (i = curwp->w_doto - 1; i >= 0; --i) {
ch = lgetc(curwp->w_dotp, i);
if (ch != ' ' && ch != '\t')
return (linsert(n, c));
return linsert(n, c);
}
/* chercher le caractere oppose correspondant */
@ -555,7 +555,7 @@ int insbrace(int n, int c)
oc = '(';
break;
default:
return (FALSE);
return FALSE;
}
oldlp = curwp->w_dotp;
@ -583,7 +583,7 @@ int insbrace(int n, int c)
if (count != 0) { /* no match */
curwp->w_dotp = oldlp;
curwp->w_doto = oldoff;
return (linsert(n, c));
return linsert(n, c);
}
curwp->w_doto = 0; /* debut de ligne */
@ -609,7 +609,7 @@ int insbrace(int n, int c)
}
/* and insert the required brace(s) */
return (linsert(n, c));
return linsert(n, c);
}
#else
@ -628,13 +628,13 @@ int insbrace(int n, int c)
/* if we are at the beginning of the line, no go */
if (curwp->w_doto == 0)
return (linsert(n, c));
return linsert(n, c);
/* scan to see if all space before this is white space */
for (i = curwp->w_doto - 1; i >= 0; --i) {
ch = lgetc(curwp->w_dotp, i);
if (ch != ' ' && ch != '\t')
return (linsert(n, c));
return linsert(n, c);
}
/* delete back first */
@ -645,7 +645,7 @@ int insbrace(int n, int c)
backdel(FALSE, 1);
/* and insert the required brace(s) */
return (linsert(n, c));
return linsert(n, c);
}
#endif
@ -656,13 +656,13 @@ int inspound(void)
/* if we are at the beginning of the line, no go */
if (curwp->w_doto == 0)
return (linsert(1, '#'));
return linsert(1, '#');
/* scan to see if all space before this is white space */
for (i = curwp->w_doto - 1; i >= 0; --i) {
ch = lgetc(curwp->w_dotp, i);
if (ch != ' ' && ch != '\t')
return (linsert(1, '#'));
return linsert(1, '#');
}
/* delete back first */
@ -670,7 +670,7 @@ int inspound(void)
backdel(FALSE, 1);
/* and insert the required pound */
return (linsert(1, '#'));
return linsert(1, '#');
}
/*
@ -688,7 +688,7 @@ int deblank(int f, int n)
long nld;
if (curbp->b_mode & MDVIEW) /* don't allow this command if */
return (rdonly()); /* we are in read only mode */
return rdonly(); /* we are in read only mode */
lp1 = curwp->w_dotp;
while (llength(lp1) == 0 && (lp2 = lback(lp1)) != curbp->b_linep)
lp1 = lp2;
@ -697,10 +697,10 @@ int deblank(int f, int n)
while ((lp2 = lforw(lp2)) != curbp->b_linep && llength(lp2) == 0)
++nld;
if (nld == 0)
return (TRUE);
return TRUE;
curwp->w_dotp = lforw(lp1);
curwp->w_doto = 0;
return (ldelete(nld, FALSE));
return ldelete(nld, FALSE);
}
/*
@ -718,9 +718,9 @@ int indent(int f, int n)
int i;
if (curbp->b_mode & MDVIEW) /* don't allow this command if */
return (rdonly()); /* we are in read only mode */
return rdonly(); /* we are in read only mode */
if (n < 0)
return (FALSE);
return FALSE;
while (n--) {
nicol = 0;
for (i = 0; i < llength(curwp->w_dotp); ++i) {
@ -734,9 +734,9 @@ int indent(int f, int n)
if (lnewline() == FALSE
|| ((i = nicol / 8) != 0 && linsert(i, '\t') == FALSE)
|| ((i = nicol % 8) != 0 && linsert(i, ' ') == FALSE))
return (FALSE);
return FALSE;
}
return (TRUE);
return TRUE;
}
/*
@ -748,15 +748,15 @@ int indent(int f, int n)
int forwdel(int f, int n)
{
if (curbp->b_mode & MDVIEW) /* don't allow this command if */
return (rdonly()); /* we are in read only mode */
return rdonly(); /* we are in read only mode */
if (n < 0)
return (backdel(f, -n));
return backdel(f, -n);
if (f != FALSE) { /* Really a kill. */
if ((lastflag & CFKILL) == 0)
kdelete();
thisflag |= CFKILL;
}
return (ldelete((long) n, f));
return ldelete((long) n, f);
}
/*
@ -770,9 +770,9 @@ int backdel(int f, int n)
int s;
if (curbp->b_mode & MDVIEW) /* don't allow this command if */
return (rdonly()); /* we are in read only mode */
return rdonly(); /* we are in read only mode */
if (n < 0)
return (forwdel(f, -n));
return forwdel(f, -n);
if (f != FALSE) { /* Really a kill. */
if ((lastflag & CFKILL) == 0)
kdelete();
@ -780,7 +780,7 @@ int backdel(int f, int n)
}
if ((s = backchar(f, n)) == TRUE)
s = ldelete((long) n, f);
return (s);
return s;
}
/*
@ -797,7 +797,7 @@ int killtext(int f, int n)
long chunk;
if (curbp->b_mode & MDVIEW) /* don't allow this command if */
return (rdonly()); /* we are in read only mode */
return rdonly(); /* we are in read only mode */
if ((lastflag & CFKILL) == 0) /* Clear kill buffer if */
kdelete(); /* last wasn't a kill. */
thisflag |= CFKILL;
@ -813,15 +813,15 @@ int killtext(int f, int n)
nextp = lforw(curwp->w_dotp);
while (--n) {
if (nextp == curbp->b_linep)
return (FALSE);
return FALSE;
chunk += llength(nextp) + 1;
nextp = lforw(nextp);
}
} else {
mlwrite("neg kill");
return (FALSE);
return FALSE;
}
return (ldelete(chunk, TRUE));
return ldelete(chunk, TRUE);
}
/*
@ -912,7 +912,7 @@ int adjustmode(int kind, int global)
status = mlreply(prompt, cbuf, NPAT - 1);
if (status != TRUE)
return (status);
return status;
/* make it uppercase */
@ -954,7 +954,7 @@ int adjustmode(int kind, int global)
curwp->w_flag |= WFCOLR;
#endif
mlerase();
return (TRUE);
return TRUE;
}
}
@ -976,12 +976,12 @@ int adjustmode(int kind, int global)
if (global == 0)
upmode();
mlerase(); /* erase the junk */
return (TRUE);
return TRUE;
}
}
mlwrite("No such mode!");
return (FALSE);
return FALSE;
}
/*
@ -993,7 +993,7 @@ int adjustmode(int kind, int global)
int clrmes(int f, int n)
{
mlforce("");
return (TRUE);
return TRUE;
}
/*
@ -1012,7 +1012,7 @@ int writemsg(int f, int n)
if ((status =
mlreply("Message to write: ", buf, NPAT - 1)) != TRUE)
return (status);
return status;
/* expand all '%' to "%%" so mlwrite won't expect arguments */
sp = buf;
@ -1026,7 +1026,7 @@ int writemsg(int f, int n)
/* write the message out */
mlforce(nbuf);
return (TRUE);
return TRUE;
}
#if CFENCE
@ -1083,7 +1083,7 @@ int getfence(int f, int n)
break;
default:
TTbeep();
return (FALSE);
return FALSE;
}
/* set up for scan */
@ -1118,14 +1118,14 @@ int getfence(int f, int n)
else
forwchar(FALSE, 1);
curwp->w_flag |= WFMOVE;
return (TRUE);
return TRUE;
}
/* restore the current position */
curwp->w_dotp = oldlp;
curwp->w_doto = oldoff;
TTbeep();
return (FALSE);
return FALSE;
}
#endif
@ -1193,7 +1193,7 @@ int fmatch(int ch)
/* restore the current position */
curwp->w_dotp = oldlp;
curwp->w_doto = oldoff;
return (TRUE);
return TRUE;
}
/*
@ -1211,7 +1211,7 @@ int istring(int f, int n)
status =
mlreplyt("String to insert<META>: ", tstring, NPAT, metac);
if (status != TRUE)
return (status);
return status;
if (f == FALSE)
n = 1;
@ -1221,7 +1221,7 @@ int istring(int f, int n)
/* insert it */
while (n-- && (status = linstr(tstring)));
return (status);
return status;
}
/*
@ -1239,7 +1239,7 @@ int ovstring(int f, int n)
status =
mlreplyt("String to overwrite<META>: ", tstring, NPAT, metac);
if (status != TRUE)
return (status);
return status;
if (f == FALSE)
n = 1;
@ -1249,5 +1249,5 @@ int ovstring(int f, int n)
/* insert it */
while (n-- && (status = lover(tstring)));
return (status);
return status;
}

View File

@ -26,15 +26,15 @@ int killregion(int f, int n)
struct region region;
if (curbp->b_mode & MDVIEW) /* don't allow this command if */
return (rdonly()); /* we are in read only mode */
return rdonly(); /* we are in read only mode */
if ((s = getregion(&region)) != TRUE)
return (s);
return s;
if ((lastflag & CFKILL) == 0) /* This is a kill type */
kdelete(); /* command, so do magic */
thisflag |= CFKILL; /* kill buffer stuff. */
curwp->w_dotp = region.r_linep;
curwp->w_doto = region.r_offset;
return (ldelete(region.r_size, TRUE));
return ldelete(region.r_size, TRUE);
}
/*
@ -51,7 +51,7 @@ int copyregion(int f, int n)
struct region region;
if ((s = getregion(&region)) != TRUE)
return (s);
return s;
if ((lastflag & CFKILL) == 0) /* Kill type command. */
kdelete();
thisflag |= CFKILL;
@ -60,17 +60,17 @@ int copyregion(int f, int n)
while (region.r_size--) {
if (loffs == llength(linep)) { /* End of line. */
if ((s = kinsert('\n')) != TRUE)
return (s);
return s;
linep = lforw(linep);
loffs = 0;
} else { /* Middle of line. */
if ((s = kinsert(lgetc(linep, loffs))) != TRUE)
return (s);
return s;
++loffs;
}
}
mlwrite("(region copied)");
return (TRUE);
return TRUE;
}
/*
@ -90,9 +90,9 @@ int lowerregion(int f, int n)
struct region region;
if (curbp->b_mode & MDVIEW) /* don't allow this command if */
return (rdonly()); /* we are in read only mode */
return rdonly(); /* we are in read only mode */
if ((s = getregion(&region)) != TRUE)
return (s);
return s;
lchange(WFHARD);
linep = region.r_linep;
loffs = region.r_offset;
@ -107,7 +107,7 @@ int lowerregion(int f, int n)
++loffs;
}
}
return (TRUE);
return TRUE;
}
/*
@ -127,9 +127,9 @@ int upperregion(int f, int n)
struct region region;
if (curbp->b_mode & MDVIEW) /* don't allow this command if */
return (rdonly()); /* we are in read only mode */
return rdonly(); /* we are in read only mode */
if ((s = getregion(&region)) != TRUE)
return (s);
return s;
lchange(WFHARD);
linep = region.r_linep;
loffs = region.r_offset;
@ -144,7 +144,7 @@ int upperregion(int f, int n)
++loffs;
}
}
return (TRUE);
return TRUE;
}
/*
@ -167,7 +167,7 @@ int getregion(struct region *rp)
if (curwp->w_markp == NULL) {
mlwrite("No mark set in this window");
return (FALSE);
return FALSE;
}
if (curwp->w_dotp == curwp->w_markp) {
rp->r_linep = curwp->w_dotp;
@ -180,7 +180,7 @@ int getregion(struct region *rp)
rp->r_size =
(long) (curwp->w_doto - curwp->w_marko);
}
return (TRUE);
return TRUE;
}
blp = curwp->w_dotp;
bsize = (long) curwp->w_doto;
@ -193,7 +193,7 @@ int getregion(struct region *rp)
rp->r_linep = curwp->w_dotp;
rp->r_offset = curwp->w_doto;
rp->r_size = fsize + curwp->w_marko;
return (TRUE);
return TRUE;
}
fsize += llength(flp) + 1;
}
@ -204,10 +204,10 @@ int getregion(struct region *rp)
rp->r_linep = blp;
rp->r_offset = curwp->w_marko;
rp->r_size = bsize - curwp->w_marko;
return (TRUE);
return TRUE;
}
}
}
mlwrite("Bug: lost mark");
return (FALSE);
return FALSE;
}

View File

@ -89,7 +89,7 @@ int forwsearch(int f, int n)
* Otherwise proceed by asking for the search string.
*/
if (n < 0)
return (backsearch(f, -n));
return backsearch(f, -n);
/* Ask the user for the text of a pattern. If the
* response is TRUE (responses other than FALSE are
@ -117,7 +117,7 @@ int forwsearch(int f, int n)
else
mlwrite("Not found");
}
return (status);
return status;
}
/*
@ -132,7 +132,7 @@ int forwhunt(int f, int n)
int status = TRUE;
if (n < 0) /* search backwards */
return (backhunt(f, -n));
return backhunt(f, -n);
/* Make sure a pattern exists, or that we didn't switch
* into MAGIC mode until after we entered the pattern.
@ -170,7 +170,7 @@ int forwhunt(int f, int n)
else
mlwrite("Not found");
return (status);
return status;
}
/*
@ -189,7 +189,7 @@ int backsearch(int f, int n)
* Otherwise proceed by asking for the search string.
*/
if (n < 0)
return (forwsearch(f, -n));
return forwsearch(f, -n);
/* Ask the user for the text of a pattern. If the
* response is TRUE (responses other than FALSE are
@ -218,7 +218,7 @@ int backsearch(int f, int n)
else
mlwrite("Not found");
}
return (status);
return status;
}
/*
@ -234,7 +234,7 @@ int backhunt(int f, int n)
int status = TRUE;
if (n < 0)
return (forwhunt(f, -n));
return forwhunt(f, -n);
/* Make sure a pattern exists, or that we didn't switch
* into MAGIC mode until after we entered the pattern.
@ -272,7 +272,7 @@ int backhunt(int f, int n)
else
mlwrite("Not found");
return (status);
return status;
}
#if MAGIC
@ -579,7 +579,7 @@ int eq(unsigned char bc, unsigned char pc)
pc ^= DIFCASE;
}
return (bc == pc);
return bc == pc;
}
/*
@ -631,7 +631,7 @@ static int readpattern(char *prompt, char *apat, int srch)
} else if (status == FALSE && apat[0] != 0) /* Old one */
status = TRUE;
return (status);
return status;
}
/*
@ -686,7 +686,7 @@ void rvstrcpy(char *rvstr, char *str)
*/
int sreplace(int f, int n)
{
return (replaces(FALSE, f, n));
return replaces(FALSE, f, n);
}
/*
@ -697,7 +697,7 @@ int sreplace(int f, int n)
*/
int qreplace(int f, int n)
{
return (replaces(TRUE, f, n));
return replaces(TRUE, f, n);
}
/*
@ -724,12 +724,12 @@ static int replaces(int kind, int f, int n)
int lastoff; /* offset (for 'u' query option) */
if (curbp->b_mode & MDVIEW) /* don't allow this command if */
return (rdonly()); /* we are in read only mode */
return rdonly(); /* we are in read only mode */
/* Check for negative repetitions.
*/
if (f && n < 0)
return (FALSE);
return FALSE;
/* Ask the user for the text of a pattern.
*/
@ -737,12 +737,12 @@ static int replaces(int kind, int f, int n)
FALSE ? "Replace" : "Query replace"),
&pat[0], TRUE))
!= TRUE)
return (status);
return status;
/* Ask for the replacement string.
*/
if ((status = readpattern("with", &rpat[0], FALSE)) == ABORT)
return (status);
return status;
/* Find the length of the replacement string.
*/
@ -860,7 +860,7 @@ static int replaces(int kind, int f, int n)
#endif
status = delins(rlength, patmatch, FALSE);
if (status != TRUE)
return (status);
return status;
/* Record one less substitution,
* backup, save our place, and
@ -880,7 +880,7 @@ static int replaces(int kind, int f, int n)
case BELL: /* abort! and stay */
mlwrite("Aborted!");
return (FALSE);
return FALSE;
default: /* bitch and beep */
TTbeep();
@ -900,7 +900,7 @@ static int replaces(int kind, int f, int n)
*/
status = delins(matchlen, &rpat[0], TRUE);
if (status != TRUE)
return (status);
return status;
/* Save our position, since we may
* undo this.
@ -916,7 +916,7 @@ static int replaces(int kind, int f, int n)
/* And report the results.
*/
mlwrite("%d substitutions", numsub);
return (TRUE);
return TRUE;
}
/*
@ -952,7 +952,7 @@ int delins(int dlength, char *instr, int use_meta)
#endif
status = linstr(instr);
return (status);
return status;
}
/*
@ -999,11 +999,11 @@ int expandp(char *srcstr, char *deststr, int maxlength)
if (maxlength < 4) {
*deststr++ = '$';
*deststr = '\0';
return (FALSE);
return FALSE;
}
}
*deststr = '\0';
return (TRUE);
return TRUE;
}
/*
@ -1024,7 +1024,7 @@ int boundry(struct line *curline, int curoff, int dir)
border = (curoff == 0) &&
(lback(curline) == curbp->b_linep);
}
return (border);
return border;
}
/*
@ -1064,7 +1064,7 @@ static int nextch(struct line **pcurline, int *pcuroff, int dir)
*pcurline = curline;
*pcuroff = curoff;
return (c);
return c;
}
#if MAGIC
@ -1187,7 +1187,7 @@ static int mcstr(void)
mcclear();
}
return (status);
return status;
}
/*
@ -1365,7 +1365,7 @@ static int mceq(int bc, MC *mt)
} /* End of switch. */
return (result);
return result;
}
extern BITMAP clearbits(void);
@ -1403,7 +1403,7 @@ static int cclmake(char **ppatptr, MC *mcptr)
if ((ochr = *patptr) == MC_ECCL) {
mlwrite("%%No characters in character class");
return (FALSE);
return FALSE;
} else {
if (ochr == MC_ESC)
ochr = *++patptr;
@ -1461,7 +1461,7 @@ static int biteq(int bc, BITMAP cclmap)
if (bc >= HICHAR)
return FALSE;
return ((*(cclmap + (bc >> 3)) & BIT(bc & 7)) ? TRUE : FALSE);
return (*(cclmap + (bc >> 3)) & BIT(bc & 7)) ? TRUE : FALSE;
}
/*
@ -1476,7 +1476,7 @@ static BITMAP clearbits(void)
for (j = 0; j < HIBYTE; j++)
*cclmap++ = 0;
return (cclstart);
return cclstart;
}
/*

86
spawn.c
View File

@ -49,7 +49,7 @@ int spawncli(int f, int n)
/* don't allow this command if restricted */
if (restflag)
return (resterr());
return resterr();
#if VMS
movecursor(term.t_nrow, 0); /* In last line. */
@ -61,7 +61,7 @@ int spawncli(int f, int n)
mlputs("\r\n(Returning from DCL)\r\n");
TTflush();
sleep(1);
return (TRUE);
return TRUE;
#endif
#if MSDOS & (MSC | TURBO)
movecursor(term.t_nrow, 0); /* Seek to last line. */
@ -70,7 +70,7 @@ int spawncli(int f, int n)
shellprog("");
TTkopen();
sgarbf = TRUE;
return (TRUE);
return TRUE;
#endif
#if V7 | USG | BSD
movecursor(term.t_nrow, 0); /* Seek to last line. */
@ -98,7 +98,7 @@ int spawncli(int f, int n)
chg_height = term.t_nrow + 1;
term.t_nrow = term.t_ncol = 0;
#endif
return (TRUE);
return TRUE;
#endif
}
@ -114,7 +114,7 @@ int bktoshell(int f, int n)
kill(pid,SIGTSTP);
******************************/
kill(0, SIGTSTP);
return (TRUE);
return TRUE;
}
void rtfrmshell(void)
@ -137,11 +137,11 @@ int spawn(int f, int n)
/* don't allow this command if restricted */
if (restflag)
return (resterr());
return resterr();
#if VMS
if ((s = mlreply("!", line, NLINE)) != TRUE)
return (s);
return s;
movecursor(term.t_nrow, 0);
TTflush();
s = sys(line); /* Run the command. */
@ -151,11 +151,11 @@ int spawn(int f, int n)
tgetc();
}
sgarbf = TRUE;
return (s);
return s;
#endif
#if MSDOS
if ((s = mlreply("!", line, NLINE)) != TRUE)
return (s);
return s;
movecursor(term.t_nrow, 0);
TTkclose();
shellprog(line);
@ -166,11 +166,11 @@ int spawn(int f, int n)
tgetc();
}
sgarbf = TRUE;
return (TRUE);
return TRUE;
#endif
#if V7 | USG | BSD
if ((s = mlreply("!", line, NLINE)) != TRUE)
return (s);
return s;
TTflush();
TTclose(); /* stty to old modes */
TTkclose();
@ -186,7 +186,7 @@ int spawn(int f, int n)
}
TTkopen();
sgarbf = TRUE;
return (TRUE);
return TRUE;
#endif
}
@ -203,23 +203,23 @@ int execprg(int f, int n)
/* don't allow this command if restricted */
if (restflag)
return (resterr());
return resterr();
#if VMS
if ((s = mlreply("!", line, NLINE)) != TRUE)
return (s);
return s;
TTflush();
s = sys(line); /* Run the command. */
mlputs("\r\n\n(End)"); /* Pause. */
TTflush();
tgetc();
sgarbf = TRUE;
return (s);
return s;
#endif
#if MSDOS
if ((s = mlreply("$", line, NLINE)) != TRUE)
return (s);
return s;
movecursor(term.t_nrow, 0);
TTkclose();
execprog(line);
@ -230,12 +230,12 @@ int execprg(int f, int n)
tgetc();
}
sgarbf = TRUE;
return (TRUE);
return TRUE;
#endif
#if V7 | USG | BSD
if ((s = mlreply("!", line, NLINE)) != TRUE)
return (s);
return s;
TTputc('\n'); /* Already have '\r' */
TTflush();
TTclose(); /* stty to old modes */
@ -246,7 +246,7 @@ int execprg(int f, int n)
TTflush();
while ((s = tgetc()) != '\r' && s != ' ');
sgarbf = TRUE;
return (TRUE);
return TRUE;
#endif
}
@ -272,7 +272,7 @@ int pipecmd(int f, int n)
/* don't allow this command if restricted */
if (restflag)
return (resterr());
return resterr();
#if MSDOS
if ((tmp = getenv("TMP")) == NULL
@ -290,12 +290,12 @@ int pipecmd(int f, int n)
#if VMS
mlwrite("Not available under VMS");
return (FALSE);
return FALSE;
#endif
/* get the command to pipe in */
if ((s = mlreply("@", line, NLINE)) != TRUE)
return (s);
return s;
/* get rid of the command output buffer if it exists */
if ((bp = bfind(bname, FALSE, 0)) != FALSE) {
@ -318,7 +318,7 @@ int pipecmd(int f, int n)
}
if (zotbuf(bp) != TRUE)
return (FALSE);
return FALSE;
}
#if MSDOS
strcat(line, " >>");
@ -349,15 +349,15 @@ int pipecmd(int f, int n)
#endif
if (s != TRUE)
return (s);
return s;
/* split the current window to make room for the command output */
if (splitwind(FALSE, 1) == FALSE)
return (FALSE);
return FALSE;
/* and read the stuff in */
if (getfile(filnam, FALSE) == FALSE)
return (FALSE);
return FALSE;
/* make this window in VIEW mode, update all mode lines */
curwp->w_bufp->b_mode |= MDVIEW;
@ -369,7 +369,7 @@ int pipecmd(int f, int n)
/* and get rid of the temporary file */
unlink(filnam);
return (TRUE);
return TRUE;
}
/*
@ -389,19 +389,19 @@ int filter_buffer(int f, int n)
/* don't allow this command if restricted */
if (restflag)
return (resterr());
return resterr();
if (curbp->b_mode & MDVIEW) /* don't allow this command if */
return (rdonly()); /* we are in read only mode */
return rdonly(); /* we are in read only mode */
#if VMS
mlwrite("Not available under VMS");
return (FALSE);
return FALSE;
#endif
/* get the filter name and its args */
if ((s = mlreply("#", line, NLINE)) != TRUE)
return (s);
return s;
/* setup the proper file names */
bp = curbp;
@ -412,7 +412,7 @@ int filter_buffer(int f, int n)
if (writeout(filnam1) != TRUE) {
mlwrite("(Cannot write filter file)");
strcpy(bp->b_fname, tmpnam);
return (FALSE);
return FALSE;
}
#if MSDOS
strcat(line, " <fltinp >fltout");
@ -442,7 +442,7 @@ int filter_buffer(int f, int n)
strcpy(bp->b_fname, tmpnam);
unlink(filnam1);
unlink(filnam2);
return (s);
return s;
}
/* reset file name */
@ -452,7 +452,7 @@ int filter_buffer(int f, int n)
/* and get rid of the temporary file */
unlink(filnam1);
unlink(filnam2);
return (TRUE);
return TRUE;
}
#if VMS
@ -473,7 +473,7 @@ int sys(char *cmd)
status = SYS$QIOW(EFN, iochan, IO$_SETMODE, iosb, 0, 0,
oldmode, sizeof(oldmode), 0, 0, 0, 0);
if (status != SS$_NORMAL || (iosb[0] & 0xFFFF) != SS$_NORMAL)
return (FALSE);
return FALSE;
cdscp = NULL; /* Assume DCL. */
if (cmd != NULL) { /* Build descriptor. */
cdsc.dsc$a_pointer = cmd;
@ -488,10 +488,10 @@ int sys(char *cmd)
status = SYS$QIOW(EFN, iochan, IO$_SETMODE, iosb, 0, 0,
newmode, sizeof(newmode), 0, 0, 0, 0);
if (status != SS$_NORMAL || (iosb[0] & 0xFFFF) != SS$_NORMAL)
return (FALSE);
return FALSE;
if ((substatus & STS$M_SUCCESS) == 0) /* Command failed. */
return (FALSE);
return (TRUE);
return FALSE;
return TRUE;
}
#endif
@ -518,7 +518,7 @@ int shellprog(char *cmd)
/* get name of system shell */
if ((shell = getenv("COMSPEC")) == NULL) {
return (FALSE); /* No shell located */
return FALSE; /* No shell located */
}
/* trim leading whitespace off the command */
@ -536,9 +536,9 @@ int shellprog(char *cmd)
comline[strlen(comline)] = swchar;
strcat(comline, "c ");
strcat(comline, cmd);
return (execprog(comline));
return execprog(comline);
} else
return (execprog(shell));
return execprog(shell);
}
/*
@ -583,7 +583,7 @@ int execprog(char *cmd)
if ((sp = flook(strcat(prog, ".exe"), TRUE)) == NULL) {
strcpy(&prog[strlen(prog) - 4], ".com");
if ((sp = flook(prog, TRUE)) == NULL)
return (FALSE);
return FALSE;
}
strcpy(prog, sp);
@ -616,6 +616,6 @@ int execprog(char *cmd)
rval = -_doserrno; /* failed child call */
#endif
#endif
return ((rval < 0) ? FALSE : TRUE);
return (rval < 0) ? FALSE : TRUE;
}
#endif

4
tcap.c
View File

@ -271,7 +271,7 @@ static void tcaprev(int state)
static int tcapcres(char *res)
{ /* change screen resolution */
return (TRUE);
return TRUE;
}
#if SCROLLCODE
@ -362,7 +362,7 @@ static void putpad(char *str)
static int fnclabel(int f, int n)
{
/* on machines with no function keys...don't bother */
return (TRUE);
return TRUE;
}
#endif
#else

View File

@ -370,7 +370,7 @@ ttgetc()
nibuf = (iosb[0] >> 16) + (iosb[1] >> 16);
}
}
return (ibuf[ibufi++] & 0xFF); /* Allow multinational */
return ibuf[ibufi++] & 0xFF; /* Allow multinational */
#endif
#if MSDOS & (MSC | TURBO)
@ -380,18 +380,18 @@ ttgetc()
if (nxtchar >= 0) {
c = nxtchar;
nxtchar = -1;
return (c);
return c;
}
/* call the dos to get a char */
rg.h.ah = 7; /* dos Direct Console Input call */
intdos(&rg, &rg);
c = rg.h.al; /* grab the char */
return (c & 255);
return c & 255;
#endif
#if V7 | BSD
return (255 & fgetc(stdin)); /* 8BIT P.K. */
return 255 & fgetc(stdin); /* 8BIT P.K. */
#endif
#if USG
@ -403,7 +403,7 @@ ttgetc()
kbdpoll = FALSE;
while (read(0, &kbdq, 1) != 1);
}
return (kbdq & 255);
return kbdq & 255;
#endif
}
@ -416,35 +416,35 @@ typahead()
{
#if MSDOS & (MSC | TURBO)
if (kbhit() != 0)
return (TRUE);
return TRUE;
else
return (FALSE);
return FALSE;
#endif
#if BSD
int x; /* holds # of pending chars */
return ((ioctl(0, FIONREAD, &x) < 0) ? 0 : x);
return (ioctl(0, FIONREAD, &x) < 0) ? 0 : x;
#endif
#if PKCODE & VMS
return (ibufi < nibuf);
return ibufi < nibuf;
#endif
#if USG
if (!kbdqp) {
if (!kbdpoll && fcntl(0, F_SETFL, kbdflgs | O_NDELAY) < 0)
return (FALSE);
return FALSE;
#if PKCODE
kbdpoll = 1;
#endif
kbdqp = (1 == read(0, &kbdq, 1));
}
return (kbdqp);
return kbdqp;
#endif
#if !UNIX & !VMS & !MSDOS
return (FALSE);
return FALSE;
#endif
}
#endif

View File

@ -497,7 +497,7 @@ fnclabel(f, n) /* label a function key */
int f, n; /* default flag, numeric argument [unused] */
{
/* on machines with no function keys...don't bother */
return (TRUE);
return TRUE;
}
#endif

4
vt52.c
View File

@ -112,7 +112,7 @@ int status; /* TRUE = reverse video, FALSE = normal video */
vt52cres()
{ /* change screen resolution - (not here though) */
return (TRUE);
return TRUE;
}
spal()
@ -172,7 +172,7 @@ int f, n; /* default flag, numeric argument [unused] */
{
/* on machines with no function keys...don't bother */
return (TRUE);
return TRUE;
}
#endif
#endif

View File

@ -22,7 +22,7 @@ int reposition(int f, int n)
n = 0;
curwp->w_force = n;
curwp->w_flag |= WFFORCE;
return (TRUE);
return TRUE;
}
/*
@ -38,7 +38,7 @@ int redraw(int f, int n)
curwp->w_flag |= WFFORCE;
}
return (TRUE);
return TRUE;
}
/*
@ -78,7 +78,7 @@ int nextwind(int f, int n)
wp = wp->w_wndp;
} else {
mlwrite("Window number out of range");
return (FALSE);
return FALSE;
}
} else if ((wp = curwp->w_wndp) == NULL)
wp = wheadp;
@ -86,7 +86,7 @@ int nextwind(int f, int n)
curbp = wp->w_bufp;
cknewwindow();
upmode();
return (TRUE);
return TRUE;
}
/*
@ -101,7 +101,7 @@ int prevwind(int f, int n)
/* if we have an argument, we mean the nth window from the bottom */
if (f)
return (nextwind(f, -n));
return nextwind(f, -n);
wp1 = wheadp;
wp2 = curwp;
@ -116,7 +116,7 @@ int prevwind(int f, int n)
curbp = wp1->w_bufp;
cknewwindow();
upmode();
return (TRUE);
return TRUE;
}
/*
@ -128,7 +128,7 @@ int prevwind(int f, int n)
*/
int mvdnwind(int f, int n)
{
return (mvupwind(f, -n));
return mvupwind(f, -n);
}
/*
@ -158,7 +158,7 @@ int mvupwind(int f, int n)
for (i = 0; i < curwp->w_ntrows; ++i) {
if (lp == curwp->w_dotp)
return (TRUE);
return TRUE;
if (lp == curbp->b_linep)
break;
lp = lforw(lp);
@ -172,7 +172,7 @@ int mvupwind(int f, int n)
curwp->w_dotp = lp;
curwp->w_doto = 0;
return (TRUE);
return TRUE;
}
/*
@ -220,7 +220,7 @@ int onlywind(int f, int n)
curwp->w_ntrows = term.t_nrow - 1;
curwp->w_linep = lp;
curwp->w_flag |= WFMODE | WFHARD;
return (TRUE);
return TRUE;
}
/*
@ -238,7 +238,7 @@ int delwind(int f, int n)
/* if there is only one window, don't delete it */
if (wheadp->w_wndp == NULL) {
mlwrite("Can not delete this window");
return (FALSE);
return FALSE;
}
/* find window before curwp in linked list */
@ -262,7 +262,7 @@ int delwind(int f, int n)
wp = wp->w_wndp;
}
if (wp == NULL)
return (FALSE);
return FALSE;
wp->w_toprow = 0;
wp->w_ntrows += target;
} else {
@ -274,7 +274,7 @@ int delwind(int f, int n)
wp = wp->w_wndp;
}
if (wp == NULL)
return (FALSE);
return FALSE;
wp->w_ntrows += 1 + curwp->w_ntrows;
}
@ -295,7 +295,7 @@ int delwind(int f, int n)
curbp = wp->w_bufp;
cknewwindow();
upmode();
return (TRUE);
return TRUE;
}
/*
@ -319,11 +319,11 @@ int splitwind(int f, int n)
if (curwp->w_ntrows < 3) {
mlwrite("Cannot split a %d line window", curwp->w_ntrows);
return (FALSE);
return FALSE;
}
if ((wp = (struct window *)malloc(sizeof(struct window))) == NULL) {
mlwrite("(OUT OF MEMORY)");
return (FALSE);
return FALSE;
}
++curbp->b_nwnd; /* Displayed twice. */
wp->w_bufp = curbp;
@ -380,7 +380,7 @@ int splitwind(int f, int n)
wp->w_linep = lp; /* if necessary. */
curwp->w_flag |= WFMODE | WFHARD;
wp->w_flag |= WFMODE | WFHARD;
return (TRUE);
return TRUE;
}
/*
@ -396,10 +396,10 @@ int enlargewind(int f, int n)
int i;
if (n < 0)
return (shrinkwind(f, -n));
return shrinkwind(f, -n);
if (wheadp->w_wndp == NULL) {
mlwrite("Only one window");
return (FALSE);
return FALSE;
}
if ((adjwp = curwp->w_wndp) == NULL) {
adjwp = wheadp;
@ -408,7 +408,7 @@ int enlargewind(int f, int n)
}
if (adjwp->w_ntrows <= n) {
mlwrite("Impossible change");
return (FALSE);
return FALSE;
}
if (curwp->w_wndp == adjwp) { /* Shrink below. */
lp = adjwp->w_linep;
@ -432,7 +432,7 @@ int enlargewind(int f, int n)
curwp->w_flag |= WFMODE | WFHARD;
adjwp->w_flag |= WFMODE | WFHARD;
#endif
return (TRUE);
return TRUE;
}
/*
@ -447,10 +447,10 @@ int shrinkwind(int f, int n)
int i;
if (n < 0)
return (enlargewind(f, -n));
return enlargewind(f, -n);
if (wheadp->w_wndp == NULL) {
mlwrite("Only one window");
return (FALSE);
return FALSE;
}
if ((adjwp = curwp->w_wndp) == NULL) {
adjwp = wheadp;
@ -459,7 +459,7 @@ int shrinkwind(int f, int n)
}
if (curwp->w_ntrows <= n) {
mlwrite("Impossible change");
return (FALSE);
return FALSE;
}
if (curwp->w_wndp == adjwp) { /* Grow below. */
lp = adjwp->w_linep;
@ -484,7 +484,7 @@ int shrinkwind(int f, int n)
curwp->w_flag |= WFMODE | WFHARD;
adjwp->w_flag |= WFMODE | WFHARD;
#endif
return (TRUE);
return TRUE;
}
/*
@ -498,16 +498,16 @@ int resize(int f, int n)
/* must have a non-default argument, else ignore call */
if (f == FALSE)
return (TRUE);
return TRUE;
/* find out what to do */
clines = curwp->w_ntrows;
/* already the right size? */
if (clines == n)
return (TRUE);
return TRUE;
return (enlargewind(TRUE, n - clines));
return enlargewind(TRUE, n - clines);
}
/*
@ -521,11 +521,11 @@ struct window *wpopup(void)
if (wheadp->w_wndp == NULL /* Only 1 window */
&& splitwind(FALSE, 0) == FALSE) /* and it won't split */
return (NULL);
return NULL;
wp = wheadp; /* Find window to use */
while (wp != NULL && wp == curwp)
wp = wp->w_wndp;
return (wp);
return wp;
}
int scrnextup(int f, int n)
@ -533,7 +533,7 @@ int scrnextup(int f, int n)
nextwind(FALSE, 1);
backpage(f, n);
prevwind(FALSE, 1);
return (TRUE);
return TRUE;
}
int scrnextdw(int f, int n)
@ -541,13 +541,13 @@ int scrnextdw(int f, int n)
nextwind(FALSE, 1);
forwpage(f, n);
prevwind(FALSE, 1);
return (TRUE);
return TRUE;
}
int savewnd(int f, int n)
{ /* save ptr to current window */
swindow = curwp;
return (TRUE);
return TRUE;
}
int restwnd(int f, int n)
@ -561,13 +561,13 @@ int restwnd(int f, int n)
curwp = wp;
curbp = wp->w_bufp;
upmode();
return (TRUE);
return TRUE;
}
wp = wp->w_wndp;
}
mlwrite("(No such window exists)");
return (FALSE);
return FALSE;
}
/*
@ -590,11 +590,11 @@ int newsize(int f, int n)
/* make sure it's in range */
if (n < 3 || n > term.t_mrow + 1) {
mlwrite("%%Screen size out of range");
return (FALSE);
return FALSE;
}
if (term.t_nrow == n - 1)
return (TRUE);
return TRUE;
else if (term.t_nrow < n - 1) {
/* go to the last window */
@ -655,7 +655,7 @@ int newsize(int f, int n)
/* screen is garbage */
term.t_nrow = n - 1;
sgarbf = TRUE;
return (TRUE);
return TRUE;
}
/*
@ -675,7 +675,7 @@ int newwidth(int f, int n)
/* make sure it's in range */
if (n < 10 || n > term.t_mcol) {
mlwrite("%%Screen width out of range");
return (FALSE);
return FALSE;
}
/* otherwise, just re-width it (no big deal) */
@ -691,7 +691,7 @@ int newwidth(int f, int n)
}
sgarbf = TRUE;
return (TRUE);
return TRUE;
}
int getwpos(void)
@ -708,7 +708,7 @@ int getwpos(void)
}
/* and return the value */
return (sline);
return sline;
}
void cknewwindow(void)

124
word.c
View File

@ -30,7 +30,7 @@ int wrapword(int f, int n)
/* backup from the <NL> 1 char */
if (!backchar(0, 1))
return (FALSE);
return FALSE;
/* back up until we aren't in a word,
make sure there is a break in the line */
@ -39,28 +39,28 @@ int wrapword(int f, int n)
&& (c != '\t')) {
cnt++;
if (!backchar(0, 1))
return (FALSE);
return FALSE;
/* if we make it to the beginning, start a new line */
if (curwp->w_doto == 0) {
gotoeol(FALSE, 0);
return (lnewline());
return lnewline();
}
}
/* delete the forward white space */
if (!forwdel(0, 1))
return (FALSE);
return FALSE;
/* put in a end of line */
if (!lnewline())
return (FALSE);
return FALSE;
/* and past the first word */
while (cnt-- > 0) {
if (forwchar(FALSE, 1) == FALSE)
return (FALSE);
return FALSE;
}
return (TRUE);
return TRUE;
}
/*
@ -71,20 +71,20 @@ int wrapword(int f, int n)
int backword(int f, int n)
{
if (n < 0)
return (forwword(f, -n));
return forwword(f, -n);
if (backchar(FALSE, 1) == FALSE)
return (FALSE);
return FALSE;
while (n--) {
while (inword() == FALSE) {
if (backchar(FALSE, 1) == FALSE)
return (FALSE);
return FALSE;
}
while (inword() != FALSE) {
if (backchar(FALSE, 1) == FALSE)
return (FALSE);
return FALSE;
}
}
return (forwchar(FALSE, 1));
return forwchar(FALSE, 1);
}
/*
@ -94,19 +94,19 @@ int backword(int f, int n)
int forwword(int f, int n)
{
if (n < 0)
return (backword(f, -n));
return backword(f, -n);
while (n--) {
while (inword() == TRUE) {
if (forwchar(FALSE, 1) == FALSE)
return (FALSE);
return FALSE;
}
while (inword() == FALSE) {
if (forwchar(FALSE, 1) == FALSE)
return (FALSE);
return FALSE;
}
}
return (TRUE);
return TRUE;
}
/*
@ -119,13 +119,13 @@ int upperword(int f, int n)
int c;
if (curbp->b_mode & MDVIEW) /* don't allow this command if */
return (rdonly()); /* we are in read only mode */
return rdonly(); /* we are in read only mode */
if (n < 0)
return (FALSE);
return FALSE;
while (n--) {
while (inword() == FALSE) {
if (forwchar(FALSE, 1) == FALSE)
return (FALSE);
return FALSE;
}
while (inword() != FALSE) {
c = lgetc(curwp->w_dotp, curwp->w_doto);
@ -139,10 +139,10 @@ int upperword(int f, int n)
lchange(WFHARD);
}
if (forwchar(FALSE, 1) == FALSE)
return (FALSE);
return FALSE;
}
}
return (TRUE);
return TRUE;
}
/*
@ -155,13 +155,13 @@ int lowerword(int f, int n)
int c;
if (curbp->b_mode & MDVIEW) /* don't allow this command if */
return (rdonly()); /* we are in read only mode */
return rdonly(); /* we are in read only mode */
if (n < 0)
return (FALSE);
return FALSE;
while (n--) {
while (inword() == FALSE) {
if (forwchar(FALSE, 1) == FALSE)
return (FALSE);
return FALSE;
}
while (inword() != FALSE) {
c = lgetc(curwp->w_dotp, curwp->w_doto);
@ -175,10 +175,10 @@ int lowerword(int f, int n)
lchange(WFHARD);
}
if (forwchar(FALSE, 1) == FALSE)
return (FALSE);
return FALSE;
}
}
return (TRUE);
return TRUE;
}
/*
@ -192,13 +192,13 @@ int capword(int f, int n)
int c;
if (curbp->b_mode & MDVIEW) /* don't allow this command if */
return (rdonly()); /* we are in read only mode */
return rdonly(); /* we are in read only mode */
if (n < 0)
return (FALSE);
return FALSE;
while (n--) {
while (inword() == FALSE) {
if (forwchar(FALSE, 1) == FALSE)
return (FALSE);
return FALSE;
}
if (inword() != FALSE) {
c = lgetc(curwp->w_dotp, curwp->w_doto);
@ -212,7 +212,7 @@ int capword(int f, int n)
lchange(WFHARD);
}
if (forwchar(FALSE, 1) == FALSE)
return (FALSE);
return FALSE;
while (inword() != FALSE) {
c = lgetc(curwp->w_dotp, curwp->w_doto);
#if PKCODE
@ -226,11 +226,11 @@ int capword(int f, int n)
lchange(WFHARD);
}
if (forwchar(FALSE, 1) == FALSE)
return (FALSE);
return FALSE;
}
}
}
return (TRUE);
return TRUE;
}
/*
@ -248,11 +248,11 @@ int delfword(int f, int n)
/* don't allow this command if we are in read only mode */
if (curbp->b_mode & MDVIEW)
return (rdonly());
return rdonly();
/* ignore the command if there is a negative argument */
if (n < 0)
return (FALSE);
return FALSE;
/* Clear the kill buffer if last command wasn't a kill */
if ((lastflag & CFKILL) == 0)
@ -269,7 +269,7 @@ int delfword(int f, int n)
/* get us into a word.... */
while (inword() == FALSE) {
if (forwchar(FALSE, 1) == FALSE)
return (FALSE);
return FALSE;
++size;
}
@ -277,7 +277,7 @@ int delfword(int f, int n)
/* skip one word, no whitespace! */
while (inword() == TRUE) {
if (forwchar(FALSE, 1) == FALSE)
return (FALSE);
return FALSE;
++size;
}
} else {
@ -287,14 +287,14 @@ int delfword(int f, int n)
/* if we are at EOL; skip to the beginning of the next */
while (curwp->w_doto == llength(curwp->w_dotp)) {
if (forwchar(FALSE, 1) == FALSE)
return (FALSE);
return FALSE;
++size;
}
/* move forward till we are at the end of the word */
while (inword() == TRUE) {
if (forwchar(FALSE, 1) == FALSE)
return (FALSE);
return FALSE;
++size;
}
@ -302,7 +302,7 @@ int delfword(int f, int n)
if (n != 0)
while (inword() == FALSE) {
if (forwchar(FALSE, 1) == FALSE)
return (FALSE);
return FALSE;
++size;
}
}
@ -320,7 +320,7 @@ int delfword(int f, int n)
/* restore the original position and delete the words */
curwp->w_dotp = dotp;
curwp->w_doto = doto;
return (ldelete(size, TRUE));
return ldelete(size, TRUE);
}
/*
@ -334,11 +334,11 @@ int delbword(int f, int n)
/* don't allow this command if we are in read only mode */
if (curbp->b_mode & MDVIEW)
return (rdonly());
return rdonly();
/* ignore the command if there is a nonpositive argument */
if (n <= 0)
return (FALSE);
return FALSE;
/* Clear the kill buffer if last command wasn't a kill */
if ((lastflag & CFKILL) == 0)
@ -346,12 +346,12 @@ int delbword(int f, int n)
thisflag |= CFKILL; /* this command is a kill */
if (backchar(FALSE, 1) == FALSE)
return (FALSE);
return FALSE;
size = 0;
while (n--) {
while (inword() == FALSE) {
if (backchar(FALSE, 1) == FALSE)
return (FALSE);
return FALSE;
++size;
}
while (inword() != FALSE) {
@ -361,8 +361,8 @@ int delbword(int f, int n)
}
}
if (forwchar(FALSE, 1) == FALSE)
return (FALSE);
bckdel:return (ldelete(size, TRUE));
return FALSE;
bckdel:return ldelete(size, TRUE);
}
/*
@ -374,19 +374,19 @@ int inword(void)
int c;
if (curwp->w_doto == llength(curwp->w_dotp))
return (FALSE);
return FALSE;
c = lgetc(curwp->w_dotp, curwp->w_doto);
#if PKCODE
if (isletter(c))
#else
if (c >= 'a' && c <= 'z')
return (TRUE);
return TRUE;
if (c >= 'A' && c <= 'Z')
#endif
return (TRUE);
return TRUE;
if (c >= '0' && c <= '9')
return (TRUE);
return (FALSE);
return TRUE;
return FALSE;
}
#if WORDPRO
@ -410,10 +410,10 @@ int fillpara(int f, int n)
char wbuf[NSTRING]; /* buffer for current word */
if (curbp->b_mode & MDVIEW) /* don't allow this command if */
return (rdonly()); /* we are in read only mode */
return rdonly(); /* we are in read only mode */
if (fillcol == 0) { /* no fill column set */
mlwrite("No fill column set");
return (FALSE);
return FALSE;
}
#if PKCODE
justflag = FALSE;
@ -484,7 +484,7 @@ int fillpara(int f, int n)
}
/* and add a last newline for the end of our new paragraph */
lnewline();
return (TRUE);
return TRUE;
}
#if PKCODE
@ -507,17 +507,17 @@ int justpara(int f, int n)
int leftmarg; /* left marginal */
if (curbp->b_mode & MDVIEW) /* don't allow this command if */
return (rdonly()); /* we are in read only mode */
return rdonly(); /* we are in read only mode */
if (fillcol == 0) { /* no fill column set */
mlwrite("No fill column set");
return (FALSE);
return FALSE;
}
justflag = TRUE;
leftmarg = curwp->w_doto;
if (leftmarg + 10 > fillcol) {
leftmarg = 0;
mlwrite("Column too narrow");
return (FALSE);
return FALSE;
}
/* record the pointer to the line just past the EOP */
@ -593,7 +593,7 @@ int justpara(int f, int n)
curwp->w_doto = llength(curwp->w_dotp);
justflag = FALSE;
return (TRUE);
return TRUE;
}
#endif
@ -622,12 +622,12 @@ int killpara(int f, int n)
/* and delete it */
if ((status = killregion(FALSE, 1)) != TRUE)
return (status);
return status;
/* and clean up the 2 extra lines */
ldelete(2L, TRUE);
}
return (TRUE);
return TRUE;
}
@ -655,7 +655,7 @@ int wordcount(int f, int n)
/* make sure we have a region to count */
if ((status = getregion(&region)) != TRUE)
return (status);
return status;
lp = region.r_linep;
offset = region.r_offset;
size = region.r_size;
@ -701,6 +701,6 @@ int wordcount(int f, int n)
mlwrite("Words %D Chars %D Lines %d Avg chars/word %f",
nwords, nchars, nlines + 1, avgch);
return (TRUE);
return TRUE;
}
#endif