Enlightenment CVS committal Author : mej Project : eterm Module : libast
Dir : eterm/libast/src Modified Files: avl_tree.c conf.c dlinked_list.c file.c linked_list.c obj.c objpair.c regexp.c socket.c str.c strings.c tok.c url.c Log Message: Tue Jul 20 18:30:54 2004 Michael Jennings (mej) Tasty treats! ---------------------------------------------------------------------- =================================================================== RCS file: /cvsroot/enlightenment/eterm/libast/src/avl_tree.c,v retrieving revision 1.10 retrieving revision 1.11 diff -u -3 -r1.10 -r1.11 --- avl_tree.c 1 Mar 2004 19:22:49 -0000 1.10 +++ avl_tree.c 20 Jul 2004 22:32:08 -0000 1.11 @@ -21,7 +21,7 @@ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -static const char cvs_ident[] = "$Id: avl_tree.c,v 1.10 2004/03/01 19:22:49 mej Exp $"; +static const char cvs_ident[] = "$Id: avl_tree.c,v 1.11 2004/07/20 22:32:08 mej Exp $"; #ifdef HAVE_CONFIG_H # include <config.h> @@ -164,7 +164,7 @@ static spif_str_t spif_avl_tree_node_show(spif_avl_tree_node_t self, spif_charptr_t name, spif_str_t buff, size_t indent) { - char tmp[4096]; + spif_char_t tmp[4096]; if (SPIF_AVL_TREE_NODE_ISNULL(self)) { SPIF_OBJ_SHOW_NULL(avl_tree_node, name, buff, indent, tmp); @@ -294,7 +294,7 @@ static spif_str_t spif_avl_tree_show(spif_avl_tree_t self, spif_charptr_t name, spif_str_t buff, size_t indent) { - char tmp[4096]; + spif_char_t tmp[4096]; if (SPIF_VECTOR_ISNULL(self)) { SPIF_OBJ_SHOW_NULL(avl_tree, name, buff, indent, tmp); =================================================================== RCS file: /cvsroot/enlightenment/eterm/libast/src/conf.c,v retrieving revision 1.22 retrieving revision 1.23 diff -u -3 -r1.22 -r1.23 --- conf.c 16 Jul 2004 23:22:18 -0000 1.22 +++ conf.c 20 Jul 2004 22:32:08 -0000 1.23 @@ -31,7 +31,7 @@ * @author Michael Jennings <[EMAIL PROTECTED]> */ -static const char cvs_ident[] = "$Id: conf.c,v 1.22 2004/07/16 23:22:18 mej Exp $"; +static const char cvs_ident[] = "$Id: conf.c,v 1.23 2004/07/20 22:32:08 mej Exp $"; #ifdef HAVE_CONFIG_H # include <config.h> @@ -41,16 +41,16 @@ static spifconf_var_t *spifconf_new_var(void); static void spifconf_free_var(spifconf_var_t *); -static char *spifconf_get_var(const char *); -static void spifconf_put_var(char *, char *); -static char *builtin_random(char *); -static char *builtin_exec(char *); -static char *builtin_get(char *); -static char *builtin_put(char *); -static char *builtin_dirscan(char *); -static char *builtin_version(char *); -static char *builtin_appname(char *); -static void *parse_null(char *, void *); +static spif_charptr_t spifconf_get_var(const spif_charptr_t); +static void spifconf_put_var(spif_charptr_t, spif_charptr_t); +static spif_charptr_t builtin_random(spif_charptr_t); +static spif_charptr_t builtin_exec(spif_charptr_t); +static spif_charptr_t builtin_get(spif_charptr_t); +static spif_charptr_t builtin_put(spif_charptr_t); +static spif_charptr_t builtin_dirscan(spif_charptr_t); +static spif_charptr_t builtin_version(spif_charptr_t); +static spif_charptr_t builtin_appname(spif_charptr_t); +static void *parse_null(spif_charptr_t, void *); static ctx_t *context; static ctx_state_t *ctx_state; @@ -75,7 +75,7 @@ ctx_idx = 0; context = (ctx_t *) MALLOC(sizeof(ctx_t) * ctx_cnt); MEMSET(context, 0, sizeof(ctx_t) * ctx_cnt); - context[0].name = STRDUP("null"); + context[0].name = SPIF_CAST(charptr) STRDUP("null"); context[0].handler = parse_null; /* Initialize the context state stack and set the current context to "null" */ @@ -108,12 +108,12 @@ /* Register a new config file context */ unsigned char -spifconf_register_context(char *name, ctx_handler_t handler) +spifconf_register_context(spif_charptr_t name, ctx_handler_t handler) { ASSERT_RVAL(!SPIF_PTR_ISNULL(name), SPIF_CAST_C(unsigned char) -1); ASSERT_RVAL(!SPIF_PTR_ISNULL(handler), SPIF_CAST_C(unsigned char) -1); - if (strcasecmp(name, "null")) { + if (strcasecmp(SPIF_CAST_C(char *) name, "null")) { if (++ctx_idx == ctx_cnt) { ctx_cnt *= 2; context = (ctx_t *) REALLOC(context, sizeof(ctx_t) * ctx_cnt); @@ -121,7 +121,7 @@ } else { FREE(context[0].name); } - context[ctx_idx].name = STRDUP(name); + context[ctx_idx].name = SPIF_CAST(charptr) STRDUP(name); context[ctx_idx].handler = handler; D_CONF(("Added context \"%s\" with ID %d and handler 0x%08x\n", context[ctx_idx].name, ctx_idx, context[ctx_idx].handler)); return (ctx_idx); @@ -129,7 +129,7 @@ /* Register a new file state structure */ unsigned char -spifconf_register_fstate(FILE * fp, char *path, char *outfile, unsigned long line, unsigned char flags) +spifconf_register_fstate(FILE * fp, spif_charptr_t path, spif_charptr_t outfile, unsigned long line, unsigned char flags) { ASSERT_RVAL(!SPIF_PTR_ISNULL(fp), SPIF_CAST_C(unsigned char) -1); ASSERT_RVAL(!SPIF_PTR_ISNULL(path), SPIF_CAST_C(unsigned char) -1); @@ -152,7 +152,7 @@ { ASSERT_RVAL(!SPIF_PTR_ISNULL(name), SPIF_CAST_C(unsigned char) -1); - builtins[builtin_idx].name = STRDUP(name); + builtins[builtin_idx].name = SPIF_CAST(charptr) STRDUP(name); builtins[builtin_idx].ptr = ptr; if (++builtin_idx == builtin_cnt) { builtin_cnt *= 2; @@ -220,15 +220,15 @@ FREE(v); } -static char * -spifconf_get_var(const char *var) +static spif_charptr_t +spifconf_get_var(const spif_charptr_t var) { spifconf_var_t *v; - ASSERT_RVAL(!SPIF_PTR_ISNULL(var), SPIF_NULL_TYPE_C(char *)); + ASSERT_RVAL(!SPIF_PTR_ISNULL(var), SPIF_NULL_TYPE_C(spif_charptr_t)); D_CONF(("var == \"%s\"\n", var)); for (v = spifconf_vars; v; v = v->next) { - if (!strcmp(v->var, var)) { + if (!strcmp(SPIF_CAST_C(char *) v->var, SPIF_CAST_C(char *) var)) { D_CONF(("Found it at %10p: \"%s\" == \"%s\"\n", v, v->var, v->value)); return (v->value); } @@ -238,7 +238,7 @@ } static void -spifconf_put_var(char *var, char *val) +spifconf_put_var(spif_charptr_t var, spif_charptr_t val) { spifconf_var_t *v, *loc = NULL, *tmp; @@ -248,7 +248,7 @@ for (v = spifconf_vars; v; loc = v, v = v->next) { int n; - n = strcmp(var, v->var); + n = strcmp(SPIF_CAST_C(char *) var, SPIF_CAST_C(char *) v->var); D_CONF(("Comparing at %10p: \"%s\" -> \"%s\", n == %d\n", v, v->var, v->value, n)); if (n == 0) { FREE(v->value); @@ -273,7 +273,9 @@ D_CONF(("Empty value given for non-existant variable \"%s\". Aborting.\n", var)); return; } - D_CONF(("Inserting new var/val pair between \"%s\" and \"%s\"\n", ((loc) ? loc->var : "-beginning-"), ((v) ? v->var : "-end-"))); + D_CONF(("Inserting new var/val pair between \"%s\" and \"%s\"\n", + ((loc) ? (loc->var) : (SPIF_CAST(charptr) "-beginning-")), + ((v) ? (v->var) : (SPIF_CAST(charptr) "-end-")))); tmp = spifconf_new_var(); if (loc == NULL) { tmp->next = spifconf_vars; @@ -286,13 +288,13 @@ tmp->value = val; } -static char * -builtin_random(char *param) +static spif_charptr_t +builtin_random(spif_charptr_t param) { unsigned long n, index; static unsigned int rseed = 0; - REQUIRE_RVAL(!SPIF_PTR_ISNULL(param), SPIF_NULL_TYPE_C(char *)); + REQUIRE_RVAL(!SPIF_PTR_ISNULL(param), SPIF_NULL_TYPE_C(spif_charptr_t)); D_PARSE(("builtin_random(%s) called\n", NONULL(param))); if (rseed == 0) { @@ -306,46 +308,50 @@ return (spiftool_get_word(index, param)); } -static char * -builtin_exec(char *param) +static spif_charptr_t +builtin_exec(spif_charptr_t param) { - unsigned long fsize; - char *Command, *Output = NULL; - char OutFile[256]; + spif_uint32_t fsize, maxlen; + spif_charptr_t Command, Output = NULL; + spif_char_t OutFile[256]; FILE *fp; int fd; - REQUIRE_RVAL(!SPIF_PTR_ISNULL(param), SPIF_NULL_TYPE_C(char *)); + REQUIRE_RVAL(!SPIF_PTR_ISNULL(param), SPIF_NULL_TYPE_C(spif_charptr_t)); D_PARSE(("builtin_exec(%s) called\n", NONULL(param))); - Command = (char *) MALLOC(CONFIG_BUFF); - strcpy(OutFile, "Eterm-exec-"); + Command = (spif_charptr_t) MALLOC(CONFIG_BUFF); + strcpy(SPIF_CAST_C(char *) OutFile, "Eterm-exec-"); fd = spiftool_temp_file(OutFile, sizeof(OutFile)); if ((fd < 0) || fchmod(fd, (S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH))) { libast_print_error("Unable to create unique temporary file for \"%s\" -- %s\n", param, strerror(errno)); - return ((char *) NULL); + return ((spif_charptr_t) NULL); } - if (strlen(param) + strlen(OutFile) + 8 > CONFIG_BUFF) { - libast_print_error("Parse error in file %s, line %lu: Cannot execute command, line too long\n", file_peek_path(), file_peek_line()); - return ((char *) NULL); - } - strcpy(Command, param); - strcat(Command, " >"); - strcat(Command, OutFile); - system(Command); + + maxlen = strlen(SPIF_CAST_C(char *) param) + strlen(SPIF_CAST_C(char *) OutFile) + 8; + if (maxlen > CONFIG_BUFF) { + libast_print_error("Parse error in file %s, line %lu: Cannot execute command, line too long\n", + file_peek_path(), file_peek_line()); + return ((spif_charptr_t) NULL); + } + strcpy(SPIF_CAST_C(char *) Command, SPIF_CAST_C(char *) param); + strcat(SPIF_CAST_C(char *) Command, " >"); + strcat(SPIF_CAST_C(char *) Command, SPIF_CAST_C(char *) OutFile); + system(SPIF_CAST_C(char *) Command); if ((fp = fdopen(fd, "rb")) != NULL) { fseek(fp, 0, SEEK_END); fsize = ftell(fp); rewind(fp); if (fsize) { - Output = (char *) MALLOC(fsize + 1); + Output = (spif_charptr_t) MALLOC(fsize + 1); fread(Output, fsize, 1, fp); Output[fsize] = 0; fclose(fp); - remove(OutFile); + remove(SPIF_CAST_C(char *) OutFile); Output = spiftool_condense_whitespace(Output); } else { - libast_print_warning("Command at line %lu of file %s returned no output.\n", file_peek_line(), file_peek_path()); + libast_print_warning("Command at line %lu of file %s returned no output.\n", + file_peek_line(), file_peek_path()); } } else { libast_print_warning("Output file %s could not be created. (line %lu of file %s)\n", NONULL(OutFile), file_peek_line(), file_peek_path()); @@ -355,10 +361,10 @@ return (Output); } -static char * -builtin_get(char *param) +static spif_charptr_t +builtin_get(spif_charptr_t param) { - char *s, *f, *v; + spif_charptr_t s, f, v; unsigned short n; if (!param || ((n = spiftool_num_words(param)) > 2)) { @@ -380,7 +386,7 @@ if (f) { FREE(f); } - return (STRDUP(v)); + return (SPIF_CAST(charptr) STRDUP(v)); } else if (f) { return f; } else { @@ -388,10 +394,10 @@ } } -static char * -builtin_put(char *param) +static spif_charptr_t +builtin_put(spif_charptr_t param) { - char *var, *val; + spif_charptr_t var, val; if (!param || (spiftool_num_words(param) != 2)) { libast_print_error("Parse error in file %s, line %lu: Invalid syntax for %put(). Syntax is: %put(variable value)\n", file_peek_path(), @@ -406,15 +412,15 @@ return NULL; } -static char * -builtin_dirscan(char *param) +static spif_charptr_t +builtin_dirscan(spif_charptr_t param) { int i; unsigned long n; DIR *dirp; struct dirent *dp; struct stat filestat; - char *dir, *buff; + spif_charptr_t dir, buff; if (!param || (spiftool_num_words(param) != 1)) { libast_print_error("Parse error in file %s, line %lu: Invalid syntax for %dirscan(). Syntax is: %dirscan(directory)\n", @@ -423,19 +429,19 @@ } D_PARSE(("builtin_dirscan(%s)\n", param)); dir = spiftool_get_word(1, param); - dirp = opendir(dir); + dirp = opendir(SPIF_CAST_C(char *) dir); if (!dirp) { return NULL; } - buff = (char *) MALLOC(CONFIG_BUFF); + buff = (spif_charptr_t) MALLOC(CONFIG_BUFF); *buff = 0; n = CONFIG_BUFF; for (i = 0; (dp = readdir(dirp)) != NULL;) { - char fullname[PATH_MAX]; + spif_char_t fullname[PATH_MAX]; - snprintf(fullname, sizeof(fullname), "%s/%s", dir, dp->d_name); - if (stat(fullname, &filestat)) { + snprintf(SPIF_CAST_C(char *) fullname, sizeof(fullname), "%s/%s", dir, dp->d_name); + if (stat(SPIF_CAST_C(char *) fullname, &filestat)) { D_PARSE((" -> Couldn't stat() file %s -- %s\n", fullname, strerror(errno))); } else { if (S_ISREG(filestat.st_mode)) { @@ -443,8 +449,8 @@ len = strlen(dp->d_name); if (len < n) { - strcat(buff, dp->d_name); - strcat(buff, " "); + strcat(SPIF_CAST_C(char *) buff, dp->d_name); + strcat(SPIF_CAST_C(char *) buff, " "); n -= len + 1; } } @@ -457,17 +463,17 @@ return buff; } -static char * -builtin_version(char *param) +static spif_charptr_t +builtin_version(spif_charptr_t param) { USE_VAR(param); D_PARSE(("builtin_version(%s) called\n", NONULL(param))); - return (STRDUP(libast_program_version)); + return (SPIF_CAST(charptr) STRDUP(libast_program_version)); } -static char * -builtin_appname(char *param) +static spif_charptr_t +builtin_appname(spif_charptr_t param) { char buff[256]; @@ -475,7 +481,7 @@ D_PARSE(("builtin_appname(%s) called\n", NONULL(param))); snprintf(buff, sizeof(buff), "%s-%s", libast_program_name, libast_program_version); - return (STRDUP(buff)); + return (SPIF_CAST(charptr) STRDUP(buff)); } /* spifconf_shell_expand() takes care of shell variable expansion, quote conventions, @@ -495,7 +501,7 @@ ASSERT_RVAL(s != NULL, SPIF_NULL_TYPE(charptr)); #if 0 - newbuff = (char *) MALLOC(CONFIG_BUFF); + newbuff = (spif_charptr_t) MALLOC(CONFIG_BUFF); #endif for (j = 0; *pbuff && j < max; pbuff++, j++) { @@ -553,8 +559,8 @@ D_CONF(("%% detected.\n")); for (k = 0, pbuff++; builtins[k].name != NULL; k++) { D_PARSE(("Checking for function %%%s, pbuff == \"%s\"\n", builtins[k].name, pbuff)); - l = strlen(builtins[k].name); - if (!strncasecmp(builtins[k].name, SPIF_CAST_C(char *) pbuff, l) + l = strlen(SPIF_CAST_C(char *) builtins[k].name); + if (!strncasecmp(SPIF_CAST_C(char *) builtins[k].name, SPIF_CAST_C(char *) pbuff, l) && ((pbuff[l] == '(') || (pbuff[l] == ' ' && pbuff[l + 1] == ')'))) { @@ -588,7 +594,7 @@ return SPIF_NULL_TYPE(charptr); } Command = spifconf_shell_expand(Command); - Output = SPIF_CAST(charptr) (builtins[k].ptr) (SPIF_CAST_C(char *) Command); + Output = SPIF_CAST(charptr) (builtins[k].ptr) (Command); FREE(Command); if (Output) { if (*Output) { @@ -618,7 +624,7 @@ ASSERT_RVAL(l < CONFIG_BUFF, NULL); Command[l] = 0; Command = spifconf_shell_expand(Command); - Output = SPIF_CAST(charptr) builtin_exec(SPIF_CAST_C(char *) Command); + Output = builtin_exec(Command); FREE(Command); if (Output) { if (*Output) { @@ -716,51 +722,52 @@ /* The config file reader. This looks for the config file by searching CONFIG_SEARCH_PATH. If it can't find a config file, it displays a warning but continues. -- mej */ -char * -spifconf_find_file(const char *file, const char *dir, const char *pathlist) +spif_charptr_t +spifconf_find_file(const spif_charptr_t file, const spif_charptr_t dir, const spif_charptr_t pathlist) { - - static char name[PATH_MAX], full_path[PATH_MAX]; - const char *path; - char *p; + static spif_char_t name[PATH_MAX], full_path[PATH_MAX]; + spif_charptr_t path, p; short maxpathlen; unsigned short len; struct stat fst; REQUIRE_RVAL(file != NULL, NULL); - getcwd(name, PATH_MAX); - D_CONF(("spifconf_find_file(\"%s\", \"%s\", \"%s\") called from directory \"%s\".\n", file, NONULL(dir), NONULL(pathlist), name)); + getcwd(SPIF_CAST_C(char *) name, PATH_MAX); + D_CONF(("spifconf_find_file(\"%s\", \"%s\", \"%s\") called from directory \"%s\".\n", + file, NONULL(dir), NONULL(pathlist), name)); if (dir) { - strcpy(name, dir); - strcat(name, "/"); - strcat(name, file); + strcpy(SPIF_CAST_C(char *) name, SPIF_CAST_C(char *) dir); + strcat(SPIF_CAST_C(char *) name, "/"); + strcat(SPIF_CAST_C(char *) name, SPIF_CAST_C(char *) file); } else { - strcpy(name, file); + strcpy(SPIF_CAST_C(char *) name, SPIF_CAST_C(char *) file); } - len = strlen(name); + len = strlen(SPIF_CAST_C(char *) name); D_CONF(("Checking for file \"%s\"\n", name)); - if ((!access(name, R_OK)) && (!stat(name, &fst)) && (!S_ISDIR(fst.st_mode))) { + if ((!access(SPIF_CAST_C(char *) name, R_OK)) + && (!stat(SPIF_CAST_C(char *) name, &fst)) + && (!S_ISDIR(fst.st_mode))) { D_CONF(("Found \"%s\"\n", name)); - return ((char *) name); + return ((spif_charptr_t) name); } /* maxpathlen is the longest possible path we can stuff into name[]. The - 2 saves room for an additional / and the trailing null. */ if ((maxpathlen = sizeof(name) - len - 2) <= 0) { D_CONF(("Too big. I lose. :(\n", name)); - return ((char *) NULL); + return ((spif_charptr_t) NULL); } for (path = pathlist; path != NULL && *path != '\0'; path = p) { short n; /* Calculate the length of the next directory in the path */ - if ((p = strchr(path, ':')) != NULL) { + if ((p = SPIF_CAST(charptr) strchr(SPIF_CAST_C(char *) path, ':')) != NULL) { n = p++ - path; } else { - n = strlen(path); + n = strlen(SPIF_CAST_C(char *) path); } /* Don't try if it's too long */ @@ -771,54 +778,73 @@ full_path[n++] = '/'; } full_path[n] = '\0'; - strcat(full_path, name); + strcat(SPIF_CAST_C(char *) full_path, SPIF_CAST_C(char *) name); D_CONF(("Checking for file \"%s\"\n", full_path)); - if ((!access(full_path, R_OK)) && (!stat(full_path, &fst)) && (!S_ISDIR(fst.st_mode))) { + if ((!access(SPIF_CAST_C(char *) full_path, R_OK)) + && (!stat(SPIF_CAST_C(char *) full_path, &fst)) + && (!S_ISDIR(fst.st_mode))) { D_CONF(("Found \"%s\"\n", full_path)); - return ((char *) full_path); + return ((spif_charptr_t) full_path); } } } D_CONF(("spifconf_find_file(): File \"%s\" not found in path.\n", name)); - return ((char *) NULL); + return ((spif_charptr_t) NULL); } FILE * -spifconf_open_file(char *name) +spifconf_open_file(spif_charptr_t name) { FILE *fp; spif_cmp_t ver; - char buff[256], test[30], *begin_ptr, *end_ptr; + spif_str_t ver_str; + spif_char_t buff[256], test[30]; + spif_charptr_t begin_ptr, end_ptr; + spif_stridx_t testlen; ASSERT_RVAL(name != NULL, NULL); - snprintf(test, sizeof(test), "<%s-", libast_program_name); - fp = fopen(name, "rt"); - if (fp != NULL) { - fgets(buff, 256, fp); - if (strncasecmp(buff, test, strlen(test))) { - libast_print_warning("%s exists but does not contain the proper magic string (<%s-%s>)\n", name, libast_program_name, - libast_program_version); - fclose(fp); - fp = NULL; - } else { - begin_ptr = strchr(buff, '-') + 1; - if ((end_ptr = strchr(buff, '>')) != NULL) { - *end_ptr = 0; - } - ver = spiftool_version_compare(begin_ptr, libast_program_version); - if (SPIF_CMP_IS_GREATER(ver)) { - libast_print_warning("Config file is designed for a newer version of %s\n", libast_program_name); - } - } + snprintf(SPIF_CAST_C(char *) test, sizeof(test), "<%s-", libast_program_name); + testlen = SPIF_CAST(stridx) strlen(SPIF_CAST_C(char *) test); + + /* Read first line from config file. Using spif_str_new_from_fp() would read the + * whole file, so we don't do that here. */ + fp = fopen(SPIF_CAST_C(char *) name, "rt"); + REQUIRE_RVAL(fp != NULL, NULL); + fgets(SPIF_CAST_C(char *) buff, 256, fp); + ver_str = spif_str_new_from_ptr(buff); + + /* Check for magic string. */ + if (spif_str_ncasecmp_with_ptr(ver_str, test, testlen)) { + libast_print_warning("%s exists but does not contain the proper magic string (<%s-%s>)\n", + name, libast_program_name, libast_program_version); + fclose(fp); + spif_str_del(ver_str); + return NULL; + } + + /* Check version number against current application version. */ + begin_ptr = SPIF_STR_STR(ver_str) + spif_str_index(ver_str, SPIF_CAST(char) '-') + 1; + end_ptr = SPIF_STR_STR(ver_str) + spif_str_index(ver_str, SPIF_CAST(char) '>'); + if (SPIF_PTR_ISNULL(end_ptr)) { + spiftool_safe_strncpy(buff, begin_ptr, sizeof(buff)); + } else { + testlen = MAX(SPIF_CAST_C(int) sizeof(buff), SPIF_CAST_C(int) (end_ptr - begin_ptr)); + spiftool_safe_strncpy(buff, begin_ptr, testlen); + } + ver = spiftool_version_compare(buff, libast_program_version); + if (SPIF_CMP_IS_GREATER(ver)) { + libast_print_warning("Config file is designed for a newer version of %s\n", + libast_program_name); } + spif_str_del(ver_str); return (fp); } #define SPIFCONF_PARSE_RET() do {if (!fp) {file_pop(); ctx_end();} return;} while (0) void -spifconf_parse_line(FILE * fp, char *buff) +spifconf_parse_line(FILE * fp, spif_charptr_t buff) { register unsigned long i = 0; unsigned char id; @@ -830,7 +856,7 @@ SPIFCONF_PARSE_RET(); } if (fp == NULL) { - file_push(NULL, "<argv>", NULL, 0, 0); + file_push(NULL, SPIF_CAST(charptr) "<argv>", NULL, 0, 0); ctx_begin(1); buff = spiftool_get_pword(2, buff); if (!buff) { @@ -846,7 +872,7 @@ SPIFCONF_PARSE_RET(); case '%': if (!BEG_STRCASECMP(spiftool_get_pword(1, buff + 1), "include ")) { - char *path; + spif_charptr_t path; FILE *fp; spifconf_shell_expand(SPIF_CAST(charptr) buff); @@ -858,18 +884,20 @@ file_push(fp, path, NULL, 1, 0); } } else if (!BEG_STRCASECMP(spiftool_get_pword(1, buff + 1), "preproc ")) { - char cmd[PATH_MAX], fname[PATH_MAX], *outfile; + spif_char_t cmd[PATH_MAX], fname[PATH_MAX]; + spif_charptr_t outfile; int fd; FILE *fp; if (file_peek_preproc()) { SPIFCONF_PARSE_RET(); } - strcpy(fname, "Eterm-preproc-"); + strcpy(SPIF_CAST_C(char *) fname, "Eterm-preproc-"); fd = spiftool_temp_file(fname, PATH_MAX); - outfile = STRDUP(fname); - snprintf(cmd, PATH_MAX, "%s < %s > %s", spiftool_get_pword(2, buff), file_peek_path(), fname); - system(cmd); + outfile = SPIF_CAST(charptr) STRDUP(fname); + snprintf(SPIF_CAST_C(char *) cmd, PATH_MAX, "%s < %s > %s", + spiftool_get_pword(2, buff), file_peek_path(), fname); + system(SPIF_CAST_C(char *) cmd); fp = fdopen(fd, "rt"); if (fp != NULL) { fclose(file_peek_fp()); @@ -894,7 +922,7 @@ } /* Intentional pass-through */ case 'e': - if (!BEG_STRCASECMP(buff, "end ") || !strcasecmp(buff, "end")) { + if (!BEG_STRCASECMP(buff, "end ") || !strcasecmp(SPIF_CAST_C(char *) buff, "end")) { ctx_end(); break; } @@ -911,25 +939,25 @@ #undef SPIFCONF_PARSE_RET -char * -spifconf_parse(char *conf_name, const char *dir, const char *path) +spif_charptr_t +spifconf_parse(spif_charptr_t conf_name, const spif_charptr_t dir, const spif_charptr_t path) { FILE *fp; - char *name = NULL, *p = "."; - char buff[CONFIG_BUFF], orig_dir[PATH_MAX]; + spif_charptr_t name = NULL, p = SPIF_CAST(charptr) "."; + spif_char_t buff[CONFIG_BUFF], orig_dir[PATH_MAX]; REQUIRE_RVAL(conf_name != NULL, 0); *orig_dir = 0; if (path) { if ((name = spifconf_find_file(conf_name, dir, path)) != NULL) { - if ((p = strrchr(name, '/')) != NULL) { - getcwd(orig_dir, PATH_MAX); + if ((p = SPIF_CAST(charptr) strrchr(SPIF_CAST_C(char *) name, '/')) != NULL) { + getcwd(SPIF_CAST_C(char *) orig_dir, PATH_MAX); *p = 0; p = name; - chdir(name); + chdir(SPIF_CAST_C(char *) name); } else { - p = "."; + p = SPIF_CAST(charptr) "."; } } else { return NULL; @@ -938,34 +966,37 @@ if ((fp = spifconf_open_file(conf_name)) == NULL) { return NULL; } - file_push(fp, conf_name, NULL, 1, 0); /* Line count starts at 1 because spifconf_open_file() parses the first line */ + /* Line count starts at 1 because spifconf_open_file() parses the first line. */ + file_push(fp, conf_name, NULL, 1, 0); for (; fstate_idx > 0;) { - for (; fgets(buff, CONFIG_BUFF, file_peek_fp());) { + for (; fgets(SPIF_CAST_C(char *) buff, CONFIG_BUFF, file_peek_fp());) { file_inc_line(); - if (!strchr(buff, '\n')) { - libast_print_error("Parse error in file %s, line %lu: line too long\n", file_peek_path(), file_peek_line()); - for (; fgets(buff, CONFIG_BUFF, file_peek_fp()) && !strrchr(buff, '\n');); + if (!strchr(SPIF_CAST_C(char *) buff, '\n')) { + libast_print_error("Parse error in file %s, line %lu: line too long\n", + file_peek_path(), file_peek_line()); + for (; fgets(SPIF_CAST_C(char *) buff, CONFIG_BUFF, file_peek_fp()) + && !strrchr(SPIF_CAST_C(char *) buff, '\n');); continue; } spifconf_parse_line(fp, buff); } fclose(file_peek_fp()); if (file_peek_preproc()) { - remove(file_peek_outfile()); + remove(SPIF_CAST_C(char *) file_peek_outfile()); FREE(file_peek_outfile()); } file_pop(); } if (*orig_dir) { - chdir(orig_dir); + chdir(SPIF_CAST_C(char *) orig_dir); } D_CONF(("Returning \"%s\"\n", p)); - return (STRDUP(p)); + return (SPIF_CAST(charptr) STRDUP(p)); } static void * -parse_null(char *buff, void *state) +parse_null(spif_charptr_t buff, void *state) { ASSERT_RVAL(!SPIF_PTR_ISNULL(buff), SPIF_NULL_TYPE(ptr)); if (*buff == SPIFCONF_BEGIN_CHAR) { @@ -1051,7 +1082,7 @@ * Context handlers defined by the client program must conform to the * following specification: * - Accept two parameters as follows: - * -# A char * containing the line of text to be parsed + * -# A spif_charptr_t containing the line of text to be parsed * -# A void * containing optional state information, or NULL * - Return a void * containing optional state information, or NULL * =================================================================== RCS file: /cvsroot/enlightenment/eterm/libast/src/dlinked_list.c,v retrieving revision 1.20 retrieving revision 1.21 diff -u -3 -r1.20 -r1.21 --- dlinked_list.c 10 Mar 2004 22:50:21 -0000 1.20 +++ dlinked_list.c 20 Jul 2004 22:32:08 -0000 1.21 @@ -21,7 +21,7 @@ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -static const char cvs_ident[] = "$Id: dlinked_list.c,v 1.20 2004/03/10 22:50:21 mej Exp $"; +static const char cvs_ident[] = "$Id: dlinked_list.c,v 1.21 2004/07/20 22:32:08 mej Exp $"; #ifdef HAVE_CONFIG_H # include <config.h> @@ -260,7 +260,7 @@ static spif_str_t spif_dlinked_list_item_show(spif_dlinked_list_item_t self, spif_charptr_t name, spif_str_t buff, size_t indent) { - char tmp[4096]; + spif_char_t tmp[4096]; if (SPIF_DLINKED_LIST_ITEM_ISNULL(self)) { SPIF_OBJ_SHOW_NULL(dlinked_list_item, name, buff, indent, tmp); @@ -268,15 +268,17 @@ } memset(tmp, ' ', indent); - snprintf(tmp + indent, sizeof(tmp) - indent, "(spif_dlinked_list_item_t) %s (%9p <- %9p -> %9p): ", - name, self->prev, self, self->next); + snprintf(SPIF_CAST_C(char *) tmp + indent, sizeof(tmp) - indent, + "(spif_dlinked_list_item_t) %s (%9p <- %9p -> %9p): ", + name, SPIF_CAST(ptr) self->prev, SPIF_CAST(ptr) self, + SPIF_CAST(ptr) self->next); if (SPIF_STR_ISNULL(buff)) { buff = spif_str_new_from_ptr(tmp); } else { - spif_str_append_from_ptr(buff, tmp); + spif_str_append_from_ptr(buff, SPIF_CAST(charptr) tmp); } if (SPIF_DLINKED_LIST_ITEM_ISNULL(self->data)) { - spif_str_append_from_ptr(buff, SPIF_NULLSTR_TYPE(obj)); + spif_str_append_from_ptr(buff, SPIF_CAST(charptr) SPIF_NULLSTR_TYPE(obj)); } else { buff = SPIF_OBJ_SHOW(self->data, buff, 0); } @@ -308,9 +310,9 @@ return SPIF_CLASS_VAR(dlinked_list_item)->classname; } -SPIF_DEFINE_PROPERTY_FUNC(dlinked_list_item, obj, data); -SPIF_DEFINE_PROPERTY_FUNC_NONOBJ(dlinked_list_item, dlinked_list_item, prev); -SPIF_DEFINE_PROPERTY_FUNC_NONOBJ(dlinked_list_item, dlinked_list_item, next); +SPIF_DEFINE_PROPERTY_FUNC(dlinked_list_item, obj, data) +SPIF_DEFINE_PROPERTY_FUNC_NONOBJ(dlinked_list_item, dlinked_list_item, prev) +SPIF_DEFINE_PROPERTY_FUNC_NONOBJ(dlinked_list_item, dlinked_list_item, next) static spif_dlinked_list_t @@ -421,7 +423,7 @@ static spif_str_t spif_dlinked_list_show(spif_dlinked_list_t self, spif_charptr_t name, spif_str_t buff, size_t indent) { - char tmp[4096]; + spif_char_t tmp[4096]; spif_dlinked_list_item_t current; spif_listidx_t i; @@ -431,7 +433,8 @@ } memset(tmp, ' ', indent); - snprintf(tmp + indent, sizeof(tmp) - indent, "(spif_dlinked_list_t) %s: %10p {\n", name, self); + snprintf(SPIF_CAST_C(char *) tmp + indent, sizeof(tmp) - indent, + "(spif_dlinked_list_t) %s: %10p {\n", name, SPIF_CAST(ptr) self); if (SPIF_STR_ISNULL(buff)) { buff = spif_str_new_from_ptr(tmp); } else { @@ -439,16 +442,16 @@ } if (SPIF_DLINKED_LIST_ITEM_ISNULL(self->head)) { - spif_str_append_from_ptr(buff, SPIF_NULLSTR_TYPE(obj)); + spif_str_append_from_ptr(buff, SPIF_CAST(charptr) SPIF_NULLSTR_TYPE(obj)); } else { for (current = self->head, i = 0; current; current = current->next, i++) { - sprintf(tmp, "item %d", i); + sprintf(SPIF_CAST_C(char *) tmp, "item %d", i); buff = spif_dlinked_list_item_show(current, tmp, buff, indent + 2); } } memset(tmp, ' ', indent); - snprintf(tmp + indent, sizeof(tmp) - indent, "}\n"); + snprintf(SPIF_CAST_C(char *) tmp + indent, sizeof(tmp) - indent, "}\n"); spif_str_append_from_ptr(buff, tmp); return buff; } @@ -1017,9 +1020,9 @@ return tmp; } -SPIF_DEFINE_PROPERTY_FUNC_NONOBJ(dlinked_list, listidx, len); -SPIF_DEFINE_PROPERTY_FUNC_NONOBJ(dlinked_list, dlinked_list_item, head); -SPIF_DEFINE_PROPERTY_FUNC_NONOBJ(dlinked_list, dlinked_list_item, tail); +SPIF_DEFINE_PROPERTY_FUNC_NONOBJ(dlinked_list, listidx, len) +SPIF_DEFINE_PROPERTY_FUNC_NONOBJ(dlinked_list, dlinked_list_item, head) +SPIF_DEFINE_PROPERTY_FUNC_NONOBJ(dlinked_list, dlinked_list_item, tail) static spif_dlinked_list_iterator_t @@ -1071,7 +1074,7 @@ static spif_str_t spif_dlinked_list_iterator_show(spif_dlinked_list_iterator_t self, spif_charptr_t name, spif_str_t buff, size_t indent) { - char tmp[4096]; + spif_char_t tmp[4096]; if (SPIF_ITERATOR_ISNULL(self)) { SPIF_OBJ_SHOW_NULL(iterator, name, buff, indent, tmp); @@ -1079,17 +1082,21 @@ } memset(tmp, ' ', indent); - snprintf(tmp + indent, sizeof(tmp) - indent, "(spif_dlinked_list_iterator_t) %s: %10p {\n", name, self); + snprintf(SPIF_CAST_C(char *) tmp + indent, sizeof(tmp) - indent, + "(spif_dlinked_list_iterator_t) %s: %10p {\n", name, + SPIF_CAST(ptr) self); if (SPIF_STR_ISNULL(buff)) { buff = spif_str_new_from_ptr(tmp); } else { spif_str_append_from_ptr(buff, tmp); } - buff = spif_dlinked_list_show(self->subject, "subject", buff, indent + 2); - buff = spif_dlinked_list_item_show(self->current, "current", buff, indent + 2); + buff = spif_dlinked_list_show(self->subject, SPIF_CAST(charptr) "subject", + buff, indent + 2); + buff = spif_dlinked_list_item_show(self->current, SPIF_CAST(charptr) "current", + buff, indent + 2); - snprintf(tmp + indent, sizeof(tmp) - indent, "}\n"); + snprintf(SPIF_CAST_C(char *) tmp + indent, sizeof(tmp) - indent, "}\n"); spif_str_append_from_ptr(buff, tmp); return buff; } @@ -1146,5 +1153,5 @@ return tmp; } -SPIF_DEFINE_PROPERTY_FUNC(dlinked_list_iterator, dlinked_list, subject); -SPIF_DEFINE_PROPERTY_FUNC_NONOBJ(dlinked_list_iterator, dlinked_list_item, current); +SPIF_DEFINE_PROPERTY_FUNC(dlinked_list_iterator, dlinked_list, subject) +SPIF_DEFINE_PROPERTY_FUNC_NONOBJ(dlinked_list_iterator, dlinked_list_item, current) =================================================================== RCS file: /cvsroot/enlightenment/eterm/libast/src/file.c,v retrieving revision 1.9 retrieving revision 1.10 diff -u -3 -r1.9 -r1.10 --- file.c 29 Jun 2004 21:18:08 -0000 1.9 +++ file.c 20 Jul 2004 22:32:08 -0000 1.10 @@ -28,11 +28,11 @@ * This file contains file-related functions. * * @author Michael Jennings <[EMAIL PROTECTED]> - * $Revision: 1.9 $ - * $Date: 2004/06/29 21:18:08 $ + * $Revision: 1.10 $ + * $Date: 2004/07/20 22:32:08 $ */ -static const char cvs_ident[] = "$Id: file.c,v 1.9 2004/06/29 21:18:08 mej Exp $"; +static const char cvs_ident[] = "$Id: file.c,v 1.10 2004/07/20 22:32:08 mej Exp $"; #ifdef HAVE_CONFIG_H # include <config.h> @@ -61,23 +61,26 @@ * @return The file descriptor for the new temp file. */ int -spiftool_temp_file(char *ftemplate, size_t len) +spiftool_temp_file(spif_charptr_t ftemplate, size_t len) { - char buff[256]; + spif_char_t buff[256]; int fd; mode_t m; ASSERT_RVAL(!SPIF_PTR_ISNULL(ftemplate), SPIF_CAST_C(int) -1); ASSERT_RVAL(len > 0, SPIF_CAST_C(int) -1); if (getenv("TMPDIR")) { - snprintf(buff, sizeof(buff), "%s/%sXXXXXX", getenv("TMPDIR"), ftemplate); + snprintf(SPIF_CAST_C(char *) buff, sizeof(buff), + "%s/%sXXXXXX", getenv("TMPDIR"), ftemplate); } else if (getenv("TMP")) { - snprintf(buff, sizeof(buff), "%s/%sXXXXXX", getenv("TMP"), ftemplate); + snprintf(SPIF_CAST_C(char *) buff, sizeof(buff), + "%s/%sXXXXXX", getenv("TMP"), ftemplate); } else { - snprintf(buff, sizeof(buff), "/tmp/%sXXXXXX", ftemplate); + snprintf(SPIF_CAST_C(char *) buff, sizeof(buff), + "/tmp/%sXXXXXX", ftemplate); } m = umask(0077); - fd = mkstemp(buff); + fd = mkstemp(SPIF_CAST_C(char *) buff); umask(m); if ((fd < 0) || fchmod(fd, (S_IRUSR | S_IWUSR))) { return (-1); =================================================================== RCS file: /cvsroot/enlightenment/eterm/libast/src/linked_list.c,v retrieving revision 1.23 retrieving revision 1.24 diff -u -3 -r1.23 -r1.24 --- linked_list.c 10 Mar 2004 22:07:31 -0000 1.23 +++ linked_list.c 20 Jul 2004 22:32:08 -0000 1.24 @@ -21,7 +21,7 @@ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -static const char cvs_ident[] = "$Id: linked_list.c,v 1.23 2004/03/10 22:07:31 mej Exp $"; +static const char cvs_ident[] = "$Id: linked_list.c,v 1.24 2004/07/20 22:32:08 mej Exp $"; #ifdef HAVE_CONFIG_H # include <config.h> @@ -256,7 +256,7 @@ static spif_str_t spif_linked_list_item_show(spif_linked_list_item_t self, spif_charptr_t name, spif_str_t buff, size_t indent) { - char tmp[4096]; + spif_char_t tmp[4096]; if (SPIF_LINKED_LIST_ITEM_ISNULL(self)) { SPIF_OBJ_SHOW_NULL(linked_list_item, name, buff, indent, tmp); @@ -421,7 +421,7 @@ static spif_str_t spif_linked_list_show(spif_linked_list_t self, spif_charptr_t name, spif_str_t buff, size_t indent) { - char tmp[4096]; + spif_char_t tmp[4096]; spif_linked_list_item_t current; spif_listidx_t i; @@ -1013,7 +1013,7 @@ static spif_str_t spif_linked_list_iterator_show(spif_linked_list_iterator_t self, spif_charptr_t name, spif_str_t buff, size_t indent) { - char tmp[4096]; + spif_char_t tmp[4096]; if (SPIF_ITERATOR_ISNULL(self)) { SPIF_OBJ_SHOW_NULL(iterator, name, buff, indent, tmp); =================================================================== RCS file: /cvsroot/enlightenment/eterm/libast/src/obj.c,v retrieving revision 1.24 retrieving revision 1.25 diff -u -3 -r1.24 -r1.25 --- obj.c 2 Feb 2004 22:21:22 -0000 1.24 +++ obj.c 20 Jul 2004 22:32:08 -0000 1.25 @@ -28,11 +28,11 @@ * This file contains the basic object class. * * @author Michael Jennings <[EMAIL PROTECTED]> - * $Revision: 1.24 $ - * $Date: 2004/02/02 22:21:22 $ + * $Revision: 1.25 $ + * $Date: 2004/07/20 22:32:08 $ */ -static const char cvs_ident[] = "$Id: obj.c,v 1.24 2004/02/02 22:21:22 mej Exp $"; +static const char cvs_ident[] = "$Id: obj.c,v 1.25 2004/07/20 22:32:08 mej Exp $"; #ifdef HAVE_CONFIG_H # include <config.h> @@ -241,7 +241,7 @@ spif_str_t spif_obj_show(spif_obj_t self, spif_charptr_t name, spif_str_t buff, size_t indent) { - char tmp[4096]; + spif_char_t tmp[4096]; if (SPIF_OBJ_ISNULL(self)) { SPIF_OBJ_SHOW_NULL(obj, name, buff, indent, tmp); =================================================================== RCS file: /cvsroot/enlightenment/eterm/libast/src/objpair.c,v retrieving revision 1.7 retrieving revision 1.8 diff -u -3 -r1.7 -r1.8 --- objpair.c 2 Mar 2004 02:16:00 -0000 1.7 +++ objpair.c 20 Jul 2004 22:32:08 -0000 1.8 @@ -28,11 +28,11 @@ * This file contains the objpair class. * * @author Michael Jennings <[EMAIL PROTECTED]> - * $Revision: 1.7 $ - * $Date: 2004/03/02 02:16:00 $ + * $Revision: 1.8 $ + * $Date: 2004/07/20 22:32:08 $ */ -static const char cvs_ident[] = "$Id: objpair.c,v 1.7 2004/03/02 02:16:00 mej Exp $"; +static const char cvs_ident[] = "$Id: objpair.c,v 1.8 2004/07/20 22:32:08 mej Exp $"; #ifdef HAVE_CONFIG_H # include <config.h> @@ -367,7 +367,7 @@ spif_str_t spif_objpair_show(spif_objpair_t self, spif_charptr_t name, spif_str_t buff, size_t indent) { - char tmp[4096]; + spif_char_t tmp[4096]; if (SPIF_OBJPAIR_ISNULL(self)) { SPIF_OBJ_SHOW_NULL(objpair, name, buff, indent, tmp); =================================================================== RCS file: /cvsroot/enlightenment/eterm/libast/src/regexp.c,v retrieving revision 1.12 retrieving revision 1.13 diff -u -3 -r1.12 -r1.13 --- regexp.c 3 Feb 2004 23:16:59 -0000 1.12 +++ regexp.c 20 Jul 2004 22:32:08 -0000 1.13 @@ -21,7 +21,7 @@ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -static const char cvs_ident[] = "$Id: regexp.c,v 1.12 2004/02/03 23:16:59 mej Exp $"; +static const char cvs_ident[] = "$Id: regexp.c,v 1.13 2004/07/20 22:32:08 mej Exp $"; #ifdef HAVE_CONFIG_H # include <config.h> @@ -146,7 +146,7 @@ spif_str_t spif_regexp_show(spif_regexp_t self, spif_charptr_t name, spif_str_t buff, size_t indent) { - char tmp[4096]; + spif_char_t tmp[4096]; if (SPIF_REGEXP_ISNULL(self)) { SPIF_OBJ_SHOW_NULL(regexp, name, buff, indent, tmp); =================================================================== RCS file: /cvsroot/enlightenment/eterm/libast/src/socket.c,v retrieving revision 1.20 retrieving revision 1.21 diff -u -3 -r1.20 -r1.21 --- socket.c 29 Jun 2004 18:32:20 -0000 1.20 +++ socket.c 20 Jul 2004 22:32:08 -0000 1.21 @@ -21,7 +21,7 @@ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -static const char cvs_ident[] = "$Id: socket.c,v 1.20 2004/06/29 18:32:20 mej Exp $"; +static const char cvs_ident[] = "$Id: socket.c,v 1.21 2004/07/20 22:32:08 mej Exp $"; #ifdef HAVE_CONFIG_H # include <config.h> @@ -162,7 +162,7 @@ spif_str_t spif_socket_show(spif_socket_t self, spif_charptr_t name, spif_str_t buff, size_t indent) { - char tmp[4096]; + spif_char_t tmp[4096]; if (SPIF_SOCKET_ISNULL(self)) { SPIF_OBJ_SHOW_NULL(socket, name, buff, indent, tmp); =================================================================== RCS file: /cvsroot/enlightenment/eterm/libast/src/str.c,v retrieving revision 1.29 retrieving revision 1.30 diff -u -3 -r1.29 -r1.30 --- str.c 10 Mar 2004 22:07:31 -0000 1.29 +++ str.c 20 Jul 2004 22:32:08 -0000 1.30 @@ -21,7 +21,7 @@ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -static const char cvs_ident[] = "$Id: str.c,v 1.29 2004/03/10 22:07:31 mej Exp $"; +static const char cvs_ident[] = "$Id: str.c,v 1.30 2004/07/20 22:32:08 mej Exp $"; #ifdef HAVE_CONFIG_H # include <config.h> @@ -273,7 +273,7 @@ spif_str_t spif_str_show(spif_str_t self, spif_charptr_t name, spif_str_t buff, size_t indent) { - char tmp[4096]; + spif_char_t tmp[4096]; if (SPIF_STR_ISNULL(self)) { SPIF_OBJ_SHOW_NULL(str, name, buff, indent, tmp); =================================================================== RCS file: /cvsroot/enlightenment/eterm/libast/src/strings.c,v retrieving revision 1.21 retrieving revision 1.22 diff -u -3 -r1.21 -r1.22 --- strings.c 16 Jul 2004 23:22:18 -0000 1.21 +++ strings.c 20 Jul 2004 22:32:08 -0000 1.22 @@ -30,7 +30,7 @@ * @author Michael Jennings <[EMAIL PROTECTED]> */ -static const char cvs_ident[] = "$Id: strings.c,v 1.21 2004/07/16 23:22:18 mej Exp $"; +static const char cvs_ident[] = "$Id: strings.c,v 1.22 2004/07/20 22:32:08 mej Exp $"; #ifdef HAVE_CONFIG_H # include <config.h> @@ -313,7 +313,7 @@ * Thread-safe way to compare a string to a regular expression. */ spif_bool_t -spiftool_regexp_match_r(register const char *str, register const char *pattern, register regex_t **rexp) +spiftool_regexp_match_r(register const spif_charptr_t str, register const spif_charptr_t pattern, register regex_t **rexp) { register int result; char errbuf[256]; @@ -345,21 +345,21 @@ #define IS_DELIM(c) ((delim != NULL) ? (strchr(delim, (c)) != NULL) : (isspace(c))) #define IS_QUOTE(c) (quote && quote == (c)) -char ** -spiftool_split(const char *delim, const char *str) +spif_charptr_t * +spiftool_split(const spif_charptr_t delim, const spif_charptr_t str) { - char **slist; - register const char *pstr; - register char *pdest; + spif_charptr_t *slist; + register const spif_charptr_t pstr; + register spif_charptr_t pdest; char quote = 0; unsigned short cnt = 0; unsigned long len; - REQUIRE_RVAL(str != NULL, (char **) NULL); + REQUIRE_RVAL(str != NULL, (spif_charptr_t *) NULL); - if ((slist = (char **) MALLOC(sizeof(char *))) == NULL) { + if ((slist = (spif_charptr_t *) MALLOC(sizeofSPIF_CAST(charptr))) == NULL) { libast_print_error("split(): Unable to allocate memory -- %s\n", strerror(errno)); - return ((char **) NULL); + return ((spif_charptr_t *) NULL); } /* Before we do anything, skip leading "whitespace." */ @@ -370,17 +370,17 @@ for (; *pstr; cnt++) { /* First, resize the list to two bigger than our count. Why two? One for the string we're about to do, and one for a trailing NULL. */ - if ((slist = (char **) REALLOC(slist, sizeof(char *) * (cnt + 2))) == NULL) { + if ((slist = (spif_charptr_t *) REALLOC(slist, sizeofSPIF_CAST(charptr) * (cnt + 2))) == NULL) { libast_print_error("split(): Unable to allocate memory -- %s\n", strerror(errno)); - return ((char **) NULL); + return ((spif_charptr_t *) NULL); } /* The string we're about to create can't possibly be larger than the remainder of the string we have yet to parse, so allocate that much space to start. */ len = strlen(pstr) + 1; - if ((slist[cnt] = (char *) MALLOC(len)) == NULL) { + if ((slist[cnt] = SPIF_CAST(charptr) MALLOC(len)) == NULL) { libast_print_error("split(): Unable to allocate memory -- %s.\n", strerror(errno)); - return ((char **) NULL); + return ((spif_charptr_t *) NULL); } pdest = slist[cnt]; @@ -414,7 +414,7 @@ /* Reallocate the new string to be just the right size. */ len = strlen(slist[cnt]) + 1; - slist[cnt] = (char *) REALLOC(slist[cnt], len); + slist[cnt] = SPIF_CAST(charptr) REALLOC(slist[cnt], len); /* Move past any trailing "whitespace." */ for (; *pstr && IS_DELIM(*pstr); pstr++); @@ -428,20 +428,20 @@ } } -char ** -spiftool_split_regexp(const char *regexp, const char *str) +spif_charptr_t * +spiftool_split_regexp(const spif_charptr_t regexp, const spif_charptr_t str) { USE_VAR(regexp); USE_VAR(str); return (NULL); } -char * -spiftool_join(const char *sep, char **slist) +spif_charptr_t +spiftool_join(const spif_charptr_t sep, spif_charptr_t *slist) { register unsigned long i; size_t len, slen; - char *new_str; + spif_charptr_t new_str; ASSERT_RVAL(slist != SPIF_NULL_TYPE(ptr), SPIF_NULL_TYPE(ptr)); if (sep == NULL) { @@ -452,7 +452,7 @@ len += strlen(slist[i]); } len += slen * (i - 1); - new_str = (char *) MALLOC(len); + new_str = SPIF_CAST(charptr) MALLOC(len); strcpy(new_str, slist[0]); for (i = 1; slist[i]; i++) { if (slen) { @@ -467,18 +467,18 @@ #undef IS_DELIM #define IS_DELIM(c) (delim ? ((c) == delim) : isspace(c)) -char * -spiftool_get_word(unsigned long index, const char *str) +spif_charptr_t +spiftool_get_word(unsigned long index, const spif_charptr_t str) { - char *tmpstr; + spif_charptr_t tmpstr; char delim = 0; register unsigned long i, j, k; ASSERT_RVAL(str != SPIF_NULL_TYPE(ptr), SPIF_NULL_TYPE(ptr)); k = strlen(str) + 1; - if ((tmpstr = (char *) MALLOC(k)) == NULL) { + if ((tmpstr = SPIF_CAST(charptr) MALLOC(k)) == NULL) { libast_print_error("get_word(%lu, %s): Unable to allocate memory -- %s.\n", index, str, strerror(errno)); - return ((char *) NULL); + return (SPIF_CAST(charptr) NULL); } *tmpstr = 0; for (i = 0, j = 0; j < index && str[i]; j++) { @@ -515,19 +515,19 @@ if (j != index) { FREE(tmpstr); D_STRINGS(("get_word(%lu, %s) returning NULL.\n", index, str)); - return ((char *) NULL); + return (SPIF_CAST(charptr) NULL); } else { - tmpstr = (char *) REALLOC(tmpstr, strlen(tmpstr) + 1); + tmpstr = SPIF_CAST(charptr) REALLOC(tmpstr, strlen(tmpstr) + 1); D_STRINGS(("get_word(%lu, %s) returning \"%s\".\n", index, str, tmpstr)); return (tmpstr); } } /* Return pointer into str to index-th word in str. "..." counts as 1 word. */ -char * -spiftool_get_pword(unsigned long index, const char *str) +spif_charptr_t +spiftool_get_pword(unsigned long index, const spif_charptr_t str) { - register const char *tmpstr = str; + register const spif_charptr_t tmpstr = str; register unsigned long j; ASSERT_RVAL(str != SPIF_NULL_TYPE(ptr), SPIF_NULL_TYPE(ptr)); @@ -542,16 +542,16 @@ } if (*tmpstr == '\0') { D_STRINGS(("get_pword(%lu, %s) returning NULL.\n", index, str)); - return ((char *) NULL); + return (SPIF_CAST(charptr) NULL); } else { D_STRINGS(("get_pword(%lu, %s) returning \"%s\"\n", index, str, tmpstr)); - return (char *) tmpstr; + return SPIF_CAST(charptr) tmpstr; } } /* Returns the number of words in str, for use with get_word() and get_pword(). "..." counts as 1 word. */ unsigned long -spiftool_num_words(const char *str) +spiftool_num_words(const spif_charptr_t str) { register unsigned long cnt = 0; char delim = 0; @@ -587,10 +587,10 @@ } /* chomp() removes leading and trailing whitespace from a string */ -char * -spiftool_chomp(char *s) +spif_charptr_t +spiftool_chomp(spif_charptr_t s) { - register char *front, *back; + register spif_charptr_t front, *back; ASSERT_RVAL(s != NULL, NULL); for (front = s; *front && isspace(*front); front++); @@ -603,8 +603,8 @@ return (s); } -char * -spiftool_strip_whitespace(register char *str) +spif_charptr_t +spiftool_strip_whitespace(register spif_charptr_t str) { register unsigned long i, j; @@ -619,10 +619,10 @@ return (str); } -char * -spiftool_downcase_str(char *str) +spif_charptr_t +spiftool_downcase_str(spif_charptr_t str) { - register char *tmp; + register spif_charptr_t tmp; ASSERT_RVAL(str != SPIF_NULL_TYPE(ptr), SPIF_NULL_TYPE(ptr)); for (tmp = str; *tmp; tmp++) { @@ -632,10 +632,10 @@ return (str); } -char * -spiftool_upcase_str(char *str) +spif_charptr_t +spiftool_upcase_str(spif_charptr_t str) { - register char *tmp; + register spif_charptr_t tmp; ASSERT_RVAL(str != SPIF_NULL_TYPE(ptr), SPIF_NULL_TYPE(ptr)); for (tmp = str; *tmp; tmp++) { @@ -645,12 +645,12 @@ return (str); } -char * -spiftool_condense_whitespace(char *s) +spif_charptr_t +spiftool_condense_whitespace(spif_charptr_t s) { register unsigned char gotspc = 0; - register char *pbuff = s, *pbuff2 = s; + register spif_charptr_t pbuff = s, *pbuff2 = s; ASSERT_RVAL(s != SPIF_NULL_TYPE(ptr), SPIF_NULL_TYPE(ptr)); D_STRINGS(("condense_whitespace(%s) called.\n", s)); @@ -671,11 +671,11 @@ pbuff--; *pbuff = 0; D_STRINGS(("condense_whitespace() returning \"%s\".\n", s)); - return ((char *) REALLOC(s, strlen(s) + 1)); + return (SPIF_CAST(charptr) REALLOC(s, strlen(s) + 1)); } -char * -spiftool_safe_str(register char *str, unsigned short len) +spif_charptr_t +spiftool_safe_str(register spif_charptr_t str, unsigned short len) { register unsigned short i; @@ -693,7 +693,7 @@ spiftool_hex_dump(void *buff, register size_t count) { register unsigned long j, k, l; - register unsigned char *ptr; + register unsigned spif_charptr_t ptr; unsigned char buffr[9]; ASSERT(buff != SPIF_NULL_TYPE(ptr)); @@ -710,7 +710,7 @@ for (; k < 8; k++) { fprintf(stderr, " "); } - fprintf(stderr, "| %-8s\n", spiftool_safe_str((char *) buffr, l)); + fprintf(stderr, "| %-8s\n", spiftool_safe_str(SPIF_CAST(charptr) buffr, l)); } } @@ -718,7 +718,7 @@ || (isdigit(a) && isdigit(b)) \ || (!isalnum(a) && !isalnum(b))) spif_cmp_t -spiftool_version_compare(const char *v1, const char *v2) +spiftool_version_compare(const spif_charptr_t v1, const spif_charptr_t v2) { char buff1[128], buff2[128]; @@ -726,7 +726,7 @@ for (; *v1 && *v2; ) { if (isalpha(*v1) && isalpha(*v2)) { - char *p1 = buff1, *p2 = buff2; + spif_charptr_t p1 = buff1, p2 = buff2; spif_int8_t ival1 = 6, ival2 = 6; /* Compare words. First, copy each word into buffers. */ @@ -773,7 +773,7 @@ } } } else if (isdigit(*v1) && isdigit(*v2)) { - char *p1 = buff1, *p2 = buff2; + spif_charptr_t p1 = buff1, p2 = buff2; spif_int32_t ival1, ival2; spif_cmp_t c; @@ -792,7 +792,7 @@ return c; } } else if (!isalnum(*v1) && !isalnum(*v2)) { - char *p1 = buff1, *p2 = buff2; + spif_charptr_t p1 = buff1, p2 = buff2; spif_cmp_t c; /* Compare non-alphanumeric strings. */ =================================================================== RCS file: /cvsroot/enlightenment/eterm/libast/src/tok.c,v retrieving revision 1.20 retrieving revision 1.21 diff -u -3 -r1.20 -r1.21 --- tok.c 2 Feb 2004 22:21:22 -0000 1.20 +++ tok.c 20 Jul 2004 22:32:08 -0000 1.21 @@ -21,7 +21,7 @@ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -static const char cvs_ident[] = "$Id: tok.c,v 1.20 2004/02/02 22:21:22 mej Exp $"; +static const char cvs_ident[] = "$Id: tok.c,v 1.21 2004/07/20 22:32:08 mej Exp $"; #ifdef HAVE_CONFIG_H # include <config.h> @@ -204,7 +204,7 @@ spif_str_t spif_tok_show(spif_tok_t self, spif_charptr_t name, spif_str_t buff, size_t indent) { - char tmp[4096]; + spif_char_t tmp[4096]; if (SPIF_TOK_ISNULL(self)) { SPIF_OBJ_SHOW_NULL(tok, name, buff, indent, tmp); =================================================================== RCS file: /cvsroot/enlightenment/eterm/libast/src/url.c,v retrieving revision 1.18 retrieving revision 1.19 diff -u -3 -r1.18 -r1.19 --- url.c 5 Feb 2004 21:29:38 -0000 1.18 +++ url.c 20 Jul 2004 22:32:08 -0000 1.19 @@ -21,7 +21,7 @@ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -static const char cvs_ident[] = "$Id: url.c,v 1.18 2004/02/05 21:29:38 mej Exp $"; +static const char cvs_ident[] = "$Id: url.c,v 1.19 2004/07/20 22:32:08 mej Exp $"; #ifdef HAVE_CONFIG_H # include <config.h> @@ -189,7 +189,7 @@ spif_str_t spif_url_show(spif_url_t self, spif_charptr_t name, spif_str_t buff, size_t indent) { - char tmp[4096]; + spif_char_t tmp[4096]; if (SPIF_URL_ISNULL(self)) { SPIF_OBJ_SHOW_NULL(url, name, buff, indent, tmp); ------------------------------------------------------- This SF.Net email is sponsored by BEA Weblogic Workshop FREE Java Enterprise J2EE developer tools! Get your free copy of BEA WebLogic Workshop 8.1 today. http://ads.osdn.com/?ad_id=4721&alloc_id=10040&op=click _______________________________________________ enlightenment-cvs mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs