EV_SET() trouble
I committed the following patch [1] to NetBSD, it's a valid issue for OpenBSD as well [2]: Convert EV_SET from macro to static __inline function LLDB introduced support for kevent(2) and it contains the following function: Status MainLoop::RunImpl::Poll() { in_events.resize(loop.m_read_fds.size()); unsigned i = 0; for (auto &fd : loop.m_read_fds) EV_SET(&in_events[i++], fd.first, EVFILT_READ, EV_ADD, 0, 0, 0); num_events = kevent(loop.m_kqueue, in_events.data(), in_events.size(), out_events, llvm::array_lengthof(out_events), nullptr); if (num_events < 0) return Status("kevent() failed with error %d\n", num_events); return Status(); } It works on FreeBSD and MacOSX, however it broke on NetBSD. Culrpit line: EV_SET(&in_events[i++], fd.first, EVFILT_READ, EV_ADD, 0, 0, 0); FreeBSD defined EV_SET() as a macro this way: #define EV_SET(kevp_, a, b, c, d, e, f) do {\ struct kevent *kevp = (kevp_); \ (kevp)->ident = (a);\ (kevp)->filter = (b); \ (kevp)->flags = (c);\ (kevp)->fflags = (d); \ (kevp)->data = (e); \ (kevp)->udata = (f);\ } while(0) NetBSD version was different: #define EV_SET(kevp, a, b, c, d, e, f) \ do {\ (kevp)->ident = (a);\ (kevp)->filter = (b); \ (kevp)->flags = (c);\ (kevp)->fflags = (d); \ (kevp)->data = (e); \ (kevp)->udata = (f);\ } while (/* CONSTCOND */ 0) This resulted in heap damage, as keyp was incremented every time value was assigned to (keyp)->. [...] http://cvsweb.netbsd.org/bsdweb.cgi/src/sys/sys/event.h.diff?r1=1.26&r2=1.27&only_with_tag=MAIN&f=h [2] http://cvsweb.openbsd.org/cgi-bin/cvsweb/src/sys/sys/event.h?annotate=1.23 signature.asc Description: OpenPGP digital signature
Re: ASan on OpenBSD
On 01.05.2017 12:28, Mark Kettenis wrote: >> From: Dmitry Vyukov >> Date: Mon, 1 May 2017 10:43:26 +0200 >> >> On Mon, May 1, 2017 at 8:51 AM, Greg Steuck wrote: >>> I naively tried to build something with -fsanitize=address using llvm-4.0 >>> port available on OpenBSD 6.1-amd64. I was immediately greeted with: >>> clang-4.0: error: unsupported option '-fsanitize=address' for target >>> 'amd64-unknown-openbsd6.1' >>> >>> How deep a rat hole does one have to go to port ASan to a new >>> flavour of BSD? Is OpenBSD going to be particularly painful with >>> its special malloc and advanced ASLR? Is anybody working on this? > > Our focus is currently still on integrating llvm/clang/lld into > OpenBSD. As far as I know nobody is working on this yet, but it > sounds like something we'd certainly be interested in having. > I'm interested in llvm sanitizers and fuzzers on NetBSD. Currently my focus is on LLDB, and next I will plan move on to LLD (linker). The current solution on NetBSD is to use the GNU flavors that work well. signature.asc Description: OpenPGP digital signature
Re: patch/ mg(1) include for struct timespec
On 22.06.2015 01:55, Brian Callahan wrote: > This is quite obviously the wrong place to put any headers. > It's odd, otherwise then the code should be refactored and the following struct perhaps moved away, together with struct buffer? /* * Previously from sysdef.h * Only used in struct buffer. */ struct fileinfo { uid_t fi_uid; gid_t fi_gid; mode_t fi_mode; struct timespec fi_mtime; /* Last modified time */ }; Are there better ideas?
patch/ mg(1) include for struct timespec
Caught on NetBSD. Index: def.h === RCS file: /cvs/src/usr.bin/mg/def.h,v retrieving revision 1.147 diff -u -r1.147 def.h --- def.h 3 Jun 2015 23:40:01 - 1.147 +++ def.h 21 Jun 2015 23:43:23 - @@ -10,6 +10,8 @@ * per-terminal definitions are in special header files. */ +#include + #include "chrdef.h" typedef int(*PF)(int, int);/* generally useful type */
mg(1) sysdef.h cleanning
Hello Brian, Thank you for erasing sysdef.h and pushing the task even further. It will make life easier to deal with it in a modern environment. Good work.
Re: mg(1): refactor sysdef.h?
Brian Callahan wrote: > On 03/15/15 19:24, Kamil Rytarowski wrote: > > Hello, Currently sysdef.h includes C headers for little purpose, as > > the same headers are already pulled in appropriate .c files. In the > > result the headers listed in sysdef.h are pulled in twice. I propose > > to move the remaining content (literally 11 lines-of-code) to def.h or > > a better place. I think that back in time all system includes were > > pulled in from sysdef.h, today I see no need for it any more. > > I'm not sure you've tried doing that. There's a warning to include those > files in order for a reason. > > However, there are some files that have redundant includes. Below is a > diff to remove those. > > OK? > Thank you, this is another approach. OK from me!
mg(1): refactor sysdef.h?
Hello, Currently sysdef.h includes C headers for little purpose, as the same headers are already pulled in appropriate .c files. In the result the headers listed in sysdef.h are pulled in twice. I propose to move the remaining content (literally 11 lines-of-code) to def.h or a better place. I think that back in time all system includes were pulled in from sysdef.h, today I see no need for it any more.
Re: (patch) mg(1) reallocarray cleanup
Me wrote: > I'm attaching a patch. Ooops, wrong file. New attached. patch-display.c-reallocarray-cleanup Description: Binary data
(patch) mg(1) reallocarray cleanup
Hello, I'm attaching a patch. Regards, patch-display.c-reallocarray-cleanup Description: Binary data
Re: ksh version lies
Ted Unangst wrote: > ksh (and sh) have a version string embedded in them: > @(#)PD KSH v5.2.14 99/07/13.2 > > This is clearly a lie. We've added, removed, and fixed bugs and features since > then. I first noticed the lie in the man page, then saw that it's also > exported via the environment and other places. > > Instead of trying to fix something that can't be fixed, it's simpler to delete > it entirely. [...] > 1. MacOSX Please see: https://developer.apple.com/library/mac/documentation/Darwin/Reference/ManPages/man1/ksh.1.html 2. ksh93 Please see original source code of ksh93 (links from http://kornshell.com ). Extracted from their sh.1 embedded in the source package: .sh.version Set to a value that identifies the version of this shell. KSH_VERSION A name reference to .sh.version. 3. MirBSD Korn Shell (pdksh fork) ( http://linux.die.net/man/1/mksh ) "KSH_VERSIONThe name and version of the shell (read-only)." What's broken?
Re: Want to help upstream software improve their random?
> Sent: Friday, December 12, 2014 at 5:02 AM > From: "Theo de Raadt" > To: t...@cvs.openbsd.org > Subject: Want to help upstream software improve their random? > Not my business, but how do you handle cases of rand() & srand()-like calls from software like awk? What is and what should be the result of: for w in `seq 1 10`; do awk 'BEGIN{print int(rand() * 32767)}'; done or for w in `seq 1 10`; do awk 'BEGIN{srand(); print int(rand() * 32767)}'; done
Re: mg(1): Second set of patches
> Sent: Sunday, November 16, 2014 at 1:27 AM > From: "Philip Guenther" > To: "Kamil Rytarowski" > Cc: tech@openbsd.org > Subject: Re: mg(1): Second set of patches > > > On Sat, 15 Nov 2014, Kamil Rytarowski wrote: > > I'm attaching two enhancements against mg(1): > > > > 0001-Include-limits.h-for-INT_MIN-and-INT_MAX.patch > > 0002-Comparison-of-array-bp-b_fname-not-equal-to-a-null-p.patch > > The latter patch was committed *months* ago. Please verify you're working > from a current tree! (That probably also explains a rejected chunk in one > of your other diffs that I had to handle manually...) I have synced my sources with current OpenBSD CVS. > > > For the former, I think the diff I correct, but doesn't go far enough. > The reason isn't needed on OpenBSD is that our is > pulling in the requisite #defines...but mg doesn't have a good reason for > needing ! So here's a slightly bigger diff that eliminates > that by switching from MAXPATHLEN to PATH_MAX and expanding the one use of > MAX(). > > oks? Good idea. Please go for it, this MAX() was problematic at SunOS. Best regards,
Re: mg(1) compatibility patches
> Sent: Sunday, November 16, 2014 at 1:09 AM > From: "Philip Guenther" > To: "Kamil Rytarowski" > Cc: "Theo de Raadt" , tech-openbsd > , "Ted Unangst" > Subject: Re: mg(1) compatibility patches > > On Fri, Nov 14, 2014 at 3:16 PM, Kamil Rytarowski wrote: > ... > > Feel free to evaluate the rest of the patches (0002-0005), > > as they are meant to be generic. > > With a couple, I've committed those. Thanks! > > > Philip Guenther > > Thank you!
mg(1): Second set of patches
Hello, I'm attaching two enhancements against mg(1): 0001-Include-limits.h-for-INT_MIN-and-INT_MAX.patch 0002-Comparison-of-array-bp-b_fname-not-equal-to-a-null-p.patch Regards,>From f4a353e59af01b14455a6302e6309887b70796ba Mon Sep 17 00:00:00 2001 From: Kamil Rytarowski Date: Sat, 15 Nov 2014 09:03:19 + Subject: [PATCH 1/2] Include for INT_MIN and INT_MAX --- basic.c | 1 + cscope.c| 1 + extend.c| 1 + grep.c | 1 + line.c | 1 + main.c | 1 + paragraph.c | 1 + 7 files changed, 7 insertions(+) diff --git a/basic.c b/basic.c index 5d6f093..340bd8d 100644 --- a/basic.c +++ b/basic.c @@ -14,6 +14,7 @@ #include "def.h" #include +#include /* * Go to beginning of line. diff --git a/cscope.c b/cscope.c index b334e6b..9f79579 100644 --- a/cscope.c +++ b/cscope.c @@ -13,6 +13,7 @@ #include #include #include +#include #include #include #include diff --git a/extend.c b/extend.c index 6196691..2f3d965 100644 --- a/extend.c +++ b/extend.c @@ -12,6 +12,7 @@ #include #include +#include #include "macro.h" diff --git a/grep.c b/grep.c index 55f7ae1..055bf33 100644 --- a/grep.c +++ b/grep.c @@ -9,6 +9,7 @@ #include #include #include +#include #include int globalwd = FALSE; diff --git a/line.c b/line.c index 51d1765..ca0b776 100644 --- a/line.c +++ b/line.c @@ -19,6 +19,7 @@ #include "def.h" +#include #include #include diff --git a/main.c b/main.c index 9204d63..7bcfe61 100644 --- a/main.c +++ b/main.c @@ -12,6 +12,7 @@ #include "macro.h" #include +#include #include int thisflag; /* flags, this command */ diff --git a/paragraph.c b/paragraph.c index d45efc4..9d593f7 100644 --- a/paragraph.c +++ b/paragraph.c @@ -8,6 +8,7 @@ */ #include +#include #include "def.h" -- 2.1.0 >From 4e3150317ef5e73933b0c53b3163861710085f67 Mon Sep 17 00:00:00 2001 From: Kamil Rytarowski Date: Sat, 15 Nov 2014 16:29:07 + Subject: [PATCH 2/2] Comparison of array 'bp->b_fname' not equal to a null pointer is always true --- buffer.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/buffer.c b/buffer.c index 331fbbb..51b2838 100644 --- a/buffer.c +++ b/buffer.c @@ -458,8 +458,7 @@ anycb(int f) char pbuf[NFILEN + 11]; for (bp = bheadp; bp != NULL; bp = bp->b_bufp) { - if (bp->b_fname != NULL && *(bp->b_fname) != '\0' && - (bp->b_flag & BFCHG) != 0) { + if (*(bp->b_fname) != '\0' && (bp->b_flag & BFCHG) != 0) { ret = snprintf(pbuf, sizeof(pbuf), "Save file %s", bp->b_fname); if (ret < 0 || ret >= sizeof(pbuf)) { -- 2.1.0
Re: mg(1) compatibility patches
> Sent: Friday, November 14, 2014 at 11:00 PM > From: "Theo de Raadt" > To: dera...@cvs.openbsd.org, n...@gmx.com > Cc: tech@openbsd.org, t...@tedunangst.com > Subject: Re: mg(1) compatibility patches > > The problem you are trying to define is that we (OpenBSD) are supposed > to have a sense of responsibility to make a portable version of mg. > > Sorry, but I cannot find any file or email where that intent was > declared in the past. > > > I think you are on your own. > > Okay. Feel free to evaluate the rest of the patches (0002-0005), as they are meant to be generic. With regards,
Re: mg(1) compatibility patches
> Sent: Friday, November 14, 2014 at 9:59 PM > From: "Theo de Raadt" > To: n...@gmx.com, t...@tedunangst.com > Cc: tech@openbsd.org > Subject: Re: mg(1) compatibility patches > > >> Sent: Friday, November 14, 2014 at 9:10 PM > >> From: "Ted Unangst" > >> To: "Kamil Rytarowski" > >> Cc: tech@openbsd.org > >> Subject: Re: mg(1) comaptibility patches > >> > >> On Fri, Nov 14, 2014 at 20:29, Kamil Rytarowski wrote: > >> > 0001-Define-strtonum-3-for-the-NetBSD-target.patch > >> > >> I don't like this at all. The reason we put strtonum in libc is > >> precisely not to have multiple copies of it floating around the tree. > >> Uncompiled copies are still clutter. > >> > >> This may be odd for a BSD system, but perhaps the pkgsrc version could > >> link against libbsd? > >> > > > >Actually not as libbsd is in reality GNU/Linux-oriented. > > > >Other solution is to go backward for strtol(3)-like functions, > >what do you think? > > > Solution to what problem? > > Hello Theo, mg(1) is maintained in OpenBSD's CVS tree, therefore OpenBSD is upstream. In downstream (except FreeBSD and libbsd consumers) there is missing strtonum(3). To enhance mg(1) and catch its bugs in general I need to start with improvement of its portability to other unsupported systems (as I'm a consumer of few pkgsrc platforms). Please point appropriate way to do it, preferably without floating patches around. Best regards,
Re: mg(1) compatibility patches
> Sent: Friday, November 14, 2014 at 9:10 PM > From: "Ted Unangst" > To: "Kamil Rytarowski" > Cc: tech@openbsd.org > Subject: Re: mg(1) comaptibility patches > > On Fri, Nov 14, 2014 at 20:29, Kamil Rytarowski wrote: > > 0001-Define-strtonum-3-for-the-NetBSD-target.patch > > I don't like this at all. The reason we put strtonum in libc is > precisely not to have multiple copies of it floating around the tree. > Uncompiled copies are still clutter. > > This may be odd for a BSD system, but perhaps the pkgsrc version could > link against libbsd? > Actually not as libbsd is in reality GNU/Linux-oriented. Other solution is to go backward for strtol(3)-like functions, what do you think?
Re: mg(1) compatibility patches
Hello, Thank you for your comments. Please see my comments below. With regards, > Sent: Friday, November 14, 2014 at 8:48 PM > From: "Philip Guenther" > To: "Kamil Rytarowski" > Cc: tech-openbsd > Subject: Re: mg(1) comaptibility patches > > On Fri, Nov 14, 2014 at 11:29 AM, Kamil Rytarowski wrote: > > As maintaining local patches or forking mg(1) for plain compatibility > > is doubtful, I'm going to send you a set of patches. > > > > I don't want to make noise with a mail per patch, so I'm attaching all > > patches to this mail. > > Please review (if needed adapt) and merge. > > > > List of files: > ... > > 0002-Add-missing-include-for-struct-timespec-NetBSD.patch > > sysdef.h should include for struct timespec; is > not required to provide it. Fixed. I changed it to be pulled on all platforms. > > ... > > 0006-Enhance-type-correctness-cast-parameter-of-isspace-3.patch > > This diff is wrong, sorry. The code where a ctype function is being > called on a char from a char * pointer should be casting to (unsigned > char); the code where 'c' is set from lgetc() should declare c as an > int, as lgetc() does the necessary cast. > Hopefully fixed. > > Philip Guenther > >From 4a1225c6c64fc857c6442b0135642a109f1d045d Mon Sep 17 00:00:00 2001 From: Kamil Rytarowski Date: Fri, 14 Nov 2014 17:55:36 + Subject: [PATCH 2/6] Add missing include for struct timespec --- sysdef.h | 1 + 1 file changed, 1 insertion(+) diff --git a/sysdef.h b/sysdef.h index 3fde496..2f5078e 100644 --- a/sysdef.h +++ b/sysdef.h @@ -29,6 +29,7 @@ #include #include #include +#include #define KBLOCK 8192 /* Kill grow. */ #define GOOD 0 /* Good exit status. */ -- 2.1.0 >From 4df46840b96e4de796e822f6636ea0e59b55697a Mon Sep 17 00:00:00 2001 From: Kamil Rytarowski Date: Fri, 14 Nov 2014 18:34:44 + Subject: [PATCH 6/6] Enhance parameter type correctness of ctype functions --- cscope.c | 2 +- extend.c | 2 +- grep.c | 3 ++- tags.c | 2 +- 4 files changed, 5 insertions(+), 4 deletions(-) diff --git a/cscope.c b/cscope.c index 0deada3..b334e6b 100644 --- a/cscope.c +++ b/cscope.c @@ -557,7 +557,7 @@ prettyprint(struct buffer *bp, struct cstokens *t) const char * ltrim(const char *s) { - while (isblank(*s)) + while (isblank((unsigned char)*s)) s++; return s; } diff --git a/extend.c b/extend.c index ef59d5f..6196691 100644 --- a/extend.c +++ b/extend.c @@ -446,7 +446,7 @@ dobindkey(KEYMAP *map, const char *func, const char *str) for (i = 0; *str && i < MAXKEY; i++) { /* XXX - convert numbers w/ strol()? */ if (*str == '^' && *(str + 1) != '\0') { - key.k_chars[i] = CCHR(toupper(*++str)); + key.k_chars[i] = CCHR(toupper((unsigned char)*++str)); } else if (*str == '\\' && *(str + 1) != '\0') { switch (*++str) { case '^': diff --git a/grep.c b/grep.c index 6a4c1c4..55f7ae1 100644 --- a/grep.c +++ b/grep.c @@ -113,7 +113,8 @@ static int gid(int f, int n) { char command[NFILEN]; - char cprompt[NFILEN], c, *bufp; + char cprompt[NFILEN], *bufp; + int c; struct buffer *bp; struct mgwin *wp; int i, j, len; diff --git a/tags.c b/tags.c index e847b9e..b75f703 100644 --- a/tags.c +++ b/tags.c @@ -482,7 +482,7 @@ curtoken(int f, int n, char *token) /* strip away leading whitespace if any like emacs. */ while (ltext(curwp->w_dotp) && - isspace(curwp->w_dotp->l_text[tdoto])) + isspace((unsigned char)curwp->w_dotp->l_text[tdoto])) tdoto++; size = curwp->w_doto - tdoto; -- 2.1.0
mg(1) comaptibility patches
Hello, I'm a user of mg(1) and I'm not a user of OpenBSD. According to known resources mg(1) [1] is currently maintained in OpenBSD's tree. As maintaining local patches or forking mg(1) for plain compatibility is doubtful, I'm going to send you a set of patches. I don't want to make noise with a mail per patch, so I'm attaching all patches to this mail. Please review (if needed adapt) and merge. List of files: 0001-Define-strtonum-3-for-the-NetBSD-target.patch 0002-Add-missing-include-for-struct-timespec-NetBSD.patch 0003-Fix-const-correctness-in-charcost-usage.patch 0004-Fix-const-correctness-of-scroll_fwd.patch 0005-dci-is-set-but-unused.patch 0006-Enhance-type-correctness-cast-parameter-of-isspace-3.patch My goal is to upgrade pkgsrc's version to the latest mg and reuse it system-wide, therefore this is the first bunch of patches, next things are waiting in the queue. [1] http://en.wikipedia.org/wiki/Mg_%28editor%29>From d49301b6559e2b1d432fd347fc826a255f9a3fdb Mon Sep 17 00:00:00 2001 From: Kamil Rytarowski Date: Fri, 14 Nov 2014 17:55:03 + Subject: [PATCH 1/6] Define strtonum(3) for the NetBSD target --- strtonum.h | 70 ++ sysdef.h | 4 2 files changed, 74 insertions(+) create mode 100644 strtonum.h diff --git a/strtonum.h b/strtonum.h new file mode 100644 index 000..74ed381 --- /dev/null +++ b/strtonum.h @@ -0,0 +1,70 @@ +/* $OpenBSD: strtonum.c,v 1.7 2013/04/17 18:40:58 tedu Exp $ */ + +/* + * Copyright (c) 2004 Ted Unangst and Todd Miller + * All rights reserved. + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +#ifndef _STRTONUM_COMPAT_ +#define _STRTONUM_COMPAT_ + +#include +#include +#include + +#define INVALID 1 +#define TOOSMALL 2 +#define TOOLARGE 3 + +static inline long long +strtonum(const char *numstr, long long minval, long long maxval, +const char **errstrp) +{ + long long ll = 0; + int error = 0; + char *ep; + struct errval { + const char *errstr; + int err; + } ev[4] = { + { NULL, 0 }, + { "invalid", EINVAL }, + { "too small", ERANGE }, + { "too large", ERANGE }, + }; + + ev[0].err = errno; + errno = 0; + if (minval > maxval) { + error = INVALID; + } else { + ll = strtoll(numstr, &ep, 10); + if (numstr == ep || *ep != '\0') + error = INVALID; + else if ((ll == LLONG_MIN && errno == ERANGE) || ll < minval) + error = TOOSMALL; + else if ((ll == LLONG_MAX && errno == ERANGE) || ll > maxval) + error = TOOLARGE; + } + if (errstrp != NULL) + *errstrp = ev[error].errstr; + errno = ev[error].err; + if (error) + ll = 0; + + return (ll); +} + +#endif /* _STRTONUM_COMPAT_ */ diff --git a/sysdef.h b/sysdef.h index 8d3d3a2..3fde496 100644 --- a/sysdef.h +++ b/sysdef.h @@ -19,6 +19,10 @@ # define LOGIN_NAME_MAX _POSIX_LOGIN_NAME_MAX #endif +#if defined(__NetBSD__) +# include "strtonum.h" /* OpenBSD specific function */ +#endif + #include #include #include -- 2.1.0 >From 4f4c1beac4422bce6419442320a67e8028ca1876 Mon Sep 17 00:00:00 2001 From: Kamil Rytarowski Date: Fri, 14 Nov 2014 17:55:36 + Subject: [PATCH 2/6] Add missing include for struct timespec (NetBSD) --- sysdef.h | 1 + 1 file changed, 1 insertion(+) diff --git a/sysdef.h b/sysdef.h index 3fde496..d51fe5b 100644 --- a/sysdef.h +++ b/sysdef.h @@ -20,6 +20,7 @@ #endif #if defined(__NetBSD__) +# include /* struct timespec */ # include "strtonum.h" /* OpenBSD specific function */ #endif -- 2.1.0 >From fb3b8c0f9350e0050de4ca72d60ba1a69d32bcba Mon Sep 17 00:00:00 2001 From: Kamil Rytarowski Date: Fri, 14 Nov 2014 18:06:05 + Subject: [PATCH 3/6] Fix const correctness in charcost usage --- tty.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tty.c b/tty.c index f803cc7..7a77ff0 100644 --- a/tty.c +++ b/tty.c @@ -35,7 +35,7 @@ #include -static int charcost(char *); +static int charcost(const char *); static int cci; static int insdel; /* Do we have both insert & delete line? */ @@ -438,7 +438,7 @@ fakec(int c) /* calculate the cost of doing string s */ static int -charcost(char *s) +charcost(const char *s) { cci = 0;