(plus_expand): Bugfix
Showing
1 changed file
with
13 additions
and
4 deletions
1 | /* GNU Mailutils -- a suite of utilities for electronic mail | 1 | /* GNU Mailutils -- a suite of utilities for electronic mail |
2 | Copyright (C) 1999, 2000, 2001 Free Software Foundation, Inc. | 2 | Copyright (C) 1999, 2000, 2001, 2003 Free Software Foundation, Inc. |
3 | 3 | ||
4 | This library is free software; you can redistribute it and/or | 4 | This library is free software; you can redistribute it and/or |
5 | modify it under the terms of the GNU Lesser General Public | 5 | modify it under the terms of the GNU Lesser General Public |
... | @@ -43,6 +43,15 @@ const char *mu_path_folder_dir = "Mail"; | ... | @@ -43,6 +43,15 @@ const char *mu_path_folder_dir = "Mail"; |
43 | #define USE_ENVIRON 1 | 43 | #define USE_ENVIRON 1 |
44 | 44 | ||
45 | static int | 45 | static int |
46 | is_proto (char *p) | ||
47 | { | ||
48 | for (; *p && *p != '/'; p++) | ||
49 | if (*p == ':') | ||
50 | return 1; | ||
51 | return 0; | ||
52 | } | ||
53 | |||
54 | static int | ||
46 | split_shortcut (const char *file, const char pfx[], char **user, char **rest) | 55 | split_shortcut (const char *file, const char pfx[], char **user, char **rest) |
47 | { | 56 | { |
48 | *user = NULL; | 57 | *user = NULL; |
... | @@ -175,7 +184,7 @@ plus_expand (const char *file, char **buf) | ... | @@ -175,7 +184,7 @@ plus_expand (const char *file, char **buf) |
175 | char *home; | 184 | char *home; |
176 | int status, len; | 185 | int status, len; |
177 | 186 | ||
178 | if ((status = split_shortcut (file, "+=", &user, &path))) | 187 | if ((status = split_shortcut (file, "+=", &path, &user))) |
179 | return status; | 188 | return status; |
180 | 189 | ||
181 | if (!path) | 190 | if (!path) |
... | @@ -192,7 +201,7 @@ plus_expand (const char *file, char **buf) | ... | @@ -192,7 +201,7 @@ plus_expand (const char *file, char **buf) |
192 | return ENOENT; | 201 | return ENOENT; |
193 | } | 202 | } |
194 | 203 | ||
195 | if (mu_path_folder_dir[0] == '/') | 204 | if (mu_path_folder_dir[0] == '/' || is_proto (mu_path_folder_dir)) |
196 | { | 205 | { |
197 | len = strlen (mu_path_folder_dir) + strlen (path) + 2; | 206 | len = strlen (mu_path_folder_dir) + strlen (path) + 2; |
198 | *buf = malloc (len); | 207 | *buf = malloc (len); |
... | @@ -334,7 +343,7 @@ mailbox_create_default (mailbox_t *pmbox, const char *mail) | ... | @@ -334,7 +343,7 @@ mailbox_create_default (mailbox_t *pmbox, const char *mail) |
334 | break; | 343 | break; |
335 | 344 | ||
336 | default: | 345 | default: |
337 | if (!strchr (mail, ':')) | 346 | if (!is_proto (mail)) |
338 | { | 347 | { |
339 | tmp_mbox = mu_getcwd(); | 348 | tmp_mbox = mu_getcwd(); |
340 | mbox = malloc (strlen (tmp_mbox) + strlen (mail) + 2); | 349 | mbox = malloc (strlen (tmp_mbox) + strlen (mail) + 2); | ... | ... |
-
Please register or sign in to post a comment