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


1662                                             MSG_ORIG(MSG_ARG_CYU));
1663                                 else
1664                                         Ulibdir = optarg + 2;
1665                         } else if (strncmp(optarg,
1666                             MSG_ORIG(MSG_ARG_PCOM), 2) == 0) {
1667                                 if (Plibpath)
1668                                         ld_eprintf(ofl, ERR_WARNING_NF,
1669                                             MSG_INTL(MSG_ARG_MTONCE),
1670                                             MSG_ORIG(MSG_ARG_CYP));
1671                                 else
1672                                         Plibpath = optarg + 2;
1673                         } else {
1674                                 ld_eprintf(ofl, ERR_FATAL,
1675                                     MSG_INTL(MSG_ARG_ILLEGAL),
1676                                     MSG_ORIG(MSG_ARG_CY), optarg);
1677                         }
1678                         break;
1679 
1680                 case '?':
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);

1684                         (*usage)++;
1685                         break;
1686 
1687                 default:
1688                         break;
1689                 }
1690 
1691                 /*
1692                  * Update the argument index for the next getopt() iteration.
1693                  */
1694                 ndx = optind;
1695         }
1696         return (1);
1697 }
1698 
1699 /*
1700  * Parsing options pass2 for
1701  */
1702 static uintptr_t
1703 parseopt_pass2(Ofl_desc *ofl, int argc, char **argv)




1662                                             MSG_ORIG(MSG_ARG_CYU));
1663                                 else
1664                                         Ulibdir = optarg + 2;
1665                         } else if (strncmp(optarg,
1666                             MSG_ORIG(MSG_ARG_PCOM), 2) == 0) {
1667                                 if (Plibpath)
1668                                         ld_eprintf(ofl, ERR_WARNING_NF,
1669                                             MSG_INTL(MSG_ARG_MTONCE),
1670                                             MSG_ORIG(MSG_ARG_CYP));
1671                                 else
1672                                         Plibpath = optarg + 2;
1673                         } else {
1674                                 ld_eprintf(ofl, ERR_FATAL,
1675                                     MSG_INTL(MSG_ARG_ILLEGAL),
1676                                     MSG_ORIG(MSG_ARG_CY), optarg);
1677                         }
1678                         break;
1679 
1680                 case '?':
1681                         DBG_CALL(Dbg_args_option(ofl->ofl_lml, ndx, c, NULL));
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                         }
1695                         (*usage)++;
1696                         break;
1697 
1698                 default:
1699                         break;
1700                 }
1701 
1702                 /*
1703                  * Update the argument index for the next getopt() iteration.
1704                  */
1705                 ndx = optind;
1706         }
1707         return (1);
1708 }
1709 
1710 /*
1711  * Parsing options pass2 for
1712  */
1713 static uintptr_t
1714 parseopt_pass2(Ofl_desc *ofl, int argc, char **argv)