parm ttype='',setup='',entry=main,record=1 comment ENVCONV v1.0 comment comment This MPE/iX 5.5 script converts TTYPE/TVFC file pairs into the new comment 5.5 setup file format. Usage: comment comment 1) ENVCONV ttypefilename comment comment Dumps the printer init string to $STDLIST in ASCII for printable comment characters and hexadecimal for unprintable ones. comment comment 2) ENVCONV ttypefilename,setupfilename comment comment Extracts the printer init string and creates setupfilename. comment comment 3) ENVCONV ttypefilename,REPLACE comment comment Extracts the printer init string. Purges ttypefilename and the comment associated TVFC file. Writes the init string in setup file format to comment ttypefilename. comment comment Contacting the author comment --------------------- comment Mark Bixby comment Coast Community College District comment District Information Services comment 1370 Adams Ave comment Costa Mesa, CA 92626-5429 comment +1 714 438-4647 comment markb@cccd.edu comment comment The author makes no guarantee that this script won't turn your computer comment into a smoldering silicon slag heap or cause a rupture in the comment space-time continuum. Use at your own risk. comment if UPS("!entry") = 'MAIN' then comment comment Does the TTYPE file exist? comment if not FINFO("!ttype",'exists') then echo File "!ttype" does not exist. escape 9999 endif setvar envconv_ttype FINFO("!ttype",'fullfname') comment comment Is the filecode TTYPE? comment if FINFO(envconv_ttype,'fmtfcode') <> 'TTYPE' then echo File "!envconv_ttype" is not a TTYPE file. escape 9999 endif comment comment Read the TTYPE record that contains the TVFC file name. comment setvar cierror 0 continue !HPFILE entry=freaddir,record=2 0 then echo I/O error while reading TTYPE file !envconv_ttype escape !hpcierr endif setvar envconv_tvfc RTRIM(STR(envconv_record,3,8))+'.'+ & RTRIM(STR(envconv_record,11,8))+'.'+RTRIM(STR(envconv_record,19,8)) comment comment Does the TVFC file exist? comment if not FINFO(envconv_tvfc,'exists') then echo Associated file "!envconv_tvfc" does not exist. escape 9999 endif comment comment Is the filecode TVFC? comment if FINFO(envconv_tvfc,'fmtfcode') <> 'TVFC' then echo Associated file "!envconv_tvfc" is not a TVFC file. escape 9999 endif comment comment Read the TVFC record containing the printer init string. comment setvar cierror 0 continue !HPFILE entry=freaddir,record=1 0 then echo I/O error while reading TVFC file !envconv_tvfc escape !hpcierr endif setvar envconv_init RTRIM(STR(envconv_record,5,120),CHR(0)) if "!setup" = '' then comment comment Just display the setup string to $STDLIST. comment echo Hex/char dump of initialization string from !envconv_tvfc: echo setvar envconv_i 1 setvar envconv_out '' while envconv_i <= LEN(envconv_init) do if STR(envconv_init,envconv_i,1) >= '!' and & STR(envconv_init,envconv_i,1) <= '~' then setvar envconv_out envconv_out+' '+STR(envconv_init,envconv_i,1) else setvar envconv_out envconv_out+' '+& RHT(HEX(256+ORD(STR(envconv_init,envconv_i,1))),2) endif if (envconv_i MOD 26) = 0 then echo !envconv_out setvar envconv_out '' endif setvar envconv_i envconv_i + 1 endwhile if LEN(envconv_out) > 0 then echo !envconv_out endif else comment comment Create the new setup file as $OLDPASS comment file envconvs=$newpass;rec=-254,1,v,ascii;disc=1 setvar cierror 0 continue echo !envconv_init>*envconvs if cierror <> 0 then echo Unable to write init string to $NEWPASS escape !hpcierr endif reset envconvs if UPS("!setup") = 'REPLACE' then setvar envconv_setup envconv_ttype setvar cierror 0 continue purge !envconv_ttype if cierror <> 0 then echo Unable to purge TTYPE file !envconv_ttype escape !hpcierr endif continue purge !envconv_tvfc if cierror <> 0 then echo Unable to purge TVFC file !envconv_tvfc escape !hpcierr endif else setvar envconv_setup "!setup" endif if FINFO(envconv_setup,'exists') then echo Error! The setup file !envconv_setup already exists. escape 9999 endif setvar cierror 0 continue save $oldpass,!envconv_setup if cierror <> 0 then echo Unable to save setup file !envconv_setup escape !hpcierr endif echo Successful creation of setup file !envconv_setup endif deletevar envconv_@ elseif UPS("!entry") = 'FREADDIR' then comment comment Sequentially read from $STDIN until we find the proper record. comment setvar envconv_recnum !record while envconv_recnum > 0 do setvar cierror 0 continue input envconv_record if cierror <> 0 then echo Unable to read record !record of file !HPSTDIN escape !hpcierr endif setvar envconv_recnum envconv_recnum - 1 endwhile else echo Unknown entrypoint of "!entry". return endif