| 1529 | } |
| 1530 | |
| 1531 | int |
| 1532 | main (int argc, char **argv) |
| 1533 | { |
| 1534 | int valid_numbers = 1; |
| 1535 | bool locale_ok; |
| 1536 | |
| 1537 | initialize_main (&argc, &argv); |
| 1538 | set_program_name (argv[0]); |
| 1539 | locale_ok = !!setlocale (LC_ALL, ""); |
| 1540 | bindtextdomain (PACKAGE, LOCALEDIR); |
| 1541 | textdomain (PACKAGE); |
| 1542 | |
| 1543 | #if HAVE_FPSETPREC |
| 1544 | /* Enabled extended precision if needed. */ |
| 1545 | fpsetprec (FP_PE); |
| 1546 | #endif |
| 1547 | |
| 1548 | decimal_point = nl_langinfo (RADIXCHAR); |
| 1549 | if (decimal_point == NULL || strlen (decimal_point) == 0) |
| 1550 | decimal_point = "."; |
| 1551 | decimal_point_length = strlen (decimal_point); |
| 1552 | |
| 1553 | thousands_sep = nl_langinfo (THOUSEP); |
| 1554 | if (thousands_sep == NULL) |
| 1555 | thousands_sep = ""; |
| 1556 | thousands_sep_length = strlen (thousands_sep); |
| 1557 | |
| 1558 | atexit (close_stdout); |
| 1559 | |
| 1560 | while (true) |
| 1561 | { |
| 1562 | int c = getopt_long (argc, argv, "d:z", longopts, NULL); |
| 1563 | |
| 1564 | if (c == -1) |
| 1565 | break; |
| 1566 | |
| 1567 | switch (c) |
| 1568 | { |
| 1569 | case FROM_OPTION: |
| 1570 | scale_from = XARGMATCH ("--from", optarg, |
| 1571 | scale_from_args, scale_from_types); |
| 1572 | break; |
| 1573 | |
| 1574 | case FROM_UNIT_OPTION: |
| 1575 | from_unit_size = unit_to_umax (optarg); |
| 1576 | break; |
| 1577 | |
| 1578 | case TO_OPTION: |
| 1579 | scale_to = |
| 1580 | XARGMATCH ("--to", optarg, scale_to_args, scale_to_types); |
| 1581 | break; |
| 1582 | |
| 1583 | case TO_UNIT_OPTION: |
| 1584 | to_unit_size = unit_to_umax (optarg); |
| 1585 | break; |
| 1586 | |
| 1587 | case ROUND_OPTION: |
| 1588 | round_style = XARGMATCH ("--round", optarg, round_args, round_types); |
nothing calls this directly
no test coverage detected