From e24278ec40c40f255ee0b9da64a3a4de9a92b547 Mon Sep 17 00:00:00 2001 From: polluks Date: Wed, 27 Jul 2016 11:54:52 +0000 Subject: [PATCH] Fixed compatibility of output. QUIET just reduce verbosity. If you want no output use >NIL:. A write protected disk now aborts. git-svn-id: https://svn.aros.org/svn/aros/trunk/AROS@52804 fb15a70f-31f2-0310-bbcc-cdcc74a49acc --- workbench/c/Delete.c | 36 +++++++++++++----------------------- 1 file changed, 13 insertions(+), 23 deletions(-) diff --git a/workbench/c/Delete.c b/workbench/c/Delete.c index bcd3ac493d..b51fd4c103 100644 --- a/workbench/c/Delete.c +++ b/workbench/c/Delete.c @@ -87,7 +87,7 @@ enum /* Maximum file path length */ #define MAX_PATH_LEN 2048 -const TEXT version[] = "$VER: Delete 41.2 (6.1.2000)\n"; +const TEXT version[] = "$VER: Delete 41.3 (27.7.2016)\n"; static char cmdname[] = "Delete"; @@ -230,8 +230,7 @@ int doDelete(struct AnchorPath *ap, STRPTR *files, BOOL all, BOOL quiet, MatchEnd(ap); UnLockDosList(LDF_ALL | LDF_READ); - if (!(quiet)) - Printf("%s is a device and cannot be deleted\n", files[i]); + Printf("%s is a device and cannot be deleted\n", files[i]); return RETURN_FAIL; } @@ -257,12 +256,9 @@ int doDelete(struct AnchorPath *ap, STRPTR *files, BOOL all, BOOL quiet, /* Try to delete the file or directory */ if (!DeleteFile(name)) { - if (!quiet) - { - LONG ioerr = IoErr(); - Printf("%s Not Deleted", (IPTR)name); - PrintFault(ioerr, ""); - } + LONG ioerr = IoErr(); + Printf("%s Not Deleted", (IPTR)name); + PrintFault(ioerr, ""); } else { @@ -323,11 +319,8 @@ int doDelete(struct AnchorPath *ap, STRPTR *files, BOOL all, BOOL quiet, SetProtection(ap->ap_Buf, 0); else { - if (!quiet) - { - Printf("%s Not Deleted", (IPTR)ap->ap_Buf); - PrintFault(ERROR_DELETE_PROTECTED, ""); - } + Printf("%s Not Deleted", (IPTR)ap->ap_Buf); + PrintFault(ERROR_DELETE_PROTECTED, ""); deleteit = FALSE; } } @@ -340,11 +333,12 @@ int doDelete(struct AnchorPath *ap, STRPTR *files, BOOL all, BOOL quiet, /* Try to delete the file or directory */ if (!DeleteFile(name)) { - if (!quiet) + LONG ioerr = IoErr(); + Printf("%s Not Deleted", (IPTR)name); + PrintFault(ioerr, ""); + if (ioerr == ERROR_DISK_WRITE_PROTECTED) { - LONG ioerr = IoErr(); - Printf("%s Not Deleted", (IPTR)name); - PrintFault(ioerr, ""); + return RETURN_FAIL; } } else @@ -352,7 +346,6 @@ int doDelete(struct AnchorPath *ap, STRPTR *files, BOOL all, BOOL quiet, deletedfile = TRUE; if (!quiet) { - Printf("%s Deleted\n", (IPTR)name); } } @@ -370,10 +363,7 @@ int doDelete(struct AnchorPath *ap, STRPTR *files, BOOL all, BOOL quiet, if (!deletedfile) { - if (!quiet) - { - PutStr("No file to delete\n"); - } + PutStr("No file to delete\n"); return RETURN_WARN; } return RETURN_OK; -- 2.11.4.GIT