Subject: Re: pkg_select upgrade
To: None <imil@home.imil.net>
From: Kibum Han <yui@yui.pe.kr>
List: tech-pkg
Date: 03/17/2005 15:17:40
Build failed on NetBSD/amd64.
--------------------
# compile pkg_select-20050315/ftpio.o
cc -O2 -g -g -I. -DPKGSRCBASE=\"/home/yui/pkgsrc/pkgsrc\" -DPKGDB=\"/var/db/pkg\" -DMAKE=\"/usr/bin/make\" -DCONFPATH=\"/usr/pkg/etc/pkg_select.conf\" -DMIRRORS=\"/usr/pkg/share/pkg_select\" -Wall -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith -Wno-sign-compare -Wno-traditional -Wno-uninitialized -Wreturn-type -Wswitch -Wshadow -Wcast-qual -Wwrite-strings -Werror -c ftpio.c
ftpio.c: In function `expect':
ftpio.c:353: warning: subscript has type `char'
*** Error code 1
Stop.
-------------------
I think we have two options.
Casting a variable to int in pkgselect source code or in ctype.h
Option #1 would be like this:
In ftpio.c file,
- if (ftprc && isdigit(buf[match.rm_so+1]))
+ if (ftprc && isdigit((int)buf[match.rm_so+1]))
And here is option #2:
In /usr/src/include/ctype.h file,
-#define isdigit(c) ((int)((_ctype_ + 1)[(c)] & _N))
+#define isdigit(c) ((int)((_ctype_ + 1)[(int)(c)] & _N))
IMHO, testing if it is digit or not should be working on a character type.
Am I thinking wrong?