From: Ben Pfaff Date: Sun, 16 Apr 2006 23:43:48 +0000 (+0000) Subject: Renamed some file name functions. X-Git-Tag: v0.6.0~979 X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d9bca7edf0d4a024ca930d1e34e08a3b4d54a6c7;p=pspp-builds.git Renamed some file name functions. --- diff --git a/src/data/ChangeLog b/src/data/ChangeLog index 4f9fd6ee..c453f178 100644 --- a/src/data/ChangeLog +++ b/src/data/ChangeLog @@ -1,3 +1,12 @@ +Sun Apr 16 16:42:47 2006 Ben Pfaff + + * filename.c: (fn_dirname) Renamed fn_dir_name(), all references + updated. + (fn_basename) Removed (dead code). + (fn_absolute_p) Renamed fn_is_absolute(), all references updated. + (fn_special_p) Renamed fn_is_special(), all references updated. + (fn_exists_p) Renamed fn_exists(), all references updated. + Sun Apr 16 16:33:58 2006 Ben Pfaff * filename.c: (fn_tilde_expand) Rewrite for cleaner code. diff --git a/src/data/filename.c b/src/data/filename.c index 49896352..2a0dd947 100644 --- a/src/data/filename.c +++ b/src/data/filename.c @@ -221,7 +221,7 @@ fn_search_path (const char *base_name, const char *path_, const char *prefix) struct string file = DS_INITIALIZER; size_t save_idx = 0; - if (fn_absolute_p (base_name)) + if (fn_is_absolute (base_name)) return fn_tilde_expand (base_name); /* Interpolate environment variables. */ @@ -242,7 +242,7 @@ fn_search_path (const char *base_name, const char *path_, const char *prefix) /* Construct file name. */ ds_clear (&file); - if (prefix != NULL && !fn_absolute_p (ds_c_str (&dir))) + if (prefix != NULL && !fn_is_absolute (ds_c_str (&dir))) { ds_puts (&file, prefix); ds_putc (&file, DIR_SEPARATOR); @@ -253,7 +253,7 @@ fn_search_path (const char *base_name, const char *path_, const char *prefix) ds_puts (&file, base_name); /* Check whether file exists. */ - if (fn_exists_p (ds_c_str (&file))) + if (fn_exists (ds_c_str (&file))) { verbose_msg (2, _("...found \"%s\""), ds_c_str (&file)); ds_destroy (&path); @@ -283,7 +283,7 @@ fn_normalize (const char *filename) char *fn1, *fn2, *dest; int maxlen; - if (fn_special_p (filename)) + if (fn_is_special (filename)) return xstrdup (filename); fn1 = fn_tilde_expand (filename); @@ -450,7 +450,7 @@ fn_normalize (const char *fn) /* Returns the directory part of FILENAME, as a malloc()'d string. */ char * -fn_dirname (const char *filename) +fn_dir_name (const char *filename) { const char *p; char *s; @@ -473,16 +473,6 @@ fn_dirname (const char *filename) return s; } -/* Returns the basename part of FILENAME as a malloc()'d string. */ -#if 0 -char * -fn_basename (const char *filename) -{ - /* Not used, not implemented. */ - abort (); -} -#endif - /* Returns the extension part of FILENAME as a malloc()'d string. If FILENAME does not have an extension, returns an empty string. */ @@ -536,7 +526,7 @@ fn_get_cwd (void) /* Returns nonzero iff NAME specifies an absolute filename. */ int -fn_absolute_p (const char *name) +fn_is_absolute (const char *name) { #ifdef unix if (name[0] == '/' @@ -558,7 +548,7 @@ fn_absolute_p (const char *name) /* Returns 1 if the filename specified is a virtual file that doesn't really exist on disk, 0 if it's a real filename. */ int -fn_special_p (const char *filename) +fn_is_special (const char *filename) { if (!strcmp (filename, "-") || !strcmp (filename, "stdin") || !strcmp (filename, "stdout") || !strcmp (filename, "stderr") @@ -574,7 +564,7 @@ fn_special_p (const char *filename) /* Returns nonzero if file with name NAME exists. */ int -fn_exists_p (const char *name) +fn_exists (const char *name) { #ifdef unix struct stat temp; diff --git a/src/data/filename.h b/src/data/filename.h index 80133138..89b8aca4 100644 --- a/src/data/filename.h +++ b/src/data/filename.h @@ -42,20 +42,19 @@ void fn_init (void); struct string; void fn_interp_vars (struct string *target, - const char *(*getenv) (const char *)); + const char *(*getenv) (const char *)); char *fn_tilde_expand (const char *fn); char *fn_search_path (const char *base_name, const char *path, const char *prefix); char *fn_normalize (const char *fn); -char *fn_dirname (const char *fn); -char *fn_basename (const char *fn); +char *fn_dir_name (const char *fn); char *fn_extension (const char *fn); char *fn_get_cwd (void); -int fn_absolute_p (const char *fn); -int fn_special_p (const char *fn); -int fn_exists_p (const char *fn); +int fn_is_absolute (const char *fn); +int fn_is_special (const char *fn); +int fn_exists (const char *fn); char *fn_readlink (const char *fn); const char *fn_getenv (const char *variable); diff --git a/src/language/line-buffer.c b/src/language/line-buffer.c index d218f7cb..53a63279 100644 --- a/src/language/line-buffer.c +++ b/src/language/line-buffer.c @@ -236,7 +236,7 @@ getl_include_syntax_file (const char *fn) if (cur_source != NULL) { char *found_fn = fn_search_path (fn, ds_c_str (&getl_include_path), - fn_dirname (cur_source->fn)); + fn_dir_name (cur_source->fn)); if (found_fn != NULL) { include_source (create_syntax_file_source (found_fn)); diff --git a/src/output/postscript.c b/src/output/postscript.c index 43b19f2b..7554dba5 100644 --- a/src/output/postscript.c +++ b/src/output/postscript.c @@ -429,7 +429,7 @@ handle_option (struct outp_driver *this, const char *key, static char * find_ps_file (const char *name) { - if (fn_absolute_p (name)) + if (fn_is_absolute (name)) return xstrdup (name); else {