summaryrefslogtreecommitdiff
path: root/usr.bin/mg/word.c
diff options
context:
space:
mode:
authorTodd C. Miller <millert@cvs.openbsd.org>2000-04-13 06:12:19 +0000
committerTodd C. Miller <millert@cvs.openbsd.org>2000-04-13 06:12:19 +0000
commit731317961dd78a8a6a84be2b662b9691fcf40d5a (patch)
tree642f051b45a10e806a55322912dad11e53435ab7 /usr.bin/mg/word.c
parentf54a169ac01105217cbf6e3dfa39f465f0bde571 (diff)
The start of KNF + -Wall. The code has been run through indent but
needs hand fixup. I stopped at keymap.c...
Diffstat (limited to 'usr.bin/mg/word.c')
-rw-r--r--usr.bin/mg/word.c73
1 files changed, 39 insertions, 34 deletions
diff --git a/usr.bin/mg/word.c b/usr.bin/mg/word.c
index e06b4cab2a8..859d904f331 100644
--- a/usr.bin/mg/word.c
+++ b/usr.bin/mg/word.c
@@ -13,10 +13,11 @@
* are performed by the "backchar" and "forwchar"
* routines.
*/
-/*ARGSUSED*/
+/* ARGSUSED */
backword(f, n)
{
- if (n < 0) return forwword(f | FFRAND, -n);
+ if (n < 0)
+ return forwword(f | FFRAND, -n);
if (backchar(FFRAND, 1) == FALSE)
return FALSE;
while (n--) {
@@ -37,7 +38,7 @@ backword(f, n)
* the specified number of words. All of the
* motion is done by "forwchar".
*/
-/*ARGSUSED*/
+/* ARGSUSED */
forwword(f, n)
{
if (n < 0)
@@ -60,12 +61,13 @@ forwword(f, n)
* the specified number of words. As you move,
* convert any characters to upper case.
*/
-/*ARGSUSED*/
+/* ARGSUSED */
upperword(f, n)
{
- register int c;
+ register int c;
- if (n < 0) return FALSE;
+ if (n < 0)
+ return FALSE;
while (n--) {
while (inword() == FALSE) {
if (forwchar(FFRAND, 1) == FALSE)
@@ -90,12 +92,13 @@ upperword(f, n)
* the specified number of words. As you move
* convert characters to lower case.
*/
-/*ARGSUSED*/
+/* ARGSUSED */
lowerword(f, n)
{
- register int c;
+ register int c;
- if (n < 0) return FALSE;
+ if (n < 0)
+ return FALSE;
while (n--) {
while (inword() == FALSE) {
if (forwchar(FFRAND, 1) == FALSE)
@@ -122,13 +125,14 @@ lowerword(f, n)
* case, and subsequent characters to lower case. Error
* if you try and move past the end of the buffer.
*/
-/*ARGSUSED*/
+/* ARGSUSED */
capword(f, n)
{
- register int c;
- VOID lchange();
+ register int c;
+ VOID lchange();
- if (n < 0) return FALSE;
+ if (n < 0)
+ return FALSE;
while (n--) {
while (inword() == FALSE) {
if (forwchar(FFRAND, 1) == FALSE)
@@ -161,16 +165,16 @@ capword(f, n)
/*
* Kill forward by "n" words.
*/
-/*ARGSUSED*/
+/* ARGSUSED */
delfword(f, n)
{
- register RSIZE size;
- register LINE *dotp;
- register int doto;
+ register RSIZE size;
+ register LINE *dotp;
+ register int doto;
if (n < 0)
return FALSE;
- if ((lastflag&CFKILL) == 0) /* Purge kill buffer. */
+ if ((lastflag & CFKILL) == 0) /* Purge kill buffer. */
kdelete();
thisflag |= CFKILL;
dotp = curwp->w_dotp;
@@ -179,12 +183,12 @@ delfword(f, n)
while (n--) {
while (inword() == FALSE) {
if (forwchar(FFRAND, 1) == FALSE)
- goto out; /* Hit end of buffer. */
+ goto out; /* Hit end of buffer. */
++size;
}
while (inword() != FALSE) {
if (forwchar(FFRAND, 1) == FALSE)
- goto out; /* Hit end of buffer. */
+ goto out; /* Hit end of buffer. */
++size;
}
}
@@ -206,34 +210,35 @@ out:
* be wierd. Normally this is bound to "M-Rubout" and
* to "M-Backspace".
*/
-/*ARGSUSED*/
+/* ARGSUSED */
delbword(f, n)
{
- register RSIZE size;
- VOID kdelete();
+ register RSIZE size;
+ VOID kdelete();
- if (n < 0) return FALSE;
- if ((lastflag&CFKILL) == 0) /* Purge kill buffer. */
+ if (n < 0)
+ return FALSE;
+ if ((lastflag & CFKILL) == 0) /* Purge kill buffer. */
kdelete();
thisflag |= CFKILL;
if (backchar(FFRAND, 1) == FALSE)
- return (TRUE); /* Hit buffer start. */
- size = 1; /* One deleted. */
+ return (TRUE); /* Hit buffer start. */
+ size = 1; /* One deleted. */
while (n--) {
while (inword() == FALSE) {
if (backchar(FFRAND, 1) == FALSE)
- goto out; /* Hit buffer start. */
+ goto out; /* Hit buffer start. */
++size;
}
while (inword() != FALSE) {
if (backchar(FFRAND, 1) == FALSE)
- goto out; /* Hit buffer start. */
+ goto out; /* Hit buffer start. */
++size;
}
}
if (forwchar(FFRAND, 1) == FALSE)
return FALSE;
- --size; /* Undo assumed delete. */
+ --size; /* Undo assumed delete. */
out:
return ldelete(size, KBACK);
}
@@ -244,9 +249,9 @@ out:
* part of a word. The word character list is hard
* coded. Should be setable.
*/
-inword() {
-/* can't use lgetc in ISWORD due to bug in OSK cpp */
- return curwp->w_doto != llength(curwp->w_dotp) &&
+inword()
+{
+ /* can't use lgetc in ISWORD due to bug in OSK cpp */
+ return curwp->w_doto != llength(curwp->w_dotp) &&
ISWORD(curwp->w_dotp->l_text[curwp->w_doto]);
}
-