From 8e6429a7648816523cab71457b4d3b3dace3c8c9 Mon Sep 17 00:00:00 2001 From: "Dirk-Jan C. Binnema" Date: Fri, 5 Aug 2011 08:20:26 +0300 Subject: [PATCH] * mu-cmd.c: (mu mv) make --printtarget work even with target=/dev/null --- src/mu-cmd.c | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/src/mu-cmd.c b/src/mu-cmd.c index 54cfc729..c9c77cdd 100644 --- a/src/mu-cmd.c +++ b/src/mu-cmd.c @@ -316,8 +316,11 @@ mu_cmd_mv (MuConfig *opts) if (unlink (opts->params[1]) != 0) { g_warning ("unlink failed: %s", strerror (errno)); return MU_EXITCODE_ERROR; - } else + } else { + if (opts->printtarget) /* if the move worked, print */ + g_print ("%s\n", "/dev/null"); /* /dev/null */ return MU_EXITCODE_OK; + } } err = NULL; @@ -329,17 +332,19 @@ mu_cmd_mv (MuConfig *opts) g_error_free (err); } return MU_EXITCODE_ERROR; - - } else if (opts->printtarget) /* if the move worked, print the */ - g_print ("%s\n", fullpath); /* target (if user set - * --printtarget) */ + + } else { + if (opts->printtarget) + g_print ("%s\n", fullpath); + return MU_EXITCODE_OK; + } g_free (fullpath); - + return MU_EXITCODE_OK; -} - - + } + + static gboolean check_file_okay (const char *path, gboolean cmd_add) {