Properly handle --user (open user's system mailbox).
Showing
1 changed file
with
11 additions
and
1 deletions
... | @@ -341,7 +341,17 @@ main (int argc, char **argv) | ... | @@ -341,7 +341,17 @@ main (int argc, char **argv) |
341 | /* open the mailbox */ | 341 | /* open the mailbox */ |
342 | if (args.file == NULL) | 342 | if (args.file == NULL) |
343 | { | 343 | { |
344 | if ((rc = mailbox_create_default (&mbox, args.user)) != 0) | 344 | if (args.user) |
345 | { | ||
346 | char *p = xmalloc (strlen (args.user) + 2); | ||
347 | p[0] = '%'; | ||
348 | strcpy (p + 1, args.user); | ||
349 | rc = mailbox_create_default (&mbox, p); | ||
350 | free (p); | ||
351 | } | ||
352 | else | ||
353 | rc = mailbox_create_default (&mbox, NULL); | ||
354 | if (rc != 0) | ||
345 | { | 355 | { |
346 | util_error ("Can not create mailbox for %s: %s", args.user, | 356 | util_error ("Can not create mailbox for %s: %s", args.user, |
347 | mu_errstring (rc)); | 357 | mu_errstring (rc)); | ... | ... |
-
Please register or sign in to post a comment