mcabber/src/utils.c
changeset 1222 75aee46d3aee
parent 1205 2de8f8ba1f34
child 1241 3a4018f18bdf
equal deleted inserted replaced
1221:0dd5df7eb007 1222:75aee46d3aee
    48 //  expand_filename(filename)
    48 //  expand_filename(filename)
    49 // Expand "~/" with the $HOME env. variable in a file name.
    49 // Expand "~/" with the $HOME env. variable in a file name.
    50 // The caller must free the string after use.
    50 // The caller must free the string after use.
    51 char *expand_filename(const char *fname)
    51 char *expand_filename(const char *fname)
    52 {
    52 {
       
    53   if (!fname)
       
    54     return NULL;
    53   if (!strncmp(fname, "~/", 2)) {
    55   if (!strncmp(fname, "~/", 2)) {
    54     char *homedir = getenv("HOME");
    56     char *homedir = getenv("HOME");
    55     if (homedir)
    57     if (homedir)
    56       return g_strdup_printf("%s%s", homedir, fname+1);
    58       return g_strdup_printf("%s%s", homedir, fname+1);
    57   }
    59   }