2013-05-20 01:16:08 -04:00
|
|
|
/* random.c -- implements random.h */
|
|
|
|
#include "random.h"
|
|
|
|
|
2010-11-14 21:10:03 -05:00
|
|
|
/* random.c
|
2005-05-31 11:50:56 -04:00
|
|
|
*
|
2010-11-14 21:10:03 -05:00
|
|
|
* This file contains the command processing functions for a number of
|
|
|
|
* random commands. There is no functional grouping here, for sure.
|
2005-05-31 11:50:56 -04:00
|
|
|
*
|
2010-11-14 21:10:03 -05:00
|
|
|
* Modified by Petri Kutvonen
|
2005-05-31 11:50:56 -04:00
|
|
|
*/
|
|
|
|
|
2010-11-14 21:10:03 -05:00
|
|
|
#include <stdio.h>
|
2013-10-08 21:43:15 -04:00
|
|
|
#include <string.h>
|
2005-05-31 11:50:56 -04:00
|
|
|
|
2013-05-28 03:10:16 -04:00
|
|
|
#include "basic.h"
|
2013-09-20 06:10:30 -04:00
|
|
|
#include "buffer.h"
|
2013-05-28 02:57:03 -04:00
|
|
|
#include "display.h"
|
2010-11-14 21:10:03 -05:00
|
|
|
#include "estruct.h"
|
2013-10-09 01:43:32 -04:00
|
|
|
#include "globals.h"
|
2013-06-03 23:52:28 -04:00
|
|
|
#include "execute.h"
|
2013-05-28 02:46:44 -04:00
|
|
|
#include "input.h"
|
2010-11-14 21:10:03 -05:00
|
|
|
#include "line.h"
|
2013-09-18 02:25:39 -04:00
|
|
|
#include "log.h"
|
2013-05-28 00:22:31 -04:00
|
|
|
#include "search.h"
|
2013-09-25 09:45:05 -04:00
|
|
|
#include "terminal.h"
|
2013-09-20 06:10:30 -04:00
|
|
|
#include "window.h"
|
2010-11-14 21:10:03 -05:00
|
|
|
|
2013-09-30 11:05:29 -04:00
|
|
|
|
|
|
|
static const char *cname[] = { /* names of colors */
|
2013-09-29 00:47:26 -04:00
|
|
|
"BLACK", "RED", "GREEN", "YELLOW", "BLUE",
|
|
|
|
"MAGENTA", "CYAN", "WHITE"
|
|
|
|
#if PKCODE & IBMPC
|
|
|
|
, "HIGH"
|
|
|
|
#endif
|
|
|
|
} ;
|
|
|
|
|
2013-09-30 11:05:29 -04:00
|
|
|
#define NCOLORS (sizeof cname / sizeof( *cname)) /* # of supported colors */
|
|
|
|
|
2013-10-01 07:40:26 -04:00
|
|
|
int gfcolor = NCOLORS - 1 ; /* global forgrnd color (white) */
|
|
|
|
int gbcolor = 0 ; /* global backgrnd color (black) */
|
2013-09-30 11:05:29 -04:00
|
|
|
|
2010-11-14 21:10:03 -05:00
|
|
|
int tabsize; /* Tab size (0: use real tabs) */
|
2005-05-31 11:50:56 -04:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Set fill column to n.
|
|
|
|
*/
|
2005-09-30 19:34:11 -04:00
|
|
|
int setfillcol(int f, int n)
|
2005-05-31 11:50:56 -04:00
|
|
|
{
|
2005-09-30 18:26:09 -04:00
|
|
|
fillcol = n;
|
|
|
|
mlwrite("(Fill column is %d)", n);
|
2010-08-29 06:03:55 -04:00
|
|
|
return TRUE;
|
2005-05-31 11:50:56 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Display the current position of the cursor, in origin 1 X-Y coordinates,
|
|
|
|
* the character that is under the cursor (in hex), and the fraction of the
|
|
|
|
* text that is before the cursor. The displayed column is not the current
|
|
|
|
* column, but the column that would be used on an infinite width display.
|
|
|
|
* Normally this is bound to "C-X =".
|
|
|
|
*/
|
2005-09-30 19:34:11 -04:00
|
|
|
int showcpos(int f, int n)
|
2005-05-31 11:50:56 -04:00
|
|
|
{
|
2010-04-17 19:38:09 -04:00
|
|
|
struct line *lp; /* current line */
|
2010-02-27 05:38:22 -05:00
|
|
|
long numchars; /* # of chars in file */
|
|
|
|
int numlines; /* # of lines in file */
|
|
|
|
long predchars; /* # chars preceding point */
|
|
|
|
int predlines; /* # lines preceding point */
|
|
|
|
int curchar; /* character under cursor */
|
2005-09-30 18:26:09 -04:00
|
|
|
int ratio;
|
|
|
|
int col;
|
|
|
|
int savepos; /* temp save for current offset */
|
|
|
|
int ecol; /* column pos/end of current line */
|
2005-05-31 11:50:56 -04:00
|
|
|
|
|
|
|
/* starting at the beginning of the buffer */
|
2005-09-30 18:26:09 -04:00
|
|
|
lp = lforw(curbp->b_linep);
|
2005-05-31 11:50:56 -04:00
|
|
|
|
|
|
|
/* start counting chars and lines */
|
2005-09-30 18:26:09 -04:00
|
|
|
numchars = 0;
|
|
|
|
numlines = 0;
|
2006-11-19 14:52:18 -05:00
|
|
|
predchars = 0;
|
|
|
|
predlines = 0;
|
|
|
|
curchar = 0;
|
2005-09-30 18:26:09 -04:00
|
|
|
while (lp != curbp->b_linep) {
|
2005-05-31 11:50:56 -04:00
|
|
|
/* if we are on the current line, record it */
|
|
|
|
if (lp == curwp->w_dotp) {
|
|
|
|
predlines = numlines;
|
|
|
|
predchars = numchars + curwp->w_doto;
|
|
|
|
if ((curwp->w_doto) == llength(lp))
|
|
|
|
curchar = '\n';
|
|
|
|
else
|
|
|
|
curchar = lgetc(lp, curwp->w_doto);
|
|
|
|
}
|
|
|
|
/* on to the next line */
|
|
|
|
++numlines;
|
|
|
|
numchars += llength(lp) + 1;
|
|
|
|
lp = lforw(lp);
|
2005-09-30 18:26:09 -04:00
|
|
|
}
|
2005-05-31 11:50:56 -04:00
|
|
|
|
|
|
|
/* if at end of file, record it */
|
|
|
|
if (curwp->w_dotp == curbp->b_linep) {
|
|
|
|
predlines = numlines;
|
|
|
|
predchars = numchars;
|
|
|
|
#if PKCODE
|
|
|
|
curchar = 0;
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Get real column and end-of-line column. */
|
|
|
|
col = getccol(FALSE);
|
|
|
|
savepos = curwp->w_doto;
|
|
|
|
curwp->w_doto = llength(curwp->w_dotp);
|
|
|
|
ecol = getccol(FALSE);
|
|
|
|
curwp->w_doto = savepos;
|
|
|
|
|
2005-09-30 18:26:09 -04:00
|
|
|
ratio = 0; /* Ratio before dot. */
|
|
|
|
if (numchars != 0)
|
|
|
|
ratio = (100L * predchars) / numchars;
|
2005-05-31 11:50:56 -04:00
|
|
|
|
|
|
|
/* summarize and report the info */
|
|
|
|
mlwrite("Line %d/%d Col %d/%d Char %D/%D (%d%%) char = 0x%x",
|
2005-09-30 18:26:09 -04:00
|
|
|
predlines + 1, numlines + 1, col, ecol,
|
2005-05-31 11:50:56 -04:00
|
|
|
predchars, numchars, ratio, curchar);
|
2010-08-29 06:03:55 -04:00
|
|
|
return TRUE;
|
2005-05-31 11:50:56 -04:00
|
|
|
}
|
|
|
|
|
2005-09-30 19:34:11 -04:00
|
|
|
int getcline(void)
|
2005-09-30 18:26:09 -04:00
|
|
|
{ /* get the current line number */
|
2010-04-17 19:38:09 -04:00
|
|
|
struct line *lp; /* current line */
|
2010-02-27 05:38:22 -05:00
|
|
|
int numlines; /* # of lines before point */
|
2005-05-31 11:50:56 -04:00
|
|
|
|
|
|
|
/* starting at the beginning of the buffer */
|
2005-09-30 18:26:09 -04:00
|
|
|
lp = lforw(curbp->b_linep);
|
2005-05-31 11:50:56 -04:00
|
|
|
|
|
|
|
/* start counting lines */
|
2005-09-30 18:26:09 -04:00
|
|
|
numlines = 0;
|
|
|
|
while (lp != curbp->b_linep) {
|
2005-05-31 11:50:56 -04:00
|
|
|
/* if we are on the current line, record it */
|
|
|
|
if (lp == curwp->w_dotp)
|
|
|
|
break;
|
|
|
|
++numlines;
|
|
|
|
lp = lforw(lp);
|
2005-09-30 18:26:09 -04:00
|
|
|
}
|
2005-05-31 11:50:56 -04:00
|
|
|
|
|
|
|
/* and return the resulting count */
|
2010-08-29 06:03:55 -04:00
|
|
|
return numlines + 1;
|
2005-05-31 11:50:56 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Return current column. Stop at first non-blank given TRUE argument.
|
|
|
|
*/
|
2005-09-30 19:34:11 -04:00
|
|
|
int getccol(int bflg)
|
2005-05-31 11:50:56 -04:00
|
|
|
{
|
2012-07-15 17:36:38 -04:00
|
|
|
int i, col;
|
|
|
|
struct line *dlp = curwp->w_dotp;
|
|
|
|
int byte_offset = curwp->w_doto;
|
|
|
|
int len = llength(dlp);
|
|
|
|
|
|
|
|
col = i = 0;
|
|
|
|
while (i < byte_offset) {
|
|
|
|
unicode_t c;
|
|
|
|
|
|
|
|
i += utf8_to_unicode(dlp->l_text, i, len, &c);
|
2005-09-30 18:26:09 -04:00
|
|
|
if (c != ' ' && c != '\t' && bflg)
|
|
|
|
break;
|
|
|
|
if (c == '\t')
|
|
|
|
col |= tabmask;
|
|
|
|
else if (c < 0x20 || c == 0x7F)
|
|
|
|
++col;
|
2012-07-15 17:36:38 -04:00
|
|
|
else if (c >= 0xc0 && c <= 0xa0)
|
|
|
|
col += 2;
|
2005-09-30 18:26:09 -04:00
|
|
|
++col;
|
|
|
|
}
|
2010-08-29 06:03:55 -04:00
|
|
|
return col;
|
2005-05-31 11:50:56 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Set current column.
|
2005-09-30 19:34:11 -04:00
|
|
|
*
|
|
|
|
* int pos; position to set cursor
|
2005-05-31 11:50:56 -04:00
|
|
|
*/
|
2005-09-30 19:34:11 -04:00
|
|
|
int setccol(int pos)
|
2005-05-31 11:50:56 -04:00
|
|
|
{
|
2010-02-27 05:38:22 -05:00
|
|
|
int c; /* character being scanned */
|
|
|
|
int i; /* index into current line */
|
|
|
|
int col; /* current cursor column */
|
|
|
|
int llen; /* length of line in bytes */
|
2005-05-31 11:50:56 -04:00
|
|
|
|
|
|
|
col = 0;
|
|
|
|
llen = llength(curwp->w_dotp);
|
|
|
|
|
|
|
|
/* scan the line until we are at or past the target column */
|
|
|
|
for (i = 0; i < llen; ++i) {
|
|
|
|
/* upon reaching the target, drop out */
|
|
|
|
if (col >= pos)
|
|
|
|
break;
|
|
|
|
|
|
|
|
/* advance one character */
|
2005-09-30 18:26:09 -04:00
|
|
|
c = lgetc(curwp->w_dotp, i);
|
|
|
|
if (c == '\t')
|
|
|
|
col |= tabmask;
|
|
|
|
else if (c < 0x20 || c == 0x7F)
|
|
|
|
++col;
|
|
|
|
++col;
|
|
|
|
}
|
2005-05-31 11:50:56 -04:00
|
|
|
|
|
|
|
/* set us at the new position */
|
|
|
|
curwp->w_doto = i;
|
|
|
|
|
|
|
|
/* and tell weather we made it */
|
2010-08-29 06:03:55 -04:00
|
|
|
return col >= pos;
|
2005-05-31 11:50:56 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Twiddle the two characters on either side of dot. If dot is at the end of
|
|
|
|
* the line twiddle the two characters before it. Return with an error if dot
|
|
|
|
* is at the beginning of line; it seems to be a bit pointless to make this
|
|
|
|
* work. This fixes up a very common typo with a single stroke. Normally bound
|
|
|
|
* to "C-T". This always works within a line, so "WFEDIT" is good enough.
|
|
|
|
*/
|
2005-09-30 19:34:11 -04:00
|
|
|
int twiddle(int f, int n)
|
2005-05-31 11:50:56 -04:00
|
|
|
{
|
2010-04-17 19:38:09 -04:00
|
|
|
struct line *dotp;
|
2010-02-27 05:38:22 -05:00
|
|
|
int doto;
|
|
|
|
int cl;
|
|
|
|
int cr;
|
2005-09-30 18:26:09 -04:00
|
|
|
|
|
|
|
if (curbp->b_mode & MDVIEW) /* don't allow this command if */
|
2010-08-29 06:03:55 -04:00
|
|
|
return rdonly(); /* we are in read only mode */
|
2005-09-30 18:26:09 -04:00
|
|
|
dotp = curwp->w_dotp;
|
|
|
|
doto = curwp->w_doto;
|
|
|
|
if (doto == llength(dotp) && --doto < 0)
|
2010-08-29 06:03:55 -04:00
|
|
|
return FALSE;
|
2005-09-30 18:26:09 -04:00
|
|
|
cr = lgetc(dotp, doto);
|
|
|
|
if (--doto < 0)
|
2010-08-29 06:03:55 -04:00
|
|
|
return FALSE;
|
2005-09-30 18:26:09 -04:00
|
|
|
cl = lgetc(dotp, doto);
|
|
|
|
lputc(dotp, doto + 0, cr);
|
|
|
|
lputc(dotp, doto + 1, cl);
|
|
|
|
lchange(WFEDIT);
|
2010-08-29 06:03:55 -04:00
|
|
|
return TRUE;
|
2005-05-31 11:50:56 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Quote the next character, and insert it into the buffer. All the characters
|
|
|
|
* are taken literally, with the exception of the newline, which always has
|
|
|
|
* its line splitting meaning. The character is always read, even if it is
|
|
|
|
* inserted 0 times, for regularity. Bound to "C-Q"
|
|
|
|
*/
|
2005-09-30 19:34:11 -04:00
|
|
|
int quote(int f, int n)
|
2005-05-31 11:50:56 -04:00
|
|
|
{
|
2010-02-27 05:38:22 -05:00
|
|
|
int s;
|
|
|
|
int c;
|
2005-09-30 18:26:09 -04:00
|
|
|
|
|
|
|
if (curbp->b_mode & MDVIEW) /* don't allow this command if */
|
2010-08-29 06:03:55 -04:00
|
|
|
return rdonly(); /* we are in read only mode */
|
2005-09-30 18:26:09 -04:00
|
|
|
c = tgetc();
|
|
|
|
if (n < 0)
|
2010-08-29 06:03:55 -04:00
|
|
|
return FALSE;
|
2005-09-30 18:26:09 -04:00
|
|
|
if (n == 0)
|
2010-08-29 06:03:55 -04:00
|
|
|
return TRUE;
|
2005-09-30 18:26:09 -04:00
|
|
|
if (c == '\n') {
|
|
|
|
do {
|
|
|
|
s = lnewline();
|
|
|
|
} while (s == TRUE && --n);
|
2010-08-29 06:03:55 -04:00
|
|
|
return s;
|
2005-09-30 18:26:09 -04:00
|
|
|
}
|
2010-08-29 06:03:55 -04:00
|
|
|
return linsert(n, c);
|
2005-05-31 11:50:56 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Set tab size if given non-default argument (n <> 1). Otherwise, insert a
|
|
|
|
* tab into file. If given argument, n, of zero, change to true tabs.
|
|
|
|
* If n > 1, simulate tab stop every n-characters using spaces. This has to be
|
|
|
|
* done in this slightly funny way because the tab (in ASCII) has been turned
|
|
|
|
* into "C-I" (in 10 bit code) already. Bound to "C-I".
|
|
|
|
*/
|
2005-10-01 03:22:55 -04:00
|
|
|
int insert_tab(int f, int n)
|
2005-05-31 11:50:56 -04:00
|
|
|
{
|
2005-09-30 18:26:09 -04:00
|
|
|
if (n < 0)
|
2010-08-29 06:03:55 -04:00
|
|
|
return FALSE;
|
2005-09-30 18:26:09 -04:00
|
|
|
if (n == 0 || n > 1) {
|
|
|
|
tabsize = n;
|
2010-08-29 06:03:55 -04:00
|
|
|
return TRUE;
|
2005-09-30 18:26:09 -04:00
|
|
|
}
|
|
|
|
if (!tabsize)
|
2010-08-29 06:03:55 -04:00
|
|
|
return linsert(1, '\t');
|
|
|
|
return linsert(tabsize - (getccol(FALSE) % tabsize), ' ');
|
2005-05-31 11:50:56 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
#if AEDIT
|
2005-09-30 19:34:11 -04:00
|
|
|
/*
|
|
|
|
* change tabs to spaces
|
|
|
|
*
|
|
|
|
* int f, n; default flag and numeric repeat count
|
|
|
|
*/
|
|
|
|
int detab(int f, int n)
|
2005-05-31 11:50:56 -04:00
|
|
|
{
|
2010-02-27 05:38:22 -05:00
|
|
|
int inc; /* increment to next line [sgn(n)] */
|
2005-05-31 11:50:56 -04:00
|
|
|
|
2005-09-30 18:26:09 -04:00
|
|
|
if (curbp->b_mode & MDVIEW) /* don't allow this command if */
|
2010-08-29 06:03:55 -04:00
|
|
|
return rdonly(); /* we are in read only mode */
|
2005-05-31 11:50:56 -04:00
|
|
|
|
|
|
|
if (f == FALSE)
|
|
|
|
n = 1;
|
|
|
|
|
|
|
|
/* loop thru detabbing n lines */
|
|
|
|
inc = ((n > 0) ? 1 : -1);
|
|
|
|
while (n) {
|
|
|
|
curwp->w_doto = 0; /* start at the beginning */
|
|
|
|
|
|
|
|
/* detab the entire current line */
|
|
|
|
while (curwp->w_doto < llength(curwp->w_dotp)) {
|
|
|
|
/* if we have a tab */
|
|
|
|
if (lgetc(curwp->w_dotp, curwp->w_doto) == '\t') {
|
2012-07-11 13:43:16 -04:00
|
|
|
ldelchar(1, FALSE);
|
2005-09-30 18:26:09 -04:00
|
|
|
insspace(TRUE,
|
|
|
|
(tabmask + 1) -
|
|
|
|
(curwp->w_doto & tabmask));
|
2005-05-31 11:50:56 -04:00
|
|
|
}
|
|
|
|
forwchar(FALSE, 1);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* advance/or back to the next line */
|
|
|
|
forwline(TRUE, inc);
|
|
|
|
n -= inc;
|
|
|
|
}
|
|
|
|
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 */
|
2010-08-29 06:03:55 -04:00
|
|
|
return TRUE;
|
2005-05-31 11:50:56 -04:00
|
|
|
}
|
|
|
|
|
2005-09-30 19:34:11 -04:00
|
|
|
/*
|
|
|
|
* change spaces to tabs where posible
|
|
|
|
*
|
|
|
|
* int f, n; default flag and numeric repeat count
|
|
|
|
*/
|
|
|
|
int entab(int f, int n)
|
2005-05-31 11:50:56 -04:00
|
|
|
{
|
2010-02-27 05:38:22 -05:00
|
|
|
int inc; /* increment to next line [sgn(n)] */
|
|
|
|
int fspace; /* pointer to first space if in a run */
|
|
|
|
int ccol; /* current cursor column */
|
|
|
|
char cchar; /* current character */
|
2005-05-31 11:50:56 -04:00
|
|
|
|
2005-09-30 18:26:09 -04:00
|
|
|
if (curbp->b_mode & MDVIEW) /* don't allow this command if */
|
2010-08-29 06:03:55 -04:00
|
|
|
return rdonly(); /* we are in read only mode */
|
2005-05-31 11:50:56 -04:00
|
|
|
|
|
|
|
if (f == FALSE)
|
|
|
|
n = 1;
|
|
|
|
|
|
|
|
/* loop thru entabbing n lines */
|
|
|
|
inc = ((n > 0) ? 1 : -1);
|
|
|
|
while (n) {
|
|
|
|
curwp->w_doto = 0; /* start at the beginning */
|
|
|
|
|
|
|
|
/* entab the entire current line */
|
|
|
|
fspace = -1;
|
|
|
|
ccol = 0;
|
|
|
|
while (curwp->w_doto < llength(curwp->w_dotp)) {
|
|
|
|
/* see if it is time to compress */
|
2005-10-01 02:54:34 -04:00
|
|
|
if ((fspace >= 0) && (nextab(fspace) <= ccol)) {
|
2005-05-31 11:50:56 -04:00
|
|
|
if (ccol - fspace < 2)
|
|
|
|
fspace = -1;
|
|
|
|
else {
|
2005-09-30 18:26:09 -04:00
|
|
|
/* there is a bug here dealing with mixed space/tabed
|
|
|
|
lines.......it will get fixed */
|
2005-05-31 11:50:56 -04:00
|
|
|
backchar(TRUE, ccol - fspace);
|
2005-09-30 18:26:09 -04:00
|
|
|
ldelete((long) (ccol - fspace),
|
|
|
|
FALSE);
|
|
|
|
linsert(1, '\t');
|
2005-05-31 11:50:56 -04:00
|
|
|
fspace = -1;
|
|
|
|
}
|
2005-10-01 02:54:34 -04:00
|
|
|
}
|
2005-05-31 11:50:56 -04:00
|
|
|
|
|
|
|
/* get the current character */
|
|
|
|
cchar = lgetc(curwp->w_dotp, curwp->w_doto);
|
|
|
|
|
|
|
|
switch (cchar) {
|
2005-09-30 18:26:09 -04:00
|
|
|
case '\t': /* a tab...count em up */
|
|
|
|
ccol = nextab(ccol);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ' ': /* a space...compress? */
|
|
|
|
if (fspace == -1)
|
|
|
|
fspace = ccol;
|
|
|
|
ccol++;
|
|
|
|
break;
|
|
|
|
|
|
|
|
default: /* any other char...just count */
|
|
|
|
ccol++;
|
|
|
|
fspace = -1;
|
|
|
|
break;
|
2005-05-31 11:50:56 -04:00
|
|
|
}
|
|
|
|
forwchar(FALSE, 1);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* advance/or back to the next line */
|
|
|
|
forwline(TRUE, inc);
|
|
|
|
n -= inc;
|
|
|
|
}
|
|
|
|
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 */
|
2010-08-29 06:03:55 -04:00
|
|
|
return TRUE;
|
2005-05-31 11:50:56 -04:00
|
|
|
}
|
|
|
|
|
2005-09-30 19:34:11 -04:00
|
|
|
/*
|
|
|
|
* trim trailing whitespace from the point to eol
|
|
|
|
*
|
|
|
|
* int f, n; default flag and numeric repeat count
|
|
|
|
*/
|
|
|
|
int trim(int f, int n)
|
2005-05-31 11:50:56 -04:00
|
|
|
{
|
2010-04-17 19:38:09 -04:00
|
|
|
struct line *lp; /* current line pointer */
|
2010-02-27 05:38:22 -05:00
|
|
|
int offset; /* original line offset position */
|
|
|
|
int length; /* current length */
|
|
|
|
int inc; /* increment to next line [sgn(n)] */
|
2005-05-31 11:50:56 -04:00
|
|
|
|
2005-09-30 18:26:09 -04:00
|
|
|
if (curbp->b_mode & MDVIEW) /* don't allow this command if */
|
2010-08-29 06:03:55 -04:00
|
|
|
return rdonly(); /* we are in read only mode */
|
2005-05-31 11:50:56 -04:00
|
|
|
|
|
|
|
if (f == FALSE)
|
|
|
|
n = 1;
|
|
|
|
|
|
|
|
/* loop thru trimming n lines */
|
|
|
|
inc = ((n > 0) ? 1 : -1);
|
|
|
|
while (n) {
|
2005-09-30 18:26:09 -04:00
|
|
|
lp = curwp->w_dotp; /* find current line text */
|
|
|
|
offset = curwp->w_doto; /* save original offset */
|
|
|
|
length = lp->l_used; /* find current length */
|
2005-05-31 11:50:56 -04:00
|
|
|
|
|
|
|
/* trim the current line */
|
|
|
|
while (length > offset) {
|
2005-09-30 18:26:09 -04:00
|
|
|
if (lgetc(lp, length - 1) != ' ' &&
|
|
|
|
lgetc(lp, length - 1) != '\t')
|
|
|
|
break;
|
2005-05-31 11:50:56 -04:00
|
|
|
length--;
|
|
|
|
}
|
|
|
|
lp->l_used = length;
|
|
|
|
|
|
|
|
/* advance/or back to the next line */
|
|
|
|
forwline(TRUE, inc);
|
|
|
|
n -= inc;
|
|
|
|
}
|
|
|
|
lchange(WFEDIT);
|
|
|
|
thisflag &= ~CFCPCN; /* flag that this resets the goal column */
|
2010-08-29 06:03:55 -04:00
|
|
|
return TRUE;
|
2005-05-31 11:50:56 -04:00
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Open up some blank space. The basic plan is to insert a bunch of newlines,
|
|
|
|
* and then back up over them. Everything is done by the subcommand
|
|
|
|
* procerssors. They even handle the looping. Normally this is bound to "C-O".
|
|
|
|
*/
|
2005-09-30 19:34:11 -04:00
|
|
|
int openline(int f, int n)
|
2005-05-31 11:50:56 -04:00
|
|
|
{
|
2010-02-27 05:38:22 -05:00
|
|
|
int i;
|
|
|
|
int s;
|
2005-09-30 18:26:09 -04:00
|
|
|
|
|
|
|
if (curbp->b_mode & MDVIEW) /* don't allow this command if */
|
2010-08-29 06:03:55 -04:00
|
|
|
return rdonly(); /* we are in read only mode */
|
2005-09-30 18:26:09 -04:00
|
|
|
if (n < 0)
|
2010-08-29 06:03:55 -04:00
|
|
|
return FALSE;
|
2005-09-30 18:26:09 -04:00
|
|
|
if (n == 0)
|
2010-08-29 06:03:55 -04:00
|
|
|
return TRUE;
|
2005-09-30 18:26:09 -04:00
|
|
|
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. */
|
2010-08-29 06:03:55 -04:00
|
|
|
return s;
|
2005-05-31 11:50:56 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Insert a newline. Bound to "C-M". If we are in CMODE, do automatic
|
|
|
|
* indentation as specified.
|
|
|
|
*/
|
2005-10-01 03:22:55 -04:00
|
|
|
int insert_newline(int f, int n)
|
2005-05-31 11:50:56 -04:00
|
|
|
{
|
2010-02-27 05:38:22 -05:00
|
|
|
int s;
|
2005-05-31 11:50:56 -04:00
|
|
|
|
2005-09-30 18:26:09 -04:00
|
|
|
if (curbp->b_mode & MDVIEW) /* don't allow this command if */
|
2010-08-29 06:03:55 -04:00
|
|
|
return rdonly(); /* we are in read only mode */
|
2005-05-31 11:50:56 -04:00
|
|
|
if (n < 0)
|
2010-08-29 06:03:55 -04:00
|
|
|
return FALSE;
|
2005-05-31 11:50:56 -04:00
|
|
|
|
|
|
|
/* 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)
|
2010-08-29 06:03:55 -04:00
|
|
|
return cinsert();
|
2005-05-31 11:50:56 -04:00
|
|
|
|
2005-09-30 18:26:09 -04:00
|
|
|
/*
|
|
|
|
* If a newline was typed, fill column is defined, the argument is non-
|
|
|
|
* negative, wrap mode is enabled, and we are now past fill column,
|
2005-05-31 11:50:56 -04:00
|
|
|
* and we are not read-only, perform word wrap.
|
2005-09-30 18:26:09 -04:00
|
|
|
*/
|
|
|
|
if ((curwp->w_bufp->b_mode & MDWRAP) && fillcol > 0 &&
|
2005-05-31 11:50:56 -04:00
|
|
|
getccol(FALSE) > fillcol &&
|
|
|
|
(curwp->w_bufp->b_mode & MDVIEW) == FALSE)
|
2005-09-30 18:26:09 -04:00
|
|
|
execute(META | SPEC | 'W', FALSE, 1);
|
2005-05-31 11:50:56 -04:00
|
|
|
|
|
|
|
/* insert some lines */
|
|
|
|
while (n--) {
|
2005-09-30 18:26:09 -04:00
|
|
|
if ((s = lnewline()) != TRUE)
|
2010-08-29 06:03:55 -04:00
|
|
|
return s;
|
2005-05-31 11:50:56 -04:00
|
|
|
#if SCROLLCODE
|
|
|
|
curwp->w_flag |= WFINS;
|
|
|
|
#endif
|
|
|
|
}
|
2010-08-29 06:03:55 -04:00
|
|
|
return TRUE;
|
2005-05-31 11:50:56 -04:00
|
|
|
}
|
|
|
|
|
2005-09-30 19:34:11 -04:00
|
|
|
int cinsert(void)
|
2005-09-30 18:26:09 -04:00
|
|
|
{ /* insert a newline and indentation for C */
|
2010-02-27 05:38:22 -05:00
|
|
|
char *cptr; /* string pointer into text to copy */
|
|
|
|
int tptr; /* index to scan into line */
|
|
|
|
int bracef; /* was there a brace at the end of line? */
|
|
|
|
int i;
|
2005-05-31 11:50:56 -04:00
|
|
|
char ichar[NSTRING]; /* buffer to hold indent of last line */
|
|
|
|
|
|
|
|
/* grab a pointer to text to copy indentation from */
|
|
|
|
cptr = &curwp->w_dotp->l_text[0];
|
|
|
|
|
|
|
|
/* check for a brace */
|
|
|
|
tptr = curwp->w_doto - 1;
|
|
|
|
bracef = (cptr[tptr] == '{');
|
|
|
|
|
|
|
|
/* save the indent of the previous line */
|
|
|
|
i = 0;
|
|
|
|
while ((i < tptr) && (cptr[i] == ' ' || cptr[i] == '\t')
|
2005-09-30 18:26:09 -04:00
|
|
|
&& (i < NSTRING - 1)) {
|
2005-05-31 11:50:56 -04:00
|
|
|
ichar[i] = cptr[i];
|
|
|
|
++i;
|
|
|
|
}
|
|
|
|
ichar[i] = 0; /* terminate it */
|
|
|
|
|
|
|
|
/* put in the newline */
|
|
|
|
if (lnewline() == FALSE)
|
2010-08-29 06:03:55 -04:00
|
|
|
return FALSE;
|
2005-05-31 11:50:56 -04:00
|
|
|
|
|
|
|
/* and the saved indentation */
|
|
|
|
linstr(ichar);
|
|
|
|
|
|
|
|
/* and one more tab for a brace */
|
|
|
|
if (bracef)
|
2005-10-01 03:22:55 -04:00
|
|
|
insert_tab(FALSE, 1);
|
2005-05-31 11:50:56 -04:00
|
|
|
|
|
|
|
#if SCROLLCODE
|
|
|
|
curwp->w_flag |= WFINS;
|
|
|
|
#endif
|
2010-08-29 06:03:55 -04:00
|
|
|
return TRUE;
|
2005-05-31 11:50:56 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
#if NBRACE
|
2005-09-30 19:34:11 -04:00
|
|
|
/*
|
|
|
|
* insert a brace into the text here...we are in CMODE
|
|
|
|
*
|
|
|
|
* int n; repeat count
|
|
|
|
* int c; brace to insert (always } for now)
|
|
|
|
*/
|
|
|
|
int insbrace(int n, int c)
|
2005-05-31 11:50:56 -04:00
|
|
|
{
|
2010-02-27 05:38:22 -05:00
|
|
|
int ch; /* last character before input */
|
|
|
|
int oc; /* caractere oppose a c */
|
|
|
|
int i, count;
|
|
|
|
int target; /* column brace should go after */
|
2010-04-17 19:38:09 -04:00
|
|
|
struct line *oldlp;
|
2010-02-27 05:38:22 -05:00
|
|
|
int oldoff;
|
2005-05-31 11:50:56 -04:00
|
|
|
|
|
|
|
/* if we aren't at the beginning of the line... */
|
|
|
|
if (curwp->w_doto != 0)
|
|
|
|
|
2005-09-30 18:26:09 -04:00
|
|
|
/* scan to see if all space before this is white space */
|
2005-05-31 11:50:56 -04:00
|
|
|
for (i = curwp->w_doto - 1; i >= 0; --i) {
|
|
|
|
ch = lgetc(curwp->w_dotp, i);
|
|
|
|
if (ch != ' ' && ch != '\t')
|
2010-08-29 06:03:55 -04:00
|
|
|
return linsert(n, c);
|
2005-05-31 11:50:56 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
/* chercher le caractere oppose correspondant */
|
|
|
|
switch (c) {
|
2005-09-30 18:26:09 -04:00
|
|
|
case '}':
|
|
|
|
oc = '{';
|
|
|
|
break;
|
|
|
|
case ']':
|
|
|
|
oc = '[';
|
|
|
|
break;
|
|
|
|
case ')':
|
|
|
|
oc = '(';
|
|
|
|
break;
|
|
|
|
default:
|
2010-08-29 06:03:55 -04:00
|
|
|
return FALSE;
|
2005-05-31 11:50:56 -04:00
|
|
|
}
|
2005-09-30 18:26:09 -04:00
|
|
|
|
2005-05-31 11:50:56 -04:00
|
|
|
oldlp = curwp->w_dotp;
|
|
|
|
oldoff = curwp->w_doto;
|
2005-09-30 18:26:09 -04:00
|
|
|
|
|
|
|
count = 1;
|
|
|
|
backchar(FALSE, 1);
|
|
|
|
|
2005-05-31 11:50:56 -04:00
|
|
|
while (count > 0) {
|
|
|
|
if (curwp->w_doto == llength(curwp->w_dotp))
|
|
|
|
ch = '\n';
|
|
|
|
else
|
|
|
|
ch = lgetc(curwp->w_dotp, curwp->w_doto);
|
|
|
|
|
2005-09-30 18:26:09 -04:00
|
|
|
if (ch == c)
|
|
|
|
++count;
|
|
|
|
if (ch == oc)
|
|
|
|
--count;
|
|
|
|
|
2005-05-31 11:50:56 -04:00
|
|
|
backchar(FALSE, 1);
|
|
|
|
if (boundry(curwp->w_dotp, curwp->w_doto, REVERSE))
|
|
|
|
break;
|
|
|
|
}
|
2005-09-30 18:26:09 -04:00
|
|
|
|
2005-05-31 11:50:56 -04:00
|
|
|
if (count != 0) { /* no match */
|
|
|
|
curwp->w_dotp = oldlp;
|
|
|
|
curwp->w_doto = oldoff;
|
2010-08-29 06:03:55 -04:00
|
|
|
return linsert(n, c);
|
2005-05-31 11:50:56 -04:00
|
|
|
}
|
2005-09-30 18:26:09 -04:00
|
|
|
|
|
|
|
curwp->w_doto = 0; /* debut de ligne */
|
2005-05-31 11:50:56 -04:00
|
|
|
/* aller au debut de la ligne apres la tabulation */
|
2005-09-30 18:26:09 -04:00
|
|
|
while ((ch = lgetc(curwp->w_dotp, curwp->w_doto)) == ' '
|
|
|
|
|| ch == '\t')
|
2005-05-31 11:50:56 -04:00
|
|
|
forwchar(FALSE, 1);
|
|
|
|
|
|
|
|
/* delete back first */
|
|
|
|
target = getccol(FALSE); /* c'est l'indent que l'on doit avoir */
|
|
|
|
curwp->w_dotp = oldlp;
|
|
|
|
curwp->w_doto = oldoff;
|
2005-09-30 18:26:09 -04:00
|
|
|
|
2005-05-31 11:50:56 -04:00
|
|
|
while (target != getccol(FALSE)) {
|
|
|
|
if (target < getccol(FALSE)) /* on doit detruire des caracteres */
|
|
|
|
while (getccol(FALSE) > target)
|
|
|
|
backdel(FALSE, 1);
|
2005-09-30 18:26:09 -04:00
|
|
|
else { /* on doit en inserer */
|
2005-05-31 11:50:56 -04:00
|
|
|
while (target - getccol(FALSE) >= 8)
|
2005-09-30 18:26:09 -04:00
|
|
|
linsert(1, '\t');
|
2005-05-31 11:50:56 -04:00
|
|
|
linsert(target - getccol(FALSE), ' ');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* and insert the required brace(s) */
|
2010-08-29 06:03:55 -04:00
|
|
|
return linsert(n, c);
|
2005-05-31 11:50:56 -04:00
|
|
|
}
|
2005-09-30 19:34:11 -04:00
|
|
|
|
2005-05-31 11:50:56 -04:00
|
|
|
#else
|
|
|
|
|
2005-09-30 19:34:11 -04:00
|
|
|
/*
|
|
|
|
* insert a brace into the text here...we are in CMODE
|
|
|
|
*
|
|
|
|
* int n; repeat count
|
|
|
|
* int c; brace to insert (always { for now)
|
|
|
|
*/
|
|
|
|
int insbrace(int n, int c)
|
2005-05-31 11:50:56 -04:00
|
|
|
{
|
2010-02-27 05:38:22 -05:00
|
|
|
int ch; /* last character before input */
|
|
|
|
int i;
|
|
|
|
int target; /* column brace should go after */
|
2005-05-31 11:50:56 -04:00
|
|
|
|
|
|
|
/* if we are at the beginning of the line, no go */
|
|
|
|
if (curwp->w_doto == 0)
|
2010-08-29 06:03:55 -04:00
|
|
|
return linsert(n, c);
|
2005-05-31 11:50:56 -04:00
|
|
|
|
|
|
|
/* 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')
|
2010-08-29 06:03:55 -04:00
|
|
|
return linsert(n, c);
|
2005-05-31 11:50:56 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
/* delete back first */
|
|
|
|
target = getccol(FALSE); /* calc where we will delete to */
|
|
|
|
target -= 1;
|
|
|
|
target -= target % (tabsize == 0 ? 8 : tabsize);
|
|
|
|
while (getccol(FALSE) > target)
|
|
|
|
backdel(FALSE, 1);
|
|
|
|
|
|
|
|
/* and insert the required brace(s) */
|
2010-08-29 06:03:55 -04:00
|
|
|
return linsert(n, c);
|
2005-05-31 11:50:56 -04:00
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2005-09-30 19:34:11 -04:00
|
|
|
int inspound(void)
|
2005-09-30 18:26:09 -04:00
|
|
|
{ /* insert a # into the text here...we are in CMODE */
|
2010-02-27 05:38:22 -05:00
|
|
|
int ch; /* last character before input */
|
|
|
|
int i;
|
2005-05-31 11:50:56 -04:00
|
|
|
|
|
|
|
/* if we are at the beginning of the line, no go */
|
|
|
|
if (curwp->w_doto == 0)
|
2010-08-29 06:03:55 -04:00
|
|
|
return linsert(1, '#');
|
2005-05-31 11:50:56 -04:00
|
|
|
|
|
|
|
/* 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')
|
2010-08-29 06:03:55 -04:00
|
|
|
return linsert(1, '#');
|
2005-05-31 11:50:56 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
/* delete back first */
|
|
|
|
while (getccol(FALSE) >= 1)
|
|
|
|
backdel(FALSE, 1);
|
|
|
|
|
|
|
|
/* and insert the required pound */
|
2010-08-29 06:03:55 -04:00
|
|
|
return linsert(1, '#');
|
2005-05-31 11:50:56 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Delete blank lines around dot. What this command does depends if dot is
|
|
|
|
* sitting on a blank line. If dot is sitting on a blank line, this command
|
|
|
|
* deletes all the blank lines above and below the current line. If it is
|
|
|
|
* sitting on a non blank line then it deletes all of the blank lines after
|
|
|
|
* the line. Normally this command is bound to "C-X C-O". Any argument is
|
|
|
|
* ignored.
|
|
|
|
*/
|
2005-09-30 19:34:11 -04:00
|
|
|
int deblank(int f, int n)
|
2005-05-31 11:50:56 -04:00
|
|
|
{
|
2010-04-17 19:38:09 -04:00
|
|
|
struct line *lp1;
|
|
|
|
struct line *lp2;
|
2005-09-30 18:26:09 -04:00
|
|
|
long nld;
|
|
|
|
|
|
|
|
if (curbp->b_mode & MDVIEW) /* don't allow this command if */
|
2010-08-29 06:03:55 -04:00
|
|
|
return rdonly(); /* we are in read only mode */
|
2005-09-30 18:26:09 -04:00
|
|
|
lp1 = curwp->w_dotp;
|
|
|
|
while (llength(lp1) == 0 && (lp2 = lback(lp1)) != curbp->b_linep)
|
|
|
|
lp1 = lp2;
|
|
|
|
lp2 = lp1;
|
|
|
|
nld = 0;
|
|
|
|
while ((lp2 = lforw(lp2)) != curbp->b_linep && llength(lp2) == 0)
|
|
|
|
++nld;
|
|
|
|
if (nld == 0)
|
2010-08-29 06:03:55 -04:00
|
|
|
return TRUE;
|
2005-09-30 18:26:09 -04:00
|
|
|
curwp->w_dotp = lforw(lp1);
|
|
|
|
curwp->w_doto = 0;
|
2010-08-29 06:03:55 -04:00
|
|
|
return ldelete(nld, FALSE);
|
2005-05-31 11:50:56 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Insert a newline, then enough tabs and spaces to duplicate the indentation
|
|
|
|
* of the previous line. Assumes tabs are every eight characters. Quite simple.
|
|
|
|
* Figure out the indentation of the current line. Insert a newline by calling
|
|
|
|
* the standard routine. Insert the indentation by inserting the right number
|
|
|
|
* of tabs and spaces. Return TRUE if all ok. Return FALSE if one of the
|
|
|
|
* subcomands failed. Normally bound to "C-J".
|
|
|
|
*/
|
2005-09-30 19:34:11 -04:00
|
|
|
int indent(int f, int n)
|
2005-05-31 11:50:56 -04:00
|
|
|
{
|
2010-02-27 05:38:22 -05:00
|
|
|
int nicol;
|
|
|
|
int c;
|
|
|
|
int i;
|
2005-09-30 18:26:09 -04:00
|
|
|
|
|
|
|
if (curbp->b_mode & MDVIEW) /* don't allow this command if */
|
2010-08-29 06:03:55 -04:00
|
|
|
return rdonly(); /* we are in read only mode */
|
2005-09-30 18:26:09 -04:00
|
|
|
if (n < 0)
|
2010-08-29 06:03:55 -04:00
|
|
|
return FALSE;
|
2005-09-30 18:26:09 -04:00
|
|
|
while (n--) {
|
|
|
|
nicol = 0;
|
|
|
|
for (i = 0; i < llength(curwp->w_dotp); ++i) {
|
|
|
|
c = lgetc(curwp->w_dotp, i);
|
|
|
|
if (c != ' ' && c != '\t')
|
|
|
|
break;
|
|
|
|
if (c == '\t')
|
|
|
|
nicol |= tabmask;
|
|
|
|
++nicol;
|
|
|
|
}
|
|
|
|
if (lnewline() == FALSE
|
|
|
|
|| ((i = nicol / 8) != 0 && linsert(i, '\t') == FALSE)
|
|
|
|
|| ((i = nicol % 8) != 0 && linsert(i, ' ') == FALSE))
|
2010-08-29 06:03:55 -04:00
|
|
|
return FALSE;
|
2005-09-30 18:26:09 -04:00
|
|
|
}
|
2010-08-29 06:03:55 -04:00
|
|
|
return TRUE;
|
2005-05-31 11:50:56 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Delete forward. This is real easy, because the basic delete routine does
|
|
|
|
* all of the work. Watches for negative arguments, and does the right thing.
|
|
|
|
* If any argument is present, it kills rather than deletes, to prevent loss
|
|
|
|
* of text if typed with a big argument. Normally bound to "C-D".
|
|
|
|
*/
|
2005-09-30 19:34:11 -04:00
|
|
|
int forwdel(int f, int n)
|
2005-05-31 11:50:56 -04:00
|
|
|
{
|
2005-09-30 18:26:09 -04:00
|
|
|
if (curbp->b_mode & MDVIEW) /* don't allow this command if */
|
2010-08-29 06:03:55 -04:00
|
|
|
return rdonly(); /* we are in read only mode */
|
2005-09-30 18:26:09 -04:00
|
|
|
if (n < 0)
|
2010-08-29 06:03:55 -04:00
|
|
|
return backdel(f, -n);
|
2005-09-30 18:26:09 -04:00
|
|
|
if (f != FALSE) { /* Really a kill. */
|
|
|
|
if ((lastflag & CFKILL) == 0)
|
|
|
|
kdelete();
|
|
|
|
thisflag |= CFKILL;
|
|
|
|
}
|
2012-07-11 13:43:16 -04:00
|
|
|
return ldelchar((long) n, f);
|
2005-05-31 11:50:56 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Delete backwards. This is quite easy too, because it's all done with other
|
|
|
|
* functions. Just move the cursor back, and delete forwards. Like delete
|
|
|
|
* forward, this actually does a kill if presented with an argument. Bound to
|
|
|
|
* both "RUBOUT" and "C-H".
|
|
|
|
*/
|
2005-09-30 19:34:11 -04:00
|
|
|
int backdel(int f, int n)
|
2005-05-31 11:50:56 -04:00
|
|
|
{
|
2010-02-27 05:38:22 -05:00
|
|
|
int s;
|
2005-09-30 18:26:09 -04:00
|
|
|
|
|
|
|
if (curbp->b_mode & MDVIEW) /* don't allow this command if */
|
2010-08-29 06:03:55 -04:00
|
|
|
return rdonly(); /* we are in read only mode */
|
2005-09-30 18:26:09 -04:00
|
|
|
if (n < 0)
|
2010-08-29 06:03:55 -04:00
|
|
|
return forwdel(f, -n);
|
2005-09-30 18:26:09 -04:00
|
|
|
if (f != FALSE) { /* Really a kill. */
|
|
|
|
if ((lastflag & CFKILL) == 0)
|
|
|
|
kdelete();
|
|
|
|
thisflag |= CFKILL;
|
|
|
|
}
|
|
|
|
if ((s = backchar(f, n)) == TRUE)
|
2012-07-11 13:43:16 -04:00
|
|
|
s = ldelchar(n, f);
|
2010-08-29 06:03:55 -04:00
|
|
|
return s;
|
2005-05-31 11:50:56 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Kill text. If called without an argument, it kills from dot to the end of
|
|
|
|
* the line, unless it is at the end of the line, when it kills the newline.
|
|
|
|
* If called with an argument of 0, it kills from the start of the line to dot.
|
|
|
|
* If called with a positive argument, it kills from dot forward over that
|
|
|
|
* number of newlines. If called with a negative argument it kills backwards
|
|
|
|
* that number of newlines. Normally bound to "C-K".
|
|
|
|
*/
|
2005-09-30 19:34:11 -04:00
|
|
|
int killtext(int f, int n)
|
2005-05-31 11:50:56 -04:00
|
|
|
{
|
2010-04-17 19:38:09 -04:00
|
|
|
struct line *nextp;
|
2005-09-30 18:26:09 -04:00
|
|
|
long chunk;
|
|
|
|
|
|
|
|
if (curbp->b_mode & MDVIEW) /* don't allow this command if */
|
2010-08-29 06:03:55 -04:00
|
|
|
return rdonly(); /* we are in read only mode */
|
2005-09-30 18:26:09 -04:00
|
|
|
if ((lastflag & CFKILL) == 0) /* Clear kill buffer if */
|
|
|
|
kdelete(); /* last wasn't a kill. */
|
|
|
|
thisflag |= CFKILL;
|
|
|
|
if (f == FALSE) {
|
|
|
|
chunk = llength(curwp->w_dotp) - curwp->w_doto;
|
|
|
|
if (chunk == 0)
|
|
|
|
chunk = 1;
|
|
|
|
} else if (n == 0) {
|
|
|
|
chunk = curwp->w_doto;
|
|
|
|
curwp->w_doto = 0;
|
|
|
|
} else if (n > 0) {
|
|
|
|
chunk = llength(curwp->w_dotp) - curwp->w_doto + 1;
|
|
|
|
nextp = lforw(curwp->w_dotp);
|
|
|
|
while (--n) {
|
|
|
|
if (nextp == curbp->b_linep)
|
2010-08-29 06:03:55 -04:00
|
|
|
return FALSE;
|
2005-09-30 18:26:09 -04:00
|
|
|
chunk += llength(nextp) + 1;
|
|
|
|
nextp = lforw(nextp);
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
mlwrite("neg kill");
|
2010-08-29 06:03:55 -04:00
|
|
|
return FALSE;
|
2005-09-30 18:26:09 -04:00
|
|
|
}
|
2010-08-29 06:03:55 -04:00
|
|
|
return ldelete(chunk, TRUE);
|
2005-05-31 11:50:56 -04:00
|
|
|
}
|
|
|
|
|
2005-09-30 19:34:11 -04:00
|
|
|
/*
|
|
|
|
* prompt and set an editor mode
|
|
|
|
*
|
|
|
|
* int f, n; default and argument
|
|
|
|
*/
|
2010-08-19 17:55:31 -04:00
|
|
|
int setemode(int f, int n)
|
2005-05-31 11:50:56 -04:00
|
|
|
{
|
|
|
|
#if PKCODE
|
2005-09-30 18:26:09 -04:00
|
|
|
return adjustmode(TRUE, FALSE);
|
2005-05-31 11:50:56 -04:00
|
|
|
#else
|
|
|
|
adjustmode(TRUE, FALSE);
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2005-09-30 19:34:11 -04:00
|
|
|
/*
|
|
|
|
* prompt and delete an editor mode
|
|
|
|
*
|
|
|
|
* int f, n; default and argument
|
|
|
|
*/
|
|
|
|
int delmode(int f, int n)
|
2005-05-31 11:50:56 -04:00
|
|
|
{
|
|
|
|
#if PKCODE
|
2005-09-30 18:26:09 -04:00
|
|
|
return adjustmode(FALSE, FALSE);
|
2005-05-31 11:50:56 -04:00
|
|
|
#else
|
|
|
|
adjustmode(FALSE, FALSE);
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2005-09-30 19:34:11 -04:00
|
|
|
/*
|
|
|
|
* prompt and set a global editor mode
|
|
|
|
*
|
|
|
|
* int f, n; default and argument
|
|
|
|
*/
|
|
|
|
int setgmode(int f, int n)
|
2005-05-31 11:50:56 -04:00
|
|
|
{
|
|
|
|
#if PKCODE
|
2005-09-30 18:26:09 -04:00
|
|
|
return adjustmode(TRUE, TRUE);
|
2005-05-31 11:50:56 -04:00
|
|
|
#else
|
|
|
|
adjustmode(TRUE, TRUE);
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2005-09-30 19:34:11 -04:00
|
|
|
/*
|
|
|
|
* prompt and delete a global editor mode
|
|
|
|
*
|
|
|
|
* int f, n; default and argument
|
|
|
|
*/
|
|
|
|
int delgmode(int f, int n)
|
2005-05-31 11:50:56 -04:00
|
|
|
{
|
|
|
|
#if PKCODE
|
2005-09-30 18:26:09 -04:00
|
|
|
return adjustmode(FALSE, TRUE);
|
2005-05-31 11:50:56 -04:00
|
|
|
#else
|
|
|
|
adjustmode(FALSE, TRUE);
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2005-09-30 19:34:11 -04:00
|
|
|
/*
|
|
|
|
* change the editor mode status
|
|
|
|
*
|
|
|
|
* int kind; true = set, false = delete
|
|
|
|
* int global; true = global flag, false = current buffer flag
|
|
|
|
*/
|
|
|
|
int adjustmode(int kind, int global)
|
2005-05-31 11:50:56 -04:00
|
|
|
{
|
2010-02-27 05:38:22 -05:00
|
|
|
int i; /* loop index */
|
|
|
|
int status; /* error return on input */
|
2005-05-31 11:50:56 -04:00
|
|
|
char prompt[50]; /* string to prompt user with */
|
2005-09-30 18:26:09 -04:00
|
|
|
char cbuf[NPAT]; /* buffer to recieve mode name into */
|
2005-05-31 11:50:56 -04:00
|
|
|
|
|
|
|
/* build the proper prompt string */
|
|
|
|
if (global)
|
2005-09-30 18:26:09 -04:00
|
|
|
strcpy(prompt, "Global mode to ");
|
2005-05-31 11:50:56 -04:00
|
|
|
else
|
2005-09-30 18:26:09 -04:00
|
|
|
strcpy(prompt, "Mode to ");
|
2005-05-31 11:50:56 -04:00
|
|
|
|
|
|
|
if (kind == TRUE)
|
|
|
|
strcat(prompt, "add: ");
|
|
|
|
else
|
|
|
|
strcat(prompt, "delete: ");
|
|
|
|
|
|
|
|
/* prompt the user and get an answer */
|
|
|
|
|
|
|
|
status = mlreply(prompt, cbuf, NPAT - 1);
|
|
|
|
if (status != TRUE)
|
2010-08-29 06:03:55 -04:00
|
|
|
return status;
|
2005-05-31 11:50:56 -04:00
|
|
|
|
|
|
|
/* test it first against the colors we know */
|
2005-09-30 18:26:09 -04:00
|
|
|
for (i = 0; i < NCOLORS; i++) {
|
2013-10-01 21:22:40 -04:00
|
|
|
if( strcasecmp( cbuf, cname[ i]) == 0) {
|
2005-05-31 11:50:56 -04:00
|
|
|
/* finding the match, we set the color */
|
|
|
|
#if COLOR
|
2013-09-30 11:05:29 -04:00
|
|
|
if( *cbuf >= 'A' && *cbuf <= 'Z') {
|
2005-05-31 11:50:56 -04:00
|
|
|
if (global)
|
|
|
|
gfcolor = i;
|
|
|
|
#if PKCODE == 0
|
|
|
|
else
|
|
|
|
#endif
|
|
|
|
curwp->w_fcolor = i;
|
2005-09-30 18:26:09 -04:00
|
|
|
} else {
|
2005-05-31 11:50:56 -04:00
|
|
|
if (global)
|
|
|
|
gbcolor = i;
|
|
|
|
#if PKCODE == 0
|
|
|
|
else
|
|
|
|
#endif
|
|
|
|
curwp->w_bcolor = i;
|
|
|
|
}
|
|
|
|
|
|
|
|
curwp->w_flag |= WFCOLR;
|
|
|
|
#endif
|
|
|
|
mlerase();
|
2010-08-29 06:03:55 -04:00
|
|
|
return TRUE;
|
2005-05-31 11:50:56 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* test it against the modes we know */
|
|
|
|
|
2005-09-30 18:26:09 -04:00
|
|
|
for (i = 0; i < NUMMODES; i++) {
|
2013-10-01 21:22:40 -04:00
|
|
|
if( strcasecmp( cbuf, modename[ i]) == 0) {
|
2005-05-31 11:50:56 -04:00
|
|
|
/* finding a match, we process it */
|
|
|
|
if (kind == TRUE)
|
|
|
|
if (global)
|
|
|
|
gmode |= (1 << i);
|
|
|
|
else
|
|
|
|
curbp->b_mode |= (1 << i);
|
2005-09-30 18:26:09 -04:00
|
|
|
else if (global)
|
|
|
|
gmode &= ~(1 << i);
|
2005-05-31 11:50:56 -04:00
|
|
|
else
|
2005-09-30 18:26:09 -04:00
|
|
|
curbp->b_mode &= ~(1 << i);
|
2005-05-31 11:50:56 -04:00
|
|
|
/* display new mode line */
|
|
|
|
if (global == 0)
|
|
|
|
upmode();
|
|
|
|
mlerase(); /* erase the junk */
|
2010-08-29 06:03:55 -04:00
|
|
|
return TRUE;
|
2005-05-31 11:50:56 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
mlwrite("No such mode!");
|
2010-08-29 06:03:55 -04:00
|
|
|
return FALSE;
|
2005-05-31 11:50:56 -04:00
|
|
|
}
|
|
|
|
|
2005-09-30 19:34:11 -04:00
|
|
|
/*
|
|
|
|
* This function simply clears the message line,
|
|
|
|
* mainly for macro usage
|
|
|
|
*
|
|
|
|
* int f, n; arguments ignored
|
|
|
|
*/
|
|
|
|
int clrmes(int f, int n)
|
2005-05-31 11:50:56 -04:00
|
|
|
{
|
|
|
|
mlforce("");
|
2010-08-29 06:03:55 -04:00
|
|
|
return TRUE;
|
2005-05-31 11:50:56 -04:00
|
|
|
}
|
|
|
|
|
2005-09-30 19:34:11 -04:00
|
|
|
/*
|
|
|
|
* This function writes a string on the message line
|
|
|
|
* mainly for macro usage
|
|
|
|
*
|
|
|
|
* int f, n; arguments ignored
|
|
|
|
*/
|
|
|
|
int writemsg(int f, int n)
|
2005-05-31 11:50:56 -04:00
|
|
|
{
|
2010-02-27 05:38:22 -05:00
|
|
|
char *sp; /* pointer into buf to expand %s */
|
|
|
|
char *np; /* ptr into nbuf */
|
|
|
|
int status;
|
2005-05-31 11:50:56 -04:00
|
|
|
char buf[NPAT]; /* buffer to recieve message into */
|
2005-09-30 18:26:09 -04:00
|
|
|
char nbuf[NPAT * 2]; /* buffer to expand string into */
|
2005-05-31 11:50:56 -04:00
|
|
|
|
2005-09-30 18:26:09 -04:00
|
|
|
if ((status =
|
|
|
|
mlreply("Message to write: ", buf, NPAT - 1)) != TRUE)
|
2010-08-29 06:03:55 -04:00
|
|
|
return status;
|
2005-05-31 11:50:56 -04:00
|
|
|
|
|
|
|
/* expand all '%' to "%%" so mlwrite won't expect arguments */
|
|
|
|
sp = buf;
|
|
|
|
np = nbuf;
|
|
|
|
while (*sp) {
|
|
|
|
*np++ = *sp;
|
|
|
|
if (*sp++ == '%')
|
|
|
|
*np++ = '%';
|
|
|
|
}
|
|
|
|
*np = '\0';
|
|
|
|
|
|
|
|
/* write the message out */
|
|
|
|
mlforce(nbuf);
|
2010-08-29 06:03:55 -04:00
|
|
|
return TRUE;
|
2005-05-31 11:50:56 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
#if CFENCE
|
2005-09-30 19:34:11 -04:00
|
|
|
/*
|
|
|
|
* the cursor is moved to a matching fence
|
|
|
|
*
|
|
|
|
* int f, n; not used
|
|
|
|
*/
|
|
|
|
int getfence(int f, int n)
|
2005-05-31 11:50:56 -04:00
|
|
|
{
|
2010-04-17 19:38:09 -04:00
|
|
|
struct line *oldlp; /* original line pointer */
|
2010-02-27 05:38:22 -05:00
|
|
|
int oldoff; /* and offset */
|
|
|
|
int sdir; /* direction of search (1/-1) */
|
|
|
|
int count; /* current fence level count */
|
|
|
|
char ch; /* fence type to match against */
|
|
|
|
char ofence; /* open fence */
|
|
|
|
char c; /* current character in scan */
|
2005-05-31 11:50:56 -04:00
|
|
|
|
|
|
|
/* save the original cursor position */
|
|
|
|
oldlp = curwp->w_dotp;
|
|
|
|
oldoff = curwp->w_doto;
|
|
|
|
|
|
|
|
/* get the current character */
|
|
|
|
if (oldoff == llength(oldlp))
|
|
|
|
ch = '\n';
|
|
|
|
else
|
|
|
|
ch = lgetc(oldlp, oldoff);
|
|
|
|
|
|
|
|
/* setup proper matching fence */
|
|
|
|
switch (ch) {
|
2005-09-30 18:26:09 -04:00
|
|
|
case '(':
|
|
|
|
ofence = ')';
|
|
|
|
sdir = FORWARD;
|
|
|
|
break;
|
|
|
|
case '{':
|
|
|
|
ofence = '}';
|
|
|
|
sdir = FORWARD;
|
|
|
|
break;
|
|
|
|
case '[':
|
|
|
|
ofence = ']';
|
|
|
|
sdir = FORWARD;
|
|
|
|
break;
|
|
|
|
case ')':
|
|
|
|
ofence = '(';
|
|
|
|
sdir = REVERSE;
|
|
|
|
break;
|
|
|
|
case '}':
|
|
|
|
ofence = '{';
|
|
|
|
sdir = REVERSE;
|
|
|
|
break;
|
|
|
|
case ']':
|
|
|
|
ofence = '[';
|
|
|
|
sdir = REVERSE;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
TTbeep();
|
2010-08-29 06:03:55 -04:00
|
|
|
return FALSE;
|
2005-05-31 11:50:56 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
/* set up for scan */
|
|
|
|
count = 1;
|
|
|
|
if (sdir == REVERSE)
|
|
|
|
backchar(FALSE, 1);
|
|
|
|
else
|
|
|
|
forwchar(FALSE, 1);
|
|
|
|
|
|
|
|
/* scan until we find it, or reach the end of file */
|
|
|
|
while (count > 0) {
|
|
|
|
if (curwp->w_doto == llength(curwp->w_dotp))
|
|
|
|
c = '\n';
|
|
|
|
else
|
|
|
|
c = lgetc(curwp->w_dotp, curwp->w_doto);
|
|
|
|
if (c == ch)
|
|
|
|
++count;
|
|
|
|
if (c == ofence)
|
|
|
|
--count;
|
|
|
|
if (sdir == FORWARD)
|
|
|
|
forwchar(FALSE, 1);
|
|
|
|
else
|
|
|
|
backchar(FALSE, 1);
|
|
|
|
if (boundry(curwp->w_dotp, curwp->w_doto, sdir))
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* if count is zero, we have a match, move the sucker */
|
|
|
|
if (count == 0) {
|
|
|
|
if (sdir == FORWARD)
|
|
|
|
backchar(FALSE, 1);
|
|
|
|
else
|
|
|
|
forwchar(FALSE, 1);
|
|
|
|
curwp->w_flag |= WFMOVE;
|
2010-08-29 06:03:55 -04:00
|
|
|
return TRUE;
|
2005-05-31 11:50:56 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
/* restore the current position */
|
|
|
|
curwp->w_dotp = oldlp;
|
|
|
|
curwp->w_doto = oldoff;
|
|
|
|
TTbeep();
|
2010-08-29 06:03:55 -04:00
|
|
|
return FALSE;
|
2005-05-31 11:50:56 -04:00
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2005-09-30 19:34:11 -04:00
|
|
|
/*
|
|
|
|
* Close fences are matched against their partners, and if
|
|
|
|
* on screen the cursor briefly lights there
|
|
|
|
*
|
|
|
|
* char ch; fence type to match against
|
|
|
|
*/
|
|
|
|
int fmatch(int ch)
|
2005-05-31 11:50:56 -04:00
|
|
|
{
|
2010-04-17 19:38:09 -04:00
|
|
|
struct line *oldlp; /* original line pointer */
|
2010-02-27 05:38:22 -05:00
|
|
|
int oldoff; /* and offset */
|
2010-04-17 19:38:09 -04:00
|
|
|
struct line *toplp; /* top line in current window */
|
2010-02-27 05:38:22 -05:00
|
|
|
int count; /* current fence level count */
|
|
|
|
char opench; /* open fence */
|
|
|
|
char c; /* current character in scan */
|
|
|
|
int i;
|
2005-05-31 11:50:56 -04:00
|
|
|
|
|
|
|
/* first get the display update out there */
|
|
|
|
update(FALSE);
|
|
|
|
|
|
|
|
/* save the original cursor position */
|
|
|
|
oldlp = curwp->w_dotp;
|
|
|
|
oldoff = curwp->w_doto;
|
|
|
|
|
|
|
|
/* setup proper open fence for passed close fence */
|
|
|
|
if (ch == ')')
|
|
|
|
opench = '(';
|
|
|
|
else if (ch == '}')
|
|
|
|
opench = '{';
|
|
|
|
else
|
|
|
|
opench = '[';
|
|
|
|
|
|
|
|
/* find the top line and set up for scan */
|
|
|
|
toplp = curwp->w_linep->l_bp;
|
|
|
|
count = 1;
|
|
|
|
backchar(FALSE, 2);
|
|
|
|
|
|
|
|
/* scan back until we find it, or reach past the top of the window */
|
|
|
|
while (count > 0 && curwp->w_dotp != toplp) {
|
|
|
|
if (curwp->w_doto == llength(curwp->w_dotp))
|
|
|
|
c = '\n';
|
|
|
|
else
|
|
|
|
c = lgetc(curwp->w_dotp, curwp->w_doto);
|
|
|
|
if (c == ch)
|
|
|
|
++count;
|
|
|
|
if (c == opench)
|
|
|
|
--count;
|
|
|
|
backchar(FALSE, 1);
|
|
|
|
if (curwp->w_dotp == curwp->w_bufp->b_linep->l_fp &&
|
|
|
|
curwp->w_doto == 0)
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* if count is zero, we have a match, display the sucker */
|
|
|
|
/* there is a real machine dependant timing problem here we have
|
|
|
|
yet to solve......... */
|
|
|
|
if (count == 0) {
|
|
|
|
forwchar(FALSE, 1);
|
|
|
|
for (i = 0; i < term.t_pause; i++)
|
|
|
|
update(FALSE);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* restore the current position */
|
|
|
|
curwp->w_dotp = oldlp;
|
|
|
|
curwp->w_doto = oldoff;
|
2010-08-29 06:03:55 -04:00
|
|
|
return TRUE;
|
2005-05-31 11:50:56 -04:00
|
|
|
}
|
|
|
|
|
2005-09-30 19:34:11 -04:00
|
|
|
/*
|
|
|
|
* ask for and insert a string into the current
|
|
|
|
* buffer at the current point
|
|
|
|
*
|
|
|
|
* int f, n; ignored arguments
|
|
|
|
*/
|
|
|
|
int istring(int f, int n)
|
2005-05-31 11:50:56 -04:00
|
|
|
{
|
2010-02-27 05:38:22 -05:00
|
|
|
int status; /* status return code */
|
2005-09-30 18:26:09 -04:00
|
|
|
char tstring[NPAT + 1]; /* string to add */
|
2005-05-31 11:50:56 -04:00
|
|
|
|
|
|
|
/* ask for string to insert */
|
2005-09-30 18:26:09 -04:00
|
|
|
status =
|
|
|
|
mlreplyt("String to insert<META>: ", tstring, NPAT, metac);
|
2005-05-31 11:50:56 -04:00
|
|
|
if (status != TRUE)
|
2010-08-29 06:03:55 -04:00
|
|
|
return status;
|
2005-05-31 11:50:56 -04:00
|
|
|
|
|
|
|
if (f == FALSE)
|
|
|
|
n = 1;
|
|
|
|
|
|
|
|
if (n < 0)
|
2005-09-30 18:26:09 -04:00
|
|
|
n = -n;
|
2005-05-31 11:50:56 -04:00
|
|
|
|
|
|
|
/* insert it */
|
2005-09-30 18:26:09 -04:00
|
|
|
while (n-- && (status = linstr(tstring)));
|
2010-08-29 06:03:55 -04:00
|
|
|
return status;
|
2005-05-31 11:50:56 -04:00
|
|
|
}
|
|
|
|
|
2005-09-30 19:34:11 -04:00
|
|
|
/*
|
|
|
|
* ask for and overwite a string into the current
|
|
|
|
* buffer at the current point
|
|
|
|
*
|
|
|
|
* int f, n; ignored arguments
|
|
|
|
*/
|
|
|
|
int ovstring(int f, int n)
|
2005-05-31 11:50:56 -04:00
|
|
|
{
|
2010-02-27 05:38:22 -05:00
|
|
|
int status; /* status return code */
|
2005-09-30 18:26:09 -04:00
|
|
|
char tstring[NPAT + 1]; /* string to add */
|
2005-05-31 11:50:56 -04:00
|
|
|
|
|
|
|
/* ask for string to insert */
|
2005-09-30 18:26:09 -04:00
|
|
|
status =
|
|
|
|
mlreplyt("String to overwrite<META>: ", tstring, NPAT, metac);
|
2005-05-31 11:50:56 -04:00
|
|
|
if (status != TRUE)
|
2010-08-29 06:03:55 -04:00
|
|
|
return status;
|
2005-05-31 11:50:56 -04:00
|
|
|
|
|
|
|
if (f == FALSE)
|
|
|
|
n = 1;
|
|
|
|
|
|
|
|
if (n < 0)
|
2005-09-30 18:26:09 -04:00
|
|
|
n = -n;
|
2005-05-31 11:50:56 -04:00
|
|
|
|
|
|
|
/* insert it */
|
2005-09-30 18:26:09 -04:00
|
|
|
while (n-- && (status = lover(tstring)));
|
2010-08-29 06:03:55 -04:00
|
|
|
return status;
|
2005-05-31 11:50:56 -04:00
|
|
|
}
|