Commit 5995a882 5995a882dd62f07f5563487fedc74968cd8b7d8b by Sergey Poznyakoff

(mail_expand_name): Use util_getenv() and util_folder_path().

1 parent 909d29b0
...@@ -32,8 +32,6 @@ static char *prev_name; ...@@ -32,8 +32,6 @@ static char *prev_name;
32 char * 32 char *
33 mail_expand_name (const char *name) 33 mail_expand_name (const char *name)
34 { 34 {
35 struct mail_env_entry *env;
36
37 switch (name[0]) 35 switch (name[0])
38 { 36 {
39 case '#': 37 case '#':
...@@ -52,32 +50,7 @@ mail_expand_name (const char *name) ...@@ -52,32 +50,7 @@ mail_expand_name (const char *name)
52 break; 50 break;
53 51
54 case '+': 52 case '+':
55 env = util_find_env ("folder"); 53 name = util_folder_path (name);
56 if (!env->set)
57 {
58 util_error ("No value set for \"folder\"");
59 return NULL;
60 }
61 else
62 {
63 char *tmp;
64
65 if (env->value[0] != '/' && env->value[1] != '~')
66 {
67 char *home = mu_get_homedir ();
68 tmp = xmalloc (strlen (home) + 1 +
69 strlen (env->value) + 1 +
70 strlen (name + 1) + 1);
71 sprintf (tmp, "%s/%s/%s", home, env->value, name + 1);
72 }
73 else
74 {
75 tmp = xmalloc (strlen (env->value) + 1 +
76 strlen (name + 1) + 1);
77 sprintf (tmp, "%s/%s", env->value, name + 1);
78 }
79 name = tmp;
80 }
81 break; 54 break;
82 55
83 default: 56 default:
...@@ -139,7 +112,7 @@ mail_file (int argc, char **argv) ...@@ -139,7 +112,7 @@ mail_file (int argc, char **argv)
139 mbox = newbox; 112 mbox = newbox;
140 mailbox_messages_count (mbox, &total); 113 mailbox_messages_count (mbox, &total);
141 cursor = realcursor = 1; 114 cursor = realcursor = 1;
142 if ((util_find_env("header"))->set) 115 if (util_getenv (NULL, "header", Mail_env_boolean, 0) == 0)
143 { 116 {
144 util_do_command ("summary"); 117 util_do_command ("summary");
145 util_do_command ("z."); 118 util_do_command ("z.");
......