1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327
|
--- lookup-1.08b.orig/Makefile
+++ lookup-1.08b/Makefile
@@ -16,7 +16,7 @@ CC=gcc
CC_TRAD=$(CC) -traditional
## set to "gcc1", "gcc2" or leave blank
-gcc=gcc1
+gcc=gcc2
## selecte exactly "0" (no) or "1" (yes) for the following
optimize=0
@@ -34,7 +34,7 @@ md=0
## it out if that's the case and you don't have a traditional compiler
## around.
##
-COMPILE_WITH_TRAD=termset_trad.o
+#COMPILE_WITH_TRAD=termset_trad.o
RANLIB=/usr/bin/ranlib
@@ -154,19 +154,22 @@ lib/system.h: Makefile
echo '/* this file generated by Makefile */' > tmp;
-echo '#ifndef __SYSTEM_H__ /*file wrapper*/' >> tmp;
-echo '#define __SYSTEM_H__' >> tmp;
- if [ -f /usr/include/strings.h ]; then\
+ if echo '#include <strings.h>' | $(CC) -E - >/dev/null 2>&1; then\
echo '#define _HAVE_STRINGS_H_' >> tmp; \
else true; fi
- if [ -f /usr/include/sys/termio.h ]; then\
+ if echo '#include <sys/termio.h>' | $(CC) -E - >/dev/null 2>&1; then\
echo '#define _HAVE_SYS_TERMIO_H_' >> tmp; \
else true; fi
- if [ -f /usr/include/sys/stdtypes.h ]; then\
+ if echo '#include <termio.h>' | $(CC) -E - >/dev/null 2>&1; then\
+ echo '#define _HAVE_TERMIO_H_' >> tmp; \
+ else true; fi
+ if echo '#include <sys/stdtypes.h>' | $(CC) -E - >/dev/null 2>&1; then\
echo '#define _HAVE_SYS_STDTYPES_H_' >> tmp; \
else true; fi
- if [ -f /usr/include/sys/fcntl.h ]; then\
+ if echo '#include <sys/fcntl.h>' | $(CC) -E - >/dev/null 2>&1; then\
echo '#define _HAVE_SYS_FCNTL_H_' >> tmp; \
else true; fi
- if [ -f /usr/include/fcntl.h ]; then\
+ if echo '#include <fcntl.h>' | $(CC) -E - >/dev/null 2>&1; then\
echo '#define _HAVE_FCNTL_H_' >> tmp; \
else true; fi
-echo '#endif /* file wrapper */' >> tmp;
--- lookup-1.08b.orig/commands.c
+++ lookup-1.08b/commands.c
@@ -262,7 +262,7 @@ static int cmd_clear(void)
if (is_xterm == unchecked)
{
- extern const char *getenv(const char *);
+ /* extern const char *getenv(const char *); */
String *term = (String *)getenv("TERM");
if (term && (strNcmp(term, "kterm", 5) == 0 ||
strNcmp(term, "xterm", 5) == 0 ||
--- lookup-1.08b.orig/lib/config.h
+++ lookup-1.08b/lib/config.h
@@ -1,5 +1,10 @@
#ifndef __CONFIG_H__ /* file wrapper */
#define __CONFIG_H__
+
+#include <string.h>
+#include <stdlib.h>
+#include <unistd.h>
+
/*
* Jeffrey Friedl
* Omron Corporation Ęł
--- lookup-1.08b.orig/lib/input.c
+++ lookup-1.08b/lib/input.c
@@ -24,8 +24,6 @@
#include "assert.h"
#include "output.h"
#include "input.h"
-extern int errno;
-
static unsigned char input_buffer[INPUT_BUF_SIZE];
#define eptr (&input_buffer[INPUT_BUF_SIZE])
--- lookup-1.08b.orig/lib/jregex.c
+++ lookup-1.08b/lib/jregex.c
@@ -1896,14 +1896,18 @@ nibble_from_pattern(const unsigned char
/* we construct a character class specifier
which is the same and use that... */
int inverted = isupper(PAT[1]);
- unsigned char class[4];
- class[0] = '\\';
- class[1] = inverted ? tolower(PAT[1]) : PAT[1];
- class[2] = ']';
- class[3] = '\0';
+ unsigned char class[5];
+ int i = 0;
+ if (inverted) {
+ class[i++] = '^';
+ }
+ class[i++] = '\\';
+ class[i++] = inverted ? tolower(PAT[1]) : PAT[1];
+ class[i++] = ']';
+ class[i++] = '\0';
if (nab_class(new, class) == 0)
return 0;
- new->u.class->inverted = inverted;
+ /* new->u.class->inverted = inverted; */
new->min_match_len = 1;
PAT += 2; /* skip past \d, etc. */
goto allow_starplus; /* can have a +, *, or ? appended */
@@ -4049,7 +4053,10 @@ regexec(const regex_t *r, const unsigned
}
#endif
+#ifndef FAST_REGEXE
+/*
FASTDEBUGSTUFF(
+*/
if (special_debug) {
outputf("popping state #%ld (total %ld): [%.*s|%s] regex %d.\n",
state_count(),
@@ -4077,7 +4084,11 @@ regexec(const regex_t *r, const unsigned
#else
-1
#endif
- );)
+ );
+/*
+)
+*/
+#endif
}
else
{
--- lookup-1.08b.orig/lib/output.c
+++ lookup-1.08b/lib/output.c
@@ -12,6 +12,8 @@
#include "assert.h"
#include <stdarg.h>
#include <ctype.h>
+#include <errno.h>
+#include <stdio.h>
#include "input.h"
#include "output.h"
@@ -29,7 +31,7 @@ static unsigned char *nextout = &outbuf[
#define THREE_BYTE_HI 143
#define HALF_WIDTH_KATA_HI 142
-unsigned const char *jis_start_208 = (unsigned const char *)"\33$@";
+unsigned const char *jis_start_208 = (unsigned const char *)"\33$B";
unsigned const char *jis_start_212 = (unsigned const char *)"\33$(D";
unsigned const char *jis_start_ASCII = (unsigned const char *)"\33(B";
unsigned const char *jis_start_kana = (unsigned const char *)"\33(I";
@@ -754,8 +756,6 @@ vfcnprintf(unsigned (*function)(unsigned
case 'n': /* errno string */
case 'N': /* errno string */
{
- extern char *sys_errlist[];
- extern int errno, sys_nerr;
char temp_error_buff[20];
const char *str;
@@ -769,13 +769,7 @@ vfcnprintf(unsigned (*function)(unsigned
else
errval = errno;
- if (errval >= 0 && errval < sys_nerr)
- str = sys_errlist[errval];
- else
- {
- sprintf(temp_error_buff, "#%d", errval);
- str = temp_error_buff;
- }
+ str = strerror(errval);
}
if (format[-2] == '%')
@@ -899,7 +893,7 @@ __volatile__ void die(const char *fmt, .
#if PROVIDE_PAGER
-static unsigned (*_real_output_char_function)(unsigned char) = 0;
+unsigned (*_real_output_char_function)(unsigned char) = 0;
/*
* output_pager_status(0) turns off and reports previous state.
--- lookup-1.08b.orig/lib/termset.c
+++ lookup-1.08b/lib/termset.c
@@ -39,8 +39,13 @@
# ifdef _HAVE_SYS_TERMIO_H_
# include <sys/termio.h>
# else
-# include <sgtty.h>
-# endif
+# ifdef _HAVE_TERMIO_H_
+# include <termio.h>
+# define _HAVE_SYS_TERMIO_H_
+# else
+# include <sgtty.h>
+# endif /* _HAVE_TERMIO_H */
+# endif /* _HAVE_SYS_TERMIO_H */
#endif
/*
@@ -49,6 +54,8 @@
* of the header files. This is all very non-portable, but the best
* I can think of to automate this stuff....
*/
+#ifndef __alpha__
+/* DEBIAN: these tests will make gcc 3.3 fail on alpha/gnu linux */
#ifndef NO_COMPILE
# ifdef __STDC__
# ifdef _IO
@@ -66,6 +73,8 @@
# endif /* __STDC__ */
#endif
+#endif
+
#ifndef NO_COMPILE
# ifdef __STDC__
# define NO_ARGS void
--- lookup-1.08b.orig/lib/xmalloc.c
+++ lookup-1.08b/lib/xmalloc.c
@@ -1,18 +1,19 @@
#include "xmalloc.h"
-#undef xmalloc
+#include <stdio.h>
+#include <stdlib.h>
/*
* like malloc(), but dies if memory not available.
*/
-void *xmalloc(unsigned len)
+void *xmalloc(unsigned int len)
{
void *ptr;
- if (ptr = (void *)malloc(len), ptr == 0)
+ ptr = malloc(len);
+ if (ptr == NULL)
{
- #define MSG "<out of memory in malloc>\n"
- write(2, MSG, sizeof(MSG)-1);
- exit(3);
+ fprintf(stderr, "<out of memory in malloc>\n");
+ exit(3);
}
return ptr;
}
--- lookup-1.08b.orig/lookup.c
+++ lookup-1.08b/lookup.c
@@ -32,7 +32,7 @@ int UseNoMemIndex = 0;
const char *expand_filename_tilde(const char *filename)
{
- extern const char *getenv(const char *);
+ /* extern const char *getenv(const char *); */
String *home = (String*)getenv("HOME");
if (home == 0 || filename[0] != '~' || filename[1] != '/')
return filename;
@@ -77,7 +77,7 @@ static int in_command;
* Getline: get a line of user input.
*/
static __inline__ string *
-getline(String *prompt)
+mygetline(String *prompt)
{
#ifdef NOREADLINE
static string linebuf[200];
@@ -114,11 +114,17 @@ getline(String *prompt)
output_pager_reset_more();
line = readline(prompt); /* Get a line from the user. */
+#if 0
+fprintf(stdout, "OK readline:%s\n",line); /* nakahara */
+#endif
output_pager_reset_more();
#ifdef LOG_FILE_SUPPORT
if (current_log_file != 0) {
int normal_fd = set_normal_output_file(log_fd);
+#if 0
+fprintf(stdout, "OK outputf \n"); /* nakahara */
+#endif
outputf("%s%s\n", jreadline_last_prompt, line);
flush_output();
set_normal_output_file(normal_fd);
@@ -265,6 +271,9 @@ check_commandline_status(string *line, s
if (in_command != old_in_command)
{
+#if 0
+fprintf(stdout, "OK mod \n"); /* nakahara */
+#endif
(void)jreadline_mod_prompt(gen_prompt(lookup.prompt_format, 0));
return 1;
}
@@ -1464,6 +1473,7 @@ int main(int argc, const char *argv[])
GET_WINDOW_SIZE(0);
#endif
+fprintf(stdout, "start \n"); /* nakahara */
/* set some basic defaults */
lookup.flag.fuzz = 1;
lookup.flag.fold = 1;
@@ -1499,7 +1509,7 @@ int main(int argc, const char *argv[])
in_command = 0;
kibishii_assert(prompt_format);
- input = getline(gen_prompt(prompt_format, 1));
+ input = mygetline(gen_prompt(prompt_format, 1));
/* if they're pounding on the break key, let them eventually leave */
if (apply_regex_abort)
--- lookup-1.08b.orig/lookup.h
+++ lookup-1.08b/lookup.h
@@ -16,6 +16,8 @@
* close there, it's been stripped and you're screwed.
*/
+#include <string.h>
+
#ifndef MAX_LOADED_FILES
# define MAX_LOADED_FILES 10
#endif
|