Skip to contentSkip to conversation

udevd.c: Add 'N:' to optstring in getopt_long

PATCH Applied Thomas Egerer 3 participants 4 messages Mar 31, 2011

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 udevd.c: Add 'N:' to optstring in getopt_long

---
 udev/udevd.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
udev/udevd.c +1 -1
index 1871474..53db44a 100644
@@ -1118,7 +1118,7 @@ int main(int argc, char *argv[])
 	for (;;) {
 		int option;
 
-		option = getopt_long(argc, argv, "c:deDthV", options, NULL);
+		option = getopt_long(argc, argv, "c:deDthN:V", options, NULL);
 		if (option == -1)
 			break;
 
#1 lore raw

Hello Thomas,

Thomas Egerer [2011-03-31 15:06 +0200]:

udev/udevd.c int main(int argc, char *argv[]) · line 1121

Quoted 2 lines
udev/udevd.c +1 -1
-		option = getopt_long(argc, argv, "c:deDthV", options, NULL);
+		option = getopt_long(argc, argv, "c:deDthN:V", options, NULL);

This is certainly an inconsistency, but I wonder if we shouldn't instead just remove the other short options from the optstring? Neither --help nor the manpage document the short versions, so they could be considered a kind of implementation detail?

I. e. we should perhaps only support the documented long options.

Martin

Signature · 2 lines
Martin Pitt                        | http://www.piware.de
Ubuntu Developer (www.ubuntu.com)  | Debian Developer  (www.debian.org)
#2 lore raw
In reply to Thomas Egerer
Quoted 6 lines · Martin Pitt

Hello Thomas,

Thomas Egerer [2011-03-31 15:06 +0200]:

Quoted 2 lines

-             option = getopt_long(argc, argv, "c:deDthV", options, NULL);
+             option = getopt_long(argc, argv, "c:deDthN:V", options, NULL);

Quoted 6 lines

This is certainly an inconsistency, but I wonder if we shouldn't instead just remove the other short options from the optstring? Neither --help nor the manpage document the short versions, so they could be considered a kind of implementation detail?

I. e. we should perhaps only support the documented long options.

There is no real need to have the long and short ones in sync.

Most of the short options are only used on the commandline during development, and none of them are documented, or there are any real guarantees about them to stay as they are.

Only the documented long options should be used for anything that is not a human on the commandline.

Kay

Applied
#3 lore raw
In reply to Thomas Egerer
Quoted 2 lines · Thomas Egerer

 udev/udevd.c |    2 +-

 1 files changed, 1 insertions(+), 1 deletions(-)

Applied. But please use the long options is anything that can not cope with possible changes. The short options are just there to please humans, not scripts. :)

Thanks,
Kay