From 2bd28f020002a4997928acf2a4874427114b970e Mon Sep 17 00:00:00 2001 From: Jim Meyering Date: Mon, 22 Jul 2002 12:24:41 +0000 Subject: Add new option, --presume-input-tty, for testing only. Not documented. --- src/rm.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) 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; -- cgit v1.2.3-54-g00ecf