/* PSPP - computes sample statistics.
- Copyright (C) 1997-9, 2000 Free Software Foundation, Inc.
+ Copyright (C) 1997-9, 2000, 2006 Free Software Foundation, Inc.
Written by Ben Pfaff <blp@gnu.org>.
This program is free software; you can redistribute it and/or
abort ();
}
#endif
+
+/* Returns the extension part of FILENAME as a malloc()'d string.
+ If FILENAME does not have an extension, returns an empty
+ string. */
+char *
+fn_extension (const char *filename)
+{
+ const char *extension = strrchr (filename, '.');
+ if (extension == NULL)
+ extension = "";
+ return xstrdup (extension);
+}
\f
#if unix
/* Returns the current working directory, as a malloc()'d string.