(command.CommandList children: [ (command.ShFunction name: header body: (command.BraceGroup children: [ (C {(clear)}) (C {(echo)} {(DQ ('\t=================================================================='))}) (C {(echo)} {(DQ ('\t------------------ Windows(r) driver converter -------------------'))}) (C {(echo)} {(DQ ('\t=================================================================='))}) (C {(echo)} {(DQ )}) ] ) ) (command.ShFunction name: mainmenu body: (command.BraceGroup children: [ (C {(header)}) (C {(echo)} {(DQ ('\tThis script is designed to guide you through the process'))}) (C {(echo)} {(DQ ('\tof converting a Windows(r) binary driver module and .INF'))}) (C {(echo)} {(DQ ('\tspecification file into a FreeBSD ELF kernel module for use'))}) (C {(echo)} {(DQ ('\twith the NDIS compatibility system.'))}) (C {(echo)} {(DQ )}) (C {(echo)} {(DQ ('\tThe following options are available:'))}) (C {(echo)} {(DQ )}) (C {(echo)} {(DQ ('\t1] Learn about the NDIS compatibility system'))}) (C {(echo)} {(DQ ('\t2] Convert individual firmware files'))}) (C {(echo)} {(DQ ('\t3] Convert driver'))}) (C {(echo)} {(DQ ('\t4] Exit'))}) (C {(echo)} {(DQ )}) (C {(echo)} {(-n)} {(DQ ('\tEnter your selection here and press return: '))}) (C {(read)} {(KEYPRESS)}) (command.ControlFlow token: (Token id:Id.ControlFlow_Return val:return span_id:227) ) ] ) ) (command.ShFunction name: help1 body: (command.BraceGroup children: [ (C {(header)}) (C {(echo)} {(DQ ('\t\t\t\tGeneral information'))}) (C {(echo)} {(DQ )}) (C {(echo)} {(DQ ('\tThe NDIS compatibility system is designed to let you use Windows(r)'))}) (C {(echo)} {(DQ ('\tbinary drivers for networking devices with FreeBSD, in cases where'))}) (C {(echo)} {(DQ ('\ta native FreeBSD driver is not available due to hardware manufacturer'))} ) (C {(echo)} {(DQ ('\toversight or stupidity. NDIS stands for Network Driver Interface'))}) (C {(echo)} {(DQ ('\tStandard, and refers to the programming model used to write Windows(r)'))} ) (C {(echo)} { (DQ ('\tnetwork drivers. (These are often called ') (word_part.EscapedLiteral token: (Token id:Id.Lit_EscapedChar val:'\\"' span_id:287) ) ('NDIS miniport') (word_part.EscapedLiteral token:(Token id:Id.Lit_EscapedChar val:'\\"' span_id:289)) (' drivers.)') ) } ) (C {(echo)} {(DQ )}) (C {(echo)} {(DQ ('\tIn order to use your network device in NDIS compatibility mode,'))}) (C {(echo)} {(DQ ('\tyou need the Windows(r) driver that goes with it. Also, the driver'))}) (C {(echo)} {(DQ ('\tmust be compiled for the same architecture as the release of FreeBSD'))} ) (C {(echo)} {(DQ ('\tyou have installed. At this time, the i386 and amd64 architectures'))}) (C {(echo)} {(DQ ('\tare both supported. Note that you cannot use a Windows/i386 driver'))}) (C {(echo)} {(DQ ('\twith FreeBSD/amd64: you must obtain a Windows/amd64 driver.'))}) (C {(echo)} {(DQ )}) (C {(echo)} {(-n)} {(DQ ('\tPress return to continue... '))}) (C {(read)} {(KEYPRESS)}) (command.ControlFlow token: (Token id:Id.ControlFlow_Return val:return span_id:351) ) ] ) ) (command.ShFunction name: help2 body: (command.BraceGroup children: [ (C {(header)}) (C {(echo)} {(DQ ('\t\t\t\tWhere to get drivers'))}) (C {(echo)} {(DQ )}) (C {(echo)} {(DQ ('\tIf you purchased your network card separately from your computer,'))}) (C {(echo)} {(DQ ('\tthere should have been a driver distribution CD included with the'))}) (C {(echo)} {(DQ ('\tcard which contains Windows(r) drivers. The NDIS compatibility'))}) (C {(echo)} {(DQ ('\tsystem is designed to emulate the NDIS API of a couple of different'))}) (C {(echo)} {(DQ ('\tWindows(r) releases, however it works best with drivers designed'))}) (C {(echo)} {(DQ ('\tfor NDIS 5.0 or later. Drivers distributed for Windows 2000 should'))}) (C {(echo)} {(DQ ('\twork; however, for best results you should use a driver designed'))}) (C {(echo)} {(DQ ('\tfor Windows XP or Windows Server 2003.'))}) (C {(echo)} {(DQ )}) (C {(echo)} {(DQ ('\tIf your card was supplied with your computer, or is a built-in device,'))} ) (C {(echo)} {(DQ ('\tdrivers may have been included on a special driver bundle CD shipped'))} ) (C {(echo)} {(DQ ('\twith the computer.'))}) (C {(echo)} {(DQ )}) (C {(echo)} {(DQ ("\tIf you don't have a driver CD, you should be able to find a driver"))}) (C {(echo)} {(DQ ("\tkit on the card or computer vendor's web site."))}) (C {(echo)} {(DQ )}) (C {(echo)} {(-n)} {(DQ ('\tPress return to continue... '))}) (C {(read)} {(KEYPRESS)}) (command.ControlFlow token: (Token id:Id.ControlFlow_Return val:return span_id:480) ) ] ) ) (command.ShFunction name: help3 body: (command.BraceGroup children: [ (C {(header)}) (C {(echo)} {(DQ ('\t\t\t\tWhat files do I need?'))}) (C {(echo)} {(DQ )}) (C {(echo)} {(DQ ('\tIn most cases, you will need only two files: a .INF file and a .SYS'))}) (C {(echo)} {(DQ ('\tfile. The .INF file is a text file used by the Windows(r) installer to'))} ) (C {(echo)} {(DQ ('\tperform the driver installation. It contains information that tells'))}) (C {(echo)} {(DQ ('\tthe installer what devices the driver supports and what registry keys'))} ) (C {(echo)} {(DQ ('\tshould be created to control driver configuration. The .SYS file'))}) (C {(echo)} {(DQ ('\tis the actual driver executable code in Windows(r) Portable Executable'))} ) (C {(echo)} {(DQ ('\t(PE) format. Note that sometimes the .INF file is supplied in Unicode'))} ) (C {(echo)} {(DQ ('\tformat. Unicode .INF files must be converted to ASCII form with the'))}) (C {(echo)} {(DQ ('\ticonv(1) utility before this installer script can use them.'))}) (C {(echo)} {(DQ ('\tOccasionally, a driver may require firmware or register setup'))}) (C {(echo)} {(DQ ('\tfiles that are external to the main .SYS file. These are provided'))}) (C {(echo)} {(DQ ('\ton the same CD with the driver itself, and sometimes have a .BIN'))}) (C {(echo)} {(DQ ('\textension, though they can be named almost anything. You will need'))}) (C {(echo)} {(DQ ('\tthese additional files to make your device work with the NDIS'))}) (C {(echo)} {(DQ ('\tcompatibility system as well.'))}) (C {(echo)} {(DQ )}) (C {(echo)} {(-n)} {(DQ ('\tPress return to continue... '))}) (C {(read)} {(KEYPRESS)}) (command.ControlFlow token: (Token id:Id.ControlFlow_Return val:return span_id:612) ) ] ) ) (command.ShFunction name: help4 body: (command.BraceGroup children: [ (C {(header)}) (C {(echo)} {(DQ ('\t\t\t\tHow does it all work?'))}) (C {(echo)} {(DQ )}) (C {(echo)} {(DQ ('\tThe installer script uses the ndiscvt(1) utility to convert the .INF,'))} ) (C {(echo)} {(DQ ('\t.SYS and optional firmware files into a FreeBSD kernel loadable module'))} ) (C {(echo)} {(DQ ('\t(.ko) file. This module can be loaded via the kldload(8) utility or'))}) (C {(echo)} {(DQ ('\tloaded automatically via the /boot/loader.conf file. The ndiscvt(1)'))}) (C {(echo)} {(DQ ('\tutility extracts the device ID information and registry key data'))}) (C {(echo)} {(DQ ('\tfrom the .INF file and converts it into a C header file. It also uses'))} ) (C {(echo)} {(DQ ('\tthe objcopy(1) utility to convert the .SYS file and optional firmware'))} ) (C {(echo)} {(DQ ('\tfiles into ELF objects. The header file is compiled into a small C'))}) (C {(echo)} {(DQ ('\tstub file which contains a small amount of code to interface with'))}) (C {(echo)} {(DQ ('\tthe FreeBSD module system. This stub is linked together with the'))}) (C {(echo)} {(DQ ('\tconverted ELF objects to form a FreeBSD kernel module. A static ELF'))}) (C {(echo)} {(DQ ('\tobject (.o) file is also created. This file can be linked into a'))}) (C {(echo)} {(DQ ('\tstatic kernel image for those who want/need a fully linked kernel'))}) (C {(echo)} {(DQ ('\timage (possibly for embedded bootstrap purposes, or just plain old'))}) (C {(echo)} {(DQ ('\texperimentation).'))}) (C {(echo)} {(DQ )}) (C {(echo)} {(-n)} {(DQ ('\tPress return to continue... '))}) (C {(read)} {(KEYPRESS)}) (command.ControlFlow token: (Token id:Id.ControlFlow_Return val:return span_id:744) ) ] ) ) (command.ShFunction name: help5 body: (command.BraceGroup children: [ (C {(header)}) (C {(echo)} {(DQ ('\t\t\t\tPrerequisites'))}) (C {(echo)} {(DQ )}) (C {(echo)} {(DQ ('\tConverting a driver requires the following utilities:'))}) (C {(echo)} {(DQ )}) (C {(echo)} {(DQ ('\t- The FreeBSD C compiler, cc(1) (part of the base install).'))}) (C {(echo)} {(DQ ('\t- The FreeBSD linker, ld(1) (part of the base install).'))}) (C {(echo)} {(DQ ('\t- The objcopy(1) utility (part of the base install).'))}) (C {(echo)} {(DQ ('\t- The ndiscvt(1) utility (part of the base install).'))}) (C {(echo)} {(DQ )}) (C {(echo)} {(DQ ("\tIf you happen to end up with a .INF file that's in Unicode format,"))}) (C {(echo)} {(DQ ("\tthen you'll also need:"))}) (C {(echo)} {(DQ )}) (C {(echo)} {(DQ ('\t- The iconv(1) utility.'))}) (C {(echo)} {(DQ )}) (C {(echo)} {(DQ ('\tIf you have installed the X Window system or some sort of desktop'))}) (C {(echo)} {(DQ ('\tenvironment, then iconv(1) should already be present. If not, you'))}) (C {(echo)} {(DQ ('\twill need to install the libiconv package or port.'))}) (C {(echo)} {(DQ )}) (C {(echo)} {(-n)} {(DQ ('\tPress return to continue... '))}) (C {(read)} {(KEYPRESS)}) (command.ControlFlow token: (Token id:Id.ControlFlow_Return val:return span_id:872) ) ] ) ) (command.ShFunction name: infconv body: (command.BraceGroup children: [ (C {(header)}) (C {(echo)} {(DQ ('\t\t\tINF file validation'))}) (command.If arms: [ (if_arm cond: [ (command.Sentence child: (C {(Id.Lit_LBracket '[')} {(-z)} {(DQ ($ Id.VSub_DollarName '$INFPATH'))} {(Id.Lit_RBracket ']')} ) terminator: (Token id:Id.Op_Semi val:';' span_id:904) ) ] action: [ (C {(echo)} {(DQ )}) (C {(echo)} {(DQ )}) (C {(echo)} {(DQ ('\tA .INF file is most often provided as an ASCII file, however'))} ) (C {(echo)} {(DQ ('\tfiles with multilanguage support are provided in Unicode format.'))} ) (C {(echo)} {(DQ ('\tPlease type in the path to your .INF file now.'))}) (C {(echo)} {(DQ )}) (C {(echo)} {(-n)} {(DQ ('\t> '))}) (C {(read)} {(INFPATH)}) ] spids: [893 906] ) ] ) (command.If arms: [ (if_arm cond: [ (command.Sentence child: (command.AndOr ops: [Id.Op_DAmp] children: [ (C {(Id.Lit_LBracket '[')} {(${ Id.VSub_Name INFPATH)} {(Id.Lit_RBracket ']')} ) (C {(Id.Lit_LBracket '[')} {(-e)} {(${ Id.VSub_Name INFPATH)} {(Id.Lit_RBracket ']')} ) ] ) terminator: (Token id:Id.Op_Semi val:';' span_id:985) ) ] action: [ (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:INFTYPE) op: assign_op.Equal rhs: { (command_sub left_token: (Token id:Id.Left_Backtick val:'`' span_id:992) command_list: (command.CommandList children: [ (C {(${ Id.VSub_Name EGREP)} {(-i)} {(-c)} {(DQ ('Signature|.S.i.g.n.a.t.u.r.e'))} {(${ Id.VSub_Name INFPATH)} ) ] ) ) } spids: [991] ) ] ) (command.If arms: [ (if_arm cond: [ (command.Sentence child: (C {(Id.Lit_LBracket '[')} {(${ Id.VSub_Name INFTYPE)} {(-le)} {(0)} {(Id.Lit_RBracket ']')} ) terminator: (Token id:Id.Op_Semi val:';' span_id:1026) ) ] action: [ (C {(echo)} {(DQ )}) (C {(echo)} { (DQ ( "\tI don't recognize this file format. It may not be a valid .INF file." ) ) } ) (C {(echo)} {(DQ )}) (C {(echo)} {(-n)} {(DQ ('\tPress enter to try again, or ^C to quit. '))}) (C {(read)} {(KEYPRESS)}) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:INFPATH) op: assign_op.Equal rhs: {(DQ )} spids: [1064] ) ] ) (command.ControlFlow token: (Token id:Id.ControlFlow_Return val:return span_id:1069) ) ] spids: [1013 1028] ) ] ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:INFTYPE) op: assign_op.Equal rhs: { (command_sub left_token: (Token id:Id.Left_Backtick val:'`' span_id:1077) command_list: (command.CommandList children: [ (C {(${ Id.VSub_Name EGREP)} {(-i)} {(-c)} {(DQ ('Class.*=.*Net'))} {(${ Id.VSub_Name INFPATH)} ) ] ) ) } spids: [1076] ) ] ) (command.If arms: [ (if_arm cond: [ (command.Sentence child: (C {(Id.Lit_LBracket '[')} {(${ Id.VSub_Name INFTYPE)} {(-gt)} {(0)} {(Id.Lit_RBracket ']')} ) terminator: (Token id:Id.Op_Semi val:';' span_id:1111) ) ] action: [ (C {(echo)} {(DQ )}) (C {(echo)} {(DQ ('\tThis .INF file appears to be ASCII.'))}) (C {(echo)} {(DQ )}) (C {(echo)} {(-n)} {(DQ ('\tPress return to continue... '))}) (C {(read)} {(KEYPRESS)}) (command.ControlFlow token: (Token id:Id.ControlFlow_Return val:return span_id:1149) ) ] spids: [1098 1113] ) ] ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:INFTYPE) op: assign_op.Equal rhs: { (command_sub left_token: (Token id:Id.Left_Backtick val:'`' span_id:1157) command_list: (command.CommandList children: [ (C {(${ Id.VSub_Name EGREP)} {(-i)} {(-c)} {(DQ ('.C.l.a.s.s.*=.*N.e.t'))} {(${ Id.VSub_Name INFPATH)} ) ] ) ) } spids: [1156] ) ] ) (command.If arms: [ (if_arm cond: [ (command.Sentence child: (C {(Id.Lit_LBracket '[')} {(${ Id.VSub_Name INFTYPE)} {(-gt)} {(0)} {(Id.Lit_RBracket ']')} ) terminator: (Token id:Id.Op_Semi val:';' span_id:1191) ) ] action: [ (C {(echo)} {(DQ )}) (C {(echo)} {(DQ ('\tThis .INF file appears to be Unicode.'))}) (command.If arms: [ (if_arm cond: [ (command.Sentence child: (C {(Id.Lit_LBracket '[')} {(-e)} {(${ Id.VSub_Name ICONVPATH)} {(Id.Lit_RBracket ']')} ) terminator: (Token id:Id.Op_Semi val:';' span_id:1220) ) ] action: [ (C {(echo)} {(DQ ('\tTrying to convert to ASCII...'))}) (command.Simple words: [ {(${ Id.VSub_Name ICONVPATH)} {(-f)} {(utf-16)} {(-t)} {(utf-8)} {(${ Id.VSub_Name INFPATH)} ] redirects: [ (redir.Redir op: (Token id:Id.Redir_Great val:'>' span_id:1248) fd: -1 arg_word: {(${ Id.VSub_Name INFFILE)} ) ] ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:INFPATH) op: assign_op.Equal rhs: {(${ Id.VSub_Name INFFILE)} spids: [1255] ) ] ) (C {(echo)} {(DQ ('\tDone.'))}) (C {(echo)} {(DQ )}) (C {(echo)} {(-n)} {(DQ ('\tPress return to continue... '))}) (C {(read)} {(KEYPRESS)}) ] spids: [1209 1222] ) ] else_action: [ (C {(echo)} {(DQ ('\tThe iconv(1) utility does not appear to be installed.'))} ) (C {(echo)} {(DQ ('\tPlease install this utility or convert the .INF file'))} ) (C {(echo)} {(DQ ('\tto ASCII and run this utility again.'))}) (C {(echo)} {(DQ )}) (command.ControlFlow token: (Token id:Id.ControlFlow_Exit val:exit span_id:1318) ) ] ) (command.ControlFlow token: (Token id:Id.ControlFlow_Return val:return span_id:1324) ) ] spids: [1178 1193] ) ] ) (C {(echo)} {(DQ )}) (C {(echo)} { (DQ ("\tI don't recognize this file format. It may not be a valid .INF file.") ) } ) (C {(echo)} {(DQ )}) (C {(echo)} {(-n)} {(DQ ('\tPress enter to try again, or ^C to quit. '))}) (C {(read)} {(KEYPRESS)}) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:INFPATH) op: assign_op.Equal rhs: {(DQ )} spids: [1364] ) ] ) ] spids: [964 987] ) ] else_action: [ (C {(echo)} {(DQ )}) (C {(echo)} {(DQ ("\tThe file '") (${ Id.VSub_Name INFPATH) ("' was not found."))}) (C {(echo)} {(DQ )}) (C {(echo)} {(-n)} {(DQ ('\tPress enter to try again, or ^C to quit. '))}) (C {(read)} {(KEYPRESS)}) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:INFPATH) op: assign_op.Equal rhs: {(DQ )} spids: [1408] ) ] ) ] ) (command.ControlFlow token: (Token id:Id.ControlFlow_Return val:return span_id:1414) ) ] ) ) (command.ShFunction name: sysconv body: (command.BraceGroup children: [ (C {(header)}) (C {(echo)} {(DQ ('\t\t\tDriver file validation'))}) (command.If arms: [ (if_arm cond: [ (command.Sentence child: (C {(Id.Lit_LBracket '[')} {(Id.KW_Bang '!')} {(-r)} {(DQ ($ Id.VSub_DollarName '$SYSPATH'))} {(Id.Lit_RBracket ']')} ) terminator: (Token id:Id.Op_Semi val:';' span_id:1447) ) ] action: [ (C {(echo)} {(DQ )}) (C {(echo)} {(DQ )}) (C {(echo)} {(DQ ('\tNow you need to specify the name of the Windows(r) driver .SYS'))} ) (C {(echo)} {(DQ ('\tfile for your device. Note that if you are running FreeBSD/amd64,'))} ) (C {(echo)} {(DQ ('\tthen you must provide a driver that has been compiled for the'))} ) (C {(echo)} {(DQ ('\t64-bit Windows(r) platform. If a 64-bit driver is not available'))} ) (C {(echo)} {(DQ ('\tfor your device, you must install FreeBSD/i386 and use the'))}) (C {(echo)} {(DQ ('\t32-bit driver instead.'))}) (C {(echo)} {(DQ )}) (C {(echo)} {(DQ ('\tPlease type in the path to the Windows(r) driver .SYS file now.'))} ) (C {(echo)} {(DQ )}) (C {(echo)} {(-n)} {(DQ ('\t> '))}) (C {(read)} {(SYSPATH)}) ] spids: [1434 1449] ) ] ) (command.If arms: [ (if_arm cond: [ (command.Sentence child: (command.AndOr ops: [Id.Op_DAmp] children: [ (C {(Id.Lit_LBracket '[')} {(${ Id.VSub_Name SYSPATH)} {(Id.Lit_RBracket ']')} ) (C {(Id.Lit_LBracket '[')} {(-e)} {(${ Id.VSub_Name SYSPATH)} {(Id.Lit_RBracket ']')} ) ] ) terminator: (Token id:Id.Op_Semi val:';' span_id:1562) ) ] action: [ (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:SYSTYPE) op: assign_op.Equal rhs: { (command_sub left_token: (Token id:Id.Left_Backtick val:'`' span_id:1568) command_list: (command.CommandList children: [(C {(${ Id.VSub_Name FILE)} {(${ Id.VSub_Name SYSPATH)})] ) ) } spids: [1567] ) ] ) (command.Case to_match: {(${ Id.VSub_Name SYSTYPE)} arms: [ (case_arm pat_list: [{(Id.Lit_Star '*') (Windows) (Id.Lit_Star '*')}] action: [ (C {(echo)} {(DQ )}) (C {(echo)} {(DQ ('\tThis .SYS file appears to be in Windows(r) PE format.'))} ) (C {(echo)} {(DQ )}) (C {(echo)} {(-n)} {(DQ ('\tPress return to continue... '))}) (C {(read)} {(KEYPRESS)}) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:SYSBASE) op: assign_op.Equal rhs: { (command_sub left_token: (Token id:Id.Left_Backtick val:'`' span_id:1631) command_list: (command.CommandList children: [ (command.Pipeline children: [ (C {(${ Id.VSub_Name BASENAME)} {(${ Id.VSub_Name SYSPATH)} ) (C {(${ Id.VSub_Name TR)} {(SQ (Token id:Id.Lit_Chars val:. span_id:1649))} {(SQ (Token id:Id.Lit_Chars val:_ span_id:1653))} ) ] negated: F ) ] ) ) } spids: [1630] ) ] ) ] spids: [1591 1594 1658 -1] ) (case_arm pat_list: [{(Id.Lit_Star '*')}] action: [ (C {(echo)} {(DQ )}) (C {(echo)} { (DQ ( "\tI don't recognize this file format. It may not be a valid .SYS file." ) ) } ) (C {(echo)} {(DQ )}) (C {(echo)} {(-n)} {(DQ ('\tPress enter to try again, or ^C to quit. '))}) (C {(read)} {(KEYPRESS)}) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:SYSPATH) op: assign_op.Equal rhs: {(DQ )} spids: [1699] ) ] ) ] spids: [1661 1662 1704 -1] ) ] ) ] spids: [1541 1564] ) ] else_action: [ (C {(echo)} {(DQ )}) (C {(echo)} {(DQ ("\tThe file '") (${ Id.VSub_Name SYSPATH) ("' was not found."))}) (C {(echo)} {(DQ )}) (C {(echo)} {(-n)} {(DQ ('\tPress enter to try again, or ^C to quit. '))}) (C {(read)} {(KEYPRESS)}) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:SYSPATH) op: assign_op.Equal rhs: {(DQ )} spids: [1749] ) ] ) ] ) (command.ControlFlow token: (Token id:Id.ControlFlow_Return val:return span_id:1756) ) ] ) ) (command.ShFunction name: ndiscvt body: (command.BraceGroup children: [ (C {(header)}) (C {(echo)} {(DQ ('\t\t\tDriver file conversion'))}) (C {(echo)} {(DQ )}) (C {(echo)} {(DQ ('\tThe script will now try to convert the .INF and .SYS files'))}) (C {(echo)} {(DQ ('\tusing the ndiscvt(1) utility. This utility can handle most'))}) (C {(echo)} {(DQ ('\t.INF files; however, occasionally it can fail to parse some files'))}) (C {(echo)} {(DQ ('\tdue to subtle syntax issues: the .INF syntax is very complex,'))}) (C {(echo)} {(DQ ('\tand the Windows(r) parser will sometimes allow files with small'))}) (C {(echo)} {(DQ ('\tsyntax errors to be processed correctly which ndiscvt(1) will'))}) (C {(echo)} {(DQ ('\tnot. If the conversion fails, you may have to edit the .INF'))}) (C {(echo)} {(DQ ('\tfile by hand to remove the offending lines.'))}) (C {(echo)} {(DQ )}) (C {(echo)} {(-n)} {(DQ ('\tPress enter to try converting the files now: '))}) (C {(read)} {(KEYPRESS)}) (command.If arms: [ (if_arm cond: [ (command.Sentence child: (command.Pipeline children: [ (command.Simple words: [ {(${ Id.VSub_Name NDISCVT)} {(-i)} {(${ Id.VSub_Name INFPATH)} {(-s)} {(${ Id.VSub_Name SYSPATH)} {(-O)} {(-o)} {(${ Id.VSub_Name DNAME) (.h)} ] redirects: [ (redir.Redir op: (Token id:Id.Redir_Great val:'>' span_id:1874) fd: -1 arg_word: {(/dev/null)} ) ] ) ] negated: T ) terminator: (Token id:Id.Op_Semi val:';' span_id:1877) ) ] action: [ (C {(echo)} {(DQ ('CONVERSION FAILED'))}) (command.ControlFlow token: (Token id:Id.ControlFlow_Exit val:exit span_id:1889) ) ] spids: [1845 1879] ) ] else_action: [ (C {(echo)} {(DQ )}) (C {(echo)} {(DQ ('\tConversion was successful.'))}) (C {(echo)} {(DQ )}) (C {(echo)} {(-n)} {(DQ ('\tPress enter to continue... '))}) (C {(read)} {(KEYPRESS)}) ] ) (command.ControlFlow token: (Token id:Id.ControlFlow_Return val:return span_id:1928) ) ] ) ) (command.ShFunction name: firmcvt body: (command.BraceGroup children: [ (command.WhileUntil keyword: (Token id:Id.KW_While val:while span_id:1940) cond: [ (command.Sentence child: (C {(Id.Lit_Other ':')}) terminator: (Token id:Id.Op_Semi val:';' span_id:1944) ) ] body: (command.DoGroup children: [ (C {(header)}) (C {(echo)} {(DQ ('\t\t\tFirmware file conversion'))}) (C {(echo)} {(DQ )}) (C {(echo)} {(DQ ('\tIf your driver uses additional firmware files, please list them'))} ) (C {(echo)} {(DQ ("\tbelow. When you're finished, just press enter to continue. (If your"))} ) (C {(echo)} {(DQ ("\tdriver doesn't need any extra firmware files, just press enter"))} ) (C {(echo)} {(DQ ('\tto move to the next step.)'))}) (C {(echo)} {(DQ )}) (C {(echo)} {(-n)} {(DQ ('\t> '))}) (C {(read)} {(FIRMPATH)}) (command.If arms: [ (if_arm cond: [ (command.Sentence child: (C {(Id.Lit_LBracket '[')} {(${ Id.VSub_Name FIRMPATH)} {(Id.Lit_RBracket ']')} ) terminator: (Token id:Id.Op_Semi val:';' span_id:2015) ) ] action: [ (command.If arms: [ (if_arm cond: [ (command.Sentence child: (C {(Id.Lit_LBracket '[')} {(Id.KW_Bang '!')} {(-e)} {(${ Id.VSub_Name FIRMPATH)} {(Id.Lit_RBracket ']')} ) terminator: (Token id:Id.Op_Semi val:';' span_id:2033) ) ] action: [ (C {(echo)} {(DQ )}) (C {(echo)} { (DQ ("\tThe file '") (${ Id.VSub_Name FIRMPATH) ("' was not found") ) } ) (C {(echo)} {(DQ )}) (C {(echo)} {(-n)} {(DQ ('\tPress enter to try again, or ^C to quit. '))} ) (C {(read)} {(KEYPRESS)}) (command.ControlFlow token: (Token id: Id.ControlFlow_Continue val: continue span_id: 2075 ) ) ] spids: [2020 2035] ) ] ) (command.If arms: [ (if_arm cond: [ (command.Sentence child: (command.Pipeline children: [ (command.Simple words: [ {(${ Id.VSub_Name NDISCVT)} {(-f)} {(${ Id.VSub_Name FIRMPATH)} ] redirects: [ (redir.Redir op: (Token id:Id.Redir_Great val:'>' span_id:2095) fd: -1 arg_word: {(/dev/null)} ) ] ) ] negated: T ) terminator: (Token id:Id.Op_Semi val:';' span_id:2098) ) ] action: [(C {(echo)} {(DQ )}) (C {(echo)} {(DQ ('CONVERSION FAILED'))})] spids: [2081 2100] ) ] else_action: [ (C {(echo)} {(DQ )}) (C {(echo)} {(DQ ('\tConversion was successful.'))}) (C {(echo)} {(DQ )}) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:FRMBASE) op: assign_op.Equal rhs: { (command_sub left_token: (Token id: Id.Left_Backtick val: '`' span_id: 2139 ) command_list: (command.CommandList children: [ (C {(${ Id.VSub_Name BASENAME)} {(${ Id.VSub_Name FIRMPATH)} ) ] ) ) } spids: [2138] ) ] ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:FRMBASE) op: assign_op.Equal rhs: {(DQ (${ Id.VSub_Name FRMBASE) (.o))} spids: [2152] ) ] ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:FRMLIST) op: assign_op.Equal rhs: { (DQ (${ Id.VSub_Name FRMLIST) (' ') (${ Id.VSub_Name FRMBASE)) } spids: [2161] ) ] ) ] ) (C {(echo)} {(-n)} {(DQ ('\tPress enter to continue... '))}) (C {(read)} {(KEYPRESS)}) ] spids: [2006 2017] ) ] else_action: [ (command.ControlFlow token: (Token id:Id.ControlFlow_Break val:break span_id:2193) ) ] ) ] ) ) (C {(header)}) (C {(echo)} {(DQ )}) (C {(echo)} {(DQ ('\tList of files converted firmware files:'))}) (C {(echo)} {(DQ )}) (command.ForEach iter_name: i iter_words: [{(${ Id.VSub_Name FRMLIST)}] do_arg_iter: F body: (command.DoGroup children: [(C {(echo)} {(DQ ('\t')) ($ Id.VSub_DollarName '$i')})] ) ) (C {(echo)} {(DQ )}) (C {(echo)} {(-n)} {(DQ ('\tPress enter to continue... '))}) (C {(read)} {(KEYPRESS)}) (command.ControlFlow token: (Token id:Id.ControlFlow_Return val:return span_id:2259) ) ] ) ) (command.ShFunction name: drvgen body: (command.BraceGroup children: [ (C {(header)}) (C {(echo)} {(DQ ('\t\t\tKernel module generation'))}) (C {(echo)} {(DQ )}) (C {(echo)} {(DQ )}) (C {(echo)} {(DQ ('\tThe script will now try to generate the kernel driver module.'))}) (C {(echo)} {(DQ ('\tThis is the last step. Once this module is generated, you should'))}) (C {(echo)} {(DQ ('\tbe able to load it just like any other FreeBSD driver module.'))}) (C {(echo)} {(DQ )}) (C {(echo)} {(DQ ('\tPress enter to compile the stub module and generate the driver'))}) (C {(echo)} {(-n)} {(DQ ('\tmodule now: '))}) (C {(read)} {(KEYPRESS)}) (C {(echo)} {(DQ )}) (C {(echo)} {(-n)} {(DQ ('\tGenerating Makefile... '))}) (command.Simple words: [ {(echo)} {(DQ ('.PATH: ') (${ Id.VSub_Name PWD) (' ') (${ Id.VSub_Name STUBPATH))} ] redirects: [ (redir.Redir op: (Token id:Id.Redir_Great val:'>' span_id:2356) fd: -1 arg_word: {(${ Id.VSub_Name MAKEFILE)} ) ] ) (command.Simple words: [{(echo)} {(DQ ('KMOD= ') (${ Id.VSub_Name SYSBASE))}] redirects: [ (redir.Redir op: (Token id:Id.Redir_DGreat val:'>>' span_id:2371) fd: -1 arg_word: {(${ Id.VSub_Name MAKEFILE)} ) ] ) (command.Simple words: [ {(echo)} { (DQ ('SRCS+= ') (${ Id.VSub_Name STUBFILE) (' ') (${ Id.VSub_Name DNAME) ('.h bus_if.h device_if.h') ) } ] redirects: [ (redir.Redir op: (Token id:Id.Redir_DGreat val:'>>' span_id:2391) fd: -1 arg_word: {(${ Id.VSub_Name MAKEFILE)} ) ] ) (command.Simple words: [ {(echo)} {(DQ ('OBJS+=') (${ Id.VSub_Name FRMLIST) (' ') (${ Id.VSub_Name DNAME) (.o))} ] redirects: [ (redir.Redir op: (Token id:Id.Redir_DGreat val:'>>' span_id:2411) fd: -1 arg_word: {(${ Id.VSub_Name MAKEFILE)} ) ] ) (command.Simple words: [ {(echo)} { (DQ ('CFLAGS+=\t') (word_part.EscapedLiteral token: (Token id:Id.Lit_EscapedChar val:'\\\\' span_id:2421) ) ) } ] redirects: [ (redir.Redir op: (Token id:Id.Redir_DGreat val:'>>' span_id:2424) fd: -1 arg_word: {(${ Id.VSub_Name MAKEFILE)} ) ] ) (command.Simple words: [ {(echo)} { (DQ ('\t-DDRV_DATA_START=ndis_') (${ Id.VSub_Name SYSBASE) ('_drv_data_start ') (word_part.EscapedLiteral token: (Token id:Id.Lit_EscapedChar val:'\\\\' span_id:2438) ) ) } ] redirects: [ (redir.Redir op: (Token id:Id.Redir_DGreat val:'>>' span_id:2441) fd: -1 arg_word: {(${ Id.VSub_Name MAKEFILE)} ) ] ) (command.Simple words: [ {(echo)} { (DQ ('\t-DDRV_NAME=ndis_') (${ Id.VSub_Name SYSBASE) (' ') (word_part.EscapedLiteral token: (Token id:Id.Lit_EscapedChar val:'\\\\' span_id:2455) ) ) } ] redirects: [ (redir.Redir op: (Token id:Id.Redir_DGreat val:'>>' span_id:2458) fd: -1 arg_word: {(${ Id.VSub_Name MAKEFILE)} ) ] ) (command.Simple words: [ {(echo)} {(DQ ('\t-DDRV_DATA_END=ndis_') (${ Id.VSub_Name SYSBASE) (_drv_data_end))} ] redirects: [ (redir.Redir op: (Token id:Id.Redir_DGreat val:'>>' span_id:2474) fd: -1 arg_word: {(${ Id.VSub_Name MAKEFILE)} ) ] ) (command.Simple words: [ {(echo)} { (DQ ('CLEANFILES+=\t') (word_part.EscapedLiteral token: (Token id:Id.Lit_EscapedChar val:'\\\\' span_id:2484) ) ) } ] redirects: [ (redir.Redir op: (Token id:Id.Redir_DGreat val:'>>' span_id:2487) fd: -1 arg_word: {(${ Id.VSub_Name MAKEFILE)} ) ] ) (command.Simple words: [ {(echo)} { (DQ ('\t') (${ Id.VSub_Name INFFILE) (' ') (word_part.EscapedLiteral token: (Token id:Id.Lit_EscapedChar val:'\\\\' span_id:2501) ) ) } ] redirects: [ (redir.Redir op: (Token id:Id.Redir_DGreat val:'>>' span_id:2504) fd: -1 arg_word: {(${ Id.VSub_Name MAKEFILE)} ) ] ) (command.Simple words: [ {(echo)} { (DQ ('\t') (${ Id.VSub_Name DNAME) ('.h ') (word_part.EscapedLiteral token: (Token id:Id.Lit_EscapedChar val:'\\\\' span_id:2518) ) ) } ] redirects: [ (redir.Redir op: (Token id:Id.Redir_DGreat val:'>>' span_id:2521) fd: -1 arg_word: {(${ Id.VSub_Name MAKEFILE)} ) ] ) (command.Simple words: [{(echo)} {(DQ ('\t') (${ Id.VSub_Name DNAME) (.o))}] redirects: [ (redir.Redir op: (Token id:Id.Redir_DGreat val:'>>' span_id:2537) fd: -1 arg_word: {(${ Id.VSub_Name MAKEFILE)} ) ] ) (command.Simple words: [{(echo)} {(DQ ('.include <bsd.kmod.mk>'))}] redirects: [ (redir.Redir op: (Token id:Id.Redir_DGreat val:'>>' span_id:2549) fd: -1 arg_word: {(${ Id.VSub_Name MAKEFILE)} ) ] ) (command.If arms: [ (if_arm cond: [ (command.Sentence child: (C {(Id.Lit_LBracket '[')} {(-f)} {(${ Id.VSub_Name MAKEFILE)} {(Id.Lit_RBracket ']')} ) terminator: (Token id:Id.Op_Semi val:';' span_id:2566) ) ] action: [(C {(echo)} {(DQ (done.))})] spids: [2555 2568] ) ] else_action: [ (C {(echo)} {(DQ ('generating Makefile failed. Exiting.'))}) (C {(echo)} {(DQ )}) (command.ControlFlow token: (Token id:Id.ControlFlow_Exit val:exit span_id:2593) ) ] ) (C {(echo)} {(-n)} {(DQ ('\tBuilding kernel module... '))}) (command.Simple words: [{(echo)} {(DQ )}] redirects: [ (redir.Redir op: (Token id:Id.Redir_Great val:'>' span_id:2610) fd: -1 arg_word: {(bus_if.h)} ) ] ) (command.Simple words: [{(echo)} {(DQ )}] redirects: [ (redir.Redir op: (Token id:Id.Redir_Great val:'>' span_id:2619) fd: -1 arg_word: {(device_if.h)} ) ] ) (command.If arms: [ (if_arm cond: [ (command.Sentence child: (command.Pipeline children: [ (command.Simple words: [ {(${ Id.VSub_Name MAKE)} {(-f)} {(${ Id.VSub_Name MAKEFILE)} {(all)} ] redirects: [ (redir.Redir op: (Token id:Id.Redir_Great val:'>' span_id:2639) fd: -1 arg_word: {(/dev/null)} ) ] ) ] negated: T ) terminator: (Token id:Id.Op_Semi val:';' span_id:2642) ) ] action: [ (C {(echo)} {(DQ ('build failed. Exiting.'))}) (C {(echo)} {(DQ )}) (command.ControlFlow token: (Token id:Id.ControlFlow_Exit val:exit span_id:2660) ) ] spids: [2623 2644] ) ] else_action: [ (command.If arms: [ (if_arm cond: [ (command.Sentence child: (C {(Id.Lit_LBracket '[')} {(-f)} {(${ Id.VSub_Name SYSBASE) (.ko)} {(Id.Lit_RBracket ']')} ) terminator: (Token id:Id.Op_Semi val:';' span_id:2677) ) ] action: [ (C {(${ Id.VSub_Name MV)} {(${ Id.VSub_Name SYSBASE) (.ko)} {(${ Id.VSub_Name SYSBASE) (.kmod)} ) (C {(echo)} {(DQ (done.))}) ] spids: [2665 2679] ) ] else_action: [ (C {(echo)} {(DQ ('build failed. Exiting.'))}) (C {(echo)} {(DQ )}) (command.ControlFlow token: (Token id:Id.ControlFlow_Exit val:exit span_id:2720) ) ] ) ] ) (C {(echo)} {(-n)} {(DQ ('\tCleaning up... '))}) (command.If arms: [ (if_arm cond: [ (command.Sentence child: (command.Pipeline children: [ (command.Simple words: [ {(${ Id.VSub_Name MAKE)} {(-f)} {(${ Id.VSub_Name MAKEFILE)} {(clean)} {(cleandepend)} ] redirects: [ (redir.Redir op: (Token id:Id.Redir_Great val:'>' span_id:2753) fd: -1 arg_word: {(/dev/null)} ) ] ) ] negated: T ) terminator: (Token id:Id.Op_Semi val:';' span_id:2756) ) ] action: [ (C {(echo)} {(DQ ('cleanup failed. Exiting.'))}) (C {(echo)} {(DQ )}) (command.ControlFlow token: (Token id:Id.ControlFlow_Exit val:exit span_id:2774) ) ] spids: [2735 2758] ) ] else_action: [(C {(echo)} {(DQ (done.))})] ) (C {(${ Id.VSub_Name RM)} {(${ Id.VSub_Name MAKEFILE)}) (C {(${ Id.VSub_Name MV)} {(${ Id.VSub_Name SYSBASE) (.kmod)} {(${ Id.VSub_Name SYSBASE) (.ko)} ) (C {(echo)} {(DQ )}) (C {(echo)} { (DQ ('\tThe file ') (${ Id.VSub_Name SYSBASE) ('.ko has been successfully generated.')) } ) (C {(echo)} {(DQ ('\tYou can kldload this module to get started.'))}) (C {(echo)} {(DQ )}) (C {(echo)} {(-n)} {(DQ ('\tPress return to exit. '))}) (C {(read)} {(KEYPRESS)}) (C {(echo)} {(DQ )}) (C {(echo)} {(DQ )}) (command.ControlFlow token: (Token id:Id.ControlFlow_Return val:return span_id:2857) ) ] ) ) (command.ShFunction name: convert_driver body: (command.BraceGroup children: [ (command.WhileUntil keyword: (Token id:Id.KW_While val:while span_id:2870) cond: [ (command.Sentence child: (C {(Id.Lit_Other ':')}) terminator: (Token id:Id.Op_Semi val:';' span_id:2874) ) ] body: (command.DoGroup children: [ (C {(infconv)}) (command.If arms: [ (if_arm cond: [ (command.Sentence child: (C {(Id.Lit_LBracket '[')} {(${ Id.VSub_Name INFPATH)} {(Id.Lit_RBracket ']')} ) terminator: (Token id:Id.Op_Semi val:';' span_id:2891) ) ] action: [ (command.ControlFlow token: (Token id:Id.ControlFlow_Break val:break span_id:2896) ) ] spids: [2882 2893] ) ] ) ] ) ) (command.WhileUntil keyword: (Token id:Id.KW_While val:while span_id:2906) cond: [ (command.Sentence child: (C {(Id.Lit_Other ':')}) terminator: (Token id:Id.Op_Semi val:';' span_id:2910) ) ] body: (command.DoGroup children: [ (C {(sysconv)}) (command.If arms: [ (if_arm cond: [ (command.Sentence child: (C {(Id.Lit_LBracket '[')} {(${ Id.VSub_Name SYSPATH)} {(Id.Lit_RBracket ']')} ) terminator: (Token id:Id.Op_Semi val:';' span_id:2927) ) ] action: [ (command.ControlFlow token: (Token id:Id.ControlFlow_Break val:break span_id:2932) ) ] spids: [2918 2929] ) ] ) ] ) ) (C {(ndiscvt)}) (C {(firmcvt)}) (C {(drvgen)}) (command.ControlFlow token: (Token id:Id.ControlFlow_Return val:return span_id:2951) ) ] ) ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:ICONVPATH) op: assign_op.Equal rhs: {(/usr/bin/iconv)} spids: [2956] ) ] ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:NDISCVT) op: assign_op.Equal rhs: {(/usr/sbin/ndiscvt)} spids: [2959] ) ] ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:STUBPATH) op: assign_op.Equal rhs: {(/usr/share/misc)} spids: [2962] ) ] ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:STUBFILE) op: assign_op.Equal rhs: {(windrv_stub.c)} spids: [2965] ) ] ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:DNAME) op: assign_op.Equal rhs: {(windrv)} spids: [2968] ) ] ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:CP) op: assign_op.Equal rhs: {(/bin/cp)} spids: [2971] ) ] ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:MV) op: assign_op.Equal rhs: {(/bin/mv)} spids: [2974] ) ] ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:RM) op: assign_op.Equal rhs: {(/bin/rm)} spids: [2977] ) ] ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:TR) op: assign_op.Equal rhs: {(/usr/bin/tr)} spids: [2980] ) ] ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:FILE) op: assign_op.Equal rhs: {(/usr/bin/file)} spids: [2983] ) ] ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:EGREP) op: assign_op.Equal rhs: {(/usr/bin/egrep)} spids: [2986] ) ] ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:MAKE) op: assign_op.Equal rhs: {(/usr/bin/make)} spids: [2989] ) ] ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:BASENAME) op: assign_op.Equal rhs: {(/usr/bin/basename)} spids: [2992] ) ] ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:TOUCH) op: assign_op.Equal rhs: {(/usr/bin/touch)} spids: [2995] ) ] ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:MKTEMP) op: assign_op.Equal rhs: {(/usr/bin/mktemp)} spids: [2998] ) ] ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:MAKEFILE) op: assign_op.Equal rhs: { (command_sub left_token: (Token id:Id.Left_Backtick val:'`' span_id:3003) command_list: (command.CommandList children: [(C {(${ Id.VSub_Name MKTEMP)} {(/tmp/Makefile.XXXXXX)})] ) ) } spids: [3002] ) ] ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:INFFILE) op: assign_op.Equal rhs: { (command_sub left_token: (Token id:Id.Left_Backtick val:'`' span_id:3014) command_list: (command.CommandList children: [(C {(${ Id.VSub_Name MKTEMP)} {(/tmp/ascii_inf.XXXXXX)})] ) ) } spids: [3013] ) ] ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:INFPATH) op: assign_op.Equal rhs: {(DQ )} spids: [3025] ) ] ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:FRMLIST) op: assign_op.Equal rhs: {(DQ )} spids: [3029] ) ] ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:SYSPATH) op: assign_op.Equal rhs: {(DQ )} spids: [3033] ) ] ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:SYSBASE) op: assign_op.Equal rhs: {(DQ )} spids: [3037] ) ] ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:FRMBASE) op: assign_op.Equal rhs: {(DQ )} spids: [3041] ) ] ) (command.If arms: [ (if_arm cond: [ (command.Sentence child: (C {(Id.Lit_LBracket '[')} {(-r)} {(DQ ($ Id.VSub_Number '$1'))} {(-a)} {(-r)} {(DQ ($ Id.VSub_Number '$2'))} {(Id.Lit_RBracket ']')} ) terminator: (Token id:Id.Op_Semi val:';' span_id:3065) ) ] action: [ (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:INFPATH) op: assign_op.Equal rhs: {($ Id.VSub_Number '$1')} spids: [3074] ) ] ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:SYSPATH) op: assign_op.Equal rhs: {($ Id.VSub_Number '$2')} spids: [3078] ) ] ) (command.AndOr ops: [Id.Op_DAmp] children: [ (C {(convert_driver)}) (command.ControlFlow token: (Token id:Id.ControlFlow_Exit val:exit span_id:3086) arg_word: {(0)} ) ] ) ] spids: [3046 3067] ) ] ) (command.WhileUntil keyword: (Token id:Id.KW_While val:while span_id:3093) cond: [ (command.Sentence child: (C {(Id.Lit_Other ':')}) terminator: (Token id:Id.Op_Semi val:';' span_id:3097) ) ] body: (command.DoGroup children: [ (C {(mainmenu)}) (command.Case to_match: {(${ Id.VSub_Name KEYPRESS)} arms: [ (case_arm pat_list: [{(1)}] action: [(C {(help1)}) (C {(help2)}) (C {(help3)}) (C {(help4)}) (C {(help5)})] spids: [3114 3115 3133 -1] ) (case_arm pat_list: [{(2)}] action: [(C {(firmcvt)})] spids: [3136 3137 3143 -1] ) (case_arm pat_list: [{(3)}] action: [(C {(convert_driver)})] spids: [3146 3147 3153 -1] ) (case_arm pat_list: [{(4)}] action: [ (C {(header)}) (C {(echo)} {(DQ )}) (C {(echo)} {(DQ ('\tBe seeing you!'))}) (C {(echo)} {(DQ )}) (command.ControlFlow token: (Token id:Id.ControlFlow_Exit val:exit span_id:3182) ) ] spids: [3156 3157 3185 -1] ) (case_arm pat_list: [{(Id.Lit_Star '*')}] action: [ (C {(header)}) (C {(echo)} {(DQ )}) (C {(echo)} {(-n)} {(DQ ("\tSorry, I didn't understand that. Press enter to try again: "))} ) (C {(read)} {(KEYPRESS)}) ] spids: [3188 3189 3215 -1] ) ] ) ] ) ) (command.ControlFlow token:(Token id:Id.ControlFlow_Exit val:exit span_id:3222)) ] )