--- getopt/trunk/getopt.c 2012/07/31 19:53:07 325 +++ getopt/trunk/getopt.c 2014/11/20 10:43:12 359 @@ -37,6 +37,8 @@ * ) * Version 1.1.4: Mon Nov 7 2005 * Fixed a few type's in the manpage + * Version 1.1.5: Mon Nov 7 2005 + * Sync with util-linux-2.21, fixed build problems, many new translations */ /* Exit codes: @@ -197,7 +199,7 @@ if (longopts[longindex].has_arg) printf(" %s", normalize(optarg ? optarg : "")); } else if (opt == NON_OPT) - printf(" %s", normalize(optarg)); + printf(" %s", normalize(optarg ? optarg : "")); else { printf(" -%c", opt); charptr = strchr(optstr, opt); @@ -258,7 +260,7 @@ long_options[long_options_nr].flag = NULL; long_options[long_options_nr].val = 0; - if (long_options_nr) { + if (long_options_nr && name) { /* Not for init! */ long_options[long_options_nr - 1].has_arg = has_arg; long_options[long_options_nr - 1].flag = NULL;