1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 2200 2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 2218 2219 2220 2221 2222 2223 2224 2225 2226 2227 2228 2229 2230 2231 2232 2233 2234 2235 2236 2237 2238 2239 2240 2241 2242 2243 2244 2245 2246 2247 2248 2249 2250 2251 2252 2253 2254 2255 2256 2257 2258 2259 2260 2261 2262 2263 2264 2265 2266 2267 2268 2269 2270 2271 2272 2273 2274 2275 2276 2277 2278 2279 2280 2281 2282 2283 2284 2285 2286 2287 2288 2289 2290 2291 2292 2293 2294 2295 2296 2297 2298 2299 2300 2301 2302 2303 2304 2305 2306 2307 2308 2309 2310 2311 2312 2313 2314 2315 2316 2317 2318 2319 2320 2321 2322 2323 2324 2325 2326 2327 2328 2329 2330 2331 2332 2333 2334 2335 2336 2337 2338 2339 2340 2341 2342 2343 2344 2345 2346 2347 2348 2349 2350 2351 2352 2353 2354 2355 2356 2357 2358 2359 2360 2361 2362 2363 2364 2365 2366 2367 2368 2369 2370 2371 2372 2373 2374 2375 2376 2377 2378 2379 2380 2381 2382 2383 2384 2385 2386 2387 2388 2389 2390 2391 2392 2393 2394 2395 2396 2397 2398 2399 2400 2401 2402 2403 2404 2405 2406 2407 2408 2409 2410 2411 2412 2413 2414 2415 2416 2417 2418 2419 2420 2421 2422 2423 2424 2425 2426 2427 2428 2429 2430 2431 2432 2433 2434 2435 2436 2437 2438 2439 2440 2441 2442 2443 2444 2445 2446 2447 2448 2449 2450 2451 2452 2453 2454 2455 2456 2457 2458 2459 2460 2461 2462 2463 2464 2465 2466 2467 2468 2469 2470 2471 2472 2473 2474 2475 2476 2477 2478 2479 2480 2481 2482 2483 2484 2485 2486 2487 2488 2489 2490 2491 2492 2493 2494 2495 2496 2497 2498 2499 2500 2501 2502 2503 2504 2505 2506 2507 2508 2509 2510 2511 2512 2513 2514 2515 2516 2517 2518 2519 2520 2521 2522 2523 2524 2525 2526 2527 2528 2529 2530 2531 2532 2533 2534 2535 2536 2537 2538 2539 2540 2541 2542 2543 2544 2545 2546 2547 2548 2549 2550 2551 2552 2553 2554 2555 2556 2557 2558 2559 2560 2561 2562 2563 2564 2565 2566 2567 2568 2569 2570 2571 2572 2573 2574 2575 2576 2577 2578 2579 2580 2581 2582 2583 2584 2585 2586 2587 2588 2589 2590 2591 2592 2593 2594 2595 2596 2597 2598 2599 2600 2601 2602 2603 2604 2605 2606 2607 2608 2609 2610 2611 2612 2613 2614 2615 2616 2617 2618 2619 2620 2621 2622 2623 2624 2625 2626 2627 2628 2629 2630 2631 2632 2633 2634 2635 2636 2637 2638 2639 2640 2641 2642 2643 2644 2645 2646 2647 2648 2649 2650 2651 2652 2653 2654 2655 2656 2657 2658 2659 2660 2661 2662 2663 2664 2665 2666 2667 2668 2669 2670 2671 2672 2673 2674 2675 2676 2677 2678 2679 2680 2681 2682 2683 2684 2685 2686 2687 2688 2689 2690 2691 2692 2693 2694 2695 2696 2697 2698 2699 2700 2701 2702 2703 2704 2705 2706 2707 2708 2709 2710 2711 2712 2713 2714 2715 2716 2717 2718 2719 2720 2721 2722 2723 2724 2725 2726 2727 2728 2729 2730 2731 2732 2733 2734 2735 2736 2737 2738 2739 2740 2741 2742 2743 2744 2745 2746 2747 2748 2749 2750 2751 2752 2753 2754 2755 2756 2757 2758 2759 2760 2761 2762 2763 2764 2765 2766 2767 2768 2769 2770 2771 2772 2773 2774 2775 2776 2777 2778 2779 2780 2781 2782 2783 2784 2785 2786 2787 2788 2789 2790 2791 2792 2793 2794 2795 2796 2797 2798 2799 2800 2801 2802 2803 2804 2805 2806 2807 2808 2809 2810 2811 2812 2813 2814 2815 2816 2817 2818 2819 2820 2821 2822 2823 2824 2825 2826 2827 2828 2829 2830 2831 2832 2833 2834 2835 2836 2837 2838 2839 2840 2841 2842 2843 2844 2845 2846 2847 2848 2849 2850 2851 2852 2853 2854 2855 2856 2857 2858 2859 2860 2861 2862 2863 2864 2865 2866 2867 2868 2869 2870 2871 2872 2873 2874
|
/* Copyright (c) 1996-2004, Adaptec Corporation
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* - Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
* - Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
* - Neither the name of the Adaptec Corporation nor the names of its
* contributors may be used to endorse or promote products derived from this
* software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
/****************************************************************************
*
* Created: 7/20/98
*
*****************************************************************************
*
* File Name: Parser.cpp
* Module:
* Contributors: Lee Page
* Description:
* Version Control:
*
* $Revision$
* $NoKeywords: $
* $Log$
* Revision 1.1.1.1 2004-04-29 10:20:12 bap
* Imported upstream version 0.0.4.
*
*****************************************************************************/
/*** INCLUDES ***/
#include "parser.hpp"
#include "parserr.hpp"
#include "listdev.hpp"
#include "flash.hpp"
#include "setrate.hpp"
#include "quietmod.hpp"
#include "pagemod.hpp"
#include "creatrad.hpp"
#include "deletrad.hpp"
#include "zap.hpp"
#include "setcache.hpp"
#include "usage.hpp"
#include "showinq.hpp"
#include "rstnvram.hpp"
#include "rustring.h"
#include "ctlr_map.hpp"
#include "alarm.hpp" // kmc
#include "nvrambit.hpp"
#include "setspeed.hpp"
#include "taskctrl.hpp"
#include "eventlog.hpp"
#include "forcest.hpp"
#include "config.hpp"
#include "expand.hpp"
#include "uartdmp.hpp"
#include "rmwflash.hpp"
#include "setscfg.hpp"
#include "rscenum.h"
#include "segment.hpp"
#include "namarray.hpp"
#include "rawdata.hpp"
#include <ctype.h>
#include <stdlib.h>
#include <stdio.h>
#ifdef _DPT_SOLARIS
#include <macros.h>
#endif // _DPT_SOLARIS
#ifndef min
#define min(a,b) ((a) < (b) ? (a) : (b))
#endif
/*** CONSTANTS ***/
extern char* EventStrings[];
/*** TYPES ***/
/*** STATIC DATA ***/
/*const unsigned long Parser::RAID_0_DEFAULT_STRIPE_SIZE = 128 * 1024L;
//const unsigned long Parser::RAID_1_DEFAULT_STRIPE_SIZE = 64 * 1024L;
const unsigned long Parser::RAID_5_DEFAULT_STRIPE_SIZE = 32 * 1024L;*/
const unsigned long Parser::BLOCK_SIZE = 512L;
/*** EXTERNAL DATA ***/
/*** MACROS ***/
/*** PROTOTYPES ***/
/*** FUNCTIONS ***/
Parser::Parser(
char *command_Line,
bool *quiet_Mode_Ptr // A pointer to the quiet mode boolean
): cmd_List( 0 ), quiet_Mode( quiet_Mode_Ptr )
{
ENTER( "Parser::Parser(" );
bool ignoreNonfatalErrors = false;
cmd_List = new Command_List();
// make sure this is all inited to '0'
memset( ¶ms, 0, sizeof( params ) );
// preserve original command line so we can display it in case of error.
// char *original_Command_Line = command_Line;
bool done = false;
// init all params to defaults.
Reset_Params_to_Defaults();
while( command_Line
&& *command_Line
&& ( command_Line = Skip_White( command_Line ) )
&& !done )
{
// make sure we can show the user where we choked if the parser fails.
char *this_Commands_Text = command_Line;
const int LEN_OF_SW_AND_CMD = 2;
// Handle the `hack' of specifying the controller sans flags
if(( command_Line[0] == 'c' ) || ( command_Line[0] == 'd' ))
{
SCSI_Address controller;
char *begin_cmd_line = command_Line;
int count = strlen(command_Line);
command_Line = Get_Address (command_Line, &controller);
if( controller.hba != -1 )
{
// shift string down
for (int counter = count + 1; counter > 0; counter--)
begin_cmd_line[counter] = begin_cmd_line[counter - 1];
// kds command_Line -= 2;
command_Line -= (command_Line - begin_cmd_line);
command_Line[0] = SW_DELIM_1;
/* kds
#if (!defined(_DPT_NETWARE) && !defined(_DPT_BSDI) && !defined(_DPT_FREE_BSD))
class DPTControllerMap * map = new class DPTControllerMap;
#else
class DPTControllerMap * map = new DPTControllerMap;
#endif
int ctlr = map->getController( controller.hba, controller.bus );
delete map;
if( ctlr >= 0 )
{
command_Line[1] = CMD_SPECIFY_CTLR;
command_Line[2] = ctlr + '0';
}
else kds
{
command_Line[1] = CMD_SPECIFY_DPT;
command_Line[2] = controller.hba + '0';
} kds */
}
else
{
Error_in_Parsing(EventStrings[STR_PARSE_ERR_CTLR_DESGINATIONS_NOT_SUPPORTED],
this_Commands_Text);
}
}
if (( *command_Line == SW_DELIM_1) ||
( *command_Line == SW_DELIM_2))
{
const int LEN_STRING_ARG = 60;
char string_Arg[ LEN_STRING_ARG ];
unsigned long int_Arg;
bool is_Int_Arg = false;
bool delete_Hot_Spare;
command_Enum command_Char = (command_Enum) *++command_Line;
// advance past the command character.
command_Line++;
// advance past any white space to the parameter( s )
command_Line = Skip_White( command_Line );
// preserve this in case this command doesn't parse out to be a
// simple command. This keeps the command from having to do all
// the parsing.
string_Arg[0] = '\0';
if (command_Line)
{
// do some of this argument extraction once and for all here.
if(( command_Char != CMD_FLASH)
&&( isdigit( *command_Line )))
{
int_Arg = strtoul( command_Line, &command_Line, 10 );
is_Int_Arg = true;
}
else
{
char c;
// prevent Extract_Word() from looking past the next command
// if there are no arguments to this command.
c = *Skip_White( command_Line );
if(( c != SW_DELIM_1 && c != SW_DELIM_2 )
|| (command_Char == CMD_FLASH))
{
// get the next word ahead of time so that any
// commands that need only the next word won't have
// to hassle. Advance to the end of this word...
command_Line = Extract_Word( command_Line, string_Arg );
if(command_Char != CMD_FLASH)
{
// make it easier to compare...
To_Lower( string_Arg );
}
}
// indicate that this isn't an integer argument.
is_Int_Arg = false;
}
}
int rw = 1;
AlarmCommand cmd = None; // kmc
switch( command_Char )
{
// verbs
// Specify drive group( Create raid )
case CMD_DRIVE_GROUP:
{
SCSI_Addr_List *components;
SCSI_Addr_List *compsOmit;
compsOmit = new SCSI_Addr_List();
// zero means use default size
unsigned long raid_Size_in_Blocks = 0;
// back up to the beginning of this argument list by
// starting from the beginning of the command, then
// skipping the command.
command_Line = Skip_White(this_Commands_Text + LEN_OF_SW_AND_CMD);
if (command_Line == NULL)
{
Error_in_Parsing(EventStrings[STR_PARSE_ERR_MUST_SPECIFY_HBA],
this_Commands_Text );
goto END_OF_VERB;
}
// CR2080 - nobuild option 'N'
// this option can only come right after -g
// this is HIDDEN
bool nobuildOption = false;
if (command_Line[0] == 'N')
{
nobuildOption = true;
command_Line++;
}
components = Get_Address_List( command_Line,
&command_Line, this_Commands_Text, &done );
if (!done && (components->get_Num_Items() > 0)
&& (components->get_Item( 0 ).hba >= 0))
{
params.hba_Num = components->get_Item( 0 ).hba;
params.hba_Num_Specified = true;
}
if ( !params.hba_Num_Specified )
{
Error_in_Parsing(EventStrings[STR_PARSE_ERR_MUST_SPECIFY_HBA],
this_Commands_Text );
done = true;
}
if( !done )
{
if( params.logical_Drive_Capacity_in_Megs_Specified )
{
unsigned long raid_Size_in_K;
// convert this from megs( 1024 * 1024 ) to K's( 1024 )
raid_Size_in_K = params.logical_Drive_Capacity_in_Megs * 1024;
// convert this from K's to blocks
raid_Size_in_Blocks = ( raid_Size_in_K / BLOCK_SIZE ) * 1024;
}
// this should be used with just hba or just hba/bus number
// user now telling us how many drives to put in each array
int numDrivesPerArray = 0;
// only do this if user specified hba or hba/bus ONLY
if (components->get_Num_Items() == 1)
{
command_Line = Skip_White(command_Line);
if (command_Line != NULL)
{
if (isdigit(command_Line[0]))
{
numDrivesPerArray = command_Line[0] - 0x30;
command_Line++;
}
// look for devices to NOT put in the array/s
command_Line = Skip_White(command_Line);
if (command_Line != NULL)
{
if ((command_Line[0] == 'c') ||
(command_Line[0] == 'd'))
compsOmit = Get_Address_List (command_Line,
&command_Line,
this_Commands_Text, &done);
}
}
}
// no need to verify that some of these parameters
// have been specified, since the defaults are
// allowed for them.
{
Create_Raid *temp = new Create_Raid (components,
params.raid_Type, params.stripe_Size,
raid_Size_in_Blocks, nobuildOption,
ignoreNonfatalErrors,
numDrivesPerArray, compsOmit);
cmd_List->add_Item( *temp );
delete temp;
}
}
else
{
Error_in_Parsing(EventStrings[STR_PARSE_ERR_MUST_SPECIFY_ADDRESS], this_Commands_Text );
}
}
goto END_OF_VERB;
// expand array
case CMD_EXPAND_ARRAY:
{
SCSI_Address raidToExpand;
SCSI_Addr_List *components;
command_Line = this_Commands_Text + LEN_OF_SW_AND_CMD;
// get the raid to expand
command_Line = Get_Address (command_Line, &raidToExpand);
// get the components to expand with
components = Get_Address_List( command_Line,
&command_Line, this_Commands_Text, &done );
if (!done)
{
Expand *temp = new Expand (raidToExpand, components);
cmd_List->add_Item (*temp);
delete temp;
}
else
{
Error_in_Parsing(EventStrings[STR_PARSE_ERR_MUST_SPECIFY_ADDRESS],
this_Commands_Text );
}
}
goto END_OF_VERB;
case CMD_ZAP:
{
SCSI_Addr_List *components;
int resync = 0;
// back up to the beginning of this argument list by
// starting from the beginning of the command, then
// skipping the command.
command_Line = this_Commands_Text + LEN_OF_SW_AND_CMD;
components = Get_Address_List( command_Line, &command_Line,
this_Commands_Text, &done );
if (!done)
{
command_Line = Extract_Word(command_Line, string_Arg);
// default is NOT to resync
// change later when bad cache issue corrected.
if (command_Line != 0)
{
// see if resync is set on/enable
if (isdigit(*string_Arg))
resync = string_Arg[0] - 0x30;
else
command_Line = TranslateNext(string_Arg, &resync);
}
Zap * temp = new Zap (components, resync);
cmd_List->add_Item( *temp );
delete temp;
}
else
{
Error_in_Parsing(EventStrings[STR_PARSE_ERR_MUST_SPECIFY_ADDRESS], this_Commands_Text );
}
}
goto END_OF_VERB;
// Delete hot spare drive
case CMD_DELETE_HOT_SPARE:
delete_Hot_Spare = true;
goto DELETE_HOT_SPARE;
// Delete logical drive( s )
case CMD_DELETE_LOGICAL_DRIVE:
delete_Hot_Spare = false;
DELETE_HOT_SPARE:
if( is_Int_Arg )
{
SCSI_Addr_List *raids_to_Del;
// back up to the beginning of this argument list by
// starting from the beginning of the command, then skipping the command.
command_Line = Skip_White( this_Commands_Text ) + LEN_OF_SW_AND_CMD;
raids_to_Del = Get_Address_List( command_Line,
&command_Line,
this_Commands_Text,
&done );
if( done )
{
Error_in_Parsing(EventStrings[STR_PARSE_ERR_MUST_SPECIFY_ALL_OR_LIST], this_Commands_Text );
}
else
{
Delete_Raid * temp = new Delete_Raid( raids_to_Del,
delete_Hot_Spare );
cmd_List->add_Item( *temp );
delete temp;
}
}
else if( !strcmp( string_Arg, EventStrings[STR_CMD_LINE_ALL]) )
{
if( params.hba_Num_Specified )
{
// create an address for the controller.
SCSI_Address Temp( params.hba_Num,
params.hba_Bus_Specified ? params.hba_Bus : -1,
-1, -1 );
SCSI_Addr_List *components = new SCSI_Addr_List();
components->add_Item( Temp );
Delete_Raid * temp = new Delete_Raid( components,
delete_Hot_Spare );
cmd_List->add_Item( *temp );
delete temp;
}
else
{
Error_in_Parsing(EventStrings[STR_PARSE_ERR_MUST_SPECIFY_HBA], this_Commands_Text );
done = true;
}
}
else
{
SCSI_Addr_List *raids_to_Del;
// back up to the beginning of this argument list by
// starting from the beginning of the command, then skipping the command.
command_Line = Skip_White( this_Commands_Text ) + LEN_OF_SW_AND_CMD;
raids_to_Del = Get_Address_List( command_Line,
&command_Line,
this_Commands_Text,
&done );
if( done )
{
Error_in_Parsing(EventStrings[STR_PARSE_ERR_MUST_SPECIFY_ALL_OR_LIST], this_Commands_Text );
}
else
{
Delete_Raid * temp = new Delete_Raid( raids_to_Del,
delete_Hot_Spare );
cmd_List->add_Item( *temp );
delete temp;
}
}
goto END_OF_VERB;
// Create hot spare drive
case CMD_CREATE_HOT_SPARE:
{
SCSI_Addr_List *components;
// back up to the beginning of this argument list by
// starting from the beginning of the command, then skipping
// the command.
command_Line= this_Commands_Text + LEN_OF_SW_AND_CMD;
components = Get_Address_List( command_Line, &command_Line,
this_Commands_Text, &done );
if( !done )
{
// TBD: allow for the specification of the
// rebuild speed
Create_Raid * temp = new Create_Raid (components,
Command::RAID_TYPE_HOT_SPARE, 0, 0);
cmd_List->add_Item(*temp);
delete temp;
}
else
{
Error_in_Parsing(EventStrings[STR_PARSE_ERR_MUST_SPECIFY_ADDRESS], this_Commands_Text );
}
}
goto END_OF_VERB;
// Action( task ) control
case CMD_ACTION_TASK_CONTROL:
// options to this command: [build|rebuild|stop|verify|/|-?]
// [list] left in just in case somebody complains
SCSI_Addr_List *components;
command_Line = Skip_White(this_Commands_Text + LEN_OF_SW_AND_CMD);
TaskCommandOptions taskCmdOpts;
if (command_Line == NULL)
{
Error_in_Parsing(EventStrings[STR_PARSE_ERR_MUST_SPECIFY_ADDRESS], this_Commands_Text);
goto END_OF_VERB;
}
if (!memcmp(command_Line, EventStrings[STR_CMD_LINE_TASK_BUILD], strlen(EventStrings[STR_CMD_LINE_TASK_BUILD])))
{
taskCmdOpts = Build;
command_Line += strlen(EventStrings[STR_CMD_LINE_TASK_BUILD]);
}
else if (!memcmp(command_Line, EventStrings[STR_CMD_LINE_TASK_REBUILD], strlen(EventStrings[STR_CMD_LINE_TASK_REBUILD])))
{
taskCmdOpts = Rebuild;
command_Line += strlen(EventStrings[STR_CMD_LINE_TASK_REBUILD]);
}
else if (!memcmp(command_Line, EventStrings[STR_CMD_LINE_TASK_STOP], strlen(EventStrings[STR_CMD_LINE_TASK_STOP])))
{
taskCmdOpts = Stop;
command_Line += strlen(EventStrings[STR_CMD_LINE_TASK_STOP]);
}
else if (!memcmp(command_Line, EventStrings[STR_CMD_LINE_TASK_LIST], strlen(EventStrings[STR_CMD_LINE_TASK_LIST])))
{
taskCmdOpts = List;
command_Line += strlen(EventStrings[STR_CMD_LINE_TASK_LIST]);
}
else if (!memcmp(command_Line, EventStrings[STR_CMD_LINE_TASK_VERIFY_NO_FIX], strlen(EventStrings[STR_CMD_LINE_TASK_VERIFY_NO_FIX])))
{
taskCmdOpts = VerifyNoFix;
command_Line += strlen(EventStrings[STR_CMD_LINE_TASK_VERIFY_NO_FIX]);
}
else if (!memcmp(command_Line, EventStrings[STR_CMD_LINE_TASK_VERIFY], strlen(EventStrings[STR_CMD_LINE_TASK_VERIFY])))
{
taskCmdOpts = Verify;
command_Line += strlen(EventStrings[STR_CMD_LINE_TASK_VERIFY]);
}
else if (!memcmp(command_Line, "-?", 2))
{
taskCmdOpts = List;
command_Line += 2;
}
else if (!memcmp(command_Line, "?", 1))
{
taskCmdOpts = List;
command_Line++;
}
else if (!memcmp(command_Line, "d", 1) ||
!memcmp(command_Line, "c", 1))
{
taskCmdOpts = List;
}
else
{
Error_in_Parsing(EventStrings[STR_PARSE_ERR_INVALID_CMD_OR_OPTION_TO_CMD], this_Commands_Text);
goto END_OF_VERB;
}
components = Get_Address_List(command_Line, &command_Line,
this_Commands_Text, &done);
if (!done)
{
TaskControl *temp = new TaskControl(components, taskCmdOpts);
cmd_List->add_Item(*temp);
delete temp;
}
else
{
Error_in_Parsing(EventStrings[STR_PARSE_ERR_MUST_SPECIFY_ADDRESS], this_Commands_Text);
}
goto END_OF_VERB;
// Force state (optimal/fail)
case CMD_FORCE_STATE:
// CMD_FORCE_STATE
{
// options to this command: [optimal|fail]
SCSI_Addr_List *components;
command_Line = Skip_White(this_Commands_Text + LEN_OF_SW_AND_CMD);
ForceStateOptions cmdOpts;
if (command_Line == NULL)
{
Error_in_Parsing(EventStrings[STR_PARSE_ERR_MUST_SPECIFY_ADDRESS], this_Commands_Text);
goto END_OF_VERB;
}
if (!memcmp(command_Line, EventStrings[STR_CMD_LINE_OPTIMAL], strlen(EventStrings[STR_CMD_LINE_OPTIMAL])))
{
cmdOpts = Optimal;
command_Line += strlen(EventStrings[STR_CMD_LINE_OPTIMAL]);
}
else if (!memcmp(command_Line, EventStrings[STR_CMD_LINE_FAIL], strlen(EventStrings[STR_CMD_LINE_FAIL])))
{
cmdOpts = Fail;
command_Line += strlen(EventStrings[STR_CMD_LINE_FAIL]);
}
else if (!memcmp(command_Line, "?", 1))
{
cmdOpts = Current;
command_Line ++;
}
else if (!memcmp(command_Line, "-?", 2))
{
cmdOpts = Current;
command_Line += 2;
}
else if ((!memcmp(command_Line, "c", 1)) ||
(!memcmp(command_Line, "d", 1)))
{
cmdOpts = Current;
}
else
{
Error_in_Parsing(EventStrings[STR_PARSE_ERR_INVALID_CMD_OR_OPTION_TO_CMD], this_Commands_Text);
goto END_OF_VERB;
}
components = Get_Address_List(command_Line, &command_Line,
this_Commands_Text, &done);
if (!done)
{
ForceState *temp = new ForceState(components, cmdOpts);
cmd_List->add_Item(*temp);
delete temp;
}
else
{
Error_in_Parsing(EventStrings[STR_PARSE_ERR_MUST_SPECIFY_ADDRESS], this_Commands_Text);
}
goto END_OF_VERB;
}
break;
// View the event log
case CMD_VIEW_LOG:
{
SCSI_Addr_List *components = new SCSI_Addr_List();
command_Line = Skip_White(this_Commands_Text + LEN_OF_SW_AND_CMD);
EventLogOptions eventLogOpts;
if (params.hba_Num_Specified == true)
{
// if bus specified too, just ignore it.
SCSI_Address Temp( params.hba_Num, -1, -1, -1 );
components->add_Item (Temp);
}
if (command_Line == NULL)
{
Error_in_Parsing(EventStrings[STR_PARSE_ERR_MUST_SPECIFY_ADDRESS], this_Commands_Text);
goto END_OF_VERB;
}
if (!memcmp(command_Line, EventStrings[STR_CMD_LINE_LOG_SOFT], strlen(EventStrings[STR_CMD_LINE_LOG_SOFT])))
{
eventLogOpts = Soft;
command_Line += strlen(EventStrings[STR_CMD_LINE_LOG_SOFT]);
}
else if (!memcmp(command_Line, EventStrings[STR_CMD_LINE_LOG_RECOV], strlen(EventStrings[STR_CMD_LINE_LOG_RECOV])))
{
eventLogOpts = Recov;
command_Line += strlen(EventStrings[STR_CMD_LINE_LOG_RECOV]);
}
else if (!memcmp(command_Line, EventStrings[STR_CMD_LINE_LOG_NONRECOV], strlen(EventStrings[STR_CMD_LINE_LOG_NONRECOV])))
{
eventLogOpts = Nonrecov;
command_Line += strlen(EventStrings[STR_CMD_LINE_LOG_NONRECOV]);
}
else if (!memcmp(command_Line, EventStrings[STR_CMD_LINE_LOG_STATUS], strlen(EventStrings[STR_CMD_LINE_LOG_STATUS])))
{
eventLogOpts = StatusChg;
command_Line += strlen(EventStrings[STR_CMD_LINE_LOG_STATUS]);
}
else if (!memcmp(command_Line, EventStrings[STR_CMD_LINE_LOG_DELETE], strlen(EventStrings[STR_CMD_LINE_LOG_DELETE])))
{
eventLogOpts = Delete;
command_Line += strlen(EventStrings[STR_CMD_LINE_LOG_DELETE]);
}
else if (!memcmp(command_Line, EventStrings[STR_CMD_LINE_LOG_BOARD], strlen(EventStrings[STR_CMD_LINE_LOG_BOARD])))
{
eventLogOpts = Board;
command_Line += strlen(EventStrings[STR_CMD_LINE_LOG_BOARD]);
}
else if (!memcmp(command_Line, "?", 1))
{
eventLogOpts = Soft;
command_Line++;
}
else if (!memcmp(command_Line, "-?", 2))
{
eventLogOpts = Soft;
command_Line += 2;
}
else if ((!memcmp(command_Line, "c", 1)) ||
(!memcmp(command_Line, "d", 1)))
{
eventLogOpts = Soft;
}
else
{
Error_in_Parsing(EventStrings[STR_PARSE_ERR_INVALID_CMD_OR_OPTION_TO_CMD], this_Commands_Text);
goto END_OF_VERB;
}
if (params.hba_Num_Specified != true)
{
components = Get_Address_List(command_Line, &command_Line,
this_Commands_Text, &done);
}
if (!done)
{
EventLog *temp = new EventLog (components, eventLogOpts);
cmd_List->add_Item (*temp);
delete temp;
}
else
Error_in_Parsing(EventStrings[STR_PARSE_ERR_MUST_SPECIFY_ADDRESS], this_Commands_Text);
goto END_OF_VERB;
}
// Predictive caching control
case CMD_PREDICTIVE_CACHING_CONTROL:
// Specify pre-fetch size
case CMD_PREFETCH_SIZE:
// Specify read-ahead size
case CMD_READ_AHEAD_SIZE:
Error_in_Parsing(EventStrings[STR_PARSE_ERR_UNIMPLEMENTED_COMMAND], this_Commands_Text );
done = true;
goto END_OF_VERB;
// kmc - Alarm commands/status
case CMD_ALARM_STATUS:
// This command should look something like this coming in:
// 'dptutil c1 -A option' where option is [on|off|enable|disable|-?]
command_Line = Skip_White( this_Commands_Text + LEN_OF_SW_AND_CMD );
if ( command_Line == 0 ) // nothing
{
// CR2047 - go ahead and show Status
//cmd = None;
cmd = Status;
}
else if ( command_Line[0] == 'o' ) // on
{
if ( command_Line[1] == 'n' )
{
command_Line += 2;
cmd = On;
}
else if (( command_Line[1] == 'f' ) && ( command_Line[2] == 'f' )) // off
{
command_Line += 3;
cmd = Off;
}
}
else if ( command_Line[0] == 'e' ) // enable
{
if (( command_Line[1] == 'n' ) && ( command_Line[2] == 'a' ) &&
( command_Line[3] == 'b' ) && ( command_Line[4] == 'l' ) &&
( command_Line[5] == 'e' ))
{
command_Line += 6;
cmd = Enable;
}
}
else if ( command_Line[0] == 'd' ) // disable
{
if (( command_Line[1] == 'i' ) && ( command_Line[2] == 's' ) &&
( command_Line[3] == 'a' ) && ( command_Line[4] == 'b' ) &&
( command_Line[5] == 'l' ) && ( command_Line[6] == 'e' ))
{
command_Line += 7;
cmd = Disable;
}
}
else if ( command_Line[0] == '?' ) // ?
{
command_Line++;
cmd = Status;
}
else if (( command_Line[0] == '-' ) && ( command_Line[1] == '?')) // -?
{
command_Line+=2;
cmd = Status;
}
else if (command_Line[0] == '-') // next command
cmd = Status;
if ( !done )
{
int theHBA = -1;
if ( params.hba_Num_Specified )
{
theHBA = params.hba_Num;
}
AlarmStatus* temp = new AlarmStatus( theHBA, cmd );
cmd_List->add_Item( *temp );
delete temp;
}
else
{
Error_in_Parsing(EventStrings[STR_PARSE_ERR_MUST_SPECIFY_ADDRESS], this_Commands_Text );
}
goto END_OF_VERB;
// Write caching
case CMD_WRITE_CACHING:
rw = 2;
goto WE_CAN_WRITE_CACHE;
// Host read caching
// case CMD_HOST_READ_CACHING:
// for CR2038 - this command is not implemented in the FIRMWARE
// when it is, we can take these 4 lines out (AND above goto).
// Error_in_Parsing( STR_PARSE_ERR_UNIMPLEMENTED_COMMAND, this_Commands_Text );
// done = true;
// goto END_OF_VERB;
WE_CAN_WRITE_CACHE:
{
SCSI_Addr_List *components;
// back up to the beginning of this argument list by
// starting from the beginning of the command, then skipping
// the command.
command_Line= Skip_White( this_Commands_Text + LEN_OF_SW_AND_CMD );
// Parse on or off
int on = -1;
command_Line = TranslateNext(command_Line, &on);
// if on is still -1, then none of the parms
// matched SO check for ? or -? or device
if (on == -1)
{
if ( command_Line[0] == '?' )
{
++command_Line;
on = -2;
}
else if (( command_Line[0] == '-' )
&& ( command_Line[1] == '?' ))
{
command_Line += 2;
on = -2;
}
// Device?
else if ((command_Line[0] == 'c') ||
(command_Line[0] == 'd'))
{
on = -2;
}
}
// if on never set correctly, error
if ( on == -1 )
{
Error_in_Parsing(EventStrings[STR_PARSE_ERR_INVALID_CMD_OR_OPTION_TO_CMD], this_Commands_Text);
goto END_OF_VERB;
}
components = Get_Address_List( command_Line, &command_Line,
this_Commands_Text, &done );
if( !done )
{
SetCache * temp = new SetCache( components, on, rw );
cmd_List->add_Item( *temp );
delete temp;
}
else
{
Error_in_Parsing(EventStrings[STR_PARSE_ERR_MUST_SPECIFY_ADDRESS], this_Commands_Text );
}
}
goto END_OF_VERB;
// Load and Save Configuration from/to file
case CMD_LOAD_SAVE_CONFIGURATION:
if (*string_Arg == '\0')
{
Error_in_Parsing(EventStrings[STR_PARSE_ERR_INVALID_CMD_OR_OPTION_TO_CMD], this_Commands_Text);
done = true;
}
else
{
command_Line = Skip_White(this_Commands_Text + LEN_OF_SW_AND_CMD);
ConfigureOption cfgOpt;
bool nobuildOption = false;
if (command_Line[0] == 'N')
{
nobuildOption = true;
command_Line++;
}
if (command_Line[0] == ' ')
command_Line++;
if (!memcmp(command_Line, EventStrings[STR_CMD_LINE_LOAD], strlen(EventStrings[STR_CMD_LINE_LOAD])))
{
cfgOpt = LoadCfg;
command_Line += strlen(EventStrings[STR_CMD_LINE_LOAD]);
}
else if (!memcmp(command_Line, EventStrings[STR_CMD_LINE_SAVE], strlen(EventStrings[STR_CMD_LINE_SAVE])))
{
cfgOpt = SaveCfg;
command_Line += strlen(EventStrings[STR_CMD_LINE_SAVE]);
}
else
{
Error_in_Parsing(EventStrings[STR_PARSE_ERR_INVALID_CMD_OR_OPTION_TO_CMD], this_Commands_Text);
done = true;
goto END_OF_VERB;
}
command_Line = Extract_Word (command_Line, string_Arg);
if (command_Line == NULL)
{
done = true;
Error_in_Parsing (EventStrings[STR_PARSE_ERR_MUST_SUPPLY_FILE_NAME], this_Commands_Text);
}
else
{
Config *temp = new Config (string_Arg, cfgOpt,
nobuildOption);
cmd_List->add_Item (*temp);
delete temp;
}
}
goto END_OF_VERB;
// Reset/Clear RAID store
// This is Zap
/* case CMD_RESET_CLEAR_RAID_STORE:
Error_in_Parsing( STR_PARSE_ERR_UNIMPLEMENTED_COMMAND, this_Commands_Text );
done = true;
goto END_OF_VERB;*/
// Reset NVRAM configuration
case CMD_RESET_NVRAM_CONFIG:
{
// default is NOT to resync
// change later when bad cache issue corrected.
int resync = 0;
if (*command_Line != 0)
{
// see if resync is set on/enable
if (is_Int_Arg)
resync = int_Arg;
else
command_Line = TranslateNext(string_Arg, &resync);
}
if( params.hba_Num_Specified )
{
Reset_NVRam * temp = new Reset_NVRam (params.hba_Num, resync);
cmd_List->add_Item( *temp );
delete temp;
}
else
{
Error_in_Parsing(EventStrings[STR_PARSE_ERR_MUST_SPECIFY_HBA], this_Commands_Text );
done = true;
}
goto END_OF_VERB;
}
// View Battery Status
// This is -L battery
/* case CMD_BATTERY_STATUS_INFO:
Error_in_Parsing( STR_PARSE_ERR_UNIMPLEMENTED_COMMAND, this_Commands_Text );
done = true;
goto END_OF_VERB;*/
case CMD_EOL_COMMENT:
// ignore the rest of the command-line, it is a comment (used
// for debugging only)
command_Line = 0;
goto END_OF_VERB;
// List devices
case CMD_LIST_DEVICES:
{
int i = 0;
static str_to_Const_Struct list_Dev_Types[25];
list_Dev_Types[i].str = EventStrings[STR_CMD_LINE_PHYSICAL];
list_Dev_Types[i++].constant = List_Device::LIST_PHYSICALS;
list_Dev_Types[i].str = EventStrings[STR_CMD_LINE_PHYSICALS];
list_Dev_Types[i++].constant = List_Device::LIST_PHYSICALS;
list_Dev_Types[i].str = EventStrings[STR_CMD_LINE_LOGICAL];
list_Dev_Types[i++].constant = List_Device::LIST_LOGICALS;
list_Dev_Types[i].str = EventStrings[STR_CMD_LINE_LOGICALS];
list_Dev_Types[i++].constant = List_Device::LIST_LOGICALS;
list_Dev_Types[i].str = EventStrings[STR_CMD_LINE_CONTROLLER];
list_Dev_Types[i++].constant = List_Device::LIST_CONTROLLERS;
list_Dev_Types[i].str = EventStrings[STR_CMD_LINE_CONTROLLERS];
list_Dev_Types[i++].constant = List_Device::LIST_CONTROLLERS;
list_Dev_Types[i].str = EventStrings[STR_CMD_LINE_SPARE];
list_Dev_Types[i++].constant = List_Device::LIST_HOT_SPARES;
list_Dev_Types[i].str = EventStrings[STR_CMD_LINE_SPARES];
list_Dev_Types[i++].constant = List_Device::LIST_HOT_SPARES;
list_Dev_Types[i].str = EventStrings[STR_CMD_LINE_HOTSPARE];
list_Dev_Types[i++].constant = List_Device::LIST_HOT_SPARES;
list_Dev_Types[i].str = EventStrings[STR_CMD_LINE_HOTSPARES];
list_Dev_Types[i++].constant = List_Device::LIST_HOT_SPARES;
list_Dev_Types[i].str = EventStrings[STR_CMD_LINE_ARRAY];
list_Dev_Types[i++].constant = List_Device::LIST_ARRAY;
list_Dev_Types[i].str = EventStrings[STR_CMD_LINE_ARRAYS];
list_Dev_Types[i++].constant = List_Device::LIST_ARRAY;
list_Dev_Types[i].str = EventStrings[STR_CMD_LINE_ALL];
list_Dev_Types[i++].constant = List_Device::LIST_ALL;
list_Dev_Types[i].str = EventStrings[STR_CMD_LINE_ALL_VENDOR];
list_Dev_Types[i++].constant = List_Device::LIST_ALL_VENDOR;
list_Dev_Types[i].str = EventStrings[STR_CMD_LINE_SPEED];
list_Dev_Types[i++].constant = List_Device::LIST_SPEED;
list_Dev_Types[i].str = EventStrings[STR_CMD_LINE_REDIRECT];
list_Dev_Types[i++].constant = List_Device::LIST_REDIRECT;
list_Dev_Types[i].str = EventStrings[STR_CMD_LINE_VERSION];
list_Dev_Types[i++].constant = List_Device::LIST_VERSION;
list_Dev_Types[i].str = EventStrings[STR_CMD_LINE_CACHE];
list_Dev_Types[i++].constant = List_Device::LIST_CACHE;
list_Dev_Types[i].str = EventStrings[STR_CMD_LINE_INQUIRY];
list_Dev_Types[i++].constant = List_Device::LIST_INQUIRY;
list_Dev_Types[i].str = EventStrings[STR_CMD_LINE_INQUIRY_VENDOR];
list_Dev_Types[i++].constant = List_Device::LIST_INQUIRY_VENDOR;
list_Dev_Types[i].str = EventStrings[STR_CMD_LINE_BATTERY];
list_Dev_Types[i++].constant = List_Device::LIST_BATTERY;
// karla's debug for listing tags
list_Dev_Types[i].str = EventStrings[STR_CMD_LINE_TAGS];
list_Dev_Types[i++].constant = List_Device::LIST_TAGS;
// end of karla's debug (1 line only)
list_Dev_Types[i].str = EventStrings[STR_CMD_LINE_ARRAYNAME];
list_Dev_Types[i++].constant = List_Device::LIST_ARRAYNAME;
list_Dev_Types[i].str = "";
list_Dev_Types[i++].constant = List_Device::LIST_INVALID_DEVICE_TYPE;
List_Device::list_Type list_Devices_Of_Type;
list_Devices_Of_Type = (List_Device::list_Type )
Str_to_Constant( string_Arg, list_Dev_Types );
if( list_Devices_Of_Type == List_Device::LIST_INVALID_DEVICE_TYPE )
{
Error_in_Parsing(EventStrings[STR_PARSE_ERR_NOT_A_VALID_LIST_TYPE], this_Commands_Text );
done= true;
}
else
{
Command *list_Device;
// even if they specified a controller number, if they
// want to list controllers, ignore the number they specified.
if( params.hba_Num_Specified)
// per CR2072 - make the option of getting the info for a specified hba
// if no hba is specified, all are listed
// && list_Devices_Of_Type != List_Device::LIST_CONTROLLERS)
{
// Keep these lines separate for SCO (Unixware)
SCSI_Address addr = SCSI_Address(params.hba_Num);
list_Device = new List_Device(list_Devices_Of_Type, addr);
}
else
{
list_Device = new List_Device(list_Devices_Of_Type);
}
cmd_List->add_Item(*list_Device);
delete list_Device;
}
}
goto END_OF_VERB;
// Display inquiry information
case CMD_DISPLAY_INQ_INFO:
{
SCSI_Addr_List *components;
// see if an arg was specified. if so, then this is
// an inq of a physical device. Otherwise, it is an
// inq of an HBA.
//
// back up to the beginning of this argument list by
// starting from the beginning of the command, then
// skipping the command.
command_Line= this_Commands_Text + LEN_OF_SW_AND_CMD;
components = Get_Address_List( command_Line,
&command_Line, this_Commands_Text, &done);
if( !done && ( components->get_Num_Items() > 0 )
&& ( components->get_Item( 0 ).hba >= 0 ))
{
params.hba_Num = components->get_Item( 0 ).hba;
params.hba_Num_Specified = true;
}
// this was put back in because usage page says
// the device is optional
if ((components->get_Num_Items() == 0) ||
(components->get_Item(0).id < 0))
{
// create an address for the controller
SCSI_Address temp(params.hba_Num, params.hba_Bus, -1, -1);
components = new SCSI_Addr_List();
components->add_Item(temp);
done = false;
}
if( !done )
{
// if there is an target id argument, then this
// must be for a physical device. If it isn't,
// then it is a controller.
Show_Inquiry * temp = new Show_Inquiry(
components->get_Item( 0 ));
cmd_List->add_Item( *temp );
delete temp;
}
}
goto END_OF_VERB;
case CMD_IGNORE_NONFATAL_ERRORS:
{
ignoreNonfatalErrors = true;
}
goto END_OF_VERB;
// Quiet mode
case CMD_QUIET_MODE:
{
Quiet_Mode *temp = new Quiet_Mode( quiet_Mode );
cmd_List->add_Item( *temp );
delete temp;
}
goto END_OF_VERB;
// Pagenation mode
case CMD_PAGENATION_MODE:
{
Pagenation_Mode mode;
mode.SetPagenationMode(true);
}
goto END_OF_VERB;
// Display usage informaiton
case CMD_SHOW_UTIL_USAGE:
{
Show_Usage *temp = new Show_Usage();
cmd_List->add_Item( *temp );
delete temp;
}
goto END_OF_VERB;
END_OF_VERB:
Reset_Params_to_Defaults();
break;
// modifiers
#if !defined _DPT_WIN_NT && !defined _DPT_LINUX && !defined _DPT_UNIXWARE
// Specify Controllers
case CMD_SPECIFY_CTLR:
if( params.hba_Num_Specified )
{
Error_in_Parsing(EventStrings[STR_PARSE_ERR_SWITCH_MULTIPLY_DEFINED], this_Commands_Text );
done = true;
}
else
{
if( is_Int_Arg )
{
DPTControllerMap map;
int dpt = map.getHba( int_Arg );
int bus = map.getBus( int_Arg );
if ( dpt < 0 )
{
Error_in_Parsing(EventStrings[STR_PARSE_ERR_CTLR_DESGINATIONS_NOT_SUPPORTED], this_Commands_Text );
}
else
{
params.hba_Num_Specified = true;
params.hba_Num = dpt;
params.hba_Bus_Specified = true;
params.hba_Bus = bus;
}
}
else
{
SCSI_Address controller;
(void)Get_Address (string_Arg, &controller);
if ( controller.hba != -1 )
{
params.hba_Num_Specified= true;
params.hba_Num = controller.hba;
if ( controller.bus != -1 )
{
params.hba_Bus_Specified= true;
params.hba_Bus = controller.bus;
}
}
else
{
Error_in_Parsing(EventStrings[STR_PARSE_ERR_CTLR_DESGINATIONS_NOT_SUPPORTED],
this_Commands_Text);
done = true;
}
}
}
break;
#endif
case CMD_SPECIFY_DPT:
if( params.hba_Num_Specified )
{
Error_in_Parsing(EventStrings[STR_PARSE_ERR_SWITCH_MULTIPLY_DEFINED],
this_Commands_Text);
done = true;
}
else
{
if( is_Int_Arg )
{
params.hba_Num_Specified = true;
params.hba_Num = int_Arg;
}
else
{
Error_in_Parsing(EventStrings[STR_PARSE_ERR_CTLR_DESGINATIONS_NOT_SUPPORTED],
this_Commands_Text);
done = true;
}
}
break;
// Specify new logical drive RAID level
case CMD_RAID_LEVEL:
if( params.raid_Type_Specified )
{
Error_in_Parsing(EventStrings[STR_PARSE_ERR_SWITCH_MULTIPLY_DEFINED],
this_Commands_Text);
done = true;
}
else
{
if( is_Int_Arg )
{
params.raid_Type_Specified = true;
if ( int_Arg == 50 )
{
int_Arg = 5;
}
else if ( int_Arg == 10 )
{
int_Arg = 1;
}
params.raid_Type = ( Create_Raid::Raid_Type ) int_Arg;
}
else if (string_Arg[0] == 'j')
{
params.raid_Type = (Create_Raid::Raid_Type) RAID_REDIRECT;
}
else
{
Error_in_Parsing(EventStrings[STR_PARSE_ERR_MUST_BE_INTEGER_VALUE], this_Commands_Text );
done = true;
}
}
break;
// Specify logical drive number
case CMD_LOGICAL_DRIVE_NUM:
Error_in_Parsing(EventStrings[STR_PARSE_ERR_UNIMPLEMENTED_COMMAND], this_Commands_Text);
done = true;
break;
#if 0 // Unreachable Code
if( is_Int_Arg )
{
if( params.logical_Drive_Number )
{
// back up to the beginning of this argument list by
// starting from the beginning of the command, then skipping
// the command.
command_Line= this_Commands_Text + LEN_OF_SW_AND_CMD;
*params.logical_Drive_Number += *Get_Int_List(
command_Line, &command_Line,
this_Commands_Text, &done );
}
else
{
// back up to the beginning of this argument list by
// starting from the beginning of the command, then skipping
// the command.
command_Line= this_Commands_Text + LEN_OF_SW_AND_CMD;
params.logical_Drive_Number =
Get_Int_List( command_Line, &command_Line,
this_Commands_Text, &done );
}
}
break;
#endif
// display cluster support "enabled/disabled"
case CMD_CLUSTER_SUPPORT:
command_Line = this_Commands_Text + LEN_OF_SW_AND_CMD;
NvramBit *temp;
if (params.hba_Num_Specified)
temp = new NvramBit (Cluster, params.hba_Num, -1);
else
temp = new NvramBit (Cluster, -1, -1);
cmd_List->add_Item (*temp);
delete temp;
break;
// Specify Logical drive capacity
case CMD_LOGICAL_DRIVE_CAPACITY:
// CMD_LOGICAL_DRIVE_CAPACITY
{
if( params.logical_Drive_Capacity_in_Megs_Specified )
{
Error_in_Parsing(EventStrings[STR_PARSE_ERR_SWITCH_MULTIPLY_DEFINED], this_Commands_Text );
done = true;
}
else
{
if( is_Int_Arg )
{
params.logical_Drive_Capacity_in_Megs_Specified = true;
params.logical_Drive_Capacity_in_Megs = int_Arg;
}
else
{
Error_in_Parsing(EventStrings[STR_PARSE_ERR_DRIVE_CAPACITY_MUST_BE_INTEGER], this_Commands_Text );
done = true;
}
}
}
break;
// Specify logical drive stripe size
case CMD_LOGICAL_DRIVE_STRIPE_SIZE:
if( params.stripe_Size_Specified )
{
Error_in_Parsing(EventStrings[STR_PARSE_ERR_SWITCH_MULTIPLY_DEFINED], this_Commands_Text );
done = true;
}
else
{
if( is_Int_Arg )
{
params.stripe_Size_Specified= true;
// accept non-abbreviated stripe sizes
if( int_Arg < 8192 )
{
int_Arg *= 1024;
}
switch( int_Arg )
{
// the only valid strip sizes
case 8192:
case 16384:
case 32768:
case 65536:
case 131072:
case 262144:
params.stripe_Size_Specified = true;
params.stripe_Size = int_Arg;
break;
default:
Error_in_Parsing(EventStrings[STR_PARSE_ERR_INVALID_STRIPE_SIZE], this_Commands_Text );
done = true;
break;
}
}
}
break;
// Specify task rate( priority )
case CMD_TASK_RATE:
if( params.task_Rate_Specified )
{
Error_in_Parsing(EventStrings[STR_PARSE_ERR_SWITCH_MULTIPLY_DEFINED], this_Commands_Text );
done = true;
}
else
{
command_Line = Skip_White(this_Commands_Text + LEN_OF_SW_AND_CMD);
if (command_Line == NULL)
done = true;
params.task_Rate_Specified = true;
if (is_Int_Arg)
{
if ((int_Arg < 0) || (int_Arg > 9))
{
Error_in_Parsing(EventStrings[STR_PARSE_ERR_INVALID_TASK_RATE], this_Commands_Text );
params.task_Rate_Specified = false;
done = true;
}
else
{
params.task_Rate = int_Arg;
command_Line++;
}
}
else
{
if (!done)
{
if (!strncmp(command_Line, EventStrings[STR_CMD_LINE_TASK_RATE_SLOW], strlen(EventStrings[STR_CMD_LINE_TASK_RATE_SLOW])))
{
params.task_Rate = 1;
command_Line += strlen(EventStrings[STR_CMD_LINE_TASK_RATE_SLOW]);
}
else if (!strncmp(command_Line, EventStrings[STR_CMD_LINE_TASK_RATE_MEDSLOW], strlen(EventStrings[STR_CMD_LINE_TASK_RATE_MEDSLOW])))
{
params.task_Rate = 3;
command_Line += strlen(EventStrings[STR_CMD_LINE_TASK_RATE_MEDSLOW]);
}
else if (!strncmp(command_Line, EventStrings[STR_CMD_LINE_TASK_RATE_MEDFAST], strlen(EventStrings[STR_CMD_LINE_TASK_RATE_MEDFAST])))
{
params.task_Rate = 7;
command_Line += strlen(EventStrings[STR_CMD_LINE_TASK_RATE_MEDFAST]);
}
else if (!strncmp(command_Line, EventStrings[STR_CMD_LINE_TASK_RATE_MED], strlen(EventStrings[STR_CMD_LINE_TASK_RATE_MED])))
{
params.task_Rate = 5;
command_Line += strlen(EventStrings[STR_CMD_LINE_TASK_RATE_MED]);
}
else if (!strncmp(command_Line, EventStrings[STR_CMD_LINE_TASK_RATE_FAST], strlen(EventStrings[STR_CMD_LINE_TASK_RATE_FAST])))
{
params.task_Rate = 9;
command_Line += strlen(EventStrings[STR_CMD_LINE_TASK_RATE_FAST]);
}
else if (!strncmp(command_Line, "?", 1))
{
params.task_Rate = -1;
command_Line++;
}
else if (!strncmp(command_Line, "-?", 2))
{
params.task_Rate = -1;
command_Line += 2;
}
else if ((!strncmp(command_Line, "c", 1)) ||
(!strncmp(command_Line, "d", 1)))
{
params.task_Rate = -1;
}
else
{
params.task_Rate_Specified = false;
}
}
}
if (params.task_Rate_Specified)
{
SCSI_Addr_List *components;
components = Get_Address_List (command_Line, &command_Line, this_Commands_Text, &done);
if (done && ( params.hba_Num_Specified ))
{
// create an address for the controller.
SCSI_Address temp( params.hba_Num, params.hba_Bus, -1, -1 );
components = new SCSI_Addr_List();
components->add_Item( temp );
done = false;
}
if (!done)
{
SetRate * temp = new SetRate (params.task_Rate,
components);
cmd_List->add_Item(*temp);
delete temp;
}
else
{
Error_in_Parsing(EventStrings[STR_PARSE_ERR_MUST_SPECIFY_ADDRESS], this_Commands_Text);
}
}
else
{
Error_in_Parsing(EventStrings[STR_PARSE_ERR_INVALID_CMD_OR_OPTION_TO_CMD], this_Commands_Text);
}
}
break;
// Specify maximum negotiated speed
case CMD_SCSI_MHZ:
Error_in_Parsing(EventStrings[STR_PARSE_ERR_UNDEFINED_SWITCH], this_Commands_Text );
done = true;
break;
#if 0
{
int speed = -1;
if( is_Int_Arg )
{
speed = int_Arg;
}
else if (!strcmp (string_Arg, EventStrings[STR_ASYNC]))
{
speed = 0;
}
else if(( *string_Arg == '\0' )
|| !strcmp( string_Arg, "-?" )
|| !strcmp( string_Arg, "?" ) )
{
speed = -1;
if ( *string_Arg != '\0' ) { command_Line += 2; }
}
else
{
speed = -2;
}
switch (speed)
{
case -1:
case 0:
case 5:
case 8:
case 10:
case 20:
case 40:
break;
default:
Error_in_Parsing(EventStrings[STR_PARSE_ERR_INVALID_SPEED],
this_Commands_Text );
done = true;
}
if ( !params.hba_Num_Specified )
{
Error_in_Parsing(EventStrings[STR_PARSE_ERR_MUST_SPECIFY_HBA],
this_Commands_Text );
done = true;
}
if ( done != true )
{
SetSpeed * temp = new SetSpeed ( speed,
params.hba_Num_Specified ? params.hba_Num : -1,
params.hba_Bus_Specified ? params.hba_Bus : -1 );
cmd_List->add_Item( *temp );
delete temp;
}
}
goto END_OF_VERB;
#endif
case CMD_FLASH:
#if defined _DPT_NETWARE
Error_in_Parsing(EventStrings[STR_PARSE_ERR_NO_FLASH_FOR_NETWARE], this_Commands_Text );
done = true;
#endif
if ( *string_Arg == '\0' )
{
Error_in_Parsing(EventStrings[STR_PARSE_ERR_MUST_SUPPLY_IMAGE], this_Commands_Text );
done = true;
}
else
{
Flash * temp;
command_Line = Skip_White(command_Line);
// default is NOT to resync
// change later when bad cache issue corrected.
int resync = 0;
if (*command_Line != 0)
{
// see if resync is set on/enable
command_Line = TranslateNext(command_Line, &resync);
}
if ( !params.hba_Num_Specified )
{
temp = new Flash ( string_Arg, resync);
}
else
{
temp = new Flash( string_Arg, resync, params.hba_Num);
}
cmd_List->add_Item( *temp );
delete temp;
}
goto END_OF_VERB;
default:
Error_in_Parsing(EventStrings[STR_PARSE_ERR_UNDEFINED_SWITCH], this_Commands_Text );
done = true;
break;
}
}
// this section to match on strings
// all these are HIDDEN!!!!!!!!!!!!!
else if (*command_Line == SW_DELIM_3)
{
command_Line = Skip_White (this_Commands_Text);
#if 0 // MGS - This feature was removed from Firmware, no CR assigned to this feature removal.
// CMD_FUA_CLUSTER - this is HIDDEN!!!!!!!!!!!!
if (!strncmp(command_Line, "+clusterfua", strlen("clusterfua")))
{
command_Line = command_Line + 1 + strlen("clusterfua");
int temp_set = -1;
command_Line = TranslateNext(command_Line, &temp_set);
NvramBit *temp;
if (params.hba_Num_Specified)
temp = new NvramBit (Cluster_FUA, params.hba_Num, temp_set);
else
temp = new NvramBit (Cluster_FUA, -1, temp_set);
cmd_List->add_Item (*temp);
delete temp;
}
// CMD_CACHE_STALE - this is HIDDEN!!!!!!!!!!!!
else
#endif
if (!strncmp(command_Line, "+cachestale", strlen("+cachestale")))
{
command_Line = command_Line + 1 + strlen("cachestale");
int temp_set = -1;
command_Line = TranslateNext(command_Line, &temp_set);
NvramBit *temp;
if (params.hba_Num_Specified)
temp = new NvramBit (Cache_Stale, params.hba_Num, temp_set);
else
temp = new NvramBit (Cache_Stale, -1, temp_set);
cmd_List->add_Item (*temp);
delete temp;
}
else if (!strncmp(command_Line, "+cluster", strlen("cluster")))
{
command_Line = command_Line + 1 + strlen("cluster");
int temp_set = -1;
command_Line = TranslateNext(command_Line, &temp_set);
NvramBit *temp;
if (params.hba_Num_Specified)
temp = new NvramBit (Cluster, params.hba_Num, temp_set);
else
temp = new NvramBit (Cluster, -1, temp_set);
cmd_List->add_Item (*temp);
delete temp;
}
else if (!strncmp(command_Line, "+hot_spare_same_channel", strlen("+hot_spare_same_channel")))
{
command_Line = command_Line + 1 + strlen("hot_spare_same_channel");
int temp_set = -1;
command_Line = TranslateNext(command_Line, &temp_set);
NvramBit *temp;
if (params.hba_Num_Specified)
temp = new NvramBit (HS_Same_Channel, params.hba_Num, temp_set);
else
temp = new NvramBit (HS_Same_Channel, -1, temp_set);
cmd_List->add_Item (*temp);
delete temp;
}
else if (!strncmp(command_Line, "+setsysconfig", strlen("+setsysconfig")))
{
command_Line = command_Line + 1 + strlen("setsysconfig");
command_Line = Skip_White (command_Line);
setscfg *temp;
temp = new setscfg ();
cmd_List->add_Item (*temp);
delete temp;
}
else if (!strncmp(command_Line, "+uartdump", strlen("+uartdump")))
{
command_Line = command_Line + 1 + strlen("uartdump");
command_Line = Skip_White (command_Line);
// look for name of file to put dump in,
// or '-' for screen dump
char *fileName;
if (*command_Line != '\0')
{
fileName = command_Line;
if (fileName[strlen(fileName) -1] == ' ')
fileName[strlen(fileName) -1] = '\0';
}
else
{
Error_in_Parsing (EventStrings[STR_PARSE_ERR_MUST_SUPPLY_FILE_NAME], this_Commands_Text);
break;
}
command_Line += strlen(fileName);
UartDmp *temp;
if (params.hba_Num_Specified)
temp = new UartDmp (params.hba_Num, fileName);
else
temp = new UartDmp (-1, fileName);
cmd_List->add_Item (*temp);
delete temp;
}
else if (!strncmp(command_Line, "+namearray", strlen("+namearray")))
{
command_Line = command_Line + 1 + strlen("namearray");
command_Line = Skip_White (command_Line);
bool error_Occurred = false;
SCSI_Address raidToName;
char arrayName[17];
// Get the address of the array to be named
if( command_Line)
{
command_Line = Skip_White (command_Line);
command_Line = Get_Address(command_Line, &raidToName);
}
// return error if no array is found
else
{
error_Occurred = true;
Error_in_Parsing(EventStrings[STR_PARSE_ERR_MUST_SPECIFY_ADDRESS], this_Commands_Text );
break;
}
command_Line = Skip_White( command_Line );
// return error if arrayName is longer than 16 characters
if (command_Line)
{
if (strlen(command_Line) > 16)
{
error_Occurred = true;
Error_in_Parsing(EventStrings[STR_ERR_NAME_TOO_LONG], this_Commands_Text );
break;
}
command_Line = Extract_Word (command_Line, arrayName);
}
else
{
error_Occurred = true;
Error_in_Parsing(EventStrings[STR_ERR_NO_ARRAY_NAME], this_Commands_Text );
break;
}
if (!error_Occurred)
{
NameArray * temp = new NameArray (raidToName, arrayName);
cmd_List->add_Item( *temp );
delete temp;
}
}
else if (!strncmp(command_Line, "+rawdata", strlen("+rawdata")))
{
command_Line = command_Line + 1 + strlen("rawdata");
command_Line = Skip_White (command_Line);
/* // look for name of file to put dump in,
// or '-' for screen dump
char *fileName;
if (*command_Line != '\0')
{
fileName = command_Line;
if (fileName[strlen(fileName) -1] == ' ')
fileName[strlen(fileName) -1] = '\0';
}
else
{
Error_in_Parsing (EventStrings[STR_PARSE_ERR_MUST_SUPPLY_FILE_NAME], this_Commands_Text);
break;
}
command_Line += strlen(fileName);
*/ RawData *temp = new RawData();
cmd_List->add_Item (*temp);
delete temp;
}
else if (!strncmp(command_Line, "+OEMSpecificName", strlen("+OEMSpecificName")))
{
command_Line = command_Line + strlen("+OEMSpecificName");
command_Line = Skip_White (command_Line);
// look for string to place within serial flash region.
char * OEMSpecificName;
if (*command_Line != '\0')
{
char quote;
char * end_of_string;
OEMSpecificName = command_Line;
if (*OEMSpecificName == '=')
{
++OEMSpecificName;
++command_Line;
}
if (((quote = *OEMSpecificName) == '\'')
|| (quote == '"')
|| (quote == '`'))
{
++OEMSpecificName;
++command_Line;
end_of_string = OEMSpecificName;
while (*end_of_string && (*end_of_string != quote))
{
++end_of_string;
}
if (*end_of_string)
{
++command_Line;
}
}
else
{
end_of_string = OEMSpecificName;
while (*end_of_string
&& (*end_of_string != ' ')
&& (*end_of_string != '\t')
&& (*end_of_string != '\n')
&& (*end_of_string != '\r'))
{
++end_of_string;
}
}
*end_of_string = '\0';
}
else
{
Error_in_Parsing (EventStrings[STR_PARSE_ERR_MUST_SUPPLY_ASCII_DATA], this_Commands_Text);
break;
}
command_Line += strlen(OEMSpecificName);
RMWFlash *temp;
/* Flash Region 3 at offset 0x100 for a maximum length of 32 characters */
if (strlen(OEMSpecificName) > 32)
{
Error_in_Parsing (EventStrings[STR_PARSE_ERR_ASCII_DATA_TOO_LONG], this_Commands_Text);
}
{
char * Buffer = new char [33]; /* This is a leak :-( */
memset (Buffer, 0, 33);
strcpy (Buffer, OEMSpecificName);
if (params.hba_Num_Specified)
temp = new RMWFlash (params.hba_Num, Buffer, 4, 0x100, 32);
else
temp = new RMWFlash (-1, Buffer, 4, 0x100, 32);
}
cmd_List->add_Item (*temp);
delete temp;
}
// Max number of segments possible is 8
// Two long arrays hold parameters to be sent to the engine (segSize, segOffset) to fill the
// firmware table.
else if (!strncmp(command_Line, "+segment", strlen("+segment")))
{
const uSHORT MAX_NUM_SEGMENTS = 8;
bool parseSegDone = false;
bool error_Occurred = false;
SCSI_Address raidToSegment;
uLONG segSize[MAX_NUM_SEGMENTS];
memset( segSize, -1, sizeof( segSize));
uLONG segOffset[MAX_NUM_SEGMENTS];
memset( segOffset, 0, sizeof( segOffset));
uLONG currSegSize;
uLONG currSegOffset;
bool showSegments = false;
uSHORT ct=0;
const int LEN_STRING_ARG = 60;
char string_Arg[ LEN_STRING_ARG ];
command_Line = command_Line + strlen("+segment");
if( command_Line)
{
command_Line = Skip_White (command_Line);
command_Line = Get_Address(command_Line, &raidToSegment);
}
while( command_Line
&& *command_Line
&& !error_Occurred
&& !parseSegDone
&& ct<MAX_NUM_SEGMENTS)
{
command_Line = Skip_White( command_Line );
if( command_Line == 0 || *command_Line == 0 )
{
error_Occurred = true;
Error_in_Parsing(EventStrings[STR_PARSE_ERR_INVALID_CMD_OR_OPTION_TO_CMD], this_Commands_Text );
break;
}
if ( isdigit (*command_Line) ){
currSegSize = strtoul (command_Line, &command_Line, 10);
}
else
{
command_Line = Extract_Word(command_Line, string_Arg);
if (strncmp(string_Arg, "showseg", sizeof(string_Arg))==0)
showSegments = true;
break;
}
segSize[ct] = currSegSize;
char *next_Delimiter = Skip_White( command_Line );
if( next_Delimiter )
{
// determine whether we are done with the comma-delimited list.
switch( *next_Delimiter )
{
case OPTION_DELIMITER:{
command_Line = Skip_White (command_Line);
command_Line = Skip_Non_Word (command_Line);
if (isdigit(*command_Line))
currSegOffset = strtoul(command_Line, &command_Line, 10);
segOffset[ct] = currSegOffset;
break;
}
// this is what we expect
case '+':{
ct++;
command_Line = Skip_White (command_Line);
command_Line = Skip_Non_Word (command_Line);
break;
}
// if we reach here, we've found something else instead of the next switch
case 0:
case SW_DELIM_1:
case SW_DELIM_2:
default:
error_Occurred = true;
break;
}
}
command_Line = Skip_White( command_Line );
}
if (!error_Occurred)
{
arraySegment * temp = new arraySegment (raidToSegment, segSize, segOffset, showSegments );
cmd_List->add_Item( *temp );
delete temp;
}
}
else
{
Error_in_Parsing(EventStrings[STR_PARSE_ERR_UNDEFINED_SWITCH], this_Commands_Text );
done = true;
}
}
else
{
Error_in_Parsing(EventStrings[STR_PARSE_ERR_INVALID_CMD_OR_OPTION_TO_CMD], this_Commands_Text );
done = true;
}
}
if (cmd_List->get_Num_Items() == 0)
{
Show_Usage *temp = new Show_Usage();
cmd_List->add_Item( *temp );
delete temp;
}
}
Parser::~Parser()
{
ENTER( "Parser::~Parser()" );
delete cmd_List;
// Hack for a crash when exiting.
// Since we are exiting it really
// doesn't matter if we cleaned up all our memory.
// Windows will handle it for us.
#if !defined _DPT_WIN_NT
delete params.logical_Drive_Number;
#endif // _DPT_WIN_NT
// this function frees certain memory allocated.
Reset_Params_to_Defaults();
EXIT();
}
void Parser::Reset_Params_to_Defaults()
{
ENTER( "void Parser::Reset_Params_to_Defaults()" );
params.raid_Type = Create_Raid::RAID_TYPE_5;
EXIT();
}
Command_List &Parser::get_Command_List()
{
ENTER( "Command_List &Parser::get_Command_List()" );
EXIT();
return( *cmd_List );
}
/****************************************************************************
*
* Function Name: Extract_Command(), Created:7/20/98
*
* Description: Does a brain-less parse of the string looking for the next switch
* character, and returns a null-terminated string consisting of
* just this command. It is copied into the buffer passed in.
*
* Return: Returns a pointer to a string containing just this command.
*
*
* Notes: This isn't meant to be an accurate lifting out of this one command.
* The actual parser does a better job, because it is aware of
* the context of each command. This only looks for the switch
* character.
*
*****************************************************************************/
char *Parser::Extract_Command( char *this_Commands_Text, char *buffer )
{
ENTER( "char *Parser::Extract_Command( char *this_Commands_Text, char *buffer )" );
// we assume the string to be pointing to the switch character.
const int LEN_OF_FIRST_HYPHEN = 1;
char *end_of_Command;
char *switch_1_Loc;
char *switch_2_Loc;
switch_1_Loc = strchr( this_Commands_Text + LEN_OF_FIRST_HYPHEN, SW_DELIM_1 );
switch_2_Loc = strchr( this_Commands_Text + LEN_OF_FIRST_HYPHEN, SW_DELIM_2 );
if( switch_1_Loc == 0 && switch_2_Loc == 0 )
{
strcpy( buffer, this_Commands_Text );
}
else
{
if( switch_1_Loc == 0 || switch_2_Loc == 0 )
{
// only one of these switches exists. Or the switch location with the null
// from the other non-existent switch location( this OR saves having to figure
// which one is valid ).
end_of_Command = (char *) ( (unsigned long) switch_1_Loc | (unsigned long) switch_2_Loc );
}
else
{
// there are two visible switches. Find the closest one.
#if !defined _DPT_NETWARE && !defined _DPT_MSDOS
end_of_Command = min( switch_1_Loc, switch_2_Loc );
#else
end_of_Command = (switch_1_Loc < switch_2_Loc) ? switch_1_Loc : switch_2_Loc;
#endif
}
if( end_of_Command )
{
strncpy( buffer, this_Commands_Text, end_of_Command - this_Commands_Text );
buffer[ end_of_Command - this_Commands_Text ] = 0;
}
else
{
strcpy( buffer, this_Commands_Text );
}
}
EXIT();
return( buffer );
}
/****************************************************************************
*
* Function Name: Extract_Word(), Created:7/21/98
*
* Description: Returns the first "word" found in the string.
*
* Return: Returns "str" advanced to just after the word.
*
* Notes:
*
*****************************************************************************/
char *Parser::Extract_Word(
char *str, // this is the string from which the string is parsed.
char *word // this is the buffer into which the word is copied
)
{
ENTER( "char *Parser::Extract_Word(" );
char *end_of_Word = 0;
*word = '\0';
if( str )
{
// in case it is on white space on entry...
str = Skip_Non_Word( str );
if( str )
{
// now skip to the end of the word
end_of_Word = Skip_Word( str );
if( end_of_Word )
{
strncpy( word, str, end_of_Word - str );
word[ end_of_Word - str ] = 0;
}
else
{
strcpy( word, str );
}
}
}
EXIT();
return( end_of_Word );
}
/****************************************************************************
*
* Function Name: TranslateNext, Created:10/15/99
*
* Description: This accepts a pointer to a c-string, and returns the integer
equivalent of the number or string in the input string.
*
* Return: 1 if "on"/"enable"/1
0 if "off"/"disable"/0
*
*****************************************************************************/
char *Parser::TranslateNext (char *str, int *retVal)
{
ENTER ("char *Parser::TranslateNext (char *str, int *retVal)");
char c;
// advance to the next non-white space
while (((c = *str) != 0) && ((c == ' ')
|| (c == '\t') || (c == '\n') || (c == '=')
|| (c == '\r')))
{
str++;
}
if (isdigit (*str))
{
*retVal = 0;
while ((str[0] != ' ') && (str[0] != '-'))
{
*retVal *= 10;
*retVal += str[0] - '0';
str++;
}
// *retVal = atoi(str);
// str++;
}
else if (strstr(str, "on"))
{
*retVal = 1;
str += 2;
}
else if (strstr(str, "enable"))
{
*retVal = 1;
str += 6;
}
else if (strstr(str, "off"))
{
*retVal = 0;
str += 3;
}
else if (strstr(str, "disable"))
{
*retVal = 0;
str += 7;
}
// string is empty
else // if (*str == 0)
{
*retVal = -1;
}
EXIT();
return(str);
}
/****************************************************************************
*
* Function Name: Skip_White(), Created:7/20/98
*
* Description: This accepts a pointer to a c-string, and returns the first non-white
character immediately following any white space at the beginning
of the string.
*
* Return: Returns a pointer to the first non-white character after initial
white space. Returns null on end of string.
*
* Notes:
*
*****************************************************************************/
char *Parser::Skip_White( char *str )
{
ENTER( "char *Parser::Skip_White( char *str )" );
char *ret_Str;
char c;
// advance to the next non-white space
while(
( ( c = *str ) != 0 )
&&
( ( c == ' ' )
|| ( c == '\t' )
|| ( c == '\n' )
|| ( c == '\r' ) ) )
{
str++;
}
if( *str == 0 )
{
ret_Str = 0;
}
else
{
ret_Str = str;
}
EXIT();
return( ret_Str );
}
/****************************************************************************
*
* Function Name: Skip_Non_White(), Created:7/20/98
*
* Description: Returns a pointer to the next white space.
*
* Return: Returns a pointer to the next white space, or null on end of
string.
*
* Notes:
*
*****************************************************************************/
char *Parser::Skip_Non_White( char *str )
{
ENTER( "char *Parser::Skip_Non_White( char *str )" );
char *ret_Str;
char c;
// advance to the next white space
while(
( ( c = *str ) != 0 )
&& ( c != ' ' )
&& ( c != '\t' )
&& ( c != '\n' )
&& ( c != '\r' ) )
{
str++;
}
if( *str == 0 )
{
ret_Str = 0;
}
else
{
ret_Str = str;
}
EXIT();
return( ret_Str );
}
/****************************************************************************
*
* Function Name: Skip_Non_Word(), Created:7/21/98
*
* Description: This skips anything that is not a word, i.e. commas, white-space,
etc.
*
* Return: A pointer to the next word character.
*
* Notes:
*
*****************************************************************************/
char *Parser::Skip_Non_Word( char *str )
{
ENTER( "char *Parser::Skip_Non_Word( char *str )" );
char *ret_Str = 0;
char c;
if( str )
{
// advance to the next non-word
while(
( ( c = *str ) != 0 )
&& !isalnum( c )
&& ( c != '.' )
&& ( c != '-' )
&& ( c != '/' )
&& ( c != '?' )
&& ( c != '_' ) )
{
str++;
}
if( *str == 0 )
{
ret_Str = 0;
}
else
{
ret_Str = str;
}
}
EXIT();
return( ret_Str );
}
char *Parser::Skip_Word( char *str )
{
ENTER( "char *Parser::Skip_Word( char *str )" );
char *ret_Str = 0;
char c;
if( str )
{
// advance to the next non-word
while(
( ( c = *str ) != 0 )
&& ( isalnum( c )
|| ( c == '.' )
#if !defined _DPT_WIN_NT
// taken out for parsing to pick off next command
// either all white spaces are ignored or all aren't
|| ( c == '-' )
#endif
#if defined _DPT_WIN_NT || defined _DPT_MSDOS
// allow this for path naming (for flashing)
// do not allow '\' because that is EOL character
|| ( c == ':' )
#endif
|| ( c == '/' )
|| ( c == '?' )
|| ( c == '_' ) ) )
{
str++;
}
if( *str == 0 )
{
ret_Str = 0;
}
else
{
ret_Str = str;
}
}
EXIT();
return( ret_Str );
}
void Parser::Error_in_Parsing(
char *error_Str,
char *this_Command_Line
)
{
ENTER( "void Parser::Error_in_Parsing(" );
char temp[ 100 ];
// remove all previous commands. Since this didn't
// parse right, we can't trust that we would be doing
// what they intended.
delete cmd_List;
// now create a new command list object, and place
// this parse error in it as the only command.
cmd_List = new Command_List();
cmd_List->add_Item(
*( new Parse_Error(
error_Str,
Extract_Command( this_Command_Line, temp ) ) ) );
EXIT();
}
int Parser::Str_to_Constant(
char *str_to_Match, // this is the string the user supplies
str_to_Const_Struct *str_to_Const // this is an array in which we have
// to match the string the user supplies
)
{
ENTER( "int Parser::Str_to_Constant(" );
int ret_Value = -1;
int str_Index;
bool done = false;
for( str_Index = 0;
!done && str_to_Const[ str_Index ].str && *str_to_Const[ str_Index ].str;
str_Index++ )
{
if( !StrICmp( str_to_Match, str_to_Const[ str_Index ].str ) )
{
ret_Value = str_to_Const[ str_Index ].constant;
done = true;
}
}
EXIT();
return( ret_Value );
}
/****************************************************************************
*
* Function Name: Get_Int_List(), Created:7/28/98
*
* Description: This function expects a string to be passed in consisting of
comma-delimited integers. Leading white-space is allowed. The
list passed in must be of the form nnn,nnn,nnn with intervening
and leading white-space allowed.
*
* Return: Int_List of all the integers in the comma-delimited list.
*
* Notes: The list of integers passed in must start with the integers
to be parsed( i.e. the command must be stripped off ). Preceding
whitespace is allowed.
The caller is responsible for deallocating the int list returned.
*
*****************************************************************************/
Int_List *Parser::Get_Int_List(
char *int_Str, // pointer to a list of comma
// delimited constants
char **end_Ptr, // this will be set to point
// to the end of the parsed list
char *this_Commands_Text, // this is the whole command,
// used to create a context-based
// error string when the command fails
bool *error_Occurred // set true when an error is
// detected
)
{
ENTER( "Int_List *Parser::Get_Int_List(" );
Int_List *integers;
bool done= false;
*error_Occurred = false;
integers = new Int_List();
// suck up any comma-delimited integers
while( int_Str
&& *int_Str
&& !*error_Occurred
&& !done )
{
// skip past any delimiters to the next "word"
int_Str = Skip_Non_Word( int_Str );
// make sure we have at least one leading digit here.
if( !isdigit( *int_Str ) )
{
Error_in_Parsing(EventStrings[STR_PARSE_ERR_MUST_BE_INTEGER_VALUE], this_Commands_Text );
done = true;
*error_Occurred = true;
}
else
{
integers->add_Item( strtol( int_Str, &int_Str, 10 ) );
}
char next_Delimiter = *Skip_White( int_Str );
// determine whether we are done with the comma-delimited list.
switch( next_Delimiter )
{
// this is what we expect
case ',':
break;
// if we reach here, we've found the next switch, or reached the end
// of the command line
case 0:
case SW_DELIM_1:
case SW_DELIM_2:
done = true;
break;
default:
// strtol must have been passed a non-numeric value in the string
Error_in_Parsing(EventStrings[STR_PARSE_ERR_MUST_BE_INTEGER_VALUE], this_Commands_Text );
done = true;
*error_Occurred = true;
break;
}
}
*end_Ptr = int_Str;
EXIT();
return( integers );
}
/****************************************************************************
*
* Function Name: Get_Address(), Created:10/20/98
*
* Description: This function expects a Solaris based address of the form
'c#t#d#[s#]' or a DPT convenience `d#b#t#d#' address.
*
* Return: length of string processed.
*
*
*****************************************************************************/
char * Parser::Get_Address (
char *address_Str, // pointer to a address string
SCSI_Address * component
)
{
int int_Arg;
char * cp;
component->hba = -1;
component->bus = -1;
component->id = -1;
component->lun = -1;
component->level = -1;
if ( address_Str == 0 )
{
return ( address_Str );
}
address_Str = Skip_White( address_Str );
switch (address_Str[0])
{
case 'c':
cp = address_Str++;
int_Arg = strtol( address_Str, &address_Str, 10 );
{
#if (!defined(_DPT_NETWARE) && !defined(_DPT_BSDI) && !defined(_DPT_FREE_BSD))
class DPTControllerMap * map = new class DPTControllerMap;
#else
class DPTControllerMap * map = new DPTControllerMap;
#endif
if ( map->getHba( int_Arg ) < 0 )
{
Error_in_Parsing(
EventStrings[STR_PARSE_ERR_CTLR_DESGINATIONS_NOT_SUPPORTED], cp );
}
else
{
component->hba = map->getHba( int_Arg );
component->bus = map->getBus( int_Arg );
}
delete map;
}
break;
case 'd':
++address_Str;
component->hba = strtol( address_Str, &address_Str, 10 );
if (address_Str[0] != 'b')
{
/*#if defined _DPT_SOLARIS kds kds
component->lun = component->hba;
component->hba = -1;
#endif*/
return ( address_Str );
}
else // get the bus number
{
++address_Str;
component->bus = strtol( address_Str, &address_Str, 10 );
}
case 't':
break;
default:
return ( address_Str );
}
if ( address_Str[0] != 't' )
{
return ( address_Str );
}
++address_Str;
component->id = strtol( address_Str, &address_Str, 10 );
// get second digit of id
if( isdigit( *address_Str ) )
{
component->id *= 10;
component->id += strtol( address_Str, &address_Str, 10 );
// get third digit of id
if( isdigit( *address_Str ) )
{
component->id *= 10;
component->id += strtol( address_Str, &address_Str, 10 );
}
}
if ( address_Str[0] != 'd' )
{
return ( address_Str );
}
++address_Str;
component->lun = strtol( address_Str, &address_Str, 10 );
if ( address_Str[0] != 's' )
{
return ( address_Str );
}
++address_Str;
component->level = strtol( address_Str, &address_Str, 10 );
return ( address_Str );
}
/****************************************************************************
*
* Function Name: Get_Address_List(), Created:7/28/98
*
* Description: This function expects a comma-delimited list of addresses of
* the form 'CIII,CIII,CIII', where 'C' is the channel, and
* 'III' is the id of the device referenced; or, c#t#d#
* which is controller, target, lun respectively
*
* Return: SCSI_Addr_List of all the addresses listed
*
* Notes: The list of addresses passed in must start with the addresses
to be parsed( i.e. the command must be stripped off ). Preceding
whitespace is allowed.
The caller is responsible for deallocating the address list returned.
*
*****************************************************************************/
SCSI_Addr_List *Parser::Get_Address_List(
char *address_Str, // pointer to a list of comma
// delimited constants
char **end_Ptr, // this will be set to point
// to the end of the parsed list
char *this_Commands_Text, // this is the whole command,
// used to create a context-based
// error string when the command fails
bool *error_Occurred // set true when an error is
// detected
)
{
ENTER( "SCSI_Addr_List *Parser::Get_Address_List(" );
SCSI_Addr_List *components;
bool done = false;
SCSI_Address last;
int last_group = -1;
last.hba = ( !params.hba_Num_Specified ) ? -1 : params.hba_Num;
last.bus = ( !params.hba_Bus_Specified ) ? -1 : params.hba_Bus;
last.id = -1;
last.lun = -1;
last.level = -1;
components = new SCSI_Addr_List();
// suck up any comma-delimited integers
while( address_Str
&& *address_Str
&& !*error_Occurred
&& !done )
{
address_Str = Skip_Non_Word( address_Str );
if( address_Str == 0 || *address_Str == 0 )
{
*error_Occurred = true;
}
else
{
SCSI_Address component;
if( !isdigit( *address_Str ) )
{
address_Str = Get_Address (address_Str, &component);
if( component.hba == -1 )
{
component.hba = last.hba;
}
else
{
last.bus = -1;
last.id = -1;
last.lun = -1;
last.level = last_group;
}
if( component.bus == -1 )
{
component.bus = last.bus;
}
else
{
last.id = -1;
last.lun = -1;
last.level = last_group;
}
if( component.id == -1 )
{
component.id = last.id;
}
else
{
last.lun = -1;
last.level = last_group;
}
if( component.lun == -1 )
{
component.lun = last.lun;
}
else
{
last.level = last_group;
}
if( component.level == -1 )
{
component.level = last.level;
}
// kds - It is okay to not have a bus specified (INQUIRY)
//#if !defined _DPT_SOLARIS
// Ex.: Can do inquiry on an HBA. kds kds
if (component.hba != -1)
//#else
// if( ( component.hba != -1 )
// && ( component.bus != -1 ) )
//#endif
{
last = component;
components->add_Item( component );
}
else
{
Error_in_Parsing(EventStrings[STR_PARSE_ERR_MUST_BE_INTEGER_VALUE], this_Commands_Text );
*error_Occurred = true;
}
}
else
{
/* kds - solaris shouldn't be any different than other OSs
#if !defined _DPT_SOLARIS
printf(EventStrings[STR_INT_NOT_EXPECTD_USE]);
*error_Occurred = true;
return( components );
#endif */
char component_Buf[ 40 ];
char *component_Str = component_Buf;
SCSI_Address component;
address_Str = Extract_Word( address_Str, component_Buf );
if( !isdigit( *component_Str ) )
{
Error_in_Parsing(EventStrings[STR_PARSE_ERR_MUST_BE_INTEGER_VALUE], this_Commands_Text );
*error_Occurred = true;
}
else
{
component.hba = params.hba_Num;
// the bus is always the first character of the string
component.bus = *component_Str++ - '0';
// the remainder of the string is the id number
component.id = strtol( component_Str, &component_Str, 10 );
component.lun = 0;
component.level = last_group;
components->add_Item( component );
}
}
char *next_Delimiter = Skip_White( address_Str );
if( next_Delimiter )
{
// determine whether we are done with the comma-delimited list.
switch( *next_Delimiter )
{
case '+':
++last_group;
// this is what we expect
case OPTION_DELIMITER:
break;
// if we reach here, we've found the next switch, or reached the end
// of the command line
case 0:
case SW_DELIM_1:
case SW_DELIM_2:
default:
done = true;
break;
//kds Removed this to allow for options to
/* default:
// strtol must have been passed a non-numeric value in the string
Error_in_Parsing( STR_PARSE_ERR_MUST_BE_INTEGER_VALUE, this_Commands_Text );
*error_Occurred = true;
break;*/
}
}
else
done = true;
}
}
*end_Ptr = address_Str;
EXIT();
return( components );
}
/****************************************************************************
*
* Function Name: To_Lower(), Created:7/30/98
*
* Description: Modifies the string, forcing alpha's to lower case.
*
* Notes: This is NOT suitable for localization!!
*
*****************************************************************************/
void Parser::To_Lower( char *str )
{
ENTER( "void Parser::To_Lower( char *str )" );
for(; *str; str++ )
{
if( isalpha( *str ) )
{
*str |= 0x20;
}
}
EXIT();
}
int Parser::StrICmp(
const char *str1,
const char *str2
)
{
ENTER( "int Parser::StrICmp(" );
char buf1[ 256 ];
char buf2[ 256 ];
strcpy( buf1, str1 );
strcpy( buf2, str2 );
To_Lower( buf1 );
To_Lower( buf2 );
EXIT();
return( strcmp( buf1, buf2 ) );
}
/*** END OF FILE ***/
|