Print this page
4270 ld(1) argument error reporting is still pretty bad

Split Close
Expand all
Collapse all
          --- old/usr/src/cmd/sgs/libld/common/args.c
          +++ new/usr/src/cmd/sgs/libld/common/args.c
↓ open down ↓ 1671 lines elided ↑ open up ↑
1672 1672                                          Plibpath = optarg + 2;
1673 1673                          } else {
1674 1674                                  ld_eprintf(ofl, ERR_FATAL,
1675 1675                                      MSG_INTL(MSG_ARG_ILLEGAL),
1676 1676                                      MSG_ORIG(MSG_ARG_CY), optarg);
1677 1677                          }
1678 1678                          break;
1679 1679  
1680 1680                  case '?':
1681 1681                          DBG_CALL(Dbg_args_option(ofl->ofl_lml, ndx, c, NULL));
1682      -                        eprintf(ofl->ofl_lml, ERR_FATAL,
1683      -                            MSG_INTL(MSG_ARG_UNKNOWN), optopt);
     1682 +                        /*
     1683 +                         * If the option character is '-', we're looking at a
     1684 +                         * long option which couldn't be translated, display a
     1685 +                         * more useful error.
     1686 +                         */
     1687 +                        if (optopt == '-') {
     1688 +                                eprintf(ofl->ofl_lml, ERR_FATAL,
     1689 +                                    MSG_INTL(MSG_ARG_LONG_UNKNOWN),
     1690 +                                    argv[optind-1]);
     1691 +                        } else {
     1692 +                                eprintf(ofl->ofl_lml, ERR_FATAL,
     1693 +                                    MSG_INTL(MSG_ARG_UNKNOWN), optopt);
     1694 +                        }
1684 1695                          (*usage)++;
1685 1696                          break;
1686 1697  
1687 1698                  default:
1688 1699                          break;
1689 1700                  }
1690 1701  
1691 1702                  /*
1692 1703                   * Update the argument index for the next getopt() iteration.
1693 1704                   */
↓ open down ↓ 441 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX