From 320d7eee6064ca0dd8cb639bd5be69ba1540090e Mon Sep 17 00:00:00 2001
From: dgp <dgp@users.sourceforge.net>
Date: Wed, 24 Sep 2008 19:31:22 +0000
Subject:         TIP #323 IMPLEMENTATION (partial)

        * doc/file.n:           Revise [file delete] and [file mkdir] to
        * generic/tclCmdAH.c:   accept zero "pathname" arguments (the
        * generic/tclFCmd.c:    no-op case).
        * tests/cmdAH.test:
        * tests/fCmd.test:
---
 ChangeLog          | 10 ++++++++++
 doc/file.n         |  6 +++---
 generic/tclCmdAH.c |  6 +-----
 generic/tclFCmd.c  |  8 +-------
 tests/cmdAH.test   |  6 +++++-
 tests/fCmd.test    | 14 +++++++-------
 6 files changed, 27 insertions(+), 23 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 150e93d..2f539a2 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2008-09-24  Don Porter  <dgp@users.sourceforge.net>
+
+	TIP #323 IMPLEMENTATION (partial)
+
+	* doc/file.n:		Revise [file delete] and [file mkdir] to
+	* generic/tclCmdAH.c:	accept zero "pathname" arguments (the
+	* generic/tclFCmd.c:	no-op case).
+	* tests/cmdAH.test:
+	* tests/fCmd.test:
+
 2008-09-24  Donal K. Fellows  <dkf@users.sf.net>
 
 	* generic/tclOOMethod.c (DBPRINT): Remove obsolete debugging macro.
diff --git a/doc/file.n b/doc/file.n
index 0df79eb..be3cefa 100644
--- a/doc/file.n
+++ b/doc/file.n
@@ -5,7 +5,7 @@
 '\" See the file "license.terms" for information on usage and redistribution
 '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
 '\" 
-'\" RCS: @(#) $Id: file.n,v 1.53 2007/12/13 15:22:32 dgp Exp $
+'\" RCS: @(#) $Id: file.n,v 1.54 2008/09/24 19:31:28 dgp Exp $
 '\" 
 .so man.macros
 .TH file n 8.3 Tcl "Tcl Built-In Commands"
@@ -111,7 +111,7 @@ specified, halting at the first error, if any.  A \fB\-\|\-\fR marks
 the end of switches; the argument following the \fB\-\|\-\fR will be
 treated as a \fIsource\fR even if it starts with a \fB\-\fR.
 .TP
-\fBfile delete \fR?\fB\-force\fR? ?\fB\-\|\-\fR? \fIpathname\fR ?\fIpathname\fR ... ?
+\fBfile delete \fR?\fB\-force\fR? ?\fB\-\|\-\fR? ?\fIpathname\fR ... ?
 .
 Removes the file or directory specified by each \fIpathname\fR
 argument.  Non-empty directories will be removed only if the
@@ -251,7 +251,7 @@ is for the link rather than the file it refers to.  On systems that
 do not support symbolic links this option behaves exactly the same
 as the \fBstat\fR option.
 .TP
-\fBfile mkdir \fIdir\fR ?\fIdir\fR ...?
+\fBfile mkdir ?\fIdir\fR ...?
 .
 Creates each directory specified.  For each pathname \fIdir\fR specified,
 this command will create all non-existing parent directories as
diff --git a/generic/tclCmdAH.c b/generic/tclCmdAH.c
index 80aadeb..19a743b 100644
--- a/generic/tclCmdAH.c
+++ b/generic/tclCmdAH.c
@@ -10,7 +10,7 @@
  * See the file "license.terms" for information on usage and redistribution of
  * this file, and for a DISCLAIMER OF ALL WARRANTIES.
  *
- * RCS: @(#) $Id: tclCmdAH.c,v 1.104 2008/09/01 12:28:08 msofer Exp $
+ * RCS: @(#) $Id: tclCmdAH.c,v 1.105 2008/09/24 19:31:28 dgp Exp $
  */
 
 #include "tclInt.h"
@@ -1239,10 +1239,6 @@ Tcl_FileObjCmd(
 		GetTypeFromMode((unsigned short) buf.st_mode), -1));
 	return TCL_OK;
     case FCMD_MKDIR:
-	if (objc < 3) {
-	    Tcl_WrongNumArgs(interp, 2, objv, "name ?name ...?");
-	    return TCL_ERROR;
-	}
 	return TclFileMakeDirsCmd(interp, objc, objv);
     case FCMD_NATIVENAME: {
 	const char *fileName;
diff --git a/generic/tclFCmd.c b/generic/tclFCmd.c
index dc13ef4..d385f8e 100644
--- a/generic/tclFCmd.c
+++ b/generic/tclFCmd.c
@@ -9,7 +9,7 @@
  * See the file "license.terms" for information on usage and redistribution of
  * this file, and for a DISCLAIMER OF ALL WARRANTIES.
  *
- * RCS: @(#) $Id: tclFCmd.c,v 1.46 2008/07/21 14:42:57 patthoyts Exp $
+ * RCS: @(#) $Id: tclFCmd.c,v 1.47 2008/09/24 19:31:29 dgp Exp $
  */
 
 #include "tclInt.h"
@@ -351,12 +351,6 @@ TclFileDeleteCmd(
 	return TCL_ERROR;
     }
     i += 2;
-    if ((objc - i) < 1) {
-	Tcl_AppendResult(interp, "wrong # args: should be \"",
-		TclGetString(objv[0]), " ", TclGetString(objv[1]),
-		" ?-option value ...? file ?file ...?\"", NULL);
-	return TCL_ERROR;
-    }
 
     errfile = NULL;
     result = TCL_OK;
diff --git a/tests/cmdAH.test b/tests/cmdAH.test
index 73a8819..cca533f 100644
--- a/tests/cmdAH.test
+++ b/tests/cmdAH.test
@@ -10,7 +10,7 @@
 # See the file "license.terms" for information on usage and redistribution
 # of this file, and for a DISCLAIMER OF ALL WARRANTIES.
 #
-# RCS: @(#) $Id: cmdAH.test,v 1.62 2008/09/10 13:50:04 dkf Exp $
+# RCS: @(#) $Id: cmdAH.test,v 1.63 2008/09/24 19:31:29 dgp Exp $
 
 if {[lsearch [namespace children] ::tcltest] == -1} {
     package require tcltest 2.1
@@ -1093,6 +1093,10 @@ test cmdAH-23.10 {Tcl_FileObjCmd: mkdir} -setup {
     file delete -force $dirA
     file delete -force $dirB
 } -result {1 1}
+test cmdAH-23.11 {Tcl_FileObjCmd: mkdir} {
+    # Allow zero arguments (TIP 323)
+    file mkdir
+} {}
 
 # mtime
 
diff --git a/tests/fCmd.test b/tests/fCmd.test
index 78c0270..78be937 100644
--- a/tests/fCmd.test
+++ b/tests/fCmd.test
@@ -10,7 +10,7 @@
 # See the file "license.terms" for information on usage and redistribution of
 # this file, and for a DISCLAIMER OF ALL WARRANTIES.
 #
-# RCS: @(#) $Id: fCmd.test,v 1.64 2008/08/14 00:08:24 das Exp $
+# RCS: @(#) $Id: fCmd.test,v 1.65 2008/09/24 19:31:40 dgp Exp $
 #
 
 if {[lsearch [namespace children] ::tcltest] == -1} {
@@ -363,9 +363,9 @@ test fCmd-4.16 {TclFileMakeDirsCmd: TclpCreateDirectory succeeds} -setup {
 test fCmd-5.1 {TclFileDeleteCmd: FileForceOption fails} -constraints {notRoot} -body {
     file delete -xyz
 } -returnCodes error -result {bad option "-xyz": should be -force or --}
-test fCmd-5.2 {TclFileDeleteCmd: not enough args} -constraints {notRoot} -body {
+test fCmd-5.2 {TclFileDeleteCmd: accept 0 files (TIP 323)} -body {
     file delete -force -force
-} -returnCodes error -result {wrong # args: should be "file delete ?-option value ...? file ?file ...?"}
+} -result {}
 test fCmd-5.3 {TclFileDeleteCmd: 1 file} -constraints {notRoot} -setup {
     cleanup
 } -body {
@@ -1587,12 +1587,12 @@ test fCmd-16.3 {test bad option} -constraints {notRoot} -setup {
 } -cleanup {
     file delete tfa
 } -result {1}
-test fCmd-16.4 {test not enough args} -constraints {notRoot} -body {
+test fCmd-16.4 {accept zero files (TIP 323)} -body {
     file delete
-} -returnCodes error -match glob -result "wrong \# args: should be *"
-test fCmd-16.5 {test not enough args with options} -constraints {notRoot} -body {
+} -result {}
+test fCmd-16.5 {accept zero files (TIP 323)} -body {
     file delete --
-} -returnCodes error -match glob -result "wrong \# args: should be *"
+} -result {}
 test fCmd-16.6 {delete: source filename translation failing} -setup {
     set temp $::env(HOME)
 } -constraints {notRoot} -body {
-- 
cgit v0.12