summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--usr.bin/mg/buffer.c8
-rw-r--r--usr.bin/mg/extend.c19
-rw-r--r--usr.bin/mg/file.c10
-rw-r--r--usr.bin/mg/fileio.c4
-rw-r--r--usr.bin/mg/keymap.c68
-rw-r--r--usr.bin/mg/line.c6
-rw-r--r--usr.bin/mg/main.c6
-rw-r--r--usr.bin/mg/window.c4
8 files changed, 62 insertions, 63 deletions
diff --git a/usr.bin/mg/buffer.c b/usr.bin/mg/buffer.c
index 6eb03cabe99..d895ddb1f58 100644
--- a/usr.bin/mg/buffer.c
+++ b/usr.bin/mg/buffer.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: buffer.c,v 1.13 2001/05/23 22:26:24 art Exp $ */
+/* $OpenBSD: buffer.c,v 1.14 2001/05/23 22:36:13 art Exp $ */
/*
* Buffer handling.
@@ -497,11 +497,9 @@ bufferinsert(f, n)
/* Get buffer to use from user */
if (curbp->b_altb != NULL)
s = eread("Insert buffer: (default %s) ", bufn, NBUFN,
- EFNEW | EFBUF, &(curbp->b_altb->b_bname),
- (char *) NULL);
+ EFNEW | EFBUF, &(curbp->b_altb->b_bname), NULL);
else
- s = eread("Insert buffer: ", bufn, NBUFN, EFNEW | EFBUF,
- (char *) NULL);
+ s = eread("Insert buffer: ", bufn, NBUFN, EFNEW | EFBUF, NULL);
if (s == ABORT)
return (s);
if (s == FALSE && curbp->b_altb != NULL)
diff --git a/usr.bin/mg/extend.c b/usr.bin/mg/extend.c
index 3c7bce7d8e3..ec83d3d9872 100644
--- a/usr.bin/mg/extend.c
+++ b/usr.bin/mg/extend.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: extend.c,v 1.12 2001/05/23 22:20:35 art Exp $ */
+/* $OpenBSD: extend.c,v 1.13 2001/05/23 22:36:13 art Exp $ */
/*
* Extended (M-X) commands, rebinding, and startup file processing.
@@ -139,7 +139,7 @@ remap(curmap, c, funct, pref_map)
if (curmap->map_num >= curmap->map_max &&
(curmap = realocmap(curmap)) == NULL)
return FALSE;
- if ((pfp = (PF *)malloc(sizeof(PF))) == NULL) {
+ if ((pfp = malloc(sizeof(PF))) == NULL) {
ewprintf("Out of memory");
return FALSE;
}
@@ -182,7 +182,7 @@ remap(curmap, c, funct, pref_map)
return TRUE;
if (funct != NULL || ele->k_prefmap == NULL) {
if (ele->k_funcp[n1] == NULL)
- ele->k_prefmap = (KEYMAP *) NULL;
+ ele->k_prefmap = NULL;
/* easy case */
ele->k_funcp[n1] = funct;
if (funct == NULL) {
@@ -341,7 +341,7 @@ dobind(curmap, p, unbind)
for (s = 0; s < maclcur->l_used - 1; s++) {
if (doscan(curmap, c = CHARMASK(maclcur->l_text[s]), &curmap)
!= NULL) {
- if (remap(curmap, c, NULL, (KEYMAP *)NULL)
+ if (remap(curmap, c, NULL, NULL)
!= TRUE)
return FALSE;
}
@@ -408,7 +408,7 @@ bindkey(mapp, fname, keys, kcount)
}
while (--kcount) {
if (doscan(curmap, c = *keys++, &curmap) != NULL) {
- if (remap(curmap, c, NULL, (KEYMAP *)NULL) != TRUE)
+ if (remap(curmap, c, NULL, NULL) != TRUE)
return FALSE;
/*
* XXX - Bizzarreness. remap creates an empty KEYMAP
@@ -652,7 +652,7 @@ load(fname)
/* just to be careful */
return FALSE;
- if (ffropen(fname, (BUFFER *)NULL) != FIOSUC)
+ if (ffropen(fname, NULL) != FIOSUC)
return FALSE;
while ((s = ffgetline(excbuf, sizeof(excbuf) - 1, &nbytes)) == FIOSUC) {
@@ -663,7 +663,7 @@ load(fname)
break;
}
}
- (void)ffclose((BUFFER *)NULL);
+ (void)ffclose(NULL);
excbuf[nbytes] = '\0';
if (s != FIOEOF || (nbytes && excline(excbuf) != TRUE))
return FALSE;
@@ -891,9 +891,10 @@ excline(line)
lp->l_text[lp->l_used] = '\0';
status = bindkey(&curmap, lp->l_text, key.k_chars,
key.k_count);
- } else
- status = bindkey(&curmap, (char *)NULL, key.k_chars,
+ } else {
+ status = bindkey(&curmap, NULL, key.k_chars,
key.k_count);
+ }
break;
case BINDNO:
#endif /* FKEYS */
diff --git a/usr.bin/mg/file.c b/usr.bin/mg/file.c
index c52f871fce7..99cf89ed4e5 100644
--- a/usr.bin/mg/file.c
+++ b/usr.bin/mg/file.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: file.c,v 1.7 2001/05/23 22:20:35 art Exp $ */
+/* $OpenBSD: file.c,v 1.8 2001/05/23 22:36:14 art Exp $ */
/*
* File commands.
@@ -22,7 +22,7 @@ fileinsert(f, n)
s = eread("Insert file: ", fname, NFILEN, EFNEW | EFCR | EFFILE);
if (s != TRUE)
return (s);
- return insertfile(adjustname(fname), (char *)NULL, FALSE);
+ return insertfile(adjustname(fname), NULL, FALSE);
/* don't set buffer name */
}
@@ -181,11 +181,11 @@ insertfile(fname, newname, needinfo)
/* cheap */
bp = curbp;
- if (newname != (char *)NULL)
+ if (newname != NULL)
(void)strcpy(bp->b_fname, newname);
/* hard file open */
- if ((s = ffropen(fname, needinfo ? bp : (BUFFER *) NULL)) == FIOERR)
+ if ((s = ffropen(fname, needinfo ? bp : NULL)) == FIOERR)
goto out;
if (s == FIOFNF) {
/* file not found */
@@ -262,7 +262,7 @@ doneread:
}
endoffile:
/* ignore errors */
- (void)ffclose((BUFFER *)NULL);
+ ffclose(NULL);
/* don't zap an error */
if (s == FIOEOF) {
if (nline == 1)
diff --git a/usr.bin/mg/fileio.c b/usr.bin/mg/fileio.c
index 4c5efd28aa0..87114d42ff3 100644
--- a/usr.bin/mg/fileio.c
+++ b/usr.bin/mg/fileio.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: fileio.c,v 1.13 2001/05/23 22:20:35 art Exp $ */
+/* $OpenBSD: fileio.c,v 1.14 2001/05/23 22:36:14 art Exp $ */
/*
* POSIX fileio.c
@@ -405,7 +405,7 @@ copy(frname, toname)
if ((pid = vfork())) {
if (pid == -1)
return -1;
- execl("/bin/cp", "cp", frname, toname, (char *) NULL);
+ execl("/bin/cp", "cp", frname, toname, NULL);
_exit(1); /* shouldn't happen */
}
waitpid(pid, &status, 0);
diff --git a/usr.bin/mg/keymap.c b/usr.bin/mg/keymap.c
index 3f4558ae2f8..58e76e742e6 100644
--- a/usr.bin/mg/keymap.c
+++ b/usr.bin/mg/keymap.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: keymap.c,v 1.9 2001/05/23 22:10:43 art Exp $ */
+/* $OpenBSD: keymap.c,v 1.10 2001/05/23 22:36:14 art Exp $ */
/*
* Keyboard maps. This is character set dependent. The terminal specific
@@ -32,10 +32,10 @@ static struct KEYMAPE (2 + IMAPEXT) helpmap = {
rescan,
{
{
- CCHR('G'), CCHR('H'), cHcG, (KEYMAP *)NULL
+ CCHR('G'), CCHR('H'), cHcG, NULL
},
{
- 'a', 'c', cHa, (KEYMAP *)NULL
+ 'a', 'c', cHa, NULL
},
}
};
@@ -88,10 +88,10 @@ static struct KEYMAPE (2 + IMAPEXT) cX4map = {
rescan,
{
{
- CCHR('F'), CCHR('G'), cX4cF, (KEYMAP *)NULL
+ CCHR('F'), CCHR('G'), cX4cF, NULL
},
{
- 'b', 'f', cX4b, (KEYMAP *)NULL
+ 'b', 'f', cX4b, NULL
},
}
};
@@ -185,24 +185,24 @@ static struct KEYMAPE (5 + IMAPEXT) cXmap = {
rescan,
{
{
- CCHR('B'), CCHR('G'), cXcB, (KEYMAP *)NULL
+ CCHR('B'), CCHR('G'), cXcB, NULL
},
{
- CCHR('L'), CCHR('X'), cXcL, (KEYMAP *)NULL
+ CCHR('L'), CCHR('X'), cXcL, NULL
},
#ifndef NO_MACRO
{
- '(', ')', cXlp, (KEYMAP *)NULL
+ '(', ')', cXlp, NULL
},
#endif /* !NO_MACRO */
{
'0', '4', cX0, (KEYMAP *) & cX4map
},
{
- '=', '=', cXeq, (KEYMAP *)NULL
+ '=', '=', cXeq, NULL
},
{
- '^', 's', cXcar, (KEYMAP *)NULL
+ '^', 's', cXcar, NULL
},
}
};
@@ -286,28 +286,28 @@ static struct KEYMAPE (8 + IMAPEXT) metamap = {
rescan,
{
{
- CCHR('G'), CCHR('G'), metacG, (KEYMAP *)NULL
+ CCHR('G'), CCHR('G'), metacG, NULL
},
{
- CCHR('V'), CCHR('V'), metacV, (KEYMAP *)NULL
+ CCHR('V'), CCHR('V'), metacV, NULL
},
{
- ' ', ' ', metasp, (KEYMAP *)NULL
+ ' ', ' ', metasp, NULL
},
{
- '%', '%', metapct, (KEYMAP *)NULL
+ '%', '%', metapct, NULL
},
{
- '-', '>', metami, (KEYMAP *)NULL
+ '-', '>', metami, NULL
},
{
- '[', 'f', metalb, (KEYMAP *)NULL
+ '[', 'f', metalb, NULL
},
{
- 'l', 'x', metal, (KEYMAP *) NULL
+ 'l', 'x', metal, NULL
},
{
- '~', CCHR('?'), metatilde, (KEYMAP *)NULL
+ '~', CCHR('?'), metatilde, NULL
},
}
};
@@ -376,7 +376,7 @@ static struct KEYMAPE (4 + NFUND_XMAPS + IMAPEXT) fundmap = {
},
#else /* !NO_HELP */
{
- CCHR('@'), CCHR('H'), fund_at, (KEYMAP *)NULL
+ CCHR('@'), CCHR('H'), fund_at, NULL
},
#endif /* !NO_HELP */
{
@@ -386,7 +386,7 @@ static struct KEYMAPE (4 + NFUND_XMAPS + IMAPEXT) fundmap = {
CCHR('['), CCHR('_'), fund_esc, (KEYMAP *) & metamap
},
{
- CCHR('?'), CCHR('?'), fund_del, (KEYMAP *)NULL
+ CCHR('?'), CCHR('?'), fund_del, NULL
},
#ifdef FUND_XMAPS
FUND_XMAPS,
@@ -404,7 +404,7 @@ static struct KEYMAPE (1 + IMAPEXT) fillmap = {
rescan,
{
{
- ' ', ' ', fill_sp, (KEYMAP *)NULL
+ ' ', ' ', fill_sp, NULL
},
}
};
@@ -422,7 +422,7 @@ static struct KEYMAPE (1 + IMAPEXT) indntmap = {
rescan,
{
{
- CCHR('J'), CCHR('M'), indent_lf, (KEYMAP *)NULL
+ CCHR('J'), CCHR('M'), indent_lf, NULL
},
}
};
@@ -437,7 +437,7 @@ static struct KEYMAPE (1 + IMAPEXT) blinkmap = {
rescan,
{
{
- ')', ')', blink_rp, (KEYMAP *)NULL
+ ')', ')', blink_rp, NULL
},
}
};
@@ -453,7 +453,7 @@ static struct KEYMAPE (1 + IMAPEXT) notabmap = {
rescan,
{
{
- CCHR('I'), CCHR('I'), notab_tab, (KEYMAP *)NULL
+ CCHR('I'), CCHR('I'), notab_tab, NULL
},
}
};
@@ -466,7 +466,7 @@ static struct KEYMAPE (1 + IMAPEXT) overwmap = {
{
/* unused dummy entry for VMS C */
{
- (KCHAR)0, (KCHAR)0, (PF *)NULL, (KEYMAP *)NULL
+ (KCHAR)0, (KCHAR)0, NULL, NULL
},
}
};
@@ -552,7 +552,7 @@ static struct KEYMAPE (6 + NDIRED_XMAPS + IMAPEXT) diredmap = {
},
#else /* !NO_HELP */
{
- CCHR('@'), CCHR('G'), dirednul, (KEYMAP *)NULL
+ CCHR('@'), CCHR('G'), dirednul, NULL
},
#endif /* !NO_HELP */
{
@@ -562,13 +562,13 @@ static struct KEYMAPE (6 + NDIRED_XMAPS + IMAPEXT) diredmap = {
CCHR('Z'), ' ', diredcz, (KEYMAP *) & metamap
},
{
- 'c', 'f', diredc, (KEYMAP *)NULL
+ 'c', 'f', diredc, NULL
},
{
- 'n', 'x', diredn, (KEYMAP *)NULL
+ 'n', 'x', diredn, NULL
},
{
- CCHR('?'), CCHR('?'), direddl, (KEYMAP *)NULL
+ CCHR('?'), CCHR('?'), direddl, NULL
},
#ifdef DIRED_XMAPS
DIRED_XMAPS, /* map sections for dired mode keys */
@@ -627,7 +627,7 @@ map_name(map)
if (mp->p_map == map)
return mp->p_name;
} while (++mp < &map_table[NMAPS]);
- return (char *)NULL;
+ return NULL;
}
MAPS *
@@ -640,7 +640,7 @@ name_mode(name)
if (strcmp(mp->p_name, name) == 0)
return mp;
} while (++mp < &map_table[NMAPS]);
- return (MAPS *)NULL;
+ return NULL;
}
KEYMAP *
@@ -648,7 +648,7 @@ name_map(name)
char *name;
{
MAPS *mp;
- return (mp = name_mode(name)) == NULL ? (KEYMAP *)NULL : mp->p_map;
+ return (mp = name_mode(name)) == NULL ? NULL : mp->p_map;
}
/*
@@ -955,10 +955,10 @@ function_name(fpoint)
if (fpoint == NULL)
/* ambiguous */
- return (char *)NULL;
+ return NULL;
do {
if (fnp->n_funct == fpoint)
return fnp->n_name;
} while (++fnp < &functnames[NFUNCT]);
- return (char *)NULL;
+ return NULL;
}
diff --git a/usr.bin/mg/line.c b/usr.bin/mg/line.c
index fda781e4ab4..924c5ed928c 100644
--- a/usr.bin/mg/line.c
+++ b/usr.bin/mg/line.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: line.c,v 1.6 2001/05/23 22:20:35 art Exp $ */
+/* $OpenBSD: line.c,v 1.7 2001/05/23 22:36:14 art Exp $ */
/*
* Text line handling.
@@ -62,9 +62,9 @@ lalloc(used)
#ifdef MALLOCROUND
MALLOCROUND(size); /* round up to a size optimal to malloc */
#endif
- if ((lp = (LINE *)malloc((unsigned)size)) == NULL) {
+ if ((lp = malloc((unsigned)size)) == NULL) {
ewprintf("Can't get %d bytes", size);
- return (LINE *)NULL;
+ return NULL;
}
lp->l_size = size - OFFSET(LINE, l_text[0]);
lp->l_used = used;
diff --git a/usr.bin/mg/main.c b/usr.bin/mg/main.c
index 9ea37882628..f2a52185ec7 100644
--- a/usr.bin/mg/main.c
+++ b/usr.bin/mg/main.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: main.c,v 1.7 2001/05/23 22:20:35 art Exp $ */
+/* $OpenBSD: main.c,v 1.8 2001/05/23 22:36:15 art Exp $ */
/*
* Mainline.
@@ -16,7 +16,7 @@ int curgoal; /* goal column */
BUFFER *curbp; /* current buffer */
BUFFER *bheadp; /* BUFFER listhead */
MGWIN *curwp; /* current window */
-MGWIN *wheadp = (MGWIN *)NULL; /* MGWIN listhead */
+MGWIN *wheadp; /* MGWIN listhead */
char pat[NPAT]; /* pattern */
static void edinit __P((void));
@@ -47,7 +47,7 @@ main(argc, argv)
#ifndef NO_STARTUP
/* user startup file */
- if ((cp = startupfile((char *)NULL)) != NULL)
+ if ((cp = startupfile(NULL)) != NULL)
(void)load(cp);
#endif /* !NO_STARTUP */
while (--argc > 0) {
diff --git a/usr.bin/mg/window.c b/usr.bin/mg/window.c
index bc63b80c4f4..b17b1a9a83c 100644
--- a/usr.bin/mg/window.c
+++ b/usr.bin/mg/window.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: window.c,v 1.5 2001/01/29 01:58:10 niklas Exp $ */
+/* $OpenBSD: window.c,v 1.6 2001/05/23 22:36:15 art Exp $ */
/*
* Window handling.
@@ -190,7 +190,7 @@ splitwind(f, n)
ewprintf("Cannot split a %d line window", curwp->w_ntrows);
return (FALSE);
}
- if ((wp = (MGWIN *)malloc(sizeof(MGWIN))) == NULL) {
+ if ((wp = malloc(sizeof(MGWIN))) == NULL) {
ewprintf("Can't get %d", sizeof(MGWIN));
return (FALSE);
}