+1998-12-31 Theodore Ts'o <tytso@rsts-11.mit.edu>
+
+ * prof_tree.c (profile_node_iterator): Make sure the pointer to
+ the iterator function is non-NULL before checking the
+ magic value.
+
+1998-12-15 Theodore Ts'o <tytso@rsts-11.mit.edu>
+
+ * prof_file.c (profile_open_file): Add ability to parse filenames
+ that begin with "~/" and substitute it with "$HOME/".
+
1998-12-04 Theodore Ts'o <tytso@rsts-11.mit.edu>
* prof_get.c: Add new public profile_iterator functions for
{
prf_file_t prf;
errcode_t retval;
+ char *home_env = 0;
+ int len;
prf = malloc(sizeof(struct _prf_file_t));
if (!prf)
return ENOMEM;
memset(prf, 0, sizeof(struct _prf_file_t));
- prf->filename = malloc(strlen(filename)+1);
+ len = strlen(filename)+1;
+ if (filename[0] == '~' && filename[1] == '/') {
+ home_env = getenv("HOME");
+ if (home_env)
+ len += strlen(home_env);
+ }
+ prf->filename = malloc(len);
if (!prf->filename) {
free(prf);
return ENOMEM;
}
- strcpy(prf->filename, filename);
+ if (home_env) {
+ strcpy(prf->filename, home_env);
+ strcat(prf->filename, filename+1);
+ } else
+ strcpy(prf->filename, filename);
prf->magic = PROF_MAGIC_FILE;
retval = profile_update_file(prf);
errcode_t retval;
int skip_num = 0;
- if (iter->magic != PROF_MAGIC_ITERATOR)
+ if (!iter || iter->magic != PROF_MAGIC_ITERATOR)
return PROF_MAGIC_ITERATOR;
/*
* If the file has changed, then the node pointer is invalid,