summaryrefslogtreecommitdiff
path: root/src/rm.c
diff options
context:
space:
mode:
authorJim Meyering <jim@meyering.net>2002-07-22 12:24:41 +0000
committerJim Meyering <jim@meyering.net>2002-07-22 12:24:41 +0000
commit2bd28f020002a4997928acf2a4874427114b970e (patch)
treeb2ebd6042c81a0e87aa27a2b2a4b307402a51ae6 /src/rm.c
parent48a269db9c9278cebdd2c2d59a2ce570d400d89c (diff)
downloadcoreutils-2bd28f020002a4997928acf2a4874427114b970e.tar.gz
Add new option, --presume-input-tty, for testing only.
Not documented.
Diffstat (limited to 'src/rm.c')
-rw-r--r--src/rm.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/rm.c b/src/rm.c
index d34c1933a..7c56280da 100644
--- a/src/rm.c
+++ b/src/rm.c
@@ -63,11 +63,25 @@
/* Name this program was run with. */
char *program_name;
+/* For long options that have no equivalent short option, use a
+ non-character as a pseudo short option, starting with CHAR_MAX + 1. */
+enum
+{
+ PRESUME_INPUT_TTY_OPTION = CHAR_MAX + 1
+};
+
static struct option const long_opts[] =
{
{"directory", no_argument, NULL, 'd'},
{"force", no_argument, NULL, 'f'},
{"interactive", no_argument, NULL, 'i'},
+
+ /* This is solely for testing. Do not document. */
+ /* It is relatively difficult to ensure that there is a tty on stdin.
+ Since rm acts differently depending on that, without this option,
+ it'd be harder to test the parts of rm that depend on that setting. */
+ {"presume-input-tty", no_argument, NULL, PRESUME_INPUT_TTY_OPTION},
+
{"recursive", no_argument, NULL, 'r'},
{"verbose", no_argument, NULL, 'v'},
{GETOPT_HELP_OPTION_DECL},
@@ -164,6 +178,9 @@ main (int argc, char **argv)
case 'R':
x.recursive = 1;
break;
+ case PRESUME_INPUT_TTY_OPTION:
+ x.stdin_tty = 1;
+ break;
case 'v':
x.verbose = 1;
break;