1*ebfedea0SLionel Sambuc$! 2*ebfedea0SLionel Sambuc$! Check operation of "bc". 3*ebfedea0SLionel Sambuc$! 4*ebfedea0SLionel Sambuc$! 2010-04-05 SMS. New. Based (loosely) on "bctest". 5*ebfedea0SLionel Sambuc$! 6*ebfedea0SLionel Sambuc$! 7*ebfedea0SLionel Sambuc$ tmp_file_name = "tmp.bctest" 8*ebfedea0SLionel Sambuc$ failure = "" 9*ebfedea0SLionel Sambuc$! 10*ebfedea0SLionel Sambuc$! Basic command test. 11*ebfedea0SLionel Sambuc$! 12*ebfedea0SLionel Sambuc$ on warning then goto bc_fail 13*ebfedea0SLionel Sambuc$ bc 14*ebfedea0SLionel Sambuc$ on error then exit 15*ebfedea0SLionel Sambuc$! 16*ebfedea0SLionel Sambuc$! Test for SunOS 5.[78] bc bug. 17*ebfedea0SLionel Sambuc$! 18*ebfedea0SLionel Sambuc$ if (failure .eqs. "") 19*ebfedea0SLionel Sambuc$ then 20*ebfedea0SLionel Sambuc$! 21*ebfedea0SLionel Sambuc$ define /user_mode sys$output 'tmp_file_name' 22*ebfedea0SLionel Sambuc$ bc 23*ebfedea0SLionel Sambucobase=16 24*ebfedea0SLionel Sambucibase=16 25*ebfedea0SLionel Sambuca=AD88C418F31B3FC712D0425001D522B3AE9134FF3A98C13C1FCC1682211195406C1A6C66C6A\ 26*ebfedea0SLionel SambucCEEC1A0EC16950233F77F1C2F2363D56DD71A36C57E0B2511FC4BA8F22D261FE2E9356D99AF57\ 27*ebfedea0SLionel Sambuc10F3817C0E05BF79C423C3F66FDF321BE8D3F18F625D91B670931C1EF25F28E489BDA1C5422D1\ 28*ebfedea0SLionel SambucC3F6F7A1AD21585746ECC4F10A14A778AF56F08898E965E9909E965E0CB6F85B514150C644759\ 29*ebfedea0SLionel Sambuc3BE731877B16EA07B552088FF2EA728AC5E0FF3A23EB939304519AB8B60F2C33D6BA0945B66F0\ 30*ebfedea0SLionel Sambuc4FC3CADF855448B24A9D7640BCF473E 31*ebfedea0SLionel Sambucb=DCE91E7D120B983EA9A104B5A96D634DD644C37657B1C7860B45E6838999B3DCE5A555583C6\ 32*ebfedea0SLionel Sambuc9209E41F413422954175A06E67FFEF6746DD652F0F48AEFECC3D8CAC13523BDAAD3F5AF4212BD\ 33*ebfedea0SLionel Sambuc8B3CD64126E1A82E190228020C05B91C8B141F1110086FC2A4C6ED631EBA129D04BB9A19FC53D\ 34*ebfedea0SLionel Sambuc3ED0E2017D60A68775B75481449 35*ebfedea0SLionel Sambuc(a/b)*b + (a%b) - a 36*ebfedea0SLionel Sambuc$ status = $status 37*ebfedea0SLionel Sambuc$ output_expected = "0" 38*ebfedea0SLionel Sambuc$ gosub check_output 39*ebfedea0SLionel Sambuc$ if (output .ne. 1) 40*ebfedea0SLionel Sambuc$ then 41*ebfedea0SLionel Sambuc$ failure = "SunOStest" 42*ebfedea0SLionel Sambuc$ else 43*ebfedea0SLionel Sambuc$ delete 'f$parse( tmp_file_name)' 44*ebfedea0SLionel Sambuc$ endif 45*ebfedea0SLionel Sambuc$ endif 46*ebfedea0SLionel Sambuc$! 47*ebfedea0SLionel Sambuc$! Test for SCO bc bug. 48*ebfedea0SLionel Sambuc$! 49*ebfedea0SLionel Sambuc$ if (failure .eqs. "") 50*ebfedea0SLionel Sambuc$ then 51*ebfedea0SLionel Sambuc$! 52*ebfedea0SLionel Sambuc$ define /user_mode sys$output 'tmp_file_name' 53*ebfedea0SLionel Sambuc$ bc 54*ebfedea0SLionel Sambucobase=16 55*ebfedea0SLionel Sambucibase=16 56*ebfedea0SLionel Sambuc-FFDD63BA1A4648F0D804F8A1C66C53F0D2110590E8A3907EC73B4AEC6F15AC177F176F2274D2\ 57*ebfedea0SLionel Sambuc9DC8022EA0D7DD3ABE9746D2D46DD3EA5B5F6F69DF12877E0AC5E7F5ADFACEE54573F5D256A06\ 58*ebfedea0SLionel Sambuc11B5D2BC24947724E22AE4EC3FB0C39D9B4694A01AFE5E43B4D99FB9812A0E4A5773D8B254117\ 59*ebfedea0SLionel Sambuc1239157EC6E3D8D50199 * -FFDD63BA1A4648F0D804F8A1C66C53F0D2110590E8A3907EC73B4\ 60*ebfedea0SLionel SambucAEC6F15AC177F176F2274D29DC8022EA0D7DD3ABE9746D2D46DD3EA5B5F6F69DF12877E0AC5E7\ 61*ebfedea0SLionel SambucF5ADFACEE54573F5D256A0611B5D2BC24947724E22AE4EC3FB0C39D9B4694A01AFE5E43B4D99F\ 62*ebfedea0SLionel SambucB9812A0E4A5773D8B2541171239157EC6E3D8D50199 - FFBACC221682DA464B6D7F123482522\ 63*ebfedea0SLionel Sambuc02EDAEDCA38C3B69E9B7BBCD6165A9CD8716C4903417F23C09A85B851961F92C217258CEEB866\ 64*ebfedea0SLionel Sambuc85EFCC5DD131853A02C07A873B8E2AF2E40C6D5ED598CD0E8F35AD49F3C3A17FDB7653E4E2DC4\ 65*ebfedea0SLionel SambucA8D23CC34686EE4AD01F7407A7CD74429AC6D36DBF0CB6A3E302D0E5BDFCD048A3B90C1BE5AA8\ 66*ebfedea0SLionel SambucE16C3D5884F9136B43FF7BB443764153D4AEC176C681B078F4CC53D6EB6AB76285537DDEE7C18\ 67*ebfedea0SLionel Sambuc8C72441B52EDBDDBC77E02D34E513F2AABF92F44109CAFE8242BD0ECBAC5604A94B02EA44D43C\ 68*ebfedea0SLionel Sambuc04E9476E6FBC48043916BFA1485C6093603600273C9C33F13114D78064AE42F3DC466C7DA543D\ 69*ebfedea0SLionel Sambuc89C8D71 70*ebfedea0SLionel SambucAD534AFBED2FA39EE9F40E20FCF9E2C861024DB98DDCBA1CD118C49CA55EEBC20D6BA51B2271C\ 71*ebfedea0SLionel Sambuc928B693D6A73F67FEB1B4571448588B46194617D25D910C6A9A130CC963155CF34079CB218A44\ 72*ebfedea0SLionel Sambuc8A1F57E276D92A33386DDCA3D241DB78C8974ABD71DD05B0FA555709C9910D745185E6FE108E3\ 73*ebfedea0SLionel Sambuc37F1907D0C56F8BFBF52B9704 % -E557905B56B13441574CAFCE2BD257A750B1A8B2C88D0E36\ 74*ebfedea0SLionel SambucE18EF7C38DAC80D3948E17ED63AFF3B3467866E3B89D09A81B3D16B52F6A3C7134D3C6F5123E9\ 75*ebfedea0SLionel SambucF617E3145BBFBE9AFD0D6E437EA4FF6F04BC67C4F1458B4F0F47B64 - 1C2BBBB19B74E86FD32\ 76*ebfedea0SLionel Sambuc9E8DB6A8C3B1B9986D57ED5419C2E855F7D5469E35E76334BB42F4C43E3F3A31B9697C171DAC4\ 77*ebfedea0SLionel SambucD97935A7E1A14AD209D6CF811F55C6DB83AA9E6DFECFCD6669DED7171EE22A40C6181615CAF3F\ 78*ebfedea0SLionel Sambuc5296964 79*ebfedea0SLionel Sambuc$ status = $status 80*ebfedea0SLionel Sambuc$ output_expected = "0\0" 81*ebfedea0SLionel Sambuc$ gosub check_output 82*ebfedea0SLionel Sambuc$ if (output .ne. 1) 83*ebfedea0SLionel Sambuc$ then 84*ebfedea0SLionel Sambuc$ failure = "SCOtest" 85*ebfedea0SLionel Sambuc$ else 86*ebfedea0SLionel Sambuc$ delete 'f$parse( tmp_file_name)' 87*ebfedea0SLionel Sambuc$ endif 88*ebfedea0SLionel Sambuc$ endif 89*ebfedea0SLionel Sambuc$! 90*ebfedea0SLionel Sambuc$! Test for working 'print' command. 91*ebfedea0SLionel Sambuc$! 92*ebfedea0SLionel Sambuc$ if (failure .eqs. "") 93*ebfedea0SLionel Sambuc$ then 94*ebfedea0SLionel Sambuc$! 95*ebfedea0SLionel Sambuc$ define /user_mode sys$output 'tmp_file_name' 96*ebfedea0SLionel Sambuc$ bc 97*ebfedea0SLionel Sambucprint "OK" 98*ebfedea0SLionel Sambuc$ status = $status 99*ebfedea0SLionel Sambuc$ output_expected = "OK" 100*ebfedea0SLionel Sambuc$ gosub check_output 101*ebfedea0SLionel Sambuc$ if (output .ne. 1) 102*ebfedea0SLionel Sambuc$ then 103*ebfedea0SLionel Sambuc$ failure = "printtest" 104*ebfedea0SLionel Sambuc$ else 105*ebfedea0SLionel Sambuc$ delete 'f$parse( tmp_file_name)' 106*ebfedea0SLionel Sambuc$ endif 107*ebfedea0SLionel Sambuc$ endif 108*ebfedea0SLionel Sambuc$! 109*ebfedea0SLionel Sambuc$ if (failure .nes. "") 110*ebfedea0SLionel Sambuc$ then 111*ebfedea0SLionel Sambuc$ write sys$output - 112*ebfedea0SLionel Sambuc "No working bc found. Consider installing GNU bc." 113*ebfedea0SLionel Sambuc$ exit %X00030000 ! %DCL-W-NORMAL 114*ebfedea0SLionel Sambuc$ endif 115*ebfedea0SLionel Sambuc$! 116*ebfedea0SLionel Sambuc$ exit 117*ebfedea0SLionel Sambuc$! 118*ebfedea0SLionel Sambuc$! 119*ebfedea0SLionel Sambuc$! Complete "bc" command failure. 120*ebfedea0SLionel Sambuc$! 121*ebfedea0SLionel Sambuc$ bc_fail: 122*ebfedea0SLionel Sambuc$ write sys$output - 123*ebfedea0SLionel Sambuc "No ""bc"" program/symbol found. Consider installing GNU bc." 124*ebfedea0SLionel Sambuc$ exit %X00030000 ! %DCL-W-NORMAL 125*ebfedea0SLionel Sambuc$! 126*ebfedea0SLionel Sambuc$! 127*ebfedea0SLionel Sambuc$! Output check subroutine. 128*ebfedea0SLionel Sambuc$! 129*ebfedea0SLionel Sambuc$ check_output: 130*ebfedea0SLionel Sambuc$ eof = 0 131*ebfedea0SLionel Sambuc$ line_nr = 0 132*ebfedea0SLionel Sambuc$ open /read tmp_file 'tmp_file_name' 133*ebfedea0SLionel Sambuc$ c_o_loop: 134*ebfedea0SLionel Sambuc$ read /error = error_read tmp_file line 135*ebfedea0SLionel Sambuc$ goto ok_read 136*ebfedea0SLionel Sambuc$ error_read: 137*ebfedea0SLionel Sambuc$ eof = 1 138*ebfedea0SLionel Sambuc$ ok_read: 139*ebfedea0SLionel Sambuc$ line_expected = f$element( line_nr, "\", output_expected) 140*ebfedea0SLionel Sambuc$ line_nr = line_nr+ 1 141*ebfedea0SLionel Sambuc$ if ((line_expected .nes. "\") .and. (.not. eof) .and. - 142*ebfedea0SLionel Sambuc (line_expected .eqs. line)) then goto c_o_loop 143*ebfedea0SLionel Sambuc$! 144*ebfedea0SLionel Sambuc$ if ((line_expected .eqs. "\") .and. eof) 145*ebfedea0SLionel Sambuc$ then 146*ebfedea0SLionel Sambuc$ output = 1 147*ebfedea0SLionel Sambuc$ else 148*ebfedea0SLionel Sambuc$ output = 0 149*ebfedea0SLionel Sambuc$ endif 150*ebfedea0SLionel Sambuc$ close tmp_file 151*ebfedea0SLionel Sambuc$ return 152*ebfedea0SLionel Sambuc$! 153