* [PATCH] su: remove unimplemented options -u and -v
@ 2012-06-06 12:29 Bernhard Voelker
2012-06-06 12:47 ` Sami Kerola
0 siblings, 1 reply; 4+ messages in thread
From: Bernhard Voelker @ 2012-06-06 12:29 UTC (permalink / raw)
To: util-linux@vger.kernel.org
>From 3e7fedef769fe0cfb71833ec51c3f897e99b0f7c Mon Sep 17 00:00:00 2001
From: Bernhard Voelker <mail@bernhard-voelker.de>
Date: Wed, 6 Jun 2012 14:26:59 +0200
Subject: [PATCH] su: remove unimplemented options -u and -v
* longopts: Change the values of "help" and "version" to upper-case - as these options
are special anyway.
* main(): Likewise.
* usage(): Remove unimplemented short options -u and -v and fix alignment.
Signed-off-by: Bernhard Voelker <mail@bernhard-voelker.de>
---
login-utils/su.c | 14 ++++++--------
1 files changed, 6 insertions(+), 8 deletions(-)
diff --git a/login-utils/su.c b/login-utils/su.c
index 0f535b9..66d5273 100644
--- a/login-utils/su.c
+++ b/login-utils/su.c
@@ -109,8 +109,8 @@ static struct option const longopts[] =
{"login", no_argument, NULL, 'l'},
{"preserve-environment", no_argument, NULL, 'p'},
{"shell", required_argument, NULL, 's'},
- {"help", no_argument, 0, 'u'},
- {"version", no_argument, 0, 'v'},
+ {"help", no_argument, 0, 'H'},
+ {"version", no_argument, 0, 'V'},
{NULL, 0, NULL, 0}
};
@@ -661,10 +661,8 @@ Change the effective user id and group id to that of USER.\n\
-m, --preserve-environment do not reset environment variables\n\
-p same as -m\n\
-s, --shell=SHELL run SHELL if /etc/shells allows it\n\
-"), stdout);
- fputs (_(" -u, --help display this help and exit\n"), stdout);
- fputs (_(" -v, --version output version information and exit\n"), stdout);
- fputs (_("\
+ --help display this help and exit\n\
+ --version output version information and exit\n\
\n\
A mere - implies -l. If USER not given, assume root.\n\
"), stdout);
@@ -727,10 +725,10 @@ main (int argc, char **argv)
shell = optarg;
break;
- case 'u':
+ case 'H':
usage(0);
- case 'v':
+ case 'V':
printf(UTIL_LINUX_VERSION);
exit(EXIT_SUCCESS);
--
1.7.7
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] su: remove unimplemented options -u and -v
2012-06-06 12:29 [PATCH] su: remove unimplemented options -u and -v Bernhard Voelker
@ 2012-06-06 12:47 ` Sami Kerola
2012-06-06 13:31 ` Bernhard Voelker
0 siblings, 1 reply; 4+ messages in thread
From: Sami Kerola @ 2012-06-06 12:47 UTC (permalink / raw)
To: Bernhard Voelker; +Cc: util-linux@vger.kernel.org
On Wed, Jun 6, 2012 at 2:29 PM, Bernhard Voelker
<mail@bernhard-voelker.de> wrote:
> From 3e7fedef769fe0cfb71833ec51c3f897e99b0f7c Mon Sep 17 00:00:00 2001
> From: Bernhard Voelker <mail@bernhard-voelker.de>
> Date: Wed, 6 Jun 2012 14:26:59 +0200
> Subject: [PATCH] su: remove unimplemented options -u and -v
Hi Berny,
If you want to remove short options I recommend to assign greater than
character value to switch. See term-utils/agetty.c and search for
_OPTION as an example.
--
Sami Kerola
http://www.iki.fi/kerolasa/
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] su: remove unimplemented options -u and -v
2012-06-06 12:47 ` Sami Kerola
@ 2012-06-06 13:31 ` Bernhard Voelker
2012-06-15 9:22 ` Karel Zak
0 siblings, 1 reply; 4+ messages in thread
From: Bernhard Voelker @ 2012-06-06 13:31 UTC (permalink / raw)
To: kerolasa; +Cc: Sami Kerola, util-linux@vger.kernel.org
On 06/06/2012 02:47 PM, Sami Kerola wrote:
> On Wed, Jun 6, 2012 at 2:29 PM, Bernhard Voelker
> <mail@bernhard-voelker.de> wrote:
>> From 3e7fedef769fe0cfb71833ec51c3f897e99b0f7c Mon Sep 17 00:00:00 2001
>> From: Bernhard Voelker <mail@bernhard-voelker.de>
>> Date: Wed, 6 Jun 2012 14:26:59 +0200
>> Subject: [PATCH] su: remove unimplemented options -u and -v
>
> Hi Berny,
>
> If you want to remove short options I recommend to assign greater than
> character value to switch. See term-utils/agetty.c and search for
> _OPTION as an example.
Hi Sami,
thank you for the review. I was searching for similar cases in U-L,
but --help and --version don't seem to be handled very consistently.
Here's a new patch.
Have a nice day,
Berny
>From 2fdc309659a91343da451bf9d6e17edd4830d895 Mon Sep 17 00:00:00 2001
From: Bernhard Voelker <mail@bernhard-voelker.de>
Date: Wed, 6 Jun 2012 15:30:52 +0200
Subject: [PATCH] su: remove unimplemented options -u and -v
Signed-off-by: Bernhard Voelker <mail@bernhard-voelker.de>
---
login-utils/su.c | 18 ++++++++++--------
1 files changed, 10 insertions(+), 8 deletions(-)
diff --git a/login-utils/su.c b/login-utils/su.c
index 0f535b9..20cc929 100644
--- a/login-utils/su.c
+++ b/login-utils/su.c
@@ -100,6 +100,10 @@ static bool _pam_cred_established;
static sig_atomic_t volatile caught_signal = false;
static pam_handle_t *pamh = NULL;
+enum {
+ VERSION_OPTION = CHAR_MAX + 1,
+ HELP_OPTION
+};
static struct option const longopts[] =
{
@@ -109,8 +113,8 @@ static struct option const longopts[] =
{"login", no_argument, NULL, 'l'},
{"preserve-environment", no_argument, NULL, 'p'},
{"shell", required_argument, NULL, 's'},
- {"help", no_argument, 0, 'u'},
- {"version", no_argument, 0, 'v'},
+ {"help", no_argument, 0, HELP_OPTION},
+ {"version", no_argument, 0, VERSION_OPTION},
{NULL, 0, NULL, 0}
};
@@ -661,10 +665,8 @@ Change the effective user id and group id to that of USER.\n\
-m, --preserve-environment do not reset environment variables\n\
-p same as -m\n\
-s, --shell=SHELL run SHELL if /etc/shells allows it\n\
-"), stdout);
- fputs (_(" -u, --help display this help and exit\n"), stdout);
- fputs (_(" -v, --version output version information and exit\n"), stdout);
- fputs (_("\
+ --help display this help and exit\n\
+ --version output version information and exit\n\
\n\
A mere - implies -l. If USER not given, assume root.\n\
"), stdout);
@@ -727,10 +729,10 @@ main (int argc, char **argv)
shell = optarg;
break;
- case 'u':
+ case HELP_OPTION:
usage(0);
- case 'v':
+ case VERSION_OPTION:
printf(UTIL_LINUX_VERSION);
exit(EXIT_SUCCESS);
--
1.7.7
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] su: remove unimplemented options -u and -v
2012-06-06 13:31 ` Bernhard Voelker
@ 2012-06-15 9:22 ` Karel Zak
0 siblings, 0 replies; 4+ messages in thread
From: Karel Zak @ 2012-06-15 9:22 UTC (permalink / raw)
To: Bernhard Voelker; +Cc: kerolasa, Sami Kerola, util-linux@vger.kernel.org
On Wed, Jun 06, 2012 at 03:31:37PM +0200, Bernhard Voelker wrote:
> login-utils/su.c | 18 ++++++++++--------
> 1 files changed, 10 insertions(+), 8 deletions(-)
Applied, thanks.
--
Karel Zak <kzak@redhat.com>
http://karelzak.blogspot.com
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2012-06-15 9:22 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-06-06 12:29 [PATCH] su: remove unimplemented options -u and -v Bernhard Voelker
2012-06-06 12:47 ` Sami Kerola
2012-06-06 13:31 ` Bernhard Voelker
2012-06-15 9:22 ` Karel Zak
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).