-/* $Id: chars.c,v 1.22 2010/07/17 09:21:39 kristaps Exp $ */
+/* $Id: chars.c,v 1.25 2010/07/31 23:52:58 schwarze Exp $ */
/*
- * Copyright (c) 2009 Kristaps Dzonsons <kristaps@bsd.lv>
+ * Copyright (c) 2009, 2010 Kristaps Dzonsons <kristaps@bsd.lv>
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
struct ln *next;
const char *code;
const char *ascii;
- size_t asciisz;
int unicode;
int type;
#define CHARS_CHAR (1 << 0)
#define LINES_MAX 370
-#define CHAR(in, ch, chsz, code) \
- { NULL, (in), (ch), (chsz), (code), CHARS_CHAR },
-#define STRING(in, ch, chsz, code) \
- { NULL, (in), (ch), (chsz), (code), CHARS_STRING },
-#define BOTH(in, ch, chsz, code) \
- { NULL, (in), (ch), (chsz), (code), CHARS_BOTH },
+#define CHAR(in, ch, code) \
+ { NULL, (in), (ch), (code), CHARS_CHAR },
+#define STRING(in, ch, code) \
+ { NULL, (in), (ch), (code), CHARS_STRING },
+#define BOTH(in, ch, code) \
+ { NULL, (in), (ch), (code), CHARS_BOTH },
#define CHAR_TBL_START static struct ln lines[LINES_MAX] = {
#define CHAR_TBL_END };
if (NULL == ln)
return(NULL);
- *rsz = ln->asciisz;
+ *rsz = strlen(ln->ascii);
return(ln->ascii);
}
if (NULL == ln)
return(NULL);
- *rsz = ln->asciisz;
+ *rsz = strlen(ln->ascii);
return(ln->ascii);
}
int hash;
assert(p);
- assert(sz > 0);
+ if (0 == sz)
+ return(NULL);
if (p[0] < PRINT_LO || p[0] > PRINT_HI)
return(NULL);