ckermit70.txt 711 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960696169626963696469656966696769686969697069716972697369746975697669776978697969806981698269836984698569866987698869896990699169926993699469956996699769986999700070017002700370047005700670077008700970107011701270137014701570167017701870197020702170227023702470257026702770287029703070317032703370347035703670377038703970407041704270437044704570467047704870497050705170527053705470557056705770587059706070617062706370647065706670677068706970707071707270737074707570767077707870797080708170827083708470857086708770887089709070917092709370947095709670977098709971007101710271037104710571067107710871097110711171127113711471157116711771187119712071217122712371247125712671277128712971307131713271337134713571367137713871397140714171427143714471457146714771487149715071517152715371547155715671577158715971607161716271637164716571667167716871697170717171727173717471757176717771787179718071817182718371847185718671877188718971907191719271937194719571967197719871997200720172027203720472057206720772087209721072117212721372147215721672177218721972207221722272237224722572267227722872297230723172327233723472357236723772387239724072417242724372447245724672477248724972507251725272537254725572567257725872597260726172627263726472657266726772687269727072717272727372747275727672777278727972807281728272837284728572867287728872897290729172927293729472957296729772987299730073017302730373047305730673077308730973107311731273137314731573167317731873197320732173227323732473257326732773287329733073317332733373347335733673377338733973407341734273437344734573467347734873497350735173527353735473557356735773587359736073617362736373647365736673677368736973707371737273737374737573767377737873797380738173827383738473857386738773887389739073917392739373947395739673977398739974007401740274037404740574067407740874097410741174127413741474157416741774187419742074217422742374247425742674277428742974307431743274337434743574367437743874397440744174427443744474457446744774487449745074517452745374547455745674577458745974607461746274637464746574667467746874697470747174727473747474757476747774787479748074817482748374847485748674877488748974907491749274937494749574967497749874997500750175027503750475057506750775087509751075117512751375147515751675177518751975207521752275237524752575267527752875297530753175327533753475357536753775387539754075417542754375447545754675477548754975507551755275537554755575567557755875597560756175627563756475657566756775687569757075717572757375747575757675777578757975807581758275837584758575867587758875897590759175927593759475957596759775987599760076017602760376047605760676077608760976107611761276137614761576167617761876197620762176227623762476257626762776287629763076317632763376347635763676377638763976407641764276437644764576467647764876497650765176527653765476557656765776587659766076617662766376647665766676677668766976707671767276737674767576767677767876797680768176827683768476857686768776887689769076917692769376947695769676977698769977007701770277037704770577067707770877097710771177127713771477157716771777187719772077217722772377247725772677277728772977307731773277337734773577367737773877397740774177427743774477457746774777487749775077517752775377547755775677577758775977607761776277637764776577667767776877697770777177727773777477757776777777787779778077817782778377847785778677877788778977907791779277937794779577967797779877997800780178027803780478057806780778087809781078117812781378147815781678177818781978207821782278237824782578267827782878297830783178327833783478357836783778387839784078417842784378447845784678477848784978507851785278537854785578567857785878597860786178627863786478657866786778687869787078717872787378747875787678777878787978807881788278837884788578867887788878897890789178927893789478957896789778987899790079017902790379047905790679077908790979107911791279137914791579167917791879197920792179227923792479257926792779287929793079317932793379347935793679377938793979407941794279437944794579467947794879497950795179527953795479557956795779587959796079617962796379647965796679677968796979707971797279737974797579767977797879797980798179827983798479857986798779887989799079917992799379947995799679977998799980008001800280038004800580068007800880098010801180128013801480158016801780188019802080218022802380248025802680278028802980308031803280338034803580368037803880398040804180428043804480458046804780488049805080518052805380548055805680578058805980608061806280638064806580668067806880698070807180728073807480758076807780788079808080818082808380848085808680878088808980908091809280938094809580968097809880998100810181028103810481058106810781088109811081118112811381148115811681178118811981208121812281238124812581268127812881298130813181328133813481358136813781388139814081418142814381448145814681478148814981508151815281538154815581568157815881598160816181628163816481658166816781688169817081718172817381748175817681778178817981808181818281838184818581868187818881898190819181928193819481958196819781988199820082018202820382048205820682078208820982108211821282138214821582168217821882198220822182228223822482258226822782288229823082318232823382348235823682378238823982408241824282438244824582468247824882498250825182528253825482558256825782588259826082618262826382648265826682678268826982708271827282738274827582768277827882798280828182828283828482858286828782888289829082918292829382948295829682978298829983008301830283038304830583068307830883098310831183128313831483158316831783188319832083218322832383248325832683278328832983308331833283338334833583368337833883398340834183428343834483458346834783488349835083518352835383548355835683578358835983608361836283638364836583668367836883698370837183728373837483758376837783788379838083818382838383848385838683878388838983908391839283938394839583968397839883998400840184028403840484058406840784088409841084118412841384148415841684178418841984208421842284238424842584268427842884298430843184328433843484358436843784388439844084418442844384448445844684478448844984508451845284538454845584568457845884598460846184628463846484658466846784688469847084718472847384748475847684778478847984808481848284838484848584868487848884898490849184928493849484958496849784988499850085018502850385048505850685078508850985108511851285138514851585168517851885198520852185228523852485258526852785288529853085318532853385348535853685378538853985408541854285438544854585468547854885498550855185528553855485558556855785588559856085618562856385648565856685678568856985708571857285738574857585768577857885798580858185828583858485858586858785888589859085918592859385948595859685978598859986008601860286038604860586068607860886098610861186128613861486158616861786188619862086218622862386248625862686278628862986308631863286338634863586368637863886398640864186428643864486458646864786488649865086518652865386548655865686578658865986608661866286638664866586668667866886698670867186728673867486758676867786788679868086818682868386848685868686878688868986908691869286938694869586968697869886998700870187028703870487058706870787088709871087118712871387148715871687178718871987208721872287238724872587268727872887298730873187328733873487358736873787388739874087418742874387448745874687478748874987508751875287538754875587568757875887598760876187628763876487658766876787688769877087718772877387748775877687778778877987808781878287838784878587868787878887898790879187928793879487958796879787988799880088018802880388048805880688078808880988108811881288138814881588168817881888198820882188228823882488258826882788288829883088318832883388348835883688378838883988408841884288438844884588468847884888498850885188528853885488558856885788588859886088618862886388648865886688678868886988708871887288738874887588768877887888798880888188828883888488858886888788888889889088918892889388948895889688978898889989008901890289038904890589068907890889098910891189128913891489158916891789188919892089218922892389248925892689278928892989308931893289338934893589368937893889398940894189428943894489458946894789488949895089518952895389548955895689578958895989608961896289638964896589668967896889698970897189728973897489758976897789788979898089818982898389848985898689878988898989908991899289938994899589968997899889999000900190029003900490059006900790089009901090119012901390149015901690179018901990209021902290239024902590269027902890299030903190329033903490359036903790389039904090419042904390449045904690479048904990509051905290539054905590569057905890599060906190629063906490659066906790689069907090719072907390749075907690779078907990809081908290839084908590869087908890899090909190929093909490959096909790989099910091019102910391049105910691079108910991109111911291139114911591169117911891199120912191229123912491259126912791289129913091319132913391349135913691379138913991409141914291439144914591469147914891499150915191529153915491559156915791589159916091619162916391649165916691679168916991709171917291739174917591769177917891799180918191829183918491859186918791889189919091919192919391949195919691979198919992009201920292039204920592069207920892099210921192129213921492159216921792189219922092219222922392249225922692279228922992309231923292339234923592369237923892399240924192429243924492459246924792489249925092519252925392549255925692579258925992609261926292639264926592669267926892699270927192729273927492759276927792789279928092819282928392849285928692879288928992909291929292939294929592969297929892999300930193029303930493059306930793089309931093119312931393149315931693179318931993209321932293239324932593269327932893299330933193329333933493359336933793389339934093419342934393449345934693479348934993509351935293539354935593569357935893599360936193629363936493659366936793689369937093719372937393749375937693779378937993809381938293839384938593869387938893899390939193929393939493959396939793989399940094019402940394049405940694079408940994109411941294139414941594169417941894199420942194229423942494259426942794289429943094319432943394349435943694379438943994409441944294439444944594469447944894499450945194529453945494559456945794589459946094619462946394649465946694679468946994709471947294739474947594769477947894799480948194829483948494859486948794889489949094919492949394949495949694979498949995009501950295039504950595069507950895099510951195129513951495159516951795189519952095219522952395249525952695279528952995309531953295339534953595369537953895399540954195429543954495459546954795489549955095519552955395549555955695579558955995609561956295639564956595669567956895699570957195729573957495759576957795789579958095819582958395849585958695879588958995909591959295939594959595969597959895999600960196029603960496059606960796089609961096119612961396149615961696179618961996209621962296239624962596269627962896299630963196329633963496359636963796389639964096419642964396449645964696479648964996509651965296539654965596569657965896599660966196629663966496659666966796689669967096719672967396749675967696779678967996809681968296839684968596869687968896899690969196929693969496959696969796989699970097019702970397049705970697079708970997109711971297139714971597169717971897199720972197229723972497259726972797289729973097319732973397349735973697379738973997409741974297439744974597469747974897499750975197529753975497559756975797589759976097619762976397649765976697679768976997709771977297739774977597769777977897799780978197829783978497859786978797889789979097919792979397949795979697979798979998009801980298039804980598069807980898099810981198129813981498159816981798189819982098219822982398249825982698279828982998309831983298339834983598369837983898399840984198429843984498459846984798489849985098519852985398549855985698579858985998609861986298639864986598669867986898699870987198729873987498759876987798789879988098819882988398849885988698879888988998909891989298939894989598969897989898999900990199029903990499059906990799089909991099119912991399149915991699179918991999209921992299239924992599269927992899299930993199329933993499359936993799389939994099419942994399449945994699479948994999509951995299539954995599569957995899599960996199629963996499659966996799689969997099719972997399749975997699779978997999809981998299839984998599869987998899899990999199929993999499959996999799989999100001000110002100031000410005100061000710008100091001010011100121001310014100151001610017100181001910020100211002210023100241002510026100271002810029100301003110032100331003410035100361003710038100391004010041100421004310044100451004610047100481004910050100511005210053100541005510056100571005810059100601006110062100631006410065100661006710068100691007010071100721007310074100751007610077100781007910080100811008210083100841008510086100871008810089100901009110092100931009410095100961009710098100991010010101101021010310104101051010610107101081010910110101111011210113101141011510116101171011810119101201012110122101231012410125101261012710128101291013010131101321013310134101351013610137101381013910140101411014210143101441014510146101471014810149101501015110152101531015410155101561015710158101591016010161101621016310164101651016610167101681016910170101711017210173101741017510176101771017810179101801018110182101831018410185101861018710188101891019010191101921019310194101951019610197101981019910200102011020210203102041020510206102071020810209102101021110212102131021410215102161021710218102191022010221102221022310224102251022610227102281022910230102311023210233102341023510236102371023810239102401024110242102431024410245102461024710248102491025010251102521025310254102551025610257102581025910260102611026210263102641026510266102671026810269102701027110272102731027410275102761027710278102791028010281102821028310284102851028610287102881028910290102911029210293102941029510296102971029810299103001030110302103031030410305103061030710308103091031010311103121031310314103151031610317103181031910320103211032210323103241032510326103271032810329103301033110332103331033410335103361033710338103391034010341103421034310344103451034610347103481034910350103511035210353103541035510356103571035810359103601036110362103631036410365103661036710368103691037010371103721037310374103751037610377103781037910380103811038210383103841038510386103871038810389103901039110392103931039410395103961039710398103991040010401104021040310404104051040610407104081040910410104111041210413104141041510416104171041810419104201042110422104231042410425104261042710428104291043010431104321043310434104351043610437104381043910440104411044210443104441044510446104471044810449104501045110452104531045410455104561045710458104591046010461104621046310464104651046610467104681046910470104711047210473104741047510476104771047810479104801048110482104831048410485104861048710488104891049010491104921049310494104951049610497104981049910500105011050210503105041050510506105071050810509105101051110512105131051410515105161051710518105191052010521105221052310524105251052610527105281052910530105311053210533105341053510536105371053810539105401054110542105431054410545105461054710548105491055010551105521055310554105551055610557105581055910560105611056210563105641056510566105671056810569105701057110572105731057410575105761057710578105791058010581105821058310584105851058610587105881058910590105911059210593105941059510596105971059810599106001060110602106031060410605106061060710608106091061010611106121061310614106151061610617106181061910620106211062210623106241062510626106271062810629106301063110632106331063410635106361063710638106391064010641106421064310644106451064610647106481064910650106511065210653106541065510656106571065810659106601066110662106631066410665106661066710668106691067010671106721067310674106751067610677106781067910680106811068210683106841068510686106871068810689106901069110692106931069410695106961069710698106991070010701107021070310704107051070610707107081070910710107111071210713107141071510716107171071810719107201072110722107231072410725107261072710728107291073010731107321073310734107351073610737107381073910740107411074210743107441074510746107471074810749107501075110752107531075410755107561075710758107591076010761107621076310764107651076610767107681076910770107711077210773107741077510776107771077810779107801078110782107831078410785107861078710788107891079010791107921079310794107951079610797107981079910800108011080210803108041080510806108071080810809108101081110812108131081410815108161081710818108191082010821108221082310824108251082610827108281082910830108311083210833108341083510836108371083810839108401084110842108431084410845108461084710848108491085010851108521085310854108551085610857108581085910860108611086210863108641086510866108671086810869108701087110872108731087410875108761087710878108791088010881108821088310884108851088610887108881088910890108911089210893108941089510896108971089810899109001090110902109031090410905109061090710908109091091010911109121091310914109151091610917109181091910920109211092210923109241092510926109271092810929109301093110932109331093410935109361093710938109391094010941109421094310944109451094610947109481094910950109511095210953109541095510956109571095810959109601096110962109631096410965109661096710968109691097010971109721097310974109751097610977109781097910980109811098210983109841098510986109871098810989109901099110992109931099410995109961099710998109991100011001110021100311004110051100611007110081100911010110111101211013110141101511016110171101811019110201102111022110231102411025110261102711028110291103011031110321103311034110351103611037110381103911040110411104211043110441104511046110471104811049110501105111052110531105411055110561105711058110591106011061110621106311064110651106611067110681106911070110711107211073110741107511076110771107811079110801108111082110831108411085110861108711088110891109011091110921109311094110951109611097110981109911100111011110211103111041110511106111071110811109111101111111112111131111411115111161111711118111191112011121111221112311124111251112611127111281112911130111311113211133111341113511136111371113811139111401114111142111431114411145111461114711148111491115011151111521115311154111551115611157111581115911160111611116211163111641116511166111671116811169111701117111172111731117411175111761117711178111791118011181111821118311184111851118611187111881118911190111911119211193111941119511196111971119811199112001120111202112031120411205112061120711208112091121011211112121121311214112151121611217112181121911220112211122211223112241122511226112271122811229112301123111232112331123411235112361123711238112391124011241112421124311244112451124611247112481124911250112511125211253112541125511256112571125811259112601126111262112631126411265112661126711268112691127011271112721127311274112751127611277112781127911280112811128211283112841128511286112871128811289112901129111292112931129411295112961129711298112991130011301113021130311304113051130611307113081130911310113111131211313113141131511316113171131811319113201132111322113231132411325113261132711328113291133011331113321133311334113351133611337113381133911340113411134211343113441134511346113471134811349113501135111352113531135411355113561135711358113591136011361113621136311364113651136611367113681136911370113711137211373113741137511376113771137811379113801138111382113831138411385113861138711388113891139011391113921139311394113951139611397113981139911400114011140211403114041140511406114071140811409114101141111412114131141411415114161141711418114191142011421114221142311424114251142611427114281142911430114311143211433114341143511436114371143811439114401144111442114431144411445114461144711448114491145011451114521145311454114551145611457114581145911460114611146211463114641146511466114671146811469114701147111472114731147411475114761147711478114791148011481114821148311484114851148611487114881148911490114911149211493114941149511496114971149811499115001150111502115031150411505115061150711508115091151011511115121151311514115151151611517115181151911520115211152211523115241152511526115271152811529115301153111532115331153411535115361153711538115391154011541115421154311544115451154611547115481154911550115511155211553115541155511556115571155811559115601156111562115631156411565115661156711568115691157011571115721157311574115751157611577115781157911580115811158211583115841158511586115871158811589115901159111592115931159411595115961159711598115991160011601116021160311604116051160611607116081160911610116111161211613116141161511616116171161811619116201162111622116231162411625116261162711628116291163011631116321163311634116351163611637116381163911640116411164211643116441164511646116471164811649116501165111652116531165411655116561165711658116591166011661116621166311664116651166611667116681166911670116711167211673116741167511676116771167811679116801168111682116831168411685116861168711688116891169011691116921169311694116951169611697116981169911700117011170211703117041170511706117071170811709117101171111712117131171411715117161171711718117191172011721117221172311724117251172611727117281172911730117311173211733117341173511736117371173811739117401174111742117431174411745117461174711748117491175011751117521175311754117551175611757117581175911760117611176211763117641176511766117671176811769117701177111772117731177411775117761177711778117791178011781117821178311784117851178611787117881178911790117911179211793117941179511796117971179811799118001180111802118031180411805118061180711808118091181011811118121181311814118151181611817118181181911820118211182211823118241182511826118271182811829118301183111832118331183411835118361183711838118391184011841118421184311844118451184611847118481184911850118511185211853118541185511856118571185811859118601186111862118631186411865118661186711868118691187011871118721187311874118751187611877118781187911880118811188211883118841188511886118871188811889118901189111892118931189411895118961189711898118991190011901119021190311904119051190611907119081190911910119111191211913119141191511916119171191811919119201192111922119231192411925119261192711928119291193011931119321193311934119351193611937119381193911940119411194211943119441194511946119471194811949119501195111952119531195411955119561195711958119591196011961119621196311964119651196611967119681196911970119711197211973119741197511976119771197811979119801198111982119831198411985119861198711988119891199011991119921199311994119951199611997119981199912000120011200212003120041200512006120071200812009120101201112012120131201412015120161201712018120191202012021120221202312024120251202612027120281202912030120311203212033120341203512036120371203812039120401204112042120431204412045120461204712048120491205012051120521205312054120551205612057120581205912060120611206212063120641206512066120671206812069120701207112072120731207412075120761207712078120791208012081120821208312084120851208612087120881208912090120911209212093120941209512096120971209812099121001210112102121031210412105121061210712108121091211012111121121211312114121151211612117121181211912120121211212212123121241212512126121271212812129121301213112132121331213412135121361213712138121391214012141121421214312144121451214612147121481214912150121511215212153121541215512156121571215812159121601216112162121631216412165121661216712168121691217012171121721217312174121751217612177121781217912180121811218212183121841218512186121871218812189121901219112192121931219412195121961219712198121991220012201122021220312204122051220612207122081220912210122111221212213122141221512216122171221812219122201222112222122231222412225122261222712228122291223012231122321223312234122351223612237122381223912240122411224212243122441224512246122471224812249122501225112252122531225412255122561225712258122591226012261122621226312264122651226612267122681226912270122711227212273122741227512276122771227812279122801228112282122831228412285122861228712288122891229012291122921229312294122951229612297122981229912300123011230212303123041230512306123071230812309123101231112312123131231412315123161231712318123191232012321123221232312324123251232612327123281232912330123311233212333123341233512336123371233812339123401234112342123431234412345123461234712348123491235012351123521235312354123551235612357123581235912360123611236212363123641236512366123671236812369123701237112372123731237412375123761237712378123791238012381123821238312384123851238612387123881238912390123911239212393123941239512396123971239812399124001240112402124031240412405124061240712408124091241012411124121241312414124151241612417124181241912420124211242212423124241242512426124271242812429124301243112432124331243412435124361243712438124391244012441124421244312444124451244612447124481244912450124511245212453124541245512456124571245812459124601246112462124631246412465124661246712468124691247012471124721247312474124751247612477124781247912480124811248212483124841248512486124871248812489124901249112492124931249412495124961249712498124991250012501125021250312504125051250612507125081250912510125111251212513125141251512516125171251812519125201252112522125231252412525125261252712528125291253012531125321253312534125351253612537125381253912540125411254212543125441254512546125471254812549125501255112552125531255412555125561255712558125591256012561125621256312564125651256612567125681256912570125711257212573125741257512576125771257812579125801258112582125831258412585125861258712588125891259012591125921259312594125951259612597125981259912600126011260212603126041260512606126071260812609126101261112612126131261412615126161261712618126191262012621126221262312624126251262612627126281262912630126311263212633126341263512636126371263812639126401264112642126431264412645126461264712648126491265012651126521265312654126551265612657126581265912660126611266212663126641266512666126671266812669126701267112672126731267412675126761267712678126791268012681126821268312684126851268612687126881268912690126911269212693126941269512696126971269812699127001270112702127031270412705127061270712708127091271012711127121271312714127151271612717127181271912720127211272212723127241272512726127271272812729127301273112732127331273412735127361273712738127391274012741127421274312744127451274612747127481274912750127511275212753127541275512756127571275812759127601276112762127631276412765127661276712768127691277012771127721277312774127751277612777127781277912780127811278212783127841278512786127871278812789127901279112792127931279412795127961279712798127991280012801128021280312804128051280612807128081280912810128111281212813128141281512816128171281812819128201282112822128231282412825128261282712828128291283012831128321283312834128351283612837128381283912840128411284212843128441284512846128471284812849128501285112852128531285412855128561285712858128591286012861128621286312864128651286612867128681286912870128711287212873128741287512876128771287812879128801288112882128831288412885128861288712888128891289012891128921289312894128951289612897128981289912900129011290212903129041290512906129071290812909129101291112912129131291412915129161291712918129191292012921129221292312924129251292612927129281292912930129311293212933129341293512936129371293812939129401294112942129431294412945129461294712948129491295012951129521295312954129551295612957129581295912960129611296212963129641296512966129671296812969129701297112972129731297412975129761297712978129791298012981129821298312984129851298612987129881298912990129911299212993129941299512996129971299812999130001300113002130031300413005130061300713008130091301013011130121301313014130151301613017130181301913020130211302213023130241302513026130271302813029130301303113032130331303413035130361303713038130391304013041130421304313044130451304613047130481304913050130511305213053130541305513056130571305813059130601306113062130631306413065130661306713068130691307013071130721307313074130751307613077130781307913080130811308213083130841308513086130871308813089130901309113092130931309413095130961309713098130991310013101131021310313104131051310613107131081310913110131111311213113131141311513116131171311813119131201312113122131231312413125131261312713128131291313013131131321313313134131351313613137131381313913140131411314213143131441314513146131471314813149131501315113152131531315413155131561315713158131591316013161131621316313164131651316613167131681316913170131711317213173131741317513176131771317813179131801318113182131831318413185131861318713188131891319013191131921319313194131951319613197131981319913200132011320213203132041320513206132071320813209132101321113212132131321413215132161321713218132191322013221132221322313224132251322613227132281322913230132311323213233132341323513236132371323813239132401324113242132431324413245132461324713248132491325013251132521325313254132551325613257132581325913260132611326213263132641326513266132671326813269132701327113272132731327413275132761327713278132791328013281132821328313284132851328613287132881328913290132911329213293132941329513296132971329813299133001330113302133031330413305133061330713308133091331013311133121331313314133151331613317133181331913320133211332213323133241332513326133271332813329133301333113332133331333413335133361333713338133391334013341133421334313344133451334613347133481334913350133511335213353133541335513356133571335813359133601336113362133631336413365133661336713368133691337013371133721337313374133751337613377133781337913380133811338213383133841338513386133871338813389133901339113392133931339413395133961339713398133991340013401134021340313404134051340613407134081340913410134111341213413134141341513416134171341813419134201342113422134231342413425134261342713428134291343013431134321343313434134351343613437134381343913440134411344213443134441344513446134471344813449134501345113452134531345413455134561345713458134591346013461134621346313464134651346613467134681346913470134711347213473134741347513476134771347813479134801348113482134831348413485134861348713488134891349013491134921349313494134951349613497134981349913500135011350213503135041350513506135071350813509135101351113512135131351413515135161351713518135191352013521135221352313524135251352613527135281352913530135311353213533135341353513536135371353813539135401354113542135431354413545135461354713548135491355013551135521355313554135551355613557135581355913560135611356213563135641356513566135671356813569135701357113572135731357413575135761357713578135791358013581135821358313584135851358613587135881358913590135911359213593135941359513596135971359813599136001360113602136031360413605136061360713608136091361013611136121361313614136151361613617136181361913620136211362213623136241362513626136271362813629136301363113632136331363413635136361363713638136391364013641136421364313644136451364613647136481364913650136511365213653136541365513656136571365813659136601366113662136631366413665136661366713668136691367013671136721367313674136751367613677136781367913680136811368213683136841368513686136871368813689136901369113692136931369413695136961369713698136991370013701137021370313704137051370613707137081370913710137111371213713137141371513716137171371813719137201372113722137231372413725137261372713728137291373013731137321373313734137351373613737137381373913740137411374213743137441374513746137471374813749137501375113752137531375413755137561375713758137591376013761137621376313764137651376613767137681376913770137711377213773137741377513776137771377813779137801378113782137831378413785137861378713788137891379013791137921379313794137951379613797137981379913800138011380213803138041380513806138071380813809138101381113812138131381413815138161381713818138191382013821138221382313824138251382613827138281382913830138311383213833138341383513836138371383813839138401384113842138431384413845138461384713848138491385013851138521385313854138551385613857138581385913860138611386213863138641386513866138671386813869138701387113872138731387413875138761387713878138791388013881138821388313884138851388613887138881388913890138911389213893138941389513896138971389813899139001390113902139031390413905139061390713908139091391013911139121391313914139151391613917139181391913920139211392213923139241392513926139271392813929139301393113932139331393413935139361393713938139391394013941139421394313944139451394613947139481394913950139511395213953139541395513956139571395813959139601396113962139631396413965139661396713968139691397013971139721397313974139751397613977139781397913980139811398213983139841398513986139871398813989139901399113992139931399413995139961399713998139991400014001140021400314004140051400614007140081400914010140111401214013140141401514016140171401814019140201402114022140231402414025140261402714028140291403014031140321403314034140351403614037140381403914040140411404214043140441404514046140471404814049140501405114052140531405414055140561405714058140591406014061140621406314064140651406614067140681406914070140711407214073140741407514076140771407814079140801408114082140831408414085140861408714088140891409014091140921409314094140951409614097140981409914100141011410214103141041410514106141071410814109141101411114112141131411414115141161411714118141191412014121141221412314124141251412614127141281412914130141311413214133141341413514136141371413814139141401414114142141431414414145141461414714148141491415014151141521415314154141551415614157141581415914160141611416214163141641416514166141671416814169141701417114172141731417414175141761417714178141791418014181141821418314184141851418614187141881418914190141911419214193141941419514196141971419814199142001420114202142031420414205142061420714208142091421014211142121421314214142151421614217142181421914220142211422214223142241422514226142271422814229142301423114232142331423414235142361423714238142391424014241142421424314244142451424614247142481424914250142511425214253142541425514256142571425814259142601426114262142631426414265142661426714268142691427014271142721427314274142751427614277142781427914280142811428214283142841428514286142871428814289142901429114292142931429414295142961429714298142991430014301143021430314304143051430614307143081430914310143111431214313143141431514316143171431814319143201432114322143231432414325143261432714328143291433014331143321433314334143351433614337143381433914340143411434214343143441434514346143471434814349143501435114352143531435414355143561435714358143591436014361143621436314364143651436614367143681436914370143711437214373143741437514376143771437814379143801438114382143831438414385143861438714388143891439014391143921439314394143951439614397143981439914400144011440214403144041440514406144071440814409144101441114412144131441414415144161441714418144191442014421144221442314424144251442614427144281442914430144311443214433144341443514436144371443814439144401444114442144431444414445144461444714448144491445014451144521445314454144551445614457144581445914460144611446214463144641446514466144671446814469144701447114472144731447414475144761447714478144791448014481144821448314484144851448614487144881448914490144911449214493144941449514496144971449814499145001450114502145031450414505145061450714508145091451014511145121451314514145151451614517145181451914520145211452214523145241452514526145271452814529145301453114532145331453414535145361453714538145391454014541145421454314544145451454614547145481454914550145511455214553145541455514556145571455814559145601456114562145631456414565145661456714568145691457014571145721457314574145751457614577145781457914580145811458214583145841458514586145871458814589145901459114592145931459414595145961459714598145991460014601146021460314604146051460614607146081460914610146111461214613146141461514616146171461814619146201462114622146231462414625146261462714628146291463014631146321463314634146351463614637146381463914640146411464214643146441464514646146471464814649146501465114652146531465414655146561465714658146591466014661146621466314664146651466614667146681466914670146711467214673146741467514676146771467814679146801468114682146831468414685146861468714688146891469014691146921469314694146951469614697146981469914700147011470214703147041470514706147071470814709147101471114712147131471414715147161471714718147191472014721147221472314724147251472614727147281472914730147311473214733147341473514736147371473814739147401474114742147431474414745147461474714748147491475014751147521475314754147551475614757147581475914760147611476214763147641476514766147671476814769147701477114772147731477414775147761477714778147791478014781147821478314784147851478614787147881478914790147911479214793147941479514796147971479814799148001480114802148031480414805148061480714808148091481014811148121481314814148151481614817148181481914820148211482214823148241482514826148271482814829148301483114832148331483414835148361483714838148391484014841148421484314844148451484614847148481484914850148511485214853148541485514856148571485814859148601486114862148631486414865148661486714868148691487014871148721487314874148751487614877148781487914880148811488214883148841488514886148871488814889148901489114892148931489414895148961489714898148991490014901149021490314904149051490614907149081490914910149111491214913149141491514916149171491814919149201492114922149231492414925149261492714928149291493014931149321493314934149351493614937149381493914940149411494214943149441494514946149471494814949149501495114952149531495414955149561495714958149591496014961149621496314964149651496614967149681496914970149711497214973149741497514976149771497814979149801498114982149831498414985149861498714988149891499014991149921499314994149951499614997149981499915000150011500215003150041500515006150071500815009150101501115012150131501415015150161501715018150191502015021150221502315024150251502615027150281502915030150311503215033150341503515036150371503815039150401504115042150431504415045150461504715048150491505015051150521505315054150551505615057150581505915060150611506215063150641506515066150671506815069150701507115072150731507415075150761507715078150791508015081150821508315084150851508615087150881508915090150911509215093150941509515096150971509815099151001510115102151031510415105151061510715108151091511015111151121511315114151151511615117151181511915120151211512215123151241512515126151271512815129151301513115132151331513415135151361513715138151391514015141151421514315144151451514615147151481514915150151511515215153151541515515156151571515815159151601516115162151631516415165151661516715168151691517015171151721517315174151751517615177151781517915180151811518215183151841518515186151871518815189151901519115192151931519415195151961519715198151991520015201152021520315204152051520615207152081520915210152111521215213152141521515216152171521815219152201522115222152231522415225152261522715228152291523015231152321523315234152351523615237152381523915240152411524215243152441524515246152471524815249152501525115252152531525415255152561525715258152591526015261152621526315264152651526615267152681526915270152711527215273152741527515276152771527815279152801528115282152831528415285152861528715288152891529015291152921529315294152951529615297152981529915300153011530215303153041530515306153071530815309153101531115312153131531415315153161531715318153191532015321153221532315324153251532615327153281532915330153311533215333153341533515336153371533815339153401534115342153431534415345153461534715348153491535015351153521535315354153551535615357153581535915360153611536215363153641536515366153671536815369153701537115372153731537415375153761537715378153791538015381153821538315384153851538615387153881538915390153911539215393153941539515396153971539815399154001540115402154031540415405154061540715408154091541015411154121541315414154151541615417154181541915420154211542215423154241542515426154271542815429154301543115432154331543415435154361543715438154391544015441154421544315444154451544615447154481544915450154511545215453154541545515456154571545815459154601546115462154631546415465154661546715468154691547015471154721547315474154751547615477154781547915480154811548215483154841548515486154871548815489154901549115492154931549415495154961549715498154991550015501155021550315504155051550615507155081550915510155111551215513155141551515516155171551815519155201552115522155231552415525155261552715528155291553015531155321553315534155351553615537155381553915540155411554215543155441554515546155471554815549155501555115552155531555415555155561555715558155591556015561155621556315564155651556615567155681556915570155711557215573155741557515576155771557815579155801558115582155831558415585155861558715588155891559015591155921559315594155951559615597155981559915600156011560215603156041560515606156071560815609156101561115612156131561415615156161561715618156191562015621156221562315624156251562615627156281562915630156311563215633156341563515636156371563815639156401564115642156431564415645156461564715648156491565015651156521565315654156551565615657156581565915660156611566215663156641566515666156671566815669156701567115672156731567415675156761567715678156791568015681156821568315684156851568615687156881568915690156911569215693156941569515696156971569815699157001570115702157031570415705157061570715708157091571015711157121571315714157151571615717157181571915720157211572215723157241572515726157271572815729157301573115732157331573415735157361573715738157391574015741157421574315744157451574615747157481574915750157511575215753157541575515756157571575815759157601576115762157631576415765157661576715768157691577015771157721577315774157751577615777157781577915780157811578215783157841578515786157871578815789157901579115792157931579415795157961579715798157991580015801158021580315804158051580615807158081580915810158111581215813158141581515816158171581815819158201582115822158231582415825158261582715828158291583015831158321583315834158351583615837158381583915840158411584215843158441584515846158471584815849158501585115852158531585415855158561585715858158591586015861158621586315864158651586615867158681586915870158711587215873158741587515876158771587815879158801588115882158831588415885158861588715888158891589015891158921589315894158951589615897158981589915900159011590215903159041590515906159071590815909159101591115912159131591415915159161591715918159191592015921159221592315924159251592615927159281592915930159311593215933159341593515936159371593815939159401594115942159431594415945159461594715948159491595015951159521595315954159551595615957159581595915960159611596215963159641596515966159671596815969159701597115972159731597415975159761597715978159791598015981159821598315984159851598615987159881598915990159911599215993159941599515996159971599815999160001600116002160031600416005160061600716008160091601016011160121601316014160151601616017160181601916020160211602216023160241602516026160271602816029160301603116032160331603416035160361603716038160391604016041160421604316044160451604616047160481604916050160511605216053160541605516056160571605816059160601606116062160631606416065160661606716068160691607016071160721607316074160751607616077160781607916080160811608216083160841608516086160871608816089160901609116092160931609416095160961609716098160991610016101161021610316104161051610616107161081610916110161111611216113161141611516116161171611816119161201612116122161231612416125161261612716128161291613016131161321613316134161351613616137161381613916140161411614216143161441614516146161471614816149161501615116152161531615416155161561615716158161591616016161161621616316164161651616616167161681616916170161711617216173161741617516176161771617816179161801618116182161831618416185161861618716188161891619016191161921619316194161951619616197161981619916200162011620216203162041620516206162071620816209162101621116212162131621416215162161621716218162191622016221162221622316224162251622616227162281622916230162311623216233162341623516236162371623816239162401624116242162431624416245162461624716248162491625016251162521625316254162551625616257162581625916260162611626216263162641626516266162671626816269162701627116272162731627416275162761627716278162791628016281162821628316284162851628616287162881628916290162911629216293162941629516296162971629816299163001630116302163031630416305163061630716308163091631016311163121631316314163151631616317163181631916320163211632216323163241632516326163271632816329163301633116332163331633416335163361633716338163391634016341163421634316344163451634616347163481634916350163511635216353163541635516356163571635816359163601636116362163631636416365163661636716368163691637016371163721637316374163751637616377163781637916380163811638216383163841638516386163871638816389163901639116392163931639416395163961639716398163991640016401164021640316404164051640616407164081640916410164111641216413164141641516416164171641816419164201642116422164231642416425164261642716428164291643016431164321643316434164351643616437164381643916440164411644216443164441644516446164471644816449164501645116452164531645416455164561645716458164591646016461164621646316464164651646616467164681646916470164711647216473164741647516476164771647816479164801648116482164831648416485164861648716488164891649016491164921649316494164951649616497164981649916500165011650216503165041650516506165071650816509165101651116512165131651416515165161651716518165191652016521165221652316524165251652616527165281652916530165311653216533165341653516536165371653816539165401654116542165431654416545165461654716548165491655016551165521655316554165551655616557165581655916560165611656216563165641656516566165671656816569165701657116572165731657416575165761657716578165791658016581165821658316584165851658616587165881658916590165911659216593165941659516596165971659816599166001660116602166031660416605166061660716608166091661016611166121661316614166151661616617166181661916620166211662216623166241662516626166271662816629166301663116632166331663416635166361663716638166391664016641166421664316644166451664616647166481664916650166511665216653166541665516656166571665816659166601666116662166631666416665166661666716668166691667016671166721667316674166751667616677166781667916680166811668216683166841668516686166871668816689166901669116692166931669416695166961669716698166991670016701167021670316704167051670616707167081670916710167111671216713167141671516716167171671816719167201672116722167231672416725167261672716728167291673016731167321673316734167351673616737167381673916740167411674216743167441674516746167471674816749167501675116752167531675416755167561675716758167591676016761167621676316764167651676616767167681676916770167711677216773167741677516776167771677816779167801678116782167831678416785167861678716788167891679016791167921679316794167951679616797167981679916800168011680216803168041680516806168071680816809168101681116812168131681416815168161681716818168191682016821168221682316824168251682616827168281682916830168311683216833168341683516836168371683816839168401684116842168431684416845168461684716848168491685016851168521685316854168551685616857168581685916860168611686216863168641686516866168671686816869168701687116872168731687416875168761687716878168791688016881168821688316884168851688616887168881688916890168911689216893168941689516896168971689816899169001690116902169031690416905169061690716908169091691016911169121691316914169151691616917169181691916920169211692216923169241692516926169271692816929169301693116932169331693416935169361693716938169391694016941169421694316944169451694616947169481694916950169511695216953169541695516956169571695816959169601696116962169631696416965169661696716968169691697016971169721697316974169751697616977169781697916980169811698216983169841698516986169871698816989169901699116992169931699416995169961699716998169991700017001170021700317004170051700617007170081700917010170111701217013170141701517016170171701817019170201702117022170231702417025170261702717028170291703017031170321703317034170351703617037
  1. The Kermit Project
  2. Columbia University
  3. 612 West 115th Street
  4. New York NY 10025 USA
  5. kermit@columbia.edu
  6. ...since 1981
  7. Supplement to Using C-Kermit, 2nd Edition
  8. For C-Kermit 7.0
  9. As of C-Kermit version: 7.0.196
  10. This file created: 8 February 2000
  11. This file last updated:
  12. Mon Aug 8 10:39:18 2011
  13. Authors: Frank da Cruz and Christine M. Gianone
  14. Address: The Kermit Project
  15. Columbia University
  16. 612 West 115th Street
  17. New York NY 10025-7799
  18. USA
  19. Fax: +1 (212) 662-6442
  20. E-Mail: kermit-support@columbia.edu
  21. Web: http://www.columbia.edu/kermit/
  22. Or: http://www.kermit-project.org/
  23. Or: http://www.columbia.nyc.ny.us/kermit/
  24. NOTICES
  25. This document:
  26. Copyright © 1997, 2000, Frank da Cruz and Christine M. Gianone.
  27. All rights reserved.
  28. Kermit 95:
  29. Copyright © 1995, 2000, Trustees of Columbia University in the
  30. City of New York. All rights reserved.
  31. C-Kermit:
  32. Copyright © 1985, 2000,
  33. Trustees of Columbia University in the City of New York. All
  34. rights reserved. See the C-KermitCOPYING.TXT file or the
  35. copyright text in theckcmai.c module for disclaimer and
  36. permissions.
  37. When Kerberos(TM) and/or SRP(TM) (Secure Remote Password) and/or SSL
  38. protocol are included:
  39. Portions Copyright © 1990, Massachusetts Institute of
  40. Technology.
  41. Portions Copyright © 1991, 1993 Regents of the University of
  42. California.
  43. Portions Copyright © 1991, 1992, 1993, 1994, 1995 by AT&T.
  44. Portions Copyright © 1997, Stanford University.
  45. Portions Copyright © 1995-1997, Eric Young <eay@cryptosoft.com>.
  46. For the full text of the third-party copyright notices, see
  47. Appendix V.
  48. WHAT IS IN THIS FILE
  49. This file lists changes made to C-Kermit since the second edition of
  50. the bookUsing C-Kermit was published and C-Kermit 6.0 was released
  51. in November 1996. Use this file as a supplement to the second edition
  52. of Using C-Kermit until the third edition is published some time in
  53. 2000. If the "most recent update" shown above is long ago, contact
  54. Columbia University to see if there is a newer release.
  55. For further information, also see theCKCBWR.TXT ("C-Kermit
  56. beware") file for hints, tips, tricks, restrictions, frequently asked
  57. questions, etc, plus the system-specific "beware file", e.g.
  58. CKUBWR.TXT for UNIX,CKVBWR.TXT for VMS, etc, and also any
  59. system-specific update files such as KERMIT95.HTM for Kermit 95 (in the
  60. DOCS\MANUAL\ subdirectory of your K95 directory).
  61. This Web-based copy of the C-Kermit 7.0 update notes supersedes the
  62. plain-text CKERMIT2.TXT file. All changes after 19 January 2000
  63. appear only here in the Web version. If you need an up-to-date
  64. plain-text copy, use your Web browser to save this page as plain
  65. text.
  66. ABOUT FILENAMES
  67. In this document, filenames are generally shown in uppercase, but on
  68. file systems with case-sensitive names such as UNIX, OS-9, and AOS/VS,
  69. lowercase names are used:ckubwr.txt,ckermit70.txt, etc.
  70. ADDITIONAL FILES
  71. Several other files accompany this new Kermit release:
  72. SECURITY.TXT
  73. Discussion of Kermit's new authentication and encryption
  74. features:
  75. +Plain-text version
  76. +HTML (hypertext) version
  77. IKSD.TXT
  78. How to install and manage an Internet Kermit Service Daemon.
  79. +Plain-text version
  80. +HTML (hypertext) version
  81. Also seecuiksd.htm for instructions for use.
  82. TELNET.TXT
  83. A thorough presentation of Kermit's new advanced Telnet features
  84. and controls.
  85. +Plain-text version
  86. +HTML (hypertext) version
  87. THE NEW C-KERMIT LICENSE
  88. The C-Kermit license was rewritten for version 7.0 to grant automatic
  89. permission to packagers of free operating-system distributions to
  90. include C-Kermit 7.0. Examples include Linux (GNU/Linux), FreeBSD,
  91. NetBSD, etc. The new license is in theCOPYING.TXT file, and is
  92. also displayed by C-Kermit itself when you give the VERSION or
  93. COPYRIGHT command. The new C-Kermit license does not apply to
  94. Kermit 95.
  95. ACKNOWLEDGMENTS
  96. Thanks to Jeff Altman, who joined the Kermit Project in 1995, for much
  97. of what you see in C-Kermit 7.0, especially in the networking and
  98. security areas, and his key role in designing and implementing the
  99. Internet Kermit Service Daemon. And special thanks to Lucas Hart for
  100. lots of help with the VMS version; to Peter Eichhorn for continuous
  101. testing on the full range of HP-UX versions and for a consolidated set
  102. of HP-UX makefile targets; and to Colin Allen, Mark Allen, Roger Allen,
  103. Ric Anderson, William Bader, Mitch Baker, Mitchell Bass, Nelson Beebe,
  104. Gerry Belanger, Jeff Bernsten, Mark Berryman, John Bigg, Volker
  105. Borchert, Jonathan Boswell, Tim Boyer, Frederick Bruckman, Kenneth
  106. Cochran, Jared Crapo, Bill Delaney, Igor Sobrado Delgado, Clarence
  107. Dold, Joe Doupnik, John Dunlap, Max Evarts, Patrick French, Carl
  108. Friedberg, Carl Friend, Hirofumi Fujii, Andrew Gabriel, Gabe Garza,
  109. Boyd Gerber, David Gerber, George Gilmer, Hunter Goatley, DJ Hagberg,
  110. Kevin Handy, Andy Harper, Randolph Herber, Sven Holström, Michal
  111. Jaegermann, Graham Jenkins, Dick Jones, Terry Kennedy, Robert D Keys,
  112. Nick Kisseberth, Igor Kovalenko, David Lane, Adam Laurie, Jeff
  113. Liebermann, Eric Lonvick, Hoi Wan Louis, Arthur Marsh, Gregorie Martin,
  114. Peter Mauzey, Dragan Milicic, Todd Miller, Christian Mondrup, Daniel
  115. Morato, Dat Nguyen, Herb Peyerl, Jean-Pierre Radley, Steve Rance,
  116. Stephen Riehm, Nigel Roles, Larry Rosenman, Jay S Rouman, David
  117. Sanderson, John Santos, Michael Schmitz, Steven Schultz, Bob Shair,
  118. Richard Shuford, Fred Smith, Michael Sokolov, Jim Spath, Peter Szell,
  119. Ted T'so, Brian Tillman, Linus Torvalds, Patrick Volkerding, Martin
  120. Vorländer, Steve Walton, Ken Weaverling, John Weekley, Martin Whitaker,
  121. Jim Whitby, Matt Willman, Joellen Windsor, Farrell Woods, and many
  122. others for binaries, hosting, reviews, suggestions, advice, bug
  123. reports, and all the rest over the 3+ year C-Kermit 7.0 development
  124. cycle. Thanks to Russ Nelson and the board of the Open Software
  125. Initiative (http://www.opensource.org) for their cooperation in
  126. developing the new C-Kermit license and to the proprietors of those
  127. free UNIX distributions that have incorporated C-Kermit 7.0 for their
  128. cooperation and support, especially FreeBSD's Jörg Wunsch.
  129. NOTE TO KERMIT 95 USERS
  130. Kermit 95 and C-Kermit share the same command and scripting language,
  131. the same Kermit file-transfer protocol implementation, and much else
  132. besides.
  133. Like the bookUsing C-Kermit, this file concentrates on the aspects
  134. of C-Kermit that are common to all versions: UNIX, VMS, Windows, OS/2,
  135. VOS, AOS/VS, etc. Please refer to your Kermit 95 documentation for
  136. information that is specific to Kermit 95.
  137. C-Kermit 7.0 corresponds to Kermit 95 1.1.19.
  138. C-KERMIT VERSIONS AND VERSION NUMBERS
  139. "C-Kermit" refers to all the many programs that are compiled in whole
  140. or in part from common C-language source code, comprising:
  141. * A Kermit file transfer protocol module
  142. * A command parser and script execution module
  143. * A modem-dialing module
  144. * A network support module
  145. * A character-set translation module.
  146. and several others. These "system-independent" modules are combined
  147. with system-dependent modules for each platform to provide the required
  148. input/output functions, and also in some cases overlaid with an
  149. alternative user interface, such as Macintosh Kermit's point-and-click
  150. interface, and in some cases also a terminal emulator, as Kermit 95.
  151. The C-Kermit version number started as 1.0, ... 3.0, 4.0, 4.1 and then
  152. (because of confusion at the time with Berkeley UNIX 4.2), 4B, 4C, and
  153. so on, with the specific edit number in parentheses, for example
  154. 4E(072) or 5A(188). This scheme was used through 5A(191), but now we
  155. have gone back to the traditional numbering scheme with decimal points:
  156. major.minor.edit; for example 7.0.196. Internal version numbers (the
  157. \v(version) variable), however, are compatible in C-Kermit 5A upwards.
  158. Meanwhile, C-Kermit derivatives for some platforms (Windows, Macintosh)
  159. might go through several releases while C-Kermit itself remains the
  160. same. These versions have their own platform-specific version numbers,
  161. such as Kermit 95 1.1.1, 1.1.2, and so on.
  162. C-Kermit Version History:
  163. 1.0 1981-1982 Command-line only, 4.2 BSD UNIX only
  164. 2.0 (*) (who remembers...)
  165. 3.0 May 1984 Command-line only, supports several platforms
  166. 4.0-4.1 Feb-Apr 1985 (*) First interactive and modular version
  167. 4C(050) May 1985
  168. 4D(060) April 1986
  169. 4E(066) August 1987 Long packets
  170. 4E(068) January 1988
  171. 4E(072) January 1989
  172. 4F(095) August 1989 (*) Attribute packets
  173. 5A(188) November 1992 Scripting, TCP/IP, sliding windows (1)
  174. 5A(189) September 1993 Control-char unprefixing
  175. 5A(190) October 1994 Recovery
  176. 5A(191) April 1995 OS/2 only
  177. 6.0.192 September 1996 Intelligent dialing, autodownload, lots more (2)
  178. 6.1.193 1997-98 (*) Development only
  179. 6.1.194 June 1998 K95 only - switches, directory recursion, more
  180. 7.0.195 August 1999 IKSD + more (CU only as K95 1.1.18-CU)
  181. 7.0.196 1 January 2000 Unicode, lots more
  182. (*) Never formally released (4.0 was a total rewrite)
  183. (1) Using C-Kermit, 1st Edition
  184. (2) Using C-Kermit, 2nd Edition
  185. CONTENTS
  186. I. C-KERMIT DOCUMENTATION
  187. II. NEW FEATURES
  188. (0) INCOMPATIBILITIES WITH PREVIOUS RELEASES
  189. (1) PROGRAM AND FILE MANAGEMENT AND COMMANDS
  190. 1.0. Bug fixes
  191. 1.1. Command Continuation
  192. 1.2. Editor Interface
  193. 1.3. Web Browser and FTP Interface
  194. 1.4. Command Editing
  195. 1.5. Command Switches
  196. 1.5.1. General Switch Syntax
  197. 1.5.2. Order and Effect of Switches
  198. 1.5.3. Distinguishing Switches from Other Fields
  199. 1.5.4. Standard File Selection Switches
  200. 1.5.5. Setting Preferences for Different Commands
  201. 1.6. Dates and Times
  202. 1.7. Partial Completion of Keywords
  203. 1.8. Command Recall
  204. 1.9. EXIT Messages
  205. 1.10. Managing Keyboard Interruptions
  206. 1.11. Taming the Wild Backslash -- Part Deux
  207. 1.11.1. Background
  208. 1.11.2. Kermit's Quoting Rules
  209. 1.11.3. Passing DOS Filenames from Kermit to Shell Commands
  210. 1.11.4. Using Variables to Hold DOS Filenames
  211. 1.11.5. Passing DOS Filenames as Parameters to Macros
  212. 1.11.6. Passing DOS File Names from Macro Parameters to
  213. the DOS Shell
  214. 1.11.7. Passing DOS Filenames to Kermit from the Shell
  215. 1.12. Debugging
  216. 1.13. Logs
  217. 1.14. Automatic File-Transfer Packet Recognition at
  218. the Command Prompt
  219. 1.15. The TYPE Command
  220. 1.16. The RESET Command
  221. 1.17. The COPY and RENAME Commands
  222. 1.18. The MANUAL Command
  223. 1.19. String and Filename Matching Patterns
  224. 1.20. Multiple Commands on One Line
  225. 1.21. What Do I Have?
  226. 1.22. Generalized File Input and Output
  227. 1.22.1. Why Another I/O System?
  228. 1.22.2. The FILE Command
  229. 1.22.3. FILE Command Examples
  230. 1.22.4. Channel Numbers
  231. 1.22.5. FILE Command Error Codes
  232. 1.22.6. File I/O Variables
  233. 1.22.7. File I/O Functions
  234. 1.22.8. File I/O Function Examples
  235. 1.23. The EXEC Command
  236. 1.24. Getting Keyword Lists with '?'
  237. (2) MAKING AND USING CONNECTIONS
  238. 2.0. SET LINE and SET HOST Command Switches
  239. 2.1. Dialing
  240. 2.1.1. The Dial Result Message
  241. 2.1.2. Long-Distance Dialing Changes
  242. 2.1.3. Forcing Long-Distance Dialing
  243. 2.1.4. Exchange-Specific Dialing Decisions
  244. 2.1.5. Cautions about Cheapest-First Dialing
  245. 2.1.6. Blind Dialing (Dialing with No Dialtone)
  246. 2.1.7. Trimming the Dialing Dialog
  247. 2.1.8. Controlling the Dialing Speed
  248. 2.1.9. Pretesting Phone Number Conversions
  249. 2.1.10. Greater Control over Partial Dialing
  250. 2.1.11. New DIAL-related Variables and Functions
  251. 2.1.12. Increased Flexibility of PBX Dialing
  252. 2.1.13. The DIAL macro - Last-Minute Phone Number Conversions
  253. 2.1.14. Automatic Tone/Pulse Dialing Selection
  254. 2.1.15. Dial-Modifier Variables
  255. 2.1.16. Giving Multiple Numbers to the DIAL Command
  256. 2.2. Modems
  257. 2.2.1. New Modem Types
  258. 2.2.2. New Modem Controls
  259. 2.3.TELNET and RLOGIN
  260. 2.3.0. Bug Fixes
  261. 2.3.1. Telnet Binary Mode Bug Adjustments
  262. 2.3.2. VMS UCX Telnet Port Bug Adjustment
  263. 2.3.3. Telnet New Environment Option
  264. 2.3.4. Telnet Location Option
  265. 2.3.5. Connecting to Raw TCP Sockets
  266. 2.3.6. Incoming TCP Connections
  267. 2.4. The EIGHTBIT Command
  268. 2.5. The Services Directory
  269. 2.6. Closing Connections
  270. 2.7. Using C-Kermit with External Communication Programs
  271. 2.7.0. C-Kermit over tn3270 and tn5250
  272. 2.7.1. C-Kermit over Telnet
  273. 2.7.2. C-Kermit over Rlogin
  274. 2.7.3. C-Kermit over Serial Communication Programs
  275. 2.7.4. C-Kermit over Secure Network Clients
  276. 2.7.4.1. SSH
  277. 2.7.4.2. SSL
  278. 2.7.4.3. SRP
  279. 2.7.4.4. SOCKS
  280. 2.7.4.5. Kerberos and SRP
  281. 2.8. Scripting Local Programs
  282. 2.9. X.25 Networking
  283. 2.9.1. IBM AIXLink/X.25 Network Provider Interface for AIX
  284. 2.9.2. HP-UX X.25
  285. 2.10. Additional Serial Port Controls
  286. 2.11. Getting Access to the Dialout Device
  287. 2.12. The Connection Log
  288. 2.13. Automatic Connection-Specific Flow Control Selection
  289. 2.14. Trapping Connection Establishment and Loss
  290. 2.15. Contacting Web Servers with the HTTP Command
  291. (3) TERMINAL CONNECTION
  292. 3.1. CONNECT Command Switches
  293. 3.2. Triggers
  294. 3.3. Transparent Printing
  295. 3.4. Binary and Text Session Logs
  296. (4) FILE TRANSFER AND MANAGEMENT
  297. 4.0. Bug Fixes, Minor Changes, and Clarifications
  298. 4.1. File-Transfer Filename Templates
  299. 4.1.1. Templates in the As-Name
  300. 4.1.2. Templates on the Command Line
  301. 4.1.3. Post-Transfer Renaming
  302. 4.2. File-Transfer Pipes and Filters
  303. 4.2.1. Introduction
  304. 4.2.1.1. Terminology
  305. 4.2.1.2. Notation
  306. 4.2.1.3. Security
  307. 4.2.2. Commands for Transferring from and to Pipes
  308. 4.2.2.1. Sending from a Command
  309. 4.2.2.2. Receiving to a Command
  310. 4.2.3. Using File-Transfer Filters
  311. 4.2.3.1. The SEND Filter
  312. 4.2.3.2. The RECEIVE Filter
  313. 4.2.4. Implicit Use of Pipes
  314. 4.2.5. Success and Failure of Piped Commands
  315. 4.2.6. Cautions about Using Pipes to Transfer Directory Trees
  316. 4.2.7. Pipes and Encryption
  317. 4.2.8. Commands and Functions Related to Pipes
  318. 4.2.8.1. The OPEN !READ and OPEN !WRITE Commands
  319. 4.2.8.2. The REDIRECT Command
  320. 4.2.8.3. Receiving Mail and Print Jobs
  321. 4.2.8.4. Pipe-Related Functions
  322. 4.3. Automatic Per-File Text/Binary Mode Switching
  323. 4.3.1. Exceptions
  324. 4.3.2. Overview
  325. 4.3.3. Commands
  326. 4.3.4. Examples
  327. 4.4. File Permissions
  328. 4.4.1. When ATTRIBUTES PROTECTION is OFF
  329. 4.4.1.1. Unix
  330. 4.4.1.2. VMS
  331. 4.4.2. When ATTRIBUTES PROTECTION is ON
  332. 4.4.2.1. System-Specific Permissions
  333. 4.4.2.1.1. UNIX
  334. 4.4.2.1.2. VMS
  335. 4.4.2.2. System-Independent Permissions
  336. 4.5. File Management Commands
  337. 4.5.1. The DIRECTORY Command
  338. 4.5.2. The CD and BACK Commands
  339. 4.5.2.1. Parsing Improvements
  340. 4.5.2.2. The CDPATH
  341. 4.5.3. Creating and Removing Directories
  342. 4.5.4. The DELETE and PURGE Commands
  343. 4.6. Starting the Remote Kermit Server Automatically
  344. 4.7. File-Transfer Command Switches
  345. 4.7.1. SEND Command Switches
  346. 4.7.2. GET Command Switches
  347. 4.7.3. RECEIVE Command Switches
  348. 4.8. Minor Kermit Protocol Improvements
  349. 4.8.1. Multiple Attribute Packets
  350. 4.8.2. Very Short Packets
  351. 4.9. Wildcard / File Group Expansion
  352. 4.9.1. In UNIX C-Kermit
  353. 4.9.2. In Kermit 95
  354. 4.9.3. In VMS, AOS/VS, OS-9, VOS, etc.
  355. 4.10. Additional Pathname Controls
  356. 4.11. Recursive SEND and GET: Transferring Directory Trees
  357. 4.11.1. Command-Line Options
  358. 4.11.2. The SEND /RECURSIVE Command
  359. 4.11.3. The GET /RECURSIVE Command
  360. 4.11.4. New and Changed File Functions
  361. 4.11.5. Moving Directory Trees Between Like Systems
  362. 4.11.6. Moving Directory Trees Between Unlike Systems
  363. 4.12. Where Did My File Go?
  364. 4.13. File Output Buffer Control
  365. 4.14. Improved Responsiveness
  366. 4.15. Doubling and Ignoring Characters for Transparency
  367. 4.16. New File-Transfer Display Formats
  368. 4.17. New Transaction Log Formats
  369. 4.17.1. The BRIEF Format
  370. 4.17.2. The FTP Format
  371. 4.18. Unprefixing NUL
  372. 4.19. Clear-Channel Protocol
  373. 4.20. Streaming Protocol
  374. 4.20.1. Commands for Streaming
  375. 4.20.2. Examples of Streaming
  376. 4.20.2.1. Streaming on Socket-to-Socket Connections
  377. 4.20.2.2. Streaming on Telnet Connections
  378. 4.20.2.3. Streaming with Limited Packet Length
  379. 4.20.2.4. Streaming on Dialup Connections
  380. 4.20.2.5. Streaming on X.25 Connections
  381. 4.20.3. Streaming - Preliminary Conclusions
  382. 4.21. The TRANSMIT Command
  383. 4.22. Coping with Faulty Kermit Implementations
  384. 4.22.1. Failure to Accept Modern Negotiation Strings
  385. 4.22.2. Failure to Negotiate 8th-bit Prefixing
  386. 4.22.3. Corrupt Files
  387. 4.22.4. Spurious Cancellations
  388. 4.22.5. Spurious Refusals
  389. 4.22.6. Failures during the Data Transfer Phase
  390. 4.22.7. Fractured Filenames
  391. 4.22.8. Bad File Dates
  392. 4.23. File Transfer Recovery
  393. 4.24. FILE COLLISION UPDATE Clarification
  394. 4.25. Autodownload Improvements
  395. (5) CLIENT / SERVER
  396. 5.0. Hints
  397. 5.1. New Command-Line Options
  398. 5.2. New Client Commands
  399. 5.3. New Server Capabilities
  400. 5.3.1. Creating and Removing Directories
  401. 5.3.2. Directory Listings
  402. 5.4. Syntax for Remote Filenames with Embedded Spaces
  403. 5.5. Automatic Orientation Messages upon Directory Change
  404. 5.6. New Server Controls
  405. 5.7. Timeouts during REMOTE HOST Command Execution
  406. (6) INTERNATIONAL CHARACTER SETS
  407. 6.0. ISO 8859-15 Latin Alphabet 9
  408. 6.1. The HP-Roman8 Character Set
  409. 6.2. Greek Character Sets
  410. 6.3. Additional Latin-2 Character Sets
  411. 6.4. Additional Cyrillic Character Sets
  412. 6.5. Automatic Character-Set Switching
  413. 6.6. Unicode
  414. 6.6.1. Overview of Unicode
  415. 6.6.2. UCS Byte Order
  416. 6.6.2. UCS Transformation Formats
  417. 6.6.3. Conformance Levels
  418. 6.6.4. Relationship of Unicode with Kermit's Other Character Sets
  419. 6.6.5. Kermit's Unicode Features
  420. 6.6.5.1. File Transfer
  421. 6.6.5.2. The TRANSLATE Command
  422. 6.6.5.3. Terminal Connection
  423. 6.6.5.4. The TRANSMIT Command
  424. 6.6.5.5. Summary of Kermit Unicode Commands
  425. 6.7. Client / Server Character-Set Switching
  426. (7) SCRIPT PROGRAMMING
  427. 7.0. Bug Fixes
  428. 7.1. The INPUT Command
  429. 7.1.1. INPUT Timeouts
  430. 7.1.2. New INPUT Controls
  431. 7.1.3. INPUT with Pattern Matching
  432. 7.1.4. The INPUT Match Result
  433. 7.2. New or Improved Built-In Variables
  434. 7.3. New or Improved Built-In Functions
  435. 7.4. New IF Conditions
  436. 7.5. Using More than Ten Macro Arguments
  437. 7.6. Clarification of Function Call Syntax
  438. 7.7. Autodownload during INPUT Command Execution
  439. 7.8. Built-in Help for Functions.
  440. 7.9. Variable Assignments
  441. 7.9.1. Assignment Operators
  442. 7.9.2. New Assignment Commands
  443. 7.10. Arrays
  444. 7.10.1. Array Initializers
  445. 7.10.2. Turning a String into an Array of Words
  446. 7.10.3. Arrays of Filenames
  447. 7.10.4. Automatic Arrays
  448. 7.10.5. Sorting Arrays
  449. 7.10.6. Displaying Arrays
  450. 7.10.7. Other Array Operations
  451. 7.10.8. Hints for Using Arrays
  452. 7.10.9. Do-It-Yourself Arrays
  453. 7.10.10. Associative Arrays
  454. 7.11. OUTPUT Command Improvements
  455. 7.12. Function and Variable Diagnostics
  456. 7.13. Return Value of Macros
  457. 7.14. The ASSERT, FAIL, and SUCCEED Commands.
  458. 7.15. Using Alarms
  459. 7.16. Passing Arguments to Command Files
  460. 7.17. Dialogs with Timed Responses
  461. 7.18. Increased Flexibility of SWITCH Case Labels
  462. 7.19. "Kerbang" Scripts
  463. 7.20. IF and XIF Statement Syntax
  464. 7.20.1. The IF/XIF Distinction
  465. 7.20.2. Boolean Expressions (The IF/WHILE Condition)
  466. 7.21. Screen Formatting and Cursor Control
  467. 7.22. Evaluating Arithmetic Expressions
  468. 7.23. Floating-Point Arithmetic
  469. 7.24. Tracing Script Execution
  470. 7.25. Compact Substring Notation
  471. 7.26. New WAIT Command Options
  472. 7.26.1. Waiting for Modem Signals
  473. 7.26.2. Waiting for File Events
  474. 7.27. Relaxed FOR and SWITCH Syntax
  475. (8) USING OTHER FILE TRANSFER PROTOCOLS
  476. (9) COMMAND-LINE OPTIONS
  477. 9.0. Extended-Format Command-Line Options
  478. 9.1. Command Line Personalities
  479. 9.2. Built-in Help for Command Line Options
  480. 9.3. New Command-Line Options
  481. (10) C-KERMIT AND G-KERMIT
  482. III. APPENDICES
  483. III.1. Character Set Tables
  484. III.1.1. The Hewlett Packard Roman8 Character Set
  485. III.1.2. Greek Character Sets
  486. III.1.2.1. The ISO 8859-7 Latin / Greek Alphabet
  487. III.1.2.2. The ELOT 927 Character Set
  488. III.1.2.3. PC Code Page 869
  489. III.2. Updated Country Codes
  490. IV. ERRATA & CORRIGENDA: Corrections to "Using C-Kermit" 2nd Edition.
  491. V. ADDITIONAL COPYRIGHT NOTICES
  492. I. C-KERMIT DOCUMENTATION
  493. The user manual for C-Kermit is:
  494. Frank da Cruz and Christine M. Gianone, Using C-Kermit, Second
  495. Edition, Digital Press / Butterworth-Heinemann, Woburn, MA, 1997,
  496. 622 pages, ISBN 1-55558-164-1.
  497. The present document is a supplement to Using C-Kermit 2nd Ed, not a
  498. replacement for it.
  499. US single-copy price: $52.95; quantity discounts available. Available
  500. in bookstores or directly from Columbia University:
  501. The Kermit Project
  502. Columbia University
  503. 612 West 115th Street
  504. New York NY 10025-7799
  505. USA
  506. Telephone: +1 (212) 854-3703
  507. Fax: +1 (212) 662-6442
  508. Domestic and overseas orders accepted. Price: US $44.95 (US, Canada,
  509. and Mexico). Shipping: $4.00 within the USA; $15.00 to all other
  510. countries. Orders may be paid by MasterCard or Visa, or prepaid by
  511. check in US dollars. Add $65 bank fee for checks not drawn on a US
  512. bank. Do not include sales tax. Inquire about quantity discounts.
  513. You can also order by phone from the publisher, Digital Press /
  514. Butterworth-Heinemann, with MasterCard, Visa, or American Express:
  515. +1 800 366-2665 (Woburn, Massachusetts office for USA & Canada)
  516. +44 1865 314627 (Oxford, England distribution centre for UK & Europe)
  517. +61 03 9245 7111 (Melbourne, Vic, office for Australia & NZ)
  518. +65 356-1968 (Singapore office for Asia)
  519. +27 (31) 2683111 (Durban office for South Africa)
  520. AGerman-language edition of the First Edition is also available:
  521. Frank da Cruz and Christine M. Gianone, C-Kermit - Einführung und
  522. Referenz, Verlag Heinz Heise, Hannover, Germany (1994). ISBN
  523. 3-88229-023-4. Deutsch von Gisbert W. Selke. Price: DM 88,00. Verlag
  524. Heinz Heise GmbH & Co. KG, Helstorfer Strasse 7, D-30625 Hannover.
  525. Tel. +49 (05 11) 53 52-0, Fax. +49 (05 11) 53 52-1 29.
  526. TheKermit file transfer protocol is specified in:
  527. Frank da Cruz, Kermit, A File Transfer Protocol, Digital Press,
  528. Bedford, MA, 1987, 379 pages, ISBN 0-932376-88-6. US single-copy
  529. price: $39.95. Availability as above.
  530. News and articles about Kermit software and protocol are published
  531. periodically in the journal,Kermit News. Subscriptions are free;
  532. contact Columbia University at the address above.
  533. Online news about Kermit is published in the
  534. comp.protocols.kermit.announce andcomp.protocols.kermit.misc
  535. newsgroups.
  536. II. NEW FEATURES
  537. Support for the Bell Labs Plan 9 operating system was added to version
  538. 6.0 too late to be mentioned in the book (although it does appear on
  539. the cover).
  540. Specific changes and additions are grouped together by major topic,
  541. roughly corresponding to the chapters ofUsing C-Kermit.
  542. 0. INCOMPATIBILITIES WITH PREVIOUS RELEASES
  543. 1. C-Kermit 7.0 uses FAST Kermit protocol settings by default. This
  544. includes "unprefixing" of certain control characters. Because of
  545. this, file transfers that worked with previous releases might not
  546. work in the new release (but it is more likely that they will work,
  547. and much faster). If a transfer fails, you'll get a
  548. context-sensitive hint suggesting possible causes and cures.
  549. Usually SET PREFIXING ALL does the trick.
  550. 2. C-Kermit 7.0 transfers files in BINARY mode by default. To restore
  551. the previous behavior, put SET FILE TYPE TEXT in your C-Kermit
  552. initialization file.
  553. 3. No matter whether FILE TYPE is BINARY or TEXT by default, C-Kermit
  554. 7.0 now switches between text and binary mode automatically on a
  555. per-file basis according to various criteria, including (a) which
  556. kind of platform is on the other end of the connection (if known),
  557. (b) the version of Kermit on the other end, and (c) the file's name
  558. (see Section 4, especially 4.3). To disable this
  559. automatic switching and restore the earlier behavior, put SET
  560. TRANSFER MODE MANUAL in your C-Kermit initialization file. To
  561. disable automatic switching for a particular transfer, include a
  562. /TEXT or /BINARY switch with your SEND or GET command.
  563. 4. The RESEND and REGET commands automatically switch to binary mode;
  564. previously if RESEND or REGET were attempted when FILE TYPE was
  565. TEXT, these commands would fail immediately, with a message telling
  566. you they work only when the FILE TYPE is BINARY. Now they simply do
  567. this for you. See Section 4.23 for additional (important)
  568. information.
  569. 5. SET PREFIXING CAUTIOUS and MINIMAL now both prefix linefeed (10 and
  570. 138) in case rlogin, ssh, or cu are "in the middle", since
  571. otherwise <LF>~ might appear in Kermit packets, and this would
  572. cause rlogin, ssh, or cu to disconnect, suspend, escape back, or
  573. otherwise wreck the file transfer. Xon and Xoff are now always
  574. prefixed too, even when Xon/Xoff flow control is not in effect,
  575. since unprefixing them has proven dangerous on TCP/IP connections.
  576. 6. In UNIX, VMS, Windows, and OS/2, the DIRECTORY command is built
  577. into C-Kermit itself rather than implemented by running an external
  578. command or program. The built-in command might not behave the way
  579. the platform-specific external one did, but many options are
  580. available for customization. Of course the underlying
  581. platform-specific command can still be accessed with "!", "@", or
  582. "RUN" wherever the installation does not forbid. In UNIX, the "ls"
  583. command can be accessed directly as "ls" in C-Kermit. See
  584. Section 4.5.1 for details.
  585. 7. SEND ? prints a list of switches rather than a list of filenames.
  586. If you want to see a list of filenames, use a (system-dependent)
  587. construction such as SEND ./? (for UNIX, Windows, or OS/2), SEND
  588. []? (VMS), etc. See Sections 1.5 and4.7.1.
  589. 8. In UNIX, OS-9, and Kermit 95, the wildcard characters in previous
  590. versions were * and ?. In C-Kermit 7.0 they are *, ?, [, ], {, and
  591. }, with dash used inside []'s to denote ranges and comma used
  592. inside {} to separate list elements. If you need to include any of
  593. these characters literally in a filename, precede each one with
  594. backslash (\). See Section 4.9.
  595. 9. SET QUIET { ON, OFF } is now on the command stack, just like SET
  596. INPUT CASE, SET COUNT, SET MACRO ERROR, etc, as described on p.458
  597. ofUsing C-Kermit, 2nd Edition. This allows any macro or
  598. command file to SET QUIET ON or OFF without worrying about saving
  599. and restoring the global QUIET value. For example, this lets you
  600. write a script that tries SET LINE on lots of devices until it
  601. finds one free without spewing out loads of error messages, and
  602. also without disturbing the global QUIET setting, whatever it was.
  603. 10. Because of the new "." operator (which introduces assignments),
  604. macros whose names begin with "." can not be invoked "by name".
  605. However, they still can be invoked with DO.
  606. 11. The syntax of the EVALUATE command has changed. SeeSection
  607. 7.9.2. To restore the previous syntax, use SET EVALUATE OLD.
  608. 12. The \v(directory) variable now includes the trailing directory
  609. separator; in previous releases it did not. This is to allow
  610. constructions such as:
  611. cd \v(dir)data.tmp
  612. to work across platforms that might have different directory
  613. notation, such as UNIX, Windows, and VMS.
  614. 13. Prior to C-Kermit 7.0, the FLOW-CONTROL setting was global and
  615. sticky. In C-Kermit 7.0, there is an array of default flow-control
  616. values for each kind of connection, that are applied automatically
  617. at SET LINE/PORT/HOST time. Thus a SET FLOW command given before
  618. SET LINE/PORT/HOST is likely to be undone. Therefore SET FLOW can
  619. be guaranteed to have the desired effect only if given after the
  620. SET LINE/PORT/HOST command.
  621. 14. Character-set translation works differently in the TRANSMIT command
  622. when (a) the file character-set is not the same as the local end of
  623. the terminal character-set, or (b) when the terminal character-set
  624. is TRANSPARENT.
  625. 1. PROGRAM AND FILE MANAGEMENT AND COMMANDS
  626. 1.0. Bug Fixes
  627. The following patches were issued to correct bugs in C-Kermit 6.0.
  628. These are described in detail in the 6.0 PATCHES file. All of these
  629. fixes have been incorporated in C-Kermit 6.1 (never released except as
  630. K95 1.1.16-17) and 7.0.
  631. 0001 All UNIX C-Kermit mishandles timestamps on files before 1970
  632. 0002 Solaris 2.5++ Compilation error on Solaris 2.5 with Pro C
  633. 0003 All VMS CKERMIT.INI Fix for VMS
  634. 0004 VMS/VAX/UCX 2.0 C-Kermit 6.0 can't TELNET on VAX/VMS with UCX 2.0
  635. 0005 All C-Kermit Might Send Packets Outside Window
  636. 0006 All MOVE from SEND-LIST does not delete original files
  637. 0007 Solaris 2.5++ Higher serial speeds on Solaris 2.5
  638. 0008 All C-Kermit application file name can't contain spaces
  639. 0009 AT&T 7300 UNIXPC setuid and hardware flow-control problems
  640. 0010 Linux on Alpha Patch to make ckutio.c compile on Linux/Alpha
  641. 0011 OS-9/68000 2.4 Patch to make ck9con.c compile on OS-9/68000 2.4
  642. 0012 MW Coherent 4.2 Patches for successful build on Coherent 4.2
  643. 0013 SINIX-Y 5.43 "delay" variable conflicts with <sys/clock.h>
  644. 0014 VMS/VAX/CMU-IP Subject: Patches for VAX/VMS 5.x + CMU-IP
  645. 0015 All XECHO doesn't flush its output
  646. 0016 VMS CD and other directory operations might not work
  647. 0017 Linux 1.2.x++ Use standard POSIX interface for high serial speeds
  648. 0018 UNIX SET WILDCARD-EXPANSION SHELL dumps core
  649. 0019 All Hayes V.34 modem init string problem
  650. 0020 All READ command does not fail if file not open
  651. 0021 All Problems with long function arguments
  652. 0022 All Certain \function()s can misbehave
  653. 0023 All X MOD 0 crashes program
  654. 0024 All Internal bulletproofing for lower() function
  655. 0025 OpenBSD Real OpenBSD support for C-Kermit 6.0
  656. 0026 All Incorrect checks for macro/command-file nesting depth
  657. 0027 All ANSWER doesn't automatically CONNECT
  658. 0028 All Overzealous EXIT warning
  659. 0029 All OUTPUT doesn't echo when DUPLEX is HALF
  660. 0030 All Minor problems with REMOTE DIRECTORY/DELETE/etc
  661. 0031 All CHECK command broken
  662. 0032 All Problem with SET TRANSMIT ECHO
  663. 0033 UNIX, VMS, etc HELP SET SERVER says too much
  664. 0034 All READ and !READ too picky about line terminators
  665. 0035 All END from inside SWITCH doesn't work
  666. 0036 All Problem telnetting to multihomed hosts
  667. 0037 All Redirection failures in REMOTE xxx > file
  668. REDIRECT was missing in many UNIX C-Kermit implementations; in version
  669. 7.0, it should be available in all of them.
  670. 1.1. Command Continuation
  671. Comments that start with ";" or "#" can no longer be continued. In:
  672. ; this is a comment -
  673. echo blah
  674. the ECHO command will execute, rather than being taken as a
  675. continuation of the preceding comment line. This allows easy
  676. "commenting out" of commands from macro definitions.
  677. However, the text of the COMMENT command can still be continued onto
  678. subsequent lines:
  679. comment this is a comment -
  680. echo blah
  681. As of version 6.0, backslash is no longer a valid continuation
  682. character. Only hyphen should be used for command continuation. This is
  683. to make it possible to issue commands like "cd a:\" on DOS-like
  684. systems.
  685. As of version 7.0:
  686. * You can quote a final dash to prevent it from being a continuation
  687. character:
  688. echo foo\-
  689. This prints "foo-". The command is not continued.
  690. * You can enter commands such as:
  691. echo foo - ; this is a comment
  692. interactively and they are properly treated as continued commands.
  693. Previously this worked only in command files.
  694. 1.2. Editor Interface
  695. SET EDITOR name [ options ]
  696. Lets you specify a text-editing program. The name can be a fully
  697. specified pathname like /usr/local/bin/emacs19/emacs, or it can
  698. be the name of any program in your PATH, e.g. "set editor
  699. emacs". In VMS, it must be a DCL command like "edit",
  700. "edit/tpu", "emacs", etc. If an environment variable EDITOR is
  701. defined when Kermit starts, its value is the default editor. You
  702. can also specify options to be included on the editor command
  703. line. Returns to Kermit when the editor exits.
  704. EDIT [ filename ]
  705. If the EDIT command is given without a filename, then if a
  706. previous filename had been given to an EDIT command, it is used;
  707. if not, the editor is started without a file. If a filename is
  708. given, the editor is started on that file, and the filename is
  709. remembered for subsequent EDIT commands.
  710. SHOW EDITOR
  711. Displays the full pathname of your text editor, if any, along
  712. with any command line options, and the file most recently edited
  713. (and therefore the default filename for your next EDIT command).
  714. Related variables: \v(editor), \v(editopts), \v(editfile).
  715. 1.3. Web Browser and FTP Interface
  716. C-Kermit includes an FTP command, which simply runs the FTP program;
  717. C-Kermit does not include any built-in support for Internet File
  718. Transfer Protocol, nor any method for interacting directly with an FTP
  719. server. In version 7.0, however, C-Kermit lets you specify your FTP
  720. client:
  721. SET FTP-CLIENT [ name [ options ] ]
  722. The name is the name of the FTP executable. In UNIX, Windows, or
  723. OS/2, it can be the filename of any executable program in your
  724. PATH (e.g. "ftp.exe" in Windows, "ftp" in UNIX); elsewhere (or
  725. if you do not have a PATH definition), it must be the fully
  726. specified pathname of the FTP program. If the name contains any
  727. spaces, enclose it braces. Include any options after the
  728. filename; these depend the particular ftp client.
  729. The Web browser interface is covered in the following subsections.
  730. 1.3.1. Invoking your Browser from C-Kermit
  731. BROWSE [ url ]
  732. Starts your preferred Web browser on the URL, if one is given,
  733. otherwise on the most recently given URL, if any. Returns to
  734. Kermit when the browser exits.
  735. SET BROWSER [ name [ options ] ]
  736. Use this command to specify the name of your Web browser
  737. program, for example: "set browser lynx". The name must be in
  738. your PATH, or else it must be a fully specified filename; in VMS
  739. it must be a DCL command.
  740. SHOW BROWSER
  741. Displays the current browser, options, and most recent URL.
  742. Related variables: \v(browser), \v(browsopts), \v(browsurl).
  743. Also see Section 2.15: Contacting Web Servers with the HTTP
  744. Command.
  745. 1.3.2. Invoking C-Kermit from your Browser
  746. The method for doing this depends, of course, on your browser. Here are
  747. some examples:
  748. Netscape on UNIX (X-based)
  749. In the Options->Applications section, set your Telnet
  750. application to:
  751. xterm -e /usr/local/bin/kermit/kermit -J %h %p
  752. (replace "/usr/local/bin/kermit/kermit" by C-Kermit's actual
  753. pathname). -J is C-Kermit's command-line option to "be like
  754. Telnet"; %h and %p are Netscape placeholders for hostname and
  755. port.
  756. Lynx on UNIX
  757. As far as we know, this can be done only at compile time. Add
  758. the following line to the Lynx userdefs.h file before building
  759. the Lynx binary:
  760. #define TELNET_COMMAND "/opt/bin/kermit -J"
  761. And then add lines like the following to the Lynx.cfg file:
  762. DOWNLOADER:Kermit binary download:/opt/bin/kermit -i -V -s %s -a %s:TRUE
  763. DOWNLOADER:Kermit text download:/opt/bin/kermit -s %s -a %s:TRUE
  764. UPLOADER:Kermit binary upload:/opt/bin/kermit -i -r -a %s:TRUE
  765. UPLOADER:Kermit text upload:/opt/bin/kermit -r -a %s:TRUE
  766. UPLOADER:Kermit text get:/opt/bin/kermit -g %s:TRUE
  767. UPLOADER:Kermit binary get:/opt/bin/kermit -ig %s:TRUE
  768. But none of the above is necessary if you make C-Kermit your default
  769. Telnet client, which you can do by making a symlink called 'telnet' to
  770. the C-Kermit 7.0 binary. See Section 9.1 for details.
  771. 1.4. Command Editing
  772. Ctrl-W ("Word delete") was changed in 7.0 to delete back to the
  773. previous non-alphanumeric, rather than all the way back to the previous
  774. space.
  775. 1.5. Command Switches
  776. As of version 7.0, C-Kermit's command parser supports a new type of
  777. field, called a "switch". This is an optional command modifier.
  778. 1.5.1. General Switch Syntax
  779. A switch is a keyword beginning with a slash (/). If it takes a value,
  780. then the value is appended to it (with no intervening spaces),
  781. separated by a colon (:) or equal sign (=). Depending on the switch,
  782. the value may be a number, a keyword, a filename, a date/time, etc.
  783. Examples:
  784. send oofa.txt ; No switches
  785. send /binary oofa.zip ; A switch without a value
  786. send /protocol:zmodem oofa.zip ; A switch with a value (:)
  787. send /protocol=zmodem oofa.zip ; A switch with a value (=)
  788. send /text /delete /as-name:x.x oofa.txt ; Several switches
  789. Like other command fields, switches are separated from other fields,
  790. and from each other, by whitespace, as shown in the examples just
  791. above. You can not put them together like so:
  792. send/text/delete/as-name:x.x oofa.txt
  793. (as you might do in VMS or DOS, or as we might once have done in
  794. TOPS-10 or TOPS0-20, or PIP). This is primarily due to ambiguity
  795. between "/" as switch introducer versus "/" as UNIX directory
  796. separator; e.g. in:
  797. send /delete/as-name:foo/text oofa.txt
  798. Does "foo/text" mean the filename is "foo" and the transfer is to be in
  799. text mode, or does it mean the filename is "foo/text"? Therefore we
  800. require whitespace between switches to resolve the ambiguity. (That's
  801. only one of several possible ambiguities -- it is also conceivable that
  802. a file called "text" exists in the path "/delete/as-name:foo/").
  803. In general, if a switch can take a value, but you omit it, then either
  804. a reasonable default value is supplied, or an error message is printed:
  805. send /print:-Plaserwriter oofa.txt ; Value included = print options
  806. send /print oofa.txt ; Value omitted, OK
  807. send /mail:kermit@columbia.edu oofa.txt ; Value included = address
  808. send /mail oofa.txt ; Not OK - address required
  809. ?Address required
  810. Context-sensitive help (?) and completion (Esc or Tab) are available in
  811. the normal manner:
  812. C-Kermit> send /pr? Switch, one of the following:
  813. /print /protocol
  814. C-Kermit> send /pro<ESC>tocol:? File-transfer protocol,
  815. one of the following:
  816. kermit xmodem ymodem ymodem-g zmodem
  817. C-Kermit> send /protocol:k<TAB>ermit
  818. If a switch takes a value and you use completion on it, a colon (:) is
  819. printed at the end of its name to indicate this. If it does not take a
  820. value, a space is printed.
  821. Also, if you type ? in a switch field, switches that take values are
  822. shown with a trailing colon; those that don't take values are shown
  823. without one.
  824. 1.5.2. Order and Effect of Switches
  825. The order of switches should not matter, except that they are evaluated
  826. from left to right, so if you give two switches with opposite effects,
  827. the rightmost one is used:
  828. send /text /binary oofa.zip ; Sends oofa.zip in binary mode.
  829. Like other command fields, switches have no effect whatsoever until the
  830. command is entered (by pressing the Return or Enter key). Even then,
  831. switches affect only the command with which they are included; they do
  832. not have global effect or side effects.
  833. 1.5.3. Distinguishing Switches from Other Fields
  834. All switches are optional. A command that uses switches lets you give
  835. any number of them, including none at all. Example:
  836. send /binary oofa.zip
  837. send /bin /delete oofa.zip
  838. send /bin /as-name:mupeen.zip oofa.zip
  839. send oofa.zip
  840. But how does Kermit know when the first "non-switch" is given? It has
  841. been told to look for both a switch and for something else, the data
  842. type of the next field (filename, number, etc). In most cases, this
  843. works well. But conflicts are not impossible. Suppose, for example, in
  844. UNIX there was a file named "text" in the top-level directory. The
  845. command to send it would be:
  846. send /text
  847. But C-Kermit would think this was the "/text" switch. To resolve the
  848. conflict, use braces:
  849. send {/text}
  850. or other circumlocutions such as "send //text", "send /./text", etc.
  851. The opposite problem can occur if you give an illegal switch that
  852. happens to match a directory name. For example:
  853. send /f oofa.txt
  854. There is no "/f" switch (there are several switches that begin with
  855. "/f", so "/f" is ambiguous). Now suppose there is an "f" directory in
  856. the root directory; then this command would be interpreted as:
  857. Send all the files in the "/f" directory, giving each one an as-name
  858. of "oofa.txt".
  859. This could be a mistake, or it could be exactly what you intended;
  860. C-Kermit has no way of telling the difference. To avoid situations like
  861. this, spell switches out in full until you are comfortable enough with
  862. them to know the minimum abbreviation for each one. Hint: use ? and
  863. completion while typing switches to obtain the necessary feedback.
  864. 1.5.4. Standard File Selection Switches
  865. The following switches are used on different file-oriented commands
  866. (such as SEND, DIRECTORY, DELETE, PURGE) to refine the selection of
  867. files that match the given specification.
  868. /AFTER:date-time
  869. Select only those files having a date-time later than the one
  870. given. See Section 1.6 for date-time formats. Synonym:
  871. /SINCE.
  872. /NOT-AFTER:date-time
  873. Select only those files having a date-time not later than (i.e.
  874. earlier or equal to) the one given. Synonym: /NOT-SINCE.
  875. /BEFORE:date-time
  876. Select only those files having a date-time earlier than the one
  877. given.
  878. /NOT-BEFORE:date-time
  879. Select only those files having a date-time not earlier than
  880. (i.e. later or equal to) the one given.
  881. /DOTFILES
  882. UNIX and OS-9 only: The filespec is allowed to match files whose
  883. names start with (dot) period. Normally these files are not
  884. shown.
  885. /NODOTFILES
  886. (UNIX and OS-9 only) Don't show files whose names start with dot
  887. (period). This is the opposite of /DOTFILES, and is the default.
  888. Note that when a directory name starts with a period, the
  889. directory and (in recursive operations) all its subdirectories
  890. are skipped.
  891. /LARGER-THAN:number
  892. Only select files larger than the given number of bytes.
  893. /SMALLER-THAN:number
  894. Only select files smaller than the given number of bytes.
  895. /EXCEPT:pattern
  896. Specifies that any files whose names match the pattern, which
  897. can be a regular filename, or may contain "*" and/or "?"
  898. metacharacters (wildcards), are not to be selected. Example:
  899. send /except:*.log *.*
  900. sends all files in the current directory except those with a
  901. filetype of ".log". Another:
  902. send /except:*.~*~ *.*
  903. sends all files except the ones that look like Kermit or EMACS
  904. backup files (such as "oofa.txt.~17~") (of course you can also
  905. use the /NOBACKUP switch for this).
  906. The pattern matcher is the same one used by IF MATCH string
  907. pattern ( Section 7.4), so you can test your patterns using
  908. IF MATCH. If you need to match a literal * or ? (etc), precede
  909. it by a backslash (\). If the pattern contains any spaces, it
  910. must be enclosed in braces:
  911. send /except:{Foo bar} *.*
  912. The pattern can also be a list of up to 8 patterns. In this
  913. case, the entire pattern must be enclosed in braces, and each
  914. sub-pattern must also be enclosed in braces; this eliminates the
  915. need for designating a separator character, which is likely to
  916. also be a legal filename character on some platform or other,
  917. and therefore a source of confusion. You may include spaces
  918. between the subpatterns but they are not necessary. The
  919. following two commands are equivalent:
  920. send /except:{{ck*.o} {ck*.c}} ck*.?
  921. send /except:{{ck*.o}{ck*.c}} ck*.?
  922. If a pattern is to include a literal brace character, precede it
  923. with "\". Also note the apparent conflict of this list format
  924. and the string-list format described in Section 4.9.1. In
  925. case you want to include a wildcard string-list with braces on
  926. its outer ends as an /EXCEPT: argument, do it like this:
  927. send /except:{{{ckuusr.c,ckuus2.c,ckuus6.c}}} ckuus*.c
  928. 1.5.5. Setting Preferences for Different Commands
  929. Certain oft-used commands offer lots of switches because different
  930. people have different requirements or preferences. For example, some
  931. people want to be able to delete files without having to watch a list
  932. of the deleted files scroll past, while others want to be prompted for
  933. permission to delete each file. Different people prefer different
  934. directory-listing styles. And so on. Such commands can be tailored with
  935. the SET OPTIONS command:
  936. SET OPTIONS command [ switch [ switch [ ... ] ] ]
  937. Sets each switch as the default for the given command, replacing
  938. the "factory default". Of course you can also override any
  939. defaults established by the SET OPTIONS command by including the
  940. relevant switches in the affected command any time you issue it.
  941. SHOW OPTIONS
  942. Lists the commands that allows option-setting, and the options
  943. currently in effect, if any, for each. Switches that have
  944. synonyms are shown under their primary name; for example. /LOG
  945. and /VERBOSE are shown as /LIST.
  946. Commands for which options may be set include DIRECTORY, DELETE, PURGE,
  947. and TYPE. Examples:
  948. SET OPTIONS DIRECTORY /PAGE /NOBACKUP /HEADING /SORT:DATE /REVERSE
  949. SET OPTIONS DELETE /LIST /NOHEADING /NOPAGE /NOASK /NODOTFILES
  950. SET OPTIONS TYPE /PAGE
  951. Not necessarily all of a command's switches can be set as options. For
  952. example, file selection switches, since these would normally be
  953. different for each command.
  954. Put the desired SET OPTIONS commands in your C-Kermit customization
  955. file for each command whose default switches you want to change every
  956. time you run C-Kermit.
  957. 1.6. Dates and Times
  958. Some commands and switches take date-time values, such as:
  959. send /after:{8-Feb-2000 10:28:01}
  960. Various date-time formats are acceptable. The rules for the date are:
  961. * The year must have 4 digits.
  962. * If the year comes first, the second field is the month.
  963. * The day, month, and year may be separated by spaces, /, -, or
  964. underscore.
  965. * The month may be numeric (1 = January) or spelled out or
  966. abbreviated in English.
  967. If the date-time string contains any spaces, it must be enclosed in
  968. braces. Examples of legal dates:
  969. Interpretation:
  970. 2000-Feb-8 8 February 2000
  971. {2000 Feb 8} 8 February 2000
  972. 2000/Feb/8 8 February 2000
  973. 2000_Feb_8 8 February 2000
  974. 2000-2-8 8 February 2000
  975. 2000-02-08 8 February 2000
  976. 8-Feb-2000 8 February 2000
  977. 08-Feb-2000 8 February 2000
  978. 12/25/2000 25 December 2000
  979. 25/12/2000 25 December 2000
  980. The last two examples show that when the year comes last, and the month
  981. is given numerically, the order of the day and month doesn't matter as
  982. long as the day is 13 or greater (mm/dd/yyyy is commonly used in the
  983. USA, whereas dd/mm/yyyy is the norm in Europe). However:
  984. 08/02/2000 Is ambiguous and therefore not accepted.
  985. If a date is given, the time is optional and defaults to 00:00:00. If
  986. the time is given with a date, it must follow the date, separated by
  987. space, /, -, or underscore, and with hours, minutes, and seconds
  988. separated by colon (:). Example:
  989. 2000-Feb-8 10:28:01 Represents 8 February 2000, 10:28:01am
  990. If a date is not given, the current date is used and a time is
  991. required.
  992. Time format is hh:mm:ss or hh:mm or hh in 24-hour format, or followed
  993. by "am" or "pm" (or "AM" or "PM") to indicate morning or afternoon.
  994. Examples of times that are acceptable:
  995. Interpretation:
  996. 3:23:56 3:23:56am
  997. 3:23:56am 3:23:56am
  998. 3:23:56pm 3:23:56pm = 15:23:56
  999. 15:23:56 3:23:56pm = 15:23:56
  1000. 3:23pm 3:23:00pm = 15:23:00
  1001. 3:23PM 3:23:00pm = 15:23:00
  1002. 3pm 3:00:00pm = 15:00:00
  1003. Examples of legal date-times:
  1004. send /after:{8 Feb 2000 10:28:01}
  1005. send /after:8_Feb_2000_10:28:01
  1006. send /after:8-Feb-2000/10:28:01
  1007. send /after:2000/02/08/10:28:01
  1008. send /after:2000/02/08_10:28:01
  1009. send /after:2000/02/08_10:28:01am
  1010. send /after:2000/02/08_10:28:01pm
  1011. send /after:2000/02/08_10:28pm
  1012. send /after:2000/02/08_10pm
  1013. send /after:10:00:00pm
  1014. send /after:10:00pm
  1015. send /after:10pm
  1016. send /after:22
  1017. Finally, there is a special all-numeric format you can use:
  1018. yyyymmdd hh:mm:ss
  1019. For example:
  1020. 20000208 10:28:01
  1021. This is Kermit's standard date-time format (based on ISO 8601), and is
  1022. accepted (among other formats) by any command or switch that requires a
  1023. date-time, and is output by any function whose result is a calendar
  1024. date-time.
  1025. There are no optional parts to this format and it must be exactly 17
  1026. characters long, punctuated as shown (except you can substitute
  1027. underscore for space in contexts where a single "word" is required).
  1028. The time is in 24-hour format (23:00:00 is 11:00pm). This is the format
  1029. returned by \fdate(filename), so you can also use constructions like
  1030. this:
  1031. send /after:\fdate(oofa.txt)
  1032. which means "all files newer than oofa.txt".
  1033. Besides explicit dates, you can also use the any of the following
  1034. shortcuts:
  1035. TODAY
  1036. Stands for the current date at 00:00:00.
  1037. TODAY 12:34:56
  1038. Stands for the current date at the given time.
  1039. YESTERDAY
  1040. Stands for yesterday's date at 00:00:00. A time may also be
  1041. given.
  1042. TOMORROW
  1043. Stands for tomorrow's date at 00:00:00. A time may also be
  1044. given.
  1045. + number { DAYS, WEEKS, MONTHS, YEARS } [ time ]
  1046. Is replaced by the future date indicated, relative to the
  1047. current date. If the time is omitted, 00:00:00 is used.
  1048. Examples: +3days, +2weeks, +1year, +37months.
  1049. - number { DAYS, WEEKS, MONTHS, YEARS } [ time ]
  1050. Is replaced by the past date indicated, relative to the current
  1051. date. If the time is omitted, 00:00:00 is used.
  1052. The time can be separated from the date shortcut by any of the same
  1053. separators that are allowed for explicit date-times: space, hyphen,
  1054. slash, period, or underscore. In switches and other space-delimited
  1055. fields, use non-spaces to separate date/time fields, or enclose the
  1056. date-time in braces, e.g.:
  1057. purge /before:-4days_12:00:00
  1058. purge /before:{- 4 days 12:00:00}
  1059. Of course you can also use variables:
  1060. define \%n 43
  1061. purge /before:-\%ndays_12:00:00
  1062. Shortcut names can be abbreviated to any length that still
  1063. distinguishes them from any other name that can appear in the same
  1064. context, e.g. "TOD" for today, "Y" for yesterday. Also, the special
  1065. abbreviation "wks" is accepted for WEEKS, and "yrs" for "YEARS".
  1066. (To see how to specify dates relative to a specific date, rather than
  1067. the current one, see the\fmjd() function description below.)
  1068. You can check date formats with the DATE command. DATE by itself prints
  1069. the current date and time in standard format: yyyymmdd hh:mm:ss. DATE
  1070. followed by a date and/or time (including shortcuts) converts it to
  1071. standard format if it can understand it, otherwise it prints an error
  1072. message.
  1073. The following variables and functions deal with dates and times; any
  1074. function argument designated as "date-time" can be in any of the
  1075. formats described above.
  1076. \v(day)
  1077. The first three letters of the English word for the current day
  1078. of the week, e.g. "Wed".
  1079. \fday(date-time)
  1080. The first three letters of the English word for day of the week
  1081. of the given date. If a time is included, it is ignored.
  1082. Example: \fday(8 Feb 1988) = "Mon".
  1083. \v(nday)
  1084. The numeric day of the week: 0 = Sunday, 1 = Monday, ..., 6 =
  1085. Saturday.
  1086. \fnday(date-time)
  1087. The numeric day of the week for the given date. If a time is
  1088. included, it is ignored. Example: \fnday(8 Feb 1988) = "1".
  1089. \v(date)
  1090. The current date as dd mmm yyyy, e.g. "08 Feb 2000" (as in this
  1091. example, a leading zero is supplied for day-of-month less than
  1092. 10).
  1093. \v(ndate)
  1094. The current date in numeric format: yyyymmdd, e.g. "20000208".
  1095. \v(time)
  1096. The current time as hh:mm:ss, e.g. "15:27:14".
  1097. \ftime(time)
  1098. The given free-format date and/or time (e.g. "3pm") returns the
  1099. time (without the date) converted to hh:mm:ss 24-hour format,
  1100. e.g. "15:00:00" (the date, if given, is ignored).
  1101. \v(ntime)
  1102. The current time as seconds since midnight, e.g. "55634".
  1103. \v(tftime)
  1104. The elapsed time of the most recent file-transfer operation in
  1105. seconds.
  1106. \v(intime)
  1107. The elapsed time for the most recent INPUT command to complete,
  1108. in milliseconds.
  1109. \fntime(time)
  1110. The given free-format date and/or time is converted to seconds
  1111. since midnight (the date, if given, is ignored). This function
  1112. replaces \ftod2secs(), which is now a synonym for \fntime().
  1113. Unlike \ftod2secs(), \fntime() allows a date to be included, and
  1114. it allows the time to be in free format (like 3pm), and it
  1115. allows the amount of time to be more than 24 hours. E.g.
  1116. \fntime(48:00:00) = 172800. Example of use:
  1117. set alarm \fntime(48:00:00) ; set alarm 48 hours from now.
  1118. \fn2time(seconds)
  1119. The given number of seconds is converted to hh:mm:ss format.
  1120. \fdate(filename)
  1121. Returns the modification date-time of the given file in standard
  1122. format: yyyymmdd hh:mm:ss.
  1123. \fcvtdate(date-time)
  1124. Converts a free-format date and/or time to Kermit standard
  1125. format: yyyymmdd hh:mm:ss. If no argument is given, returns the
  1126. current date-time in standard format. If a date is given but no
  1127. time, the converted date is returned without a time. If a time
  1128. is given with no date, the current date is supplied. Examples:
  1129. \fcvtdate(4 Jul 2000 2:21:17pm) = 20000704 14:21:17
  1130. \fcvtdate() = 20000704 14:21:17 (on 4 Jul 2000 at 2:21:17pm).
  1131. \fcvtd(4 Jul 2000) = 20000704
  1132. \fcvtd(6pm) = 20000704 18:00:00 (on 4 Jul 2000 at 6:00pm).
  1133. \fdayofyear(date-time)
  1134. \fdoy(date-time)
  1135. Converts a free-format date and/or time to yyyyddd, where ddd is
  1136. the 3-digit day of the year, and 1 January is Day 1. If a time
  1137. is included with the date, it is returned in standard format. If
  1138. a date is included but no time, the date is returned without a
  1139. time. If a time is given with no date, the time is converted and
  1140. the current date is supplied. If no argument is given, the
  1141. current date-time is returned. Synonym: \fdoy(). Examples:
  1142. \fddayofyear(4 Jul 2000 2:21:17pm) = 2000185 14:21:17
  1143. \fdoy() = 2000185 14:21:17 (on 4 Jul 2000 at 2:21:17pm).
  1144. \fdoy(4 Jul 2000) = 2000185
  1145. \fdoy(6pm) = 2000185 18:00:00 (on 4 Jul 2000 at 6:00pm).
  1146. Note: The yyyyddd day-of-year format is often erroneously referred to
  1147. as a Julian date. However, a true Julian date is a simple counting
  1148. number, the number of days since a certain fixed day in the past.
  1149. See \fmjd() below.
  1150. \fdoy2date(date-time)
  1151. Converts a date or date-time in day-of-year format to a standard
  1152. format date. A yyyyddd-format date must be supplied; time is
  1153. optional. The given date is converted to yyyymmdd format. If a
  1154. time is given, it is converted to 24-hour format. Examples:
  1155. \fdoy2date(2000185) = 20000704
  1156. \fdoy2(2000185 3pm) = 20000704 15:00:00
  1157. \fmjd(date-time)
  1158. Converts free-format date and/or time to a Modified Julian Date
  1159. (MJD), the number of days since 17 Nov 1858 00:00:00. If a time
  1160. is given, it is ignored. Examples:
  1161. \fmjd(4 Jul 2000) = 50998
  1162. \fmjd(17 Nov 1858) = 0
  1163. \fmjd(16 Nov 1858) = -1
  1164. \fmjd2date(mjd)
  1165. Converts an MJD (integer) to standard date format, yyyymmdd:
  1166. \fmjd2(50998) = 4 Jul 1998
  1167. \fmjd2(0) = 17 Nov 1858
  1168. \fmjd2(-1) = 16 Nov 1858
  1169. \fmjd2(-365) = 17 Nov 1857
  1170. MJDs are normal integers and, unlike DOYs, may be added, subtracted,
  1171. etc, with each other or with other integers, to obtain meaningful
  1172. results. For example, to find out the date 212 days ago:
  1173. echo \fmjd2date(\fmjd()-212)
  1174. Constructions such as this can be used in any command where a date-time
  1175. is required, e.g.:
  1176. send /after:\fmjd2date(\fmjd()-212)
  1177. to send all files that are not older than 212 days (this is equivalent
  1178. to "send /after:-212days").
  1179. MJDs also have other regularities not exhibited by other date formats.
  1180. For example, \fmodulus(\fmjd(any-date),7) gives the day of the week for
  1181. any date (where 4=Sun, 5=Mon, ..., 3=Sat). (However, it is easier to
  1182. use \fnday() for this purpose, and it gives the more conventional
  1183. result of 0=Sun, 1=Mon, ..., 6=Sat).
  1184. Note that if MJDs are to be compared, they must be compared numerically
  1185. (IF <, =, >) and not lexically (IF LLT, EQUAL, LGT), whereas DOYs must
  1186. be compared lexically if they include a time (which contains ":"
  1187. characters); however, if DOYs do not include a time, they may also be
  1188. compared numerically.
  1189. In any case, lexical comparison of DOYs always produces the appropriate
  1190. result, as does numeric comparison of MJDs.
  1191. The same comments apply to sorting. Also note that DOYs are fixed
  1192. length, but MJDs can vary in length. However, all MJDs between 3 April
  1193. 1886 and 30 Aug 2132 are 5 decimal digits long. (MJDs become 6 digits
  1194. long on 31 Aug 2132, and 7 digits long on 13 Oct 4596).
  1195. 1.7. Partial Completion of Keywords
  1196. Partial completion of keywords was added in C-Kermit 7.0. In prior
  1197. versions, if completion was attempted (by pressing the Esc or Tab key)
  1198. on a string that matched different keywords, you'd just get a beep. Now
  1199. Kermit completes up to the first character where the possibly matching
  1200. keywords differ and then beeps. For example:
  1201. C-Kermit> send /n<Tab>
  1202. which matches /NOT-BEFORE and /NOT-AFTER, now completes up to the dash:
  1203. C-Kermit> send /n<Tab>ot-<Beep>
  1204. Partial completion works for filenames too (as it has for some years).
  1205. 1.8. Command Recall
  1206. C-Kermit has had a command history buffer for some time, which could be
  1207. scrolled interactively using control characters or (in Kermit 95 only)
  1208. arrow keys. Version 7.0 adds a REDO command that allows the most recent
  1209. command matching a given pattern to be re-executed:
  1210. { REDO, RR, ^ } [ pattern ]
  1211. Search the command history list for the most recent command that
  1212. matches the given pattern, and if one is found, execute it
  1213. again.
  1214. The pattern can be a simple string (like "send"), in which case the
  1215. last SEND command is re-executed. Or it can contain wildcard characters
  1216. "*" and/or "?", which match any string and any single character,
  1217. respectively (note that "?" must be preceded by backslash to override
  1218. its normal function of giving help), and in most C-Kermit versions may
  1219. also include [] character lists and {} string lists (seeSection
  1220. 4.9).
  1221. The match works by appending "*" to the end of the given pattern (if
  1222. you didn't put one there yourself). Thus "redo *oofa" becomes "redo
  1223. *oofa*" and therefore matches the most recent command that contains
  1224. "oofa" anywhere within the command. If you want to inhibit the
  1225. application of the trailing "*", e.g. to force matching a string at the
  1226. end of a command, enclose the pattern in braces:
  1227. redo {*oofa}
  1228. matches the most recent command that ends with "oofa".
  1229. REDO commands themselves are not entered into the command history list.
  1230. If no pattern is given, the previous (non-REDO) command is re-executed.
  1231. The REDOne command is reinserted at the end of the command history
  1232. buffer, so the command scrollback character (Ctrl-P, Ctrl-B, or
  1233. Uparrow) can retrieve it.
  1234. Examples:
  1235. C-Kermit> echo foo
  1236. foo
  1237. C-Kermit> show alarm
  1238. (no alarm set)
  1239. C-Kermit> echo blah
  1240. blah
  1241. C-Kermit> redo ; Most recent command
  1242. blah
  1243. C-Kermit> redo s ; Most recent command starting with "s"
  1244. (no alarm set)
  1245. C-Kermit> redo echo f ; Most recent command starting with "echo f"
  1246. foo
  1247. C-Kermit> redo *foo ; Most recent command that has "foo" in it
  1248. foo
  1249. C-Kermit> <Ctrl-P> ; Scroll back
  1250. C-Kermit> echo foo ; The REDOne command is there
  1251. C-Kermit> redo {*foo} ; Most recent command that ends with "foo"
  1252. foo
  1253. C-Kermit>
  1254. Since REDO, REDIAL, and REDIRECT all start the same way, and RED is the
  1255. designated non-unique abbreviation for REDIAL, REDO must be spelled out
  1256. in full. For convenience, RR is included as an invisible easy-to-type
  1257. synonym for REDO. You can also use the "^" character for this:
  1258. C-Kermit> ^ ; Most recent command
  1259. C-Kermit> ^ s ; Most recent command starting with "s"
  1260. C-Kermit> ^s ; Ditto (space not required after "^").
  1261. C-Kermit> ^*foo ; Most recent command that has "foo" in it.
  1262. C-Kermit> ^{*foo} ; Most recent command ends with "foo".
  1263. Unlike the manual command-history-scrolling keys, the REDO command can
  1264. be used in a script, but it's not recommended (since the command to be
  1265. REDOne might not be found, so if the REDO command fails, you can't tell
  1266. whether it was because REDO failed to find the requested command, or
  1267. because the command was found but it failed).
  1268. 1.9. EXIT Messages
  1269. The EXIT and QUIT commands now accept an optional message to be
  1270. printed. This makes the syntax of EXIT and QUIT just like END and STOP:
  1271. { EXIT, QUIT, END, STOP } [ status-code [ message ] ]
  1272. where status-code is a number (0 indicating success, nonzero indicating
  1273. failure). This is handy in scripts that are never supposed to enter
  1274. interactive mode:
  1275. dial 7654321
  1276. if fail exit 1 Can't make connection - try again later.
  1277. Previously this could only be done in two steps:
  1278. dial 7654321
  1279. xif fail { echo Can't make connection - try again later, exit 1 }
  1280. A status code must be included in order to specify a message. In the
  1281. case of EXIT and QUIT, the default status code is contained in the
  1282. variable \v(exitstatus), and is set automatically by various events
  1283. (file transfer failures, etc; it can also be set explicitly with the
  1284. SET EXIT STATUS command). If you want to give an EXIT or QUIT command
  1285. with a message, but without changing the exit status from what it
  1286. normally would have been, use the \v(exitstatus) variable, e.g.:
  1287. exit \v(exitstatus) Goodbye from \v(cmdfile).
  1288. The EXIT status is returned to the system shell or whatever other
  1289. process invoked C-Kermit, e.g. in UNIX:
  1290. C-Kermit> exit 97 bye bye
  1291. bye bye
  1292. $ echo $?
  1293. 97
  1294. $
  1295. 1.10. Managing Keyboard Interruptions
  1296. When C-Kermit is in command or file-transfer mode (as opposed to
  1297. CONNECT mode), it can be interrupted with Ctrl-C. Version 7.0 adds the
  1298. ability to disarm the Ctrl-C interrupt:
  1299. SET COMMAND INTERRUPT { ON, OFF }
  1300. COMMAND INTERRUPT is ON by default, meaning the Ctrl-C can be
  1301. used to interrupt a command or a file transfer in progress. Use
  1302. OFF to disable these interruptions, and use it with great
  1303. caution for obvious reasons.
  1304. SET TRANSFER INTERRUPT { ON, OFF }
  1305. This can be used to disable keyboard interruption of file
  1306. transfer when C-Kermit is in local mode, or to re-enable it
  1307. after it has been disabled. This applies to the X, Z, E, and
  1308. similar keys as well as to the system interrupt character,
  1309. usually Ctrl-C. This is distinct from SET TRANSFER CANCELLATION,
  1310. which tells whether packet mode can be exited by sending a
  1311. special sequence of characters.
  1312. Several other commands can be interrupted by pressing any key while
  1313. they are active. Version 7.0 adds the ability to disable this form of
  1314. interruption also:
  1315. SET INPUT CANCELLATION { ON, OFF }
  1316. Whether an INPUT command in progress can be interrupted by
  1317. pressing a key. Normally ON. Setting INPUT CANCELLATION OFF
  1318. makes INPUT commands uninterruptible except by Ctrl-C (unless
  1319. COMMAND INTERRUPTION is also OFF).
  1320. SET SLEEP CANCELLATION { ON, OFF }
  1321. Whether a SLEEP, PAUSE, or WAIT command in progress can be
  1322. interrupted by pressing a key. Normally ON. Setting SLEEP
  1323. CANCELLATION OFF makes these commands uninterruptible except by
  1324. Ctrl-C (unless COMMAND INTERRUPTION is also OFF). Synonyms: SET
  1325. PAUSE CANCELLATION, SET WAIT CANCELLATION.
  1326. So to make certain a script is not interruptible by the user, include
  1327. these commands:
  1328. SET TRANSFER INTERRUPT OFF
  1329. SET SLEEP CANCELLATION OFF
  1330. SET INPUT CANCELLATION OFF
  1331. SET COMMAND INTERRUPTION OFF
  1332. Make sure to turn them back on afterwards if interruption is to be
  1333. re-enabled.
  1334. When a PAUSE, SLEEP, WAIT, or INPUT command is interrupted from the
  1335. keyboard, the new variable \v(kbchar) contains a copy of the (first)
  1336. character that was typed and caused the interruption, provided it was
  1337. not the command interrupt character (usually Ctrl-C). If these commands
  1338. complete successfully or time out without a keyboard interruption, the
  1339. \v(kbchar) variable is empty.
  1340. The \v(kbchar) variable (like any other variable) can be tested with:
  1341. if defined \v(kbchar) command
  1342. The command is executed if the variable is not empty.
  1343. The \v(kbchar) variable can be reset with WAIT 0 (PAUSE 0, SLEEP 0,
  1344. etc).
  1345. 1.11. Taming The Wild Backslash -- Part Deux
  1346. Using C-Kermit, 2nd Edition, contains a brief section, "Taming the
  1347. Wild Backslash", on page 48, which subsequent experience has shown to
  1348. be inadequate for Kermit users intent on writing scripts that deal with
  1349. Windows, DOS, and OS/2 filenames, in which backslash (\) is used as the
  1350. directory separator. This section fills in the blanks.
  1351. 1.11.1. Background
  1352. The Kermit command language shares a certain unavoidable but annoying
  1353. characteristic with most other command languages that are capable of
  1354. string replacement, namely the necessity to "quote" certain characters
  1355. when you want them to be taken literally. This is a consequence of the
  1356. facts that:
  1357. 1. One or more characters must be set aside to denote replacement,
  1358. rather than acting as literal text.
  1359. 2. We have only 96 printable characters to work with in ASCII, which
  1360. is still the only universally portable character set.
  1361. 3. There is no single printable character that is unused everywhere.
  1362. 4. Variables are not restricted to certain contexts, as they are in
  1363. formal programming languages like C and Fortran, but can appear
  1364. anywhere at all within a command, and therefore require special
  1365. syntax.
  1366. Thus there can be conflicts. To illustrate, the standard UNIX shell
  1367. uses dollar sign ($) to introduce variables. So the shell command:
  1368. echo $TERM
  1369. displays the value of the TERM variable, e.g. vt320. But suppose you
  1370. want to display a real dollar sign:
  1371. echo The price is $10.20
  1372. This causes the shell to evaluate the variable "$1", which might or
  1373. might not exist, and substitute its value, e.g.:
  1374. The price is 0.20
  1375. (in this case the $1 variable had no value.) This is probably not what
  1376. you wanted. To force the dollar sign to be taken literally, you must
  1377. apply a "quoting rule", such as "precede a character by backslash (\)
  1378. to force the shell to take the character literally":
  1379. echo The price is \$10.20
  1380. The price is $10.20
  1381. But now suppose you want the backslash AND the dollar sign to be taken
  1382. literally:
  1383. echo The price is \\$10.20
  1384. This doesn't work, since the first backslash quotes the second one,
  1385. thereby leaving the dollar sign unquoted again:
  1386. The price is \0.20
  1387. Quoting the dollar sign requires addition of a third backslash:
  1388. echo The price is \\\$10.20
  1389. The price is \$10.20
  1390. The first backslash quotes the second one, and the third backslash
  1391. quotes the dollar sign.
  1392. Every command language -- all UNIX shells, VMS DCL, DOS Batch, AOS/VS
  1393. CLI, etc etc -- has similar rules. UNIX shell rules are probably the
  1394. most complicated, since many printable characters -- not just one --
  1395. are special there: dollar sign, single quote, double quote, backslash,
  1396. asterisk, accent grave, number sign, ampersand, question mark,
  1397. parentheses, brackets, braces, etc -- practically every
  1398. non-alphanumeric character needs some form of quoting if it is to be
  1399. taken literally. And to add to the confusion, the UNIX shell offers
  1400. many forms of quoting, and many alternative UNIX shells are available,
  1401. each using slightly different syntax.
  1402. 1.11.2. Kermit's Quoting Rules
  1403. Kermit's basic quoting rules are simple by comparison (there are, of
  1404. course, additional syntax requirements for macro definitions, command
  1405. blocks, function calls, etc, but they are not relevant here).
  1406. The following characters are special in Kermit commands:
  1407. Backslash (\)
  1408. Introduces a variable, or the numeric representation of a
  1409. special character, or a function, or other item for
  1410. substitution. If the backslash is followed by a digit or by any
  1411. of the following characters:
  1412. x, o, d, m, s, f, v, $, %, &, :, {
  1413. this indicates a special substitution item; otherwise the
  1414. following character is to be taken literally (exceptions: \ at
  1415. end of line is taken literally; \n, \b, and \n are special items
  1416. in the OUTPUT command only).
  1417. Semicolon (;)
  1418. (Only when at the beginning of a line or preceded by at least
  1419. one space or tab) Introduces a comment.
  1420. Number sign (#)
  1421. (Only when at the beginning of a line or preceded by at least
  1422. one space or tab) Just like semicolon; introduces a comment.
  1423. Question mark (?)
  1424. (Only at the command prompt - not in command files or macros)
  1425. Requests context-sensitive help.
  1426. To force Kermit to take any of these characters literally, simply
  1427. precede it by a backslash (\).
  1428. Sounds easy! And it is, except when backslash also has a special
  1429. meaning to the underlying operating system, as it does in DOS, Windows,
  1430. and OS/2, where it serves as the directory separator in filenames such
  1431. as:
  1432. D:\K95\KEYMAPS\READ.ME
  1433. Using our rule, we would need to refer to this file in Kermit commands
  1434. as follows:
  1435. D:\\K95\\KEYMAPS\\READ.ME
  1436. But this would not be obvious to new users of Kermit software on DOS,
  1437. Windows, or OS/2, and it would be annoying to seasoned ones. Thus
  1438. MS-DOS Kermit and Kermit 95 go to rather extreme lengths to allow the
  1439. more natural notation, as in:
  1440. send d:\k95\keymaps\read.me
  1441. The reason this is tricky is that we also need to allow for variables
  1442. and other expressions introduced by backslash in the same command. For
  1443. example, suppose \%a is a variable whose value is "oofa" (without the
  1444. quotes). What does the following command do?
  1445. send d:\%a
  1446. Does it send the file named "oofa" in the current directory of the D:
  1447. disk, or does it send a file named "%a" in the root directory of the D:
  1448. disk? This is the kind of trouble we get into when we attempt to bend
  1449. the rules in the interest of user friendliness. (The answer is: if the
  1450. variable \%a has definition that is the name of an existing file, that
  1451. file is sent; if a file d:\%a exists, it is sent; otherwise if both
  1452. conditions are true, the variable takes precedence, and the literal
  1453. filename can be forced by quoting: \\%a.)
  1454. In Kermit 95 (but not MS-DOS Kermit), we also bend the rules another
  1455. way by allowing you to use forward slash (/) rather than backslash (\)
  1456. as the directory separator:
  1457. send d:/k95/keymaps/read.me
  1458. This looks more natural to UNIX users, and in fact is perfectly
  1459. acceptable to the Windows 95/98/NT and OS/2 operating systems on the
  1460. API level. BUT (there is always a "but") the Microsoft shell,
  1461. COMMAND.COM, for Windows 95/98 and NT does not allow this notation, and
  1462. therefore it can not be used in any Kermit command -- such as RUN --
  1463. that invokes the Windows command shell AND your command shell is
  1464. COMMAND.COM or any other shell that does not allow forward slash as
  1465. directory separator (some alternative shells do allow this).
  1466. NOTE: There exists a wide variety of alternative shells from third
  1467. parties that do not have this restriction. If you are using a shell
  1468. that accepts forward slash as a directory separator, you can stop
  1469. reading right now -- UNLESS (there is always an "unless") you want
  1470. your scripts to be portable to systems that have other shells. Also
  1471. note that some Windows shells might actually REQUIRE forward slashes
  1472. (instead of backslashes) as directory separators; we do not treat
  1473. this situation below, but the treatment is obvious -- use slash
  1474. rather backslash as the directory separator.
  1475. 1.11.3. Passing DOS Filenames from Kermit to Shell Commands
  1476. The following Kermit commands invoke the system command shell:
  1477. RUN (and its synonyms ! and @)
  1478. REDIRECT
  1479. PIPE
  1480. Each of these commands takes a shell command as an operand. These shell
  1481. commands are not, and can not be, parsed by Kermit since Kermit does
  1482. not know the syntax of shell commands, and so can't tell the difference
  1483. between a keyword, a filename, a variable, a switch, or other item.
  1484. Therefore the rules can not be bent since Kermit doesn't know where or
  1485. how to bend them. To illustrate (using the regular Windows shell):
  1486. run c:\\windows\\command\\chkdsk.exe
  1487. works OK, but:
  1488. run c:/windows/command/chkdsk.exe
  1489. is not accepted by COMMAND.COM. But:
  1490. run c:\windows\command\chkdsk.exe
  1491. results in Kermit applying its quoting rules before sending the text to
  1492. the shell. Since "w" and "c" are not in the list of backslash-item
  1493. codes, the backslash means "take the following character literally".
  1494. Thus, by the time this filename gets to the Windows shell, it has
  1495. become:
  1496. c:windowscommandchkdsk.exe
  1497. which is probably not what you wanted. (If "w" and "c" were in the
  1498. list, the results could be even stranger.) Even more confusing is the
  1499. case where a directory or filename starts with one or more digits:
  1500. run c:\123\lotus.exe
  1501. in which "\123" is the Kermit notation for ASCII character 123, which
  1502. happens to be left brace ({), resulting in "c:{lotus.exe".
  1503. So when passing filenames to a Windows shell, always use double
  1504. backslashes as directory separators, to ensure that the shell gets
  1505. single backslashes:
  1506. run c:\\windows\\command\\chkdsk.exe
  1507. run c:\\123\\lotus.exe
  1508. Similar problems might occur with the built-in EDIT, BROWSE, and FTP
  1509. commands. These commands result in Kermit building a shell command
  1510. internally to invoke the associated helper program; the form of this
  1511. command might conflict with the form demanded by certain alternative
  1512. shells.
  1513. 1.11.4. Using Variables to Hold DOS Filenames
  1514. Now to the next level. Suppose you want to write a script in which
  1515. filenames are parameters, and therefore are stored in variables.
  1516. Example:
  1517. define \%f c:\windows\command\chkdsk.exe
  1518. ...
  1519. run \%f
  1520. Obviously this won't work for the reasons just noted; the RUN command
  1521. requires directory separators be coded as double backslashes:
  1522. define \%f c:\\windows\\command\\chkdsk.exe
  1523. ...
  1524. run \%f
  1525. This will work; no surprises here. However, if you had used ASSIGN
  1526. rather than DEFINE, you might have been surprised after all; review
  1527. pages 348-349 ofUsing C-Kermit (2nd Ed) for the difference
  1528. between DEFINE and ASSIGN.
  1529. We have said that any Kermit 95 or MS-DOS Kermit command that parses
  1530. filenames itself -- SEND, for example -- does not require double
  1531. backslashes since it knows it is parsing a filename. So since the
  1532. following works:
  1533. send c:\windows\command\chkdsk.exe
  1534. Should the following also work?
  1535. define \%f c:\windows\command\chkdsk.exe
  1536. ...
  1537. send \%f
  1538. Answer: No. Why? Because \%f is evaluated "recursively", to allow for
  1539. the possibility that its definition contains further variable
  1540. references. This is true of all "backslash-percent-letter" (or -digit)
  1541. variables, and also for array references. So \%f becomes
  1542. c:\windows\command\chkdsk.exe, which becomes
  1543. c:windowscommandchkdsk.exe.
  1544. The trick here is to use the "other" kind of variable, that is
  1545. evaluated only "one level deep" rather than recursively:
  1546. define filename c:\windows\command\chkdsk.exe
  1547. ...
  1548. send \m(filename)
  1549. Similarly if you want to prompt the user for a filename:
  1550. ask filename { Please type a filename: }
  1551. Please type a filename: c:\windows\command\chkdsk.exe
  1552. send \m(filename)
  1553. 1.11.5. Passing DOS Filenames as Parameters to Macros
  1554. Suppose you want to pass a DOS filename containing backslashes as a
  1555. parameter to a Kermit macro. This raises two issues:
  1556. 1. Parameters to macros are "just text" and so are fully evaluated
  1557. before they are passed to the macro.
  1558. 2. Once inside the macro, the formal parameters \%1, \%2, ... \%9 are
  1559. the type of variable that is evaluated recursively.
  1560. Thus a DOS filename is ruined once in the act of parsing the macro
  1561. invocation, and again when referring to it from within the macro. To
  1562. illustrate, suppose "test" is a macro. Then in the invocation:
  1563. test c:\mydir\blah.txt
  1564. "c:mydirblah.txt" is assigned to \%1. However, if we double the
  1565. backslashes:
  1566. test c:\\mydir\\blah.txt
  1567. "c:\mydir\blah.txt" is assigned to \%1. But then when you refer to \%1
  1568. in the macro, it is evaluated recursively, resulting in
  1569. "c:mydirblah.txt". To illustrate:
  1570. define test echo \%1
  1571. test c:\mydir\blah.txt
  1572. c:mydirblah.txt
  1573. test c:\\mydir\\blah.txt
  1574. c:mydirblah.txt
  1575. test c:\\\\mydir\\\\blah.txt
  1576. c:\mydir\blah.txt
  1577. Let's address each part of the problem separately. First, inside the
  1578. macro. You can use the \fcontents() function to force a
  1579. backslash-percent variable (such as a macro argument) to be evaluated
  1580. one level deep instead of recursively, for example:
  1581. define test echo { The filename is "\fcontents(\%1)"}
  1582. test c:\mydir\blah.txt ; We don't expect this to work
  1583. The filename is "c:mydirblah.txt" ; and it doesn't.
  1584. test c:\\mydir\\blah.txt ; But this does...
  1585. The filename is "c:\mydir\blah.txt"
  1586. Thus if the filename arrives inside the macro with single backslashes,
  1587. the backslashes are preserved if you always refer to the parameter
  1588. through the \fcontents() function.
  1589. Now how to ensure that backslashes are not stripped or misinterpreted
  1590. when passing a filename to a macro? This brings us back to what we
  1591. learned in earlier sections:
  1592. 1. If it is a literal filename, either double the backslashes, or (if
  1593. the filename is to be used only within Kermit itself and not passed
  1594. to a DOS shell, or it is to be passed to an alternative shell that
  1595. accepts forward slash as a directory separator), use forward slash
  1596. instead of backslash as the directory separator.
  1597. 2. If it is a variable that contains a filename, make sure you use a
  1598. macro-style variable name, rather than a
  1599. backslash-percent-character name.
  1600. Examples:
  1601. define test echo \fcontents(\%1)
  1602. define filename c:\mydir\blah.txt
  1603. test c:\\mydir\\blah.txt ; Literal filename with double backslashes
  1604. c:\mydir\blah.txt
  1605. test c:/mydir/blah.txt ; Literal filename with forward slashes
  1606. c:/mydir/blah.txt
  1607. test \m(filename) ; Variable
  1608. c:\mydir\blah.txt
  1609. But what if you don't like these rules and you still want to pass a
  1610. literal filename containing single backslashes to a macro? This is
  1611. possible too, but a bit tricky: turn command quoting off before
  1612. invoking the macro, and then turn it back on inside the macro. Example:
  1613. define test set command quoting on, echo \fcontents(\%1)
  1614. set command quoting off
  1615. test c:\mydir\blah.txt
  1616. c:\mydir\blah.txt
  1617. Upon return from the macro, command quoting is back on (since the macro
  1618. turned it on).
  1619. Obviously this trick can not be used if the filename is stored in a
  1620. variable, since it prevents the variable from being evaluated.
  1621. 1.11.6. Passing DOS File Names from Macro Parameters to the DOS Shell
  1622. Now suppose you need to pass a DOS filename to a macro, and the macro
  1623. needs to pass it, in turn, to the Windows shell via (say) Kermit's RUN
  1624. command. This works too:
  1625. define xrun run \fcontents(\%1)
  1626. xrun c:\\windows\\command\\chkdsk.exe
  1627. (or you can use the SET COMMAND QUOTING OFF / ON technique described
  1628. above to avoid the double backslashes.) But..
  1629. xrun c:/windows/command/chkdsk.exe
  1630. does not work if the Windows shell does not recognize "/" as a
  1631. directory separator. If there is a chance that a filename might be
  1632. passed to the macro in this form, the macro will need to convert it to
  1633. a form acceptable to the shell:
  1634. define xrun run \freplace(\fcontents(\%1),/,\\)
  1635. Here we replace all occurrences (if any) of "/" in the argument with
  1636. "\" prior to issuing the RUN command. Of course, in order to specify
  1637. "\" as a literal character in the \freplace() argument list, we have to
  1638. double it.
  1639. 1.11.7. Passing DOS Filenames to Kermit from the Shell
  1640. As noted in the manual, the \&@[] array contains Kermit's command-line
  1641. arguments. Suppose one of these arguments, say \&@[3], is a DOS
  1642. filename such as C:\FOO\BAR\BAZ\OOFA.TXT. (Note: In C-Kermit 7.0 and
  1643. K95 1.1.18 and later, command-line arguments after "=" or "--" are also
  1644. available in the top-level \%1..9 variables; see Section 7.5.)
  1645. Of course you can eliminate any problems by using forward slashes
  1646. rather than backslashes in the filename, but sometimes this is not
  1647. possible, as when the Kermit command line is being generated by another
  1648. program than can only generate "native" format DOS filenames.
  1649. As noted in the manual, "\%x" variables and \&x[] arrays are always
  1650. evaluated "all the way" (recursively). If the contents of one of these
  1651. variables contains backslashes, this causes another level of
  1652. evaluation.
  1653. There is another kind of variable, which is evaluated only "one level
  1654. deep". You can use this to prevent interpretation of the backslashes in
  1655. the filenames. Example:
  1656. assign filename \fcontents(\&@[3]) ; Transfer contents
  1657. ...
  1658. send \m(filename)
  1659. Or, more simply:
  1660. send \fcontents(\&@[3])
  1661. 1.12. Debugging
  1662. The debug log is produced when you give a "log debug" command. This is
  1663. normally done at the request of the Kermit help desk, for forwarding to
  1664. the Kermit developers for analysis as a last resort in troubleshooting
  1665. problems. (Last resort because it can grow quite huge in a very short
  1666. time.) In cases where timing information is critical to understanding a
  1667. problem, you can tell C-Kermit to put a timestamp on each debug log
  1668. line by giving the command:
  1669. SET DEBUG TIMESTAMP ON
  1670. At any time before or after activating the debug log (SET DEBUG
  1671. TIMESTAMP OFF turns off timestamping). Timestamps can be turned off and
  1672. on as desired while logging. Obviously, they increase the size and
  1673. growth rate of the log significantly, and so should be used sparingly.
  1674. Timestamps are of the form hh:mm:ss.xxx, where .xxx is thousands of a
  1675. second (but is included only on platforms that include this feature).
  1676. 1.13. Logs
  1677. In UNIX C-Kermit and in K-95, you can now direct any log to a pipe.
  1678. This not only lets you send your logs to places other than disk files,
  1679. but also lets you customize them to any desired degree.
  1680. LOG { DEBUG, PACKETS, SESSION, TRANSACTION, CONNECTION } { file, pipe }
  1681. ...
  1682. A "pipe" is the name of a command, preceded by a vertical bar.
  1683. If the pipe contains any spaces, it must be enclosed in braces.
  1684. Here are some examples for UNIX (always remember the importance of
  1685. getting the UNIX shell quoting rules right):
  1686. LOG TRANSACTIONS |lpr
  1687. This sends the transaction log to the default UNIX printer,
  1688. rather than to a file (use "lp" rather than "lpr" if necessary).
  1689. LOG TRANSACTIONS {| myfilter > t.log}
  1690. For those who don't like the format of the transaction log, or
  1691. want to extract certain information from it; write your own
  1692. output filter.
  1693. LOG SESSION {| lpr -Plaserwriter}
  1694. This sends the session log to a specific UNIX printer, rather
  1695. than to a file. Note the braces around the pipeline. These are
  1696. required because it contains spaces.
  1697. LOG DEBUG {| tail -100 > debug.log}
  1698. This causes the debug log file to contain only the final 100
  1699. lines. Suppose C-Kermit crashes under some unpredictable
  1700. circumstances, and you need a debug log to catch it in the act.
  1701. But the debug log can grow to huge proportions very quickly,
  1702. possibly filling up the disk. Piping the debug log through
  1703. "tail" results in keeping only the last 100 lines (or other
  1704. number of your choice).
  1705. LOG DEBUG {| grep "^TELNET" > debug.log}
  1706. This one shows how to log only Telnet negotiations. Piping the
  1707. debug log through grep or egrep lets you log only specific
  1708. information, rather than everything. "man grep" for further
  1709. info.
  1710. LOG DEBUG {| gzip -c > debug.log.gz}
  1711. Creates a full debug log, but compressed by gzip to save space.
  1712. LOG PACKETS {| tr "\\01" "X" | cut -c9- > packet.log}
  1713. This one writes the regular packet log, but translates the
  1714. Ctrl-A that starts each packet to the letter "X" and removes the
  1715. s-nn-nn- notation from the beginning of each line. Note the
  1716. double backslash (normal Kermit quoting rules). "man tr" and
  1717. "man cut" for further info.
  1718. See Section 2.12 for information about the new connection log.
  1719. 1.14. Automatic File-Transfer Packet Recognition at the Command Prompt
  1720. Beginning in version 7.0, C-Kermit can recognize Kermit (and in some
  1721. cases also Zmodem) file-transfer packets while at its command prompt.
  1722. This is convenient (for example), if you escaped back from a remote
  1723. Kermit program and told the local Kermit program to send a file, but
  1724. forgot to tell the remote Kermit program to receive it (and the local
  1725. Kermit did not have the "send a Kermit receive command" feature
  1726. available). This feature is controlled by the following command:
  1727. SET COMMAND AUTODOWNLOAD { ON, OFF }
  1728. When ON, which is the default, the command parser recognizes
  1729. Kermit packets when Kermit is in remote mode. An S packet makes
  1730. it go into receive mode, an I packet makes it go into server
  1731. mode. When OFF, packet recognition is disabled and the behavior
  1732. when a packet is received at the command prompt is as it was in
  1733. C-Kermit 6.1 and earlier (namely to print an error message).
  1734. COMMAND AUTODOWNLOAD is the command-mode equivalent of TERMINAL
  1735. AUTODOWNLOAD, which is effective during CONNECT mode.
  1736. 1.15. The TYPE Command
  1737. The TYPE command now accepts a selection of optional switches
  1738. ( Section 1.5), and also sets several variables.
  1739. Syntax: TYPE [ switches... ] filename
  1740. Variables:
  1741. \v(ty_ln)
  1742. Line number of current line (during TYPE command; see /PREFIX)
  1743. \v(ty_lc)
  1744. Line count of file most recently TYPEd.
  1745. \v(ty_mc)
  1746. Match count of file most recently TYPEd (see /MATCH).
  1747. Switches:
  1748. /PAGE
  1749. If /PAGE is included, Kermit pauses at the end of each screenful
  1750. and issues a "more?" prompt. You may press the space bar to view
  1751. the next page (screenful), or press "q" or "n" to return to the
  1752. C-Kermit prompt. If this switch is given, it overrides the
  1753. COMMAND MORE-PROMPTING setting for this command only. If it is
  1754. not given, paging is according to COMMAND MORE-PROMPTING.
  1755. /NOPAGE
  1756. Do not pause at the end of each screenful; show the whole file
  1757. (or all selected lines) at once. If this switch is given, it
  1758. overrides the COMMAND MORE-PROMPTING setting for this command
  1759. only. If it is not given, paging is according to COMMAND
  1760. MORE-PROMPTING.
  1761. /HEAD[:n]
  1762. Only show the first n lines of the file (where n is a number).
  1763. If n is omitted, 10 is used.
  1764. /TAIL[:n]
  1765. Only show the last n lines of the file (where n is a number). If
  1766. nis omitted, 10 is used. Note: /HEAD and /TAIL can't be
  1767. combined; if you give both switches, only the most recent one is
  1768. used.
  1769. /MATCH:pattern
  1770. Only type lines from the file that match the given pattern (see
  1771. Section 4.9.1 for pattern notation). UNIX users familiar
  1772. with grep should note a significant difference: there is no
  1773. implied "*" at the beginning and end of the pattern. Thus:
  1774. TYPE /MATCH:foo Lists lines whose entire contents are "foo".
  1775. TYPE /MATCH:foo* Lists lines that start with "foo".
  1776. TYPE /MATCH:*foo Lists lines that end with "foo".
  1777. TYPE /MATCH:*foo* Lists lines that have "foo" anywhere in them.
  1778. /HEAD and /TAIL apply after /MATCH, so "type /tail:20 /match:x*"
  1779. shows the last 20 lines in the file that start with "x".
  1780. /PREFIX:string
  1781. Print the given string at the beginning of each line. The string
  1782. may be a constant, a variable, or a quoted variable. If it's an
  1783. unquoted variable, its value at the time the TYPE command was
  1784. given is used as a constant. If it is a quoted variable, it is
  1785. re-evaluated for each line; a useful variable for this context
  1786. is \v(ty_ln) (the line number of the current line being typed).
  1787. If the prefix is to include spaces, it must be enclosed in
  1788. braces. Examples:
  1789. type /prefix:{oofa.txt: } /match:*thing* oofa.txt
  1790. Prints all lines in oofa.txt that contain "thing" with the
  1791. filename itself as the prefix (similar to UNIX grep).
  1792. type /prefix:{\v(time). } oofa.txt
  1793. Prefixes each line of oofa.txt with the time at which the
  1794. TYPE command was given (one backslash)
  1795. type /prefix:{\\v(time). } oofa.txt
  1796. Prefixes each line of oofa.txt with the time at which that
  1797. line is being typed (two backslashes).
  1798. type /prefix:{\\v(ty_ln). } oofa.txt
  1799. Prefixes each line of oofa.txt with its line number.
  1800. type /prefix:{\\flpad(\\v(ty_ln),4). } oofa.txt
  1801. Same as the previous example, except the line number is
  1802. right-adjusted in a 4-column field.
  1803. /WIDTH[:n]
  1804. Truncates each line at column n (which must be a number) prior
  1805. to printing it. This option can be used for long lines when you
  1806. don't want them to wrap. If nis omitted, your current screen
  1807. width is used.
  1808. /COUNT
  1809. Counts lines and -- if /MATCH was included, matches -- but does
  1810. not print any lines from the file. The line and match count is
  1811. shown at the end, and the variables \v(ty_lc) and \v(ty_lm) are
  1812. set accordingly.
  1813. SET OPTIONS TYPE { /PAGE, /NOPAGE, /WIDTH:n }
  1814. Sets the paging default for TYPE commands, which can be
  1815. overridden in any particular TYPE command by including the
  1816. desired switch.
  1817. If a TYPE command is given with no switch, and no SET OPTIONS TYPE
  1818. selection is in effect, paging is according to your COMMAND
  1819. MORE-PROMPTING setting (SHOW COMMAND).
  1820. 1.16. The RESET Command
  1821. The RESET command, added in 7.0, closes all open files and logs, but
  1822. does not affect the open connection (if any).
  1823. 1.17. The COPY and RENAME Commands
  1824. As of C-Kermit 7.0, in the UNIX version only, the COPY and RENAME
  1825. commands are built in and do not call the underlying platform's COPY or
  1826. RENAME command. This allows them to work in "NOPUSH" versions and other
  1827. circumstances where it can't access system commands, and it allows file
  1828. copying and renaming to be done portably in scripts. The
  1829. characteristics of the built-in COPY or RENAME include:
  1830. * It fails if the source file is a directory or is wild or lacks read
  1831. access.
  1832. * It fails if the source file is the destination file.
  1833. * It allows the destination file to be a directory, in which case the
  1834. source file is copied (or renamed) into it with the same name.
  1835. * It overwrites an existing destination file if its permission
  1836. allows.
  1837. * It sets the new file's permission according to umask but also
  1838. carries forward the source file's execute permission bits if the
  1839. destination file did not already exist.
  1840. * It fails if interrupted by Ctrl-C.
  1841. * Upon error, it prints an appropriate message.
  1842. * It returns standardized error codes that can be tested by IF
  1843. SUCCESS / FAIL.
  1844. These commands now also accept the following switches:
  1845. /LIST (/LOG, /VERBOSE) = Print "file1 => file2 (OK)" (or error message).
  1846. /NOLIST (/NOLOG, /QUIET) = Don't print anything (except error messages).
  1847. /NOLIST is the default.
  1848. The same built-in code is used by the UNIX C-Kermit server to execute
  1849. REMOTE COPY commands (except in this case no switches are available).
  1850. The COPY command also accepts the following additional switches. When
  1851. any of these are given (and they can be used in any combination except
  1852. /SWAP and /APPEND), some of the checks listed above are relaxed, and
  1853. thus it might be possible to get into trouble in certain cases, e.g.
  1854. when the source and target files are the same file:
  1855. /APPEND = Append source file to destination file.
  1856. /SWAP-BYTES = Swap bytes (see Section 6.6.5).
  1857. /FROMB64 = Decode the source file from Base64 encoding.
  1858. /TOB64 = Encode the target file in Base64.
  1859. Base64 is the encoding commonly used for enclosures in Internet email.
  1860. 1.18. The MANUAL Command
  1861. The MANUAL command can be used to access the appropriate Kermit manual
  1862. or other manual. The general syntax is:
  1863. MANUAL [ string ]
  1864. If the string is omitted, C-Kermit asks the underlying system to
  1865. access the C-Kermit manual using whatever method is appropriate
  1866. for the system.
  1867. The specific action depends on the system. In UNIX, a "man" command is
  1868. issued; "kermit" is the default argument but other manual topics may be
  1869. specified. If the "man" command allows index or string searching, the
  1870. appropriate syntax may be included.
  1871. In Kermit 95, the MANUAL command brings up the HTML online K95 manual.
  1872. In VMS and elsewhere, "man" is simply translated to "help", with a
  1873. default argument of "kermit"; other and/or additional arguments may be
  1874. included according to the definition of the system's "help" command.
  1875. Correct operation of the "man" command in C-Kermit depends on the
  1876. appropriate man page or help topic having been installed in the right
  1877. place with the right permissions and format.
  1878. 1.19. String and Filename Matching Patterns
  1879. A pattern is a string that includes special notation for matching
  1880. classes or sequences of characters. C-Kermit 7.0 / K95 1.1.19 supports
  1881. patterns in several places:
  1882. * Filenames ( Section 4.9)
  1883. * SWITCH case labels ( Section 7.18)
  1884. * The new IF MATCH statement ( Section 7.4)
  1885. * TYPE /MATCH ( Section 1.15)
  1886. * SET FILE TEXT-PATTERNS and BINARY-PATTERNS ( Section 4.3)
  1887. * The \fsearch() and \farraylook() functions (Sections 7.3 and
  1888. 7.10.7)
  1889. * The \fpattern() function used with [M,RE]INPUT ( Section 7.1)
  1890. Patterns are also called wildcards, especially when used for filename
  1891. matching. C-Kermit's pattern syntax is explained in Section 4.9.1,
  1892. and also by the HELP WILDCARDS command.
  1893. 1.20. Multiple Commands on One Line
  1894. As of C-Kermit 7.0, commands can be grouped together on one line by
  1895. separating the commands with commas and enclosing the list in braces.
  1896. For example:
  1897. C-Kermit> { echo One, echo Two, echo Three }
  1898. C-Kermit> do { echo One, echo Two, echo Three }
  1899. Command lists can be nested:
  1900. [ do ] { echo One, echo Two, if true { echo A, echo B}, echo Three }
  1901. and the END command works as it does in macros:
  1902. [ do ] { echo One, echo Two, if true end, echo Three }
  1903. The "one line" stricture is, of course, pliant to line-continuation
  1904. conventions, namely that lines ending in hyphen (-) or left brace ({)
  1905. are to be continued. Thus the first example can also be rendered:
  1906. [ do ] {
  1907. echo One
  1908. echo Two
  1909. echo Three
  1910. }
  1911. (the "do" is optional).
  1912. 1.21. What Do I Have?
  1913. C-Kermit can be built for hundreds of different platforms with
  1914. practically countless configuration options. Certain commands might not
  1915. be available in certain configurations, etc. Even on the same platform,
  1916. different builds are possible: "maximum functionality", "minimum size",
  1917. "maximum performance", and so on. You can find out a lot about the
  1918. configuration of your C-Kermit program with the SHOW FEATURES command.
  1919. Of course, a lot of what it says, especially in the bottom part, might
  1920. seem like gibberish, but can be deciphered with a Rosetta Stone (such
  1921. as the C-Kermit source or theckccfg.txt file). In any case, the
  1922. output from SHOW FEATURES might easily explain why some expected
  1923. feature is missing, or some buffer is smaller than expected. Here's a
  1924. sample of the bottom section for the SunOS version:
  1925. C-Kermit 7.0.196, 1 Jan 2000
  1926. Major optional features included:
  1927. Network support (type SHOW NET for further info)
  1928. Telnet Kermit Option
  1929. Hardware flow control
  1930. External XYZMODEM protocol support
  1931. Latin-1 (West European) character-set translation
  1932. Latin-2 (East European) character-set translation
  1933. Cyrillic (Russian, Ukrainian, etc) character-set translation
  1934. Greek character-set translation
  1935. Hebrew character-set translation
  1936. Japanese character-set translation
  1937. Unicode character-set translation
  1938. Pseudoterminal control
  1939. REDIRECT command
  1940. RESEND command
  1941. Fullscreen file transfer display
  1942. Control-character unprefixing
  1943. Streaming
  1944. Autodownload
  1945. Major optional features not included:
  1946. No Kerberos(TM) authentication
  1947. No SRP(TM) (Secure Remote Password) protocol
  1948. No Secure Sockets Layer (SSL) protocol
  1949. No Transport Layer Security (TLS) protocol
  1950. No encryption
  1951. No X Windows forwarding
  1952. Host info:
  1953. Machine: sun4m
  1954. Model: (unknown)
  1955. OS: SunOS
  1956. OS Release: 4.1.3_U1
  1957. OS Version: 4
  1958. Target: sunos41gsc
  1959. GCC version: 2.7.2
  1960. Compiled Dec 31 1999 10:38:54, options:
  1961. __GNUC__ __STDC__ _POSIX_JOB_CONTROL _SC_JOB_CONTROL ARRAYREFLEN=1024 BIGBUFOK
  1962. BROWSER BSD4 CK_ANSIC CK_APC CK_AUTODL CK_CURSES CK_DNS_SRV CK_ENVIRONMENT
  1963. CK_FAST CK_LOGIN CK_MKDIR CK_NAWS CK_PCT_BAR CK_PERMS CK_RECALL CK_RTSCTS
  1964. CK_SPEED CK_TIMERS CK_TMPDIR CK_TTGWSIZ CK_TTYFD CK_WREFRESH CKEXEC
  1965. CKFLOAT=double CKGHNLHOST ckmaxfiles=64 CKMAXOPEN=64 CKMAXPATH=1023 CKREALPATH
  1966. CKREGEX CKSYSLOG CKTUNING CMDBL=32763 CMDDEP=64 CONGSPD DCMDBUF DIRENT DYNAMIC
  1967. FNFLOAT FORDEPTH=32 GFTIMER HADDRLIST HDBUUCP IFDEBUG IKS_OPTION IKSDB
  1968. IKSDCONF INBUFSIZE=32768 INPBUFSIZ=4096 MAC_MAX=16384 MACLEVEL=128 MAXDDIR=32
  1969. MAXDNUMS=4095 MAXGETPATH=128 MAXTAKE=54 MAXWLD=102400 MSENDMAX=1024 NETCMD
  1970. NETCONN NETPTY NOKVERBS NOSETBUF OBUFSIZE=32768 PARSENSE PATTERNS PIPESEND
  1971. RENAME RLOGCODE SAVEDUID SELECT SIG_V SOL_SOCKET sparc STREAMING sun SUNOS4
  1972. SYSTIMEH TCPSOCKET TIMEH TLOG TNCODE TTLEBUF TTSPDLIST UIDBUFLEN=256 UNIX
  1973. UNPREFIXZERO USE_LSTAT USE_MEMCPY VNAML=4096 WHATAMI XFRCAN Z_MAXCHAN=46
  1974. z_maxchan=46 ZXREWIND
  1975. byte order: big endian
  1976. sizeofs: int=4 long=4 short=2 char=1 char*=4 float=4 double=8
  1977. floating-point: precision=16 rounding=1
  1978. Without going into detail about what all the notation means, notice a
  1979. couple things:
  1980. * The Options section shows symbols ("macros") in effect during
  1981. compilation, together with their values (for those that have
  1982. values). The options are listed in alphabetical order to make any
  1983. particular option easier to find.
  1984. * MAXWLD is the maximum number of files that a wildcard can expand
  1985. to.
  1986. * Anything starting with "NO" is a feature (or something other than a
  1987. feature) that has been deliberately "compiled out", or omitted.
  1988. * Important items for script writers include: CMDBL=32763 (the size
  1989. of the command buffer and therefore the maximum length for a macro
  1990. or variable definition; CMDDEP=64 (the limit on recursion depth);
  1991. FORDEPTH=32 (the nesting limit on FOR loops); INBUFSIZE=32768 (the
  1992. size of the INPUT command circular buffer); MAC_MAX=16384 (the
  1993. maximum number of macros), etc.
  1994. See theckccfg.txt file for details.
  1995. 1.22. Generalized File Input and Output
  1996. C-Kermit 7.0 adds a new generalized I/O system for stream files,
  1997. augmenting (and to some extent, overlapping with) the older OPEN, READ,
  1998. WRITE, and CLOSE commands. In the new file i/o system, which can be
  1999. used simultaneously with the old one, all commands are grouped together
  2000. under the new FILE keyword, and some related functions and variables
  2001. are added.
  2002. 1.22.1. Why Another I/O System?
  2003. The well-known LOG, OPEN, READ, WRITE, and CLOSE commands have the
  2004. following restrictions:
  2005. 1. Only one READ file and one WRITE file can be open at a time.
  2006. 2. The READ and WRITE commands are strictly line oriented.
  2007. 3. These commands can not be used with binary files.
  2008. 4. They do not support read/write access or random access.
  2009. 5. The syntax is a bit counterintuitive for programmers.
  2010. The new file i/o system allows multiple files to be open at once, in
  2011. any desired combination of modes (read/write/append) supported by the
  2012. operating system, for line, block (record), or character i/o, for
  2013. sequential or random access, using consistent syntax and conventions.
  2014. The new system, however, does not replace the old one, since the old
  2015. system still must be used for:
  2016. 1. The session, packet, debug, transaction, and connection logs.
  2017. 2. Reading and writing commands rather than files.
  2018. 3. Existing scripts.
  2019. The new system works only with regular files, not with commands or
  2020. pipes or mailboxes or pseudoterminals. No special provisions are made
  2021. in the FILE commands for handling devices or network connections, nor
  2022. for preventing you from trying to open them; if the underlying
  2023. operating system treats them like regular stream disk files, the FILE
  2024. commands (except, of course SEEK, REWIND, and COUNT) might work with
  2025. them. (In C programming terms, the FILE commands are, at present,
  2026. nothing more than a front end to fopen() / fread() / fwrite() /
  2027. fclose() and friends, which are a portable API to sequential files, but
  2028. this might change in the future for platforms like VMS and VOS that
  2029. have more complicated file systems.)
  2030. Definitions:
  2031. Channel
  2032. A number assigned to a file when it is opened, by which it must
  2033. be referred to in all input/output operations.
  2034. Read/Write Pointer
  2035. The current position in an open file, expressed as the 0-based
  2036. byte count from the beginning.
  2037. 1.22.2. The FILE Command
  2038. FILE keyword [ switches ] channel [ data ]
  2039. The keyword specifies the function: FILE OPEN, FILE READ, FILE
  2040. WRITE, FILE CLOSE, etc. For convenience (and for familiarity to
  2041. C programmers), the two-word FILE commands can be shortened to
  2042. the single words FOPEN, FREAD, FWRITE, FCLOSE, and so on.
  2043. Switches are optional, and modify or amplify the requested file
  2044. function.
  2045. As in C, Fortran, and other programming languages, open files are
  2046. referred to by "channels", integers such as 0, 1, 2, 3, and so on. A
  2047. channel number is assigned when you open a file. The number of
  2048. available channels depends on the underlying operating system, and can
  2049. be seen in the variable:
  2050. \v(f_max)
  2051. or by giving the FILE LIST (FLIST) command. Channels are discussed in
  2052. greater detail in Section 1.22.4.
  2053. FILE command errors can be caught with IF FAIL after the FILE command.
  2054. In addition, the \v(f_error) variable is set to the completion code of
  2055. the command: 0 if no error, or a negative number if there was an error.
  2056. The error codes are listed in Section 1.22.5.
  2057. The command to open a file is:
  2058. FILE OPEN [ switches ] variable filename
  2059. Opens a file for the type of access specified by the switches,
  2060. or for read-only access if no switches are given. Upon success,
  2061. a channel number is assigned to this file and stored in the
  2062. given variable so you can refer to the open file in subsequent
  2063. i/o commands. If the file can not be opened, the FILE OPEN
  2064. command fails. Synonym: FOPEN.
  2065. The FILE OPEN switches are:
  2066. /READ
  2067. Open the file for read access. If no switches are given, /READ
  2068. is assumed. If the file does not exist or can't be opened for
  2069. read access, the FILE OPEN command fails.
  2070. /WRITE
  2071. Allow writing. If a file of the same name already exists, it is
  2072. overwritten unless /READ or /APPEND is also included. If a file
  2073. of the given name does not exist, it is created.
  2074. /APPEND
  2075. Equivalent to /WRITE, except that if the file exists, it is not
  2076. destroyed. The read/write pointer is set to the end of the file,
  2077. so unless you change it with FILE SEEK or REWIND (see below),
  2078. the first FILE WRITE command adds to the end of the file,
  2079. preserving what was there already. If /WRITE is also given, it
  2080. is ignored.
  2081. /BINARY
  2082. Open the file in "binary" mode, rather than text mode. This
  2083. switch is meaningless (but still can be used) in UNIX. In VMS,
  2084. Windows, and OS/2, it inhibits end-of-line processing and
  2085. conversion, and so should be used for binary files and/or files
  2086. that are to be accessed in record or character mode rather than
  2087. line by line.
  2088. The variable for the channel number can be any kind of variable: the
  2089. \%x kind, a macro name, or an array element. But it must be a variable,
  2090. not a number -- C-Kermit assigns the channel number; you can't tell it
  2091. what number to use.
  2092. Example:
  2093. FILE OPEN \%c oofa.txt ; Open oofa.txt for reading.
  2094. IF FAIL exit 1 Can't open oofa.txt ; Always check to see if it worked.
  2095. ECHO oofa.txt: channel = \%c
  2096. If the file oofa.txt is opened successfully, a channel number is
  2097. assigned to the variable \%c. Here's another example using a macro name
  2098. for the channel number:
  2099. FILE OPEN channel oofa.txt ; Open oofa.txt for reading.
  2100. IF SUCCESS ECHO oofa.txt: channel = \m(channel)
  2101. Switches can be combined when it makes sense and the underlying
  2102. operating system allows it. For example, to open a file in binary mode
  2103. for reading and writing (sometimes called "update"):
  2104. FILE OPEN /READ /WRITE /BINARY \%c budget.db
  2105. Some combinations might be allowed, others not. For example /READ
  2106. /APPEND will usually not be allowed. /WRITE /APPEND is treated as
  2107. /APPEND.
  2108. A major advantage of the new system over the older one is that you can
  2109. have multiple files open at once. Suppose, for example, that you want
  2110. to open all the files in a certain directory at once:
  2111. .\%n := \ffiles(/usr/olga*,&f) ; Get file list into array.
  2112. if ( > \%n \v(f_max) ) { ; Make sure there aren't too many.
  2113. exit 1 {\v(dir): \%n = Too many files}
  2114. }
  2115. declare \&c[\%n] ; Make array for channel numbers.
  2116. for \%i 1 \%n 1 { ; Loop to open every file...
  2117. file open \&c[\%i] \&f[\%i] ; Try to open this one
  2118. if fail exit 1 Open error: \&f[\%i] ; Check for failure
  2119. }
  2120. If this loop completes successfully, the \&c[] array will contain \%n
  2121. channel numbers of open files in elements 1 through \%n.
  2122. Any file that you open with FILE OPEN stays open until Kermit exits, or
  2123. you close it explicitly. The command to close a file is:
  2124. FILE CLOSE { ALL, channel }
  2125. If a channel number is given and the channel refers to an open
  2126. file, the file is closed and the channel is freed for reuse; if
  2127. the channel does not refer to an open file, an error message is
  2128. printed and the command fails. If ALL is specified instead of a
  2129. specific channel, all files opened with FILE OPEN are closed and
  2130. if all open files were closed successfully (even if no files
  2131. were open), the command succeeds; if any open file could not be
  2132. closed, the command fails; however, all open files that could be
  2133. closed are still closed. Synonym: FCLOSE.
  2134. FILE CLOSE might fail because, for example, the disk filled up or a
  2135. quota was exceeded. Example:
  2136. fopen /write \%c new.txt ; Open new.txt for writing.
  2137. if fail exit 1 ; Check for error.
  2138. fclose \%c ; Close the file we just opened.
  2139. This creates a 0-length file called new.txt.
  2140. Note that FILE OPEN /WRITE (without /READ or /APPEND) always creates a
  2141. new file, and therefore destroys any file with the same name that might
  2142. already exist (assuming you have permission to delete it). To avoid
  2143. overwriting existing files, simply check first:
  2144. if exist new.txt exit 1 {Fatal - new.txt already exists}
  2145. fopen /write \%c new.txt
  2146. if fail ...
  2147. The next two commands give information about open files:
  2148. FILE STATUS channel
  2149. Tells the name of the file, if any, open on the given channel
  2150. and the switches it was opened with. The read/write pointer is
  2151. also shown; this is where the next read or write will occur;
  2152. "[EOF]" is shown if the current position in the open file is the
  2153. end -- i.e. the next read will fail if the file was opened in
  2154. /READ mode; the next write will add material to the end. The
  2155. current line number (0-based) is also shown if known. The FILE
  2156. STATUS command succeeds if the channel is open, and fails if
  2157. there is no open file on the given channel, or if the channel
  2158. number is invalid or out of range. Synonym: FSTATUS.
  2159. FILE LIST
  2160. Lists the channel number and name of each open file, along with
  2161. its OPEN modes (R, W, A, B, RW, etc) and its current read/write
  2162. pointer or "[EOF]" if it is at the end. Also tells the number of
  2163. files currently opened with FILE OPEN, plus the maximum number
  2164. of open files allowed by the system and the maximum number
  2165. allowed for FILE OPEN. Synonym: FLIST.
  2166. Next come the commands for reading and writing files:
  2167. FILE READ [ switches ] channel [ variable ]
  2168. Reads data from the file on the given channel number into the
  2169. variable, if one was given; if no variable was given, the result
  2170. is printed on the screen. IMPORTANT: The variable should
  2171. normally be a macro name rather than a \%x or \&x[] variable if
  2172. you want backslash characters in the file to be taken literally
  2173. (see pp.408-412 ofUsing C-Kermit for an explanation; you
  2174. can also read into a \%x or \&x[] variable, but then you must
  2175. remember to protect future references to by \fcontents() if you
  2176. don't want C-Kermit to process any backslashes it might
  2177. contain). The desired amount of data (according to the switches)
  2178. is read from the file at the current read/write pointer, and
  2179. upon completion the read/write position is updated to first byte
  2180. after the data that was read, no matter what switches were
  2181. given. Synonym: FREAD.
  2182. FILE WRITE [ switches ] channel text
  2183. Writes the given text to the file on the given channel number.
  2184. The text, of course, can be literal text or a variable, or any
  2185. combination. If the text might contain leading or trailing
  2186. spaces, it must be enclosed in braces if you want to preserve
  2187. them. Synonym: FWRITE.
  2188. Before proceeding, a caution about the NUL character. C-Kermit is so
  2189. named because it is a Kermit program written in the C language. In C,
  2190. character strings are represented as a sequence of non-NUL bytes
  2191. terminated by a NUL byte (a byte in which all bits are 0). Thus a C
  2192. string can not contain NUL bytes; it always ends with the first NUL
  2193. byte. C-Kermit variables are implemented as C strings and therefore
  2194. can't contain NUL bytes either, so the FILE READ and FILE WRITE
  2195. commands do not handle files or strings that contain NUL bytes, except
  2196. when the /CHARACTER switch is included with the FILE READ or WRITE
  2197. command, or when /LPAD:0 or /RPAD:0 is given with the FILE WRITE
  2198. command; these switches are explained below.
  2199. Also note that Kermit can not be used read or write binary numbers in
  2200. the machine's internal format (integer or floating-point); in general,
  2201. numbers can be processed only when represented as numeric or
  2202. floating-point strings.
  2203. FILE READ switches are:
  2204. /LINE
  2205. Specifies that a line of text is to be read. A line is defined
  2206. according to the underlying operating system's text-file format.
  2207. For example, in UNIX a line is a sequence of characters up to
  2208. and including a linefeed, or the end of the file, which ever
  2209. comes first. The line terminator (if any) is removed before
  2210. assigning the text to the variable. If no switches are included
  2211. with the FILE READ command, /LINE is assumed. Normally this
  2212. switch should not be used with files opened in /BINARY mode (but
  2213. nothing prevents it either).
  2214. /SIZE:number
  2215. Specifies that the given number of bytes (characters) is to be
  2216. read. The actual number of bytes returned will be less if the
  2217. end of file is reached (or a NUL byte is encountered). For
  2218. example, if a file is 514 bytes long, FILE READ /SIZE:512
  2219. returns 512 bytes the first time and 2 bytes the second time.
  2220. FILE READ /SIZE provides a kind of "record i/o" for files that
  2221. do not necessarily contain lines. The resulting block of
  2222. characters is assigned to the variable without any editing.
  2223. Synonym: /BLOCK.
  2224. /CHARACTER
  2225. Equivalent to /SIZE:1. If FILE READ /CHAR succeeds but the
  2226. variable is empty, this indicates a NUL byte was read. Synonym:
  2227. BYTE.
  2228. FILE WRITE switches are:
  2229. /LINE
  2230. Specifies that an appropriate line terminator is to be added to
  2231. the end of the text. If no switches are included, /LINE is
  2232. assumed.
  2233. /SIZE:number
  2234. Specifies that the given number of bytes (characters) is to be
  2235. written. If the given text is longer than the requested size, it
  2236. is truncated; if is shorter, it is padded according /LPAD and
  2237. /RPAD switches. Synonym: /BLOCK.
  2238. /LPAD[:value]
  2239. If /SIZE was given, but the text is shorter than the requested
  2240. size, the text is padded on the left with sufficient copies of
  2241. the character whose ASCII value is given to write the given
  2242. length. If no value is specified, 32 (the code for Space) is
  2243. used. The value can also be 0 to write the indicated number of
  2244. NUL bytes. If /SIZE was not given, this switch is ignored.
  2245. /RPAD[:value]
  2246. Like LPAD, but pads on the right.
  2247. /CHARACTER
  2248. Specifies that one character should be written. If the text is
  2249. empty or not given, a NUL character is written; otherwise the
  2250. first character of text is given. Synonym: /BYTE.
  2251. /STRING
  2252. Specifies that the text is to be written as-is, with no
  2253. terminator added.
  2254. Here's an example in which we copy a text file line by line:
  2255. file open /read \%c oofa.txt ; Open input file
  2256. if fail exit 1 Can't open input file ; Check that it's open
  2257. file open /write \%d new.txt ; Open output file
  2258. if fail exit 1 Can't open output file ; Check
  2259. while true { ; Loop to copy lines
  2260. file read /line \%c line ; Read a line
  2261. if fail break ; Assume failure = end of file
  2262. file write /line \%d {\m(line)} ; Write the line to output file
  2263. if fail exit 1 Write failure ; Failure here is fatal
  2264. }
  2265. file close \%c ; Close the two files
  2266. file close \%d
  2267. Note that since /LINE is the default for both FILE READ and FILE WRITE,
  2268. it can be omitted as in the following example, where we also use the
  2269. short names for the FILE commands.
  2270. fopen /read \%c oofa.txt ; Open input file
  2271. if fail exit 1 Can't open input file ; Check that it's open
  2272. fopen /write \%d new.txt ; Open output file
  2273. if fail exit 1 Can't open output file ; Check
  2274. while true { ; Loop to copy lines
  2275. fread \%c line ; Read a line
  2276. if fail break ; Assume failure = end of file
  2277. fwrite \%d {\m(line)} ; Write the line to output file
  2278. if fail exit 1 Write failure ; Failure here is fatal
  2279. }
  2280. fclose \%c ; Close the two files
  2281. fclose \%d
  2282. Here's the same example using "record i/o" (the open and close
  2283. sequences are are omitted since they are the same as above). The result
  2284. is the same, but execution is much faster:
  2285. while true { ; Loop to copy blocks
  2286. fread /size:512 \%c block ; Read a block into \%a
  2287. if fail break ; Assume failure = end of file
  2288. fwrite /string \%d {\m(block)} ; Write the block to output file
  2289. if fail exit 1 Write failure ; Failure here is fatal
  2290. }
  2291. Although record i/o is faster, it should not be used in line-oriented
  2292. applications, since it returns arbitrary chunks of the file to your
  2293. script, rather than lines. In this example, FWRITE /STRING is used
  2294. rather than FWRITE /SIZE:512 to avoid the last output block being
  2295. padded beyond the original file's length.
  2296. A file can also be copied character by character, but this is much
  2297. slower than line i/o and VERY much slower than block i/o:
  2298. while true { ; Loop to copy blocks
  2299. fread /char \%c c ; Read a character into c
  2300. if fail break ; Assume failure = end of file
  2301. fwrite /char \%d {\m(c)} ; Write character to output file
  2302. if fail exit 1 Write failure ; Failure is fatal
  2303. }
  2304. Although character i/o is slow, it is the only way to process files
  2305. that contain NUL characters (i.e. bytes composed of only zero bits). In
  2306. the example above, when "fread /char \%c c" returns a NUL, the c
  2307. variable is empty. But since the FREAD /CHAR command did not fail, we
  2308. know the result was really a NUL. FWRITE /CHAR, when given an empty
  2309. variable (or no variable at all) writes a NUL. Thus the loop above will
  2310. copy any file at all (very slowly). In non-copying applications, NULs
  2311. are detected like this:
  2312. fread /char \%c c
  2313. if fail (do something)
  2314. if not def c (a NUL byte was read)
  2315. Finally some advanced file operations:
  2316. FILE FLUSH channel
  2317. For output files only: commits all previous writes to disk, in
  2318. case the computer was buffering them. Synonym: FFLUSH.
  2319. FILE COUNT [ { /BYTES, /LINES, /LIST, /NOLIST } ] channel
  2320. By default, or if the /BYTES switch is given, counts the bytes
  2321. in the file, if any, open on the given channel. If the /LINES
  2322. switch is given, counts lines in the file. If the /LIST switch
  2323. is given, the result is printed. If the /NOLIST switch is given,
  2324. the result is not printed. /QUIET is a synonym for /NOLIST. If
  2325. neither /LIST nor /NOLIST is given, the result is printed if the
  2326. command is given at top level, i.e. not from a command file or
  2327. macro. In all cases, the result of the most recent FILE COUNT
  2328. command is stored in the variable \v(f_count). Note that FILE
  2329. COUNT /LINE works (and can only work) by reading the entire
  2330. file; expect it to take some time if the file is large. Synonym:
  2331. FCOUNT.
  2332. FILE REWIND channel
  2333. Moves the read/write pointer to the beginning of the file.
  2334. Equivalent to FILE SEEK channel 0. Synonym: FREWIND.
  2335. FILE SEEK [ switches ] channel { [{+,-}]number, LAST, EOF }
  2336. Moves the read/write pointer for the file on this channel to the
  2337. given position, which may be a byte (character) number or a line
  2338. number, expressed in either absolute or relative terms.
  2339. Switches:
  2340. /BYTE
  2341. The number given is a byte number. Synonym: /CHARACTER.
  2342. /LINE
  2343. The number given is a line number.
  2344. /ABSOLUTE
  2345. The number given is absolute.
  2346. /RELATIVE
  2347. The number given is relative to the current position.
  2348. By default, or if the /BYTE switch is given, the number is a
  2349. byte number (0 = first byte). If /LINE is given, the number is a
  2350. line number (0 = first line). EOF means to move to the end of
  2351. the file. LAST means to move to the last line or character of
  2352. the file, depending on whether it's a line or character seek.
  2353. If neither the /RELATIVE nor the /ABSOLUTE switch is given, then
  2354. if a signed number is given, the motion is relative to the
  2355. current position. An expression that evaluates to a negative
  2356. number is not considered signed for this purpose; that is, a
  2357. sign (+ or -) must be included as the first character of the
  2358. number in the command itself to force a relative seek (in the
  2359. absence of /RELATIVE or /ABSOLUTE).
  2360. If the number has no sign, or if the /ABSOLUTE switch is given,
  2361. the number represents an absolute position (relative to the
  2362. beginning of the file). Subsequent FILE READs or WRITEs will
  2363. take place at the new position.
  2364. If the read/write pointer is placed after the end of the file, a
  2365. subsequent FILE READ will fail, but a FILE WRITE will succeed
  2366. (possibly creating a file with "holes"). If a FILE SEEK /BYTE
  2367. command is given, the current line becomes unknown (unless the
  2368. position is 0) and subsequent FILE SEEK /RELATIVE /LINE commands
  2369. will fail until the next non-relative FILE SEEK /LINE command is
  2370. given. Synonym: FSEEK.
  2371. An absolute FILE SEEK to a negative position fails silently, as does a
  2372. relative seek to a position before the beginning of the file.
  2373. A caution about relative SEEKs: remember that the number is relative to
  2374. the current position. Whenever you read or write, this changes the
  2375. position. In each of the following examples, assume the file open on
  2376. channel \%c is positioned at line n (the FREAD target variable is
  2377. omitted for lack of space):
  2378. { FREAD \%c, FSEEK /LINE \%c -1, FREAD \%c } <-- Reads line n twice
  2379. { FREAD \%c, FSEEK /LINE \%c +0, FREAD \%c } <-- Reads lines n and n+1
  2380. { FREAD \%c, FSEEK /LINE \%c +1, FREAD \%c } <-- Reads lines n and n+2
  2381. { FREAD \%c, FSEEK /LINE \%c -2, FREAD \%c } <-- Reads lines n and n-1
  2382. { FREAD \%c, FSEEK /LINE \%c -3, FREAD \%c } <-- Reads lines n and n-2
  2383. Another caution: Using FSEEK and FREAD /SIZE to repeatedly read the
  2384. same disk block (e.g. when sampling a database record that is
  2385. frequently updated) might not give you updated disk blocks due to the
  2386. internal buffering and caching of the C library (this probably varies
  2387. from one platform/compiler combination to another). If necessary you
  2388. can force a fresh disk read with a close/open sequence:
  2389. FCLOS \%c
  2390. FOPEN \%c samefilename
  2391. FSEEK \%c samespot
  2392. FREAD /SIZE:howmanybytes \%c variable
  2393. 1.22.3. FILE Command Examples
  2394. To read the last 10 lines of a text file into an array:
  2395. fopen /read \%c oofa.txt ; Open the file
  2396. if fail exit 1 Can't open oofa.txt ; Always check for failure
  2397. dcl \&a[10] ; Declare a 10-element array
  2398. fcount /line \%c ; Count lines in the file
  2399. fseek /line \%c \v(f_count)-10 ; Seek to 10 lines from the end
  2400. if fail exit 1 Can't seek ; Check for failure
  2401. for \%i 1 10 1 { fread \%c \&a[\%i] } ; Read the last 10 lines
  2402. fclose \%c ; Close the file
  2403. Note that blank lines show up as empty (undefined) array elements, for
  2404. example if you give a "show array a" command at this point. This is
  2405. normal. You can still use these elements; e.g.:
  2406. for \%i 1 10 1 { echo \%i. \&a[\%i] } ; Display the 10 lines
  2407. Here is how to read the last line of a file (already open on channel
  2408. \%c):
  2409. fseek /line \%c last ; Seek directly to last line
  2410. Alternatively:
  2411. fseek /line \%c eof ; Seek to end of file
  2412. fseek /line \%c -1 ; Seek to beginning of last line
  2413. Alternatively:
  2414. fcount /line \%c ; Count the file's lines
  2415. fseek /line \%c \v(f_count)-1 ; Seek to last line
  2416. fread \%c ; Read it
  2417. To read every other line from the file (using relative SEEK), skipping
  2418. the first line:
  2419. fopen /read \%c oofa.txt ; Open the file
  2420. while ( success ) { ; Loop through lines
  2421. fseek /line \%c +1 ; Skip a line
  2422. if success fread \%c ; Read & display a line
  2423. }
  2424. fclose \%c ; Close the file
  2425. Here is how to read the lines of a file in reverse order:
  2426. fopen /read \%c oofa.txt ; Open
  2427. if fail exit 1 ; Check
  2428. fseek /line \%c last ; Seek to last line
  2429. while success { ; Loop
  2430. fread \%c ; Read line
  2431. fseek /line \%c -2 ; Seek backwards two lines
  2432. }
  2433. fclose \%c ; Close the file
  2434. The loop works because a relative SEEK outside the file fails.
  2435. It is also possible to use block i/o to manage random-access files with
  2436. fixed-length records (as long as they don't contain NUL characters).
  2437. Suppose, for example, you have a file of "card image" records with
  2438. fixed-field information about customers, such as:
  2439. Name: Columns 1-32 (column numbers are 1-based)
  2440. Address: Columns 33-72
  2441. Balance: Columns 73-80
  2442. The records are indexed by customer number, starting with 0. There are
  2443. no line terminators separating them. Therefore the record for customer
  2444. number n starts at position nx 80 (\%n*80).
  2445. Now suppose we received a payment from customer number 173 and want to
  2446. update the balance:
  2447. .\%n = 173 ; Customer (record) number
  2448. .\%a = 12.72 ; Amount
  2449. fopen /read /write \%c customer.db ; Open the file
  2450. if fail stop 1 OPEN FAILED: \f_errmsg() ; Check
  2451. fseek /byte \%c 80*\%n ; Seek to record
  2452. fread /size:80 \%c r ; Read the record
  2453. if fail stop 1 READ FAILED: \f_errmsg() ; Check (IMPORTANT)
  2454. .\%b := \fright(\m(r),8) ; Extract the balance
  2455. .\%b := \ffpadd(\%b,\%a,2) ; Add the new payment
  2456. if fail stop 1 ARITHMETIC ERROR: \%b/\%a ; Catch bad records
  2457. .r := {\fleft(\m(r),72)\flpad(\%b,8)} ; Update the record
  2458. fseek /byte \%c 80*\%n ; Reposition to same spot
  2459. fwrite /size:80 \%c {\m(r)} ; Replace the record
  2460. if fail stop 1 WRITE FAILED: \f_errmsg() ; Check
  2461. fclose \%c ; Close the file
  2462. REMEMBER: Using FILE SEEK to move beyond the end of file can result in
  2463. a file with holes when writing; when reading, an end-of-file error will
  2464. occur -- be sure to check for it.
  2465. 1.22.4. Channel Numbers
  2466. C-Kermit's channel numbers are integers from 0 to some
  2467. platform-dependent limit, such as 46 or 1985 (the value of \v(f_max)).
  2468. This is the limit placed by the operating system on the number of files
  2469. that may be opened by one process or user or job, minus the standard
  2470. input, output, and error files, and minus the number of files reserved
  2471. by C-Kermit for logs, OPEN READ and WRITE, and file transfer (and maybe
  2472. some command files -- the \v(f_max) number can't be exact).
  2473. Although you must include a variable in the FILE OPEN command, to which
  2474. the channel number is assigned, you don't have to use a variable in the
  2475. other FILE commands if you know what the number is -- you can just put
  2476. the number. This saves you a few keystrokes when typing commands at the
  2477. prompt:
  2478. fopen \%c oofa.txt
  2479. flist
  2480. 0. /usr/olga.oofa.txt (R) 0
  2481. This tells the channel number is 0 (the number on the left is the
  2482. channel file's channel number). Of course you can also find it by
  2483. echoing the variable:
  2484. echo \%c
  2485. 0
  2486. Or with "fstatus \%c". Now you can type commands like:
  2487. fread 0
  2488. to read a line from the file. Obviously, however, using digits rather
  2489. than a variable for the channel number would be poor practice in a
  2490. script.
  2491. If in commands like:
  2492. fread \%c \%a
  2493. you have trouble remembering which variable is which, note that the
  2494. channel number is, indeed, a number. Anywhere C-Kermit accepts a number
  2495. it can also accept an expression, so you can put parentheses around the
  2496. channel number to remind you it's the channel number and not the
  2497. variable into which data is to be read:
  2498. fread (\%c) \%a
  2499. Normally channel numbers are assigned sequentially as 0, 1, 2, ... up
  2500. to the limit. However, once you start closing files, there can be holes
  2501. in the sequence. New channels are assigned to fill in the holes. Thus
  2502. you can't depend on channel numbers being in any particular sequence.
  2503. 1.22.5. FILE Command Errors
  2504. Each FILE command sets the variable \v(f_error) to one of the following
  2505. values:
  2506. 0 = No error
  2507. -1 = System error
  2508. -2 = Attempt to read after end of file
  2509. -3 = Channel not open
  2510. -4 = Channel number out of range (negative or too large)
  2511. -5 = Numeric argument (size, ...) out of range
  2512. -6 = File not found
  2513. -7 = Bad or missing filename
  2514. -8 = Too many files are already open (FILE OPEN only)
  2515. -9 = Forbidden operation (e.g. write to a read-only file)
  2516. -10 = Access denied
  2517. -11 = Illegal combination of OPEN modes (FILE OPEN only)
  2518. -12 = Buffer overflow
  2519. -13 = Current line number unknown (for relative line seeks)
  2520. -14 through -98: Reserved.
  2521. -99 = Requested operation not implemented in this version of C-Kermit
  2522. -999 = Unknown error
  2523. When \v(f_error) is -1, this means the FILE command failed because
  2524. because of a system error, in which case you can examine the following
  2525. variables:
  2526. \v(errno) = System error number.
  2527. \v(errstring) = Error message corresponding to \v(errno).
  2528. A special function is available for translating the \v(f_error) code to
  2529. an error message string:
  2530. \f_errmsg([code])
  2531. If the code is -1, returns error message of the most recent system
  2532. error; otherwise if the code is a valid \v(f_error) value, the associated
  2533. message is returned. If the code is omitted, the status message
  2534. corresponding to the current \v(f_error) value is returned.
  2535. A FILE command that fails prints the appropriate error message
  2536. automatically, except when the command is READ or SEEK and the error is
  2537. -2 (end of file); in that case, the command still fails, but does not
  2538. print a message. This allows constructions such as:
  2539. fopen \%c oofa.txt
  2540. while success { fread \%c }
  2541. fclose \%c
  2542. to work as expected, i.e. without an annoying message when the end of
  2543. file is reached.
  2544. 1.22.6. File I/O Variables
  2545. The variables associated with the file i/o package are:
  2546. \v(f_count)
  2547. Result of the most recent FILE COUNT (FCOUNT) command.
  2548. \v(f_error)
  2549. Numeric error code of most recent FILE command (0 = no error).
  2550. \v(f_max)
  2551. Maximum number of files open simultaneously.
  2552. 1.22.7. File I/O Functions
  2553. Some of the FILE commands can also be issued as function calls, which
  2554. makes script writing a bit more convenient, especially for C
  2555. programmers. Also, several functions are provided that do not have
  2556. command equivalents. Each of these functions takes a channel number as
  2557. the first argument. These functions do not work for OPEN { READ, !READ,
  2558. WRITE, !WRITE, and APPEND } files.
  2559. \f_status(channel)
  2560. Returns 0 if the channel is not open, otherwise a number between
  2561. 1 and 15 which is the sum of the OPEN modes:
  2562. 1 = /READ
  2563. 2 = /WRITE
  2564. 4 = /APPEND
  2565. 8 = /BINARY
  2566. The remaining functions work only for open channels. Each of these
  2567. functions can fail for the applicable reasons listed inSection
  2568. 1.22.5. For instructions on handling function errors, seeSection
  2569. 7.12.
  2570. \f_pos(channel)
  2571. Returns the file's current read/write pointer (0-based). There
  2572. is no FILE command equivalent.
  2573. \f_line(channel)
  2574. Returns the file's current line number (0-based), if known,
  2575. otherwise -1. There is no FILE command equivalent. The line
  2576. number is known as long as no character or block i/o has been
  2577. done on the channel.
  2578. \f_handle(channel)
  2579. Returns the "file handle" of the file. That is, it translates
  2580. the portable C-Kermit channel number into a system-specific file
  2581. handle or number that can be passed to other programs on the
  2582. same platform. In UNIX this is a file descriptor. There is no
  2583. FILE command equivalent.
  2584. \f_eof(channel)
  2585. Returns 1 if the read/write pointer of the file on the given
  2586. channel is at the end of the file, 0 otherwise. Convenient in
  2587. WHILE statements, e.g.:
  2588. while not \f_eof(\%c) { fread \%c }
  2589. \f_getchar(channel)
  2590. Equivalent to FREAD /CHAR. Returns the character actually read.
  2591. If \f_getchar() does not fail but the return value is empty,
  2592. this means a NULL character was read.
  2593. \f_getline(channel)
  2594. Equivalent to FREAD /LINE. Returns the line actually read, but
  2595. with the line terminator stripped. If \f_getline() does not fail
  2596. but the return value is empty, this normally means an empty line
  2597. was read.
  2598. \f_getblock(channel,n)
  2599. Equivalent to FREAD /SIZE:n. Returns the block of characters
  2600. actually read. If the returned block is smaller than n, it
  2601. indicates either that the end of file was reached or a NUL
  2602. character is in the block.
  2603. \f_putchar(channel,c)
  2604. Equivalent to FWRITE /CHARACTER. Writes the character c. If c
  2605. contains more than one character, only the first is written. If
  2606. c is empty a NUL is written. Returns the number of characters
  2607. written on success, or a negative error code upon failure.
  2608. \f_putline(channel,string)
  2609. Equivalent to FWRITE /LINE. Writes the string and adds the
  2610. appropriate line termination character or sequence. If the
  2611. string is empty or omitted, an empty line is written. Returns
  2612. the number of characters written on success, or a negative error
  2613. code upon failure.
  2614. \f_putblock(channel,string)
  2615. Equivalent to FWRITE /STRING. Writes the string as given. If the
  2616. string is empty or omitted, nothing is written. Returns the
  2617. number of characters written on success, or a negative error
  2618. code upon failure.
  2619. 1.22.8. File I/O Function Examples
  2620. fopen /read \%c oofa.txt ; Open our favorite file for reading
  2621. if failure exit 1 ; Check that it's open
  2622. while not \f_eof(\%c) { ; Loop until EOF
  2623. .line := \f_getline(\%c) ; Get a line
  2624. if success echo {\m(line)} ; Echo it
  2625. }
  2626. if not \f_eof(\%c) { ; Check reason for loop exit
  2627. exit 1 File Error: \f_errmsg() ; If not EOF say so.
  2628. }
  2629. frewind \%c ; Rewind the file
  2630. while not \f_eof(\%c) { ; Same thing but with block i/o
  2631. .block := \f_getblock(\%c,256) ; (much faster than line i/o)
  2632. if success xecho {\m(block)}
  2633. }
  2634. frewind \%c ; Rewind again
  2635. while not \f_eof(\%c) { ; Same deal but with character i/o
  2636. .c := \f_getchar(\%c) ; (much slower than line i/o)
  2637. if success xecho {\m(c)}
  2638. }
  2639. close \%c
  2640. To close all open files (equivalent to FCLOSE ALL):
  2641. for \%i 0 \v(f_max)-1 1 {
  2642. if \f_status(\%i) fclose \%i
  2643. }
  2644. 1.23. The EXEC Command
  2645. The EXEC command is available only in UNIX.
  2646. EXEC [ /REDIRECT ] command [ arg1 [ arg2 [ ... ] ]
  2647. Runs the given command with the arguments in such a way that the
  2648. command replaces C-Kermit in memory, and C-Kermit ceases to
  2649. execute. EXEC is like RUN, except instead of returning to
  2650. C-Kermit when finished, the command returns to whatever process
  2651. invoked Kermit.
  2652. In the normal case, no files are closed, so the EXEC'd command inherits
  2653. the open files, read/write pointers, working directory, process ID,
  2654. user ID (unless command is SUID), group ID (unless command is SGID),
  2655. groups, etc. (In UNIX, the EXEC command is simply a front end for
  2656. execvp().)
  2657. If the /REDIRECT switch is included, then if a connection is open (SET
  2658. LINE or SET HOST), it becomes the standard input and output of the
  2659. EXEC'd program. If no connection is open, the /REDIRECT switch has no
  2660. effect. For example to use C-Kermit for PPP dialing in Linux:
  2661. set modem type usr ; Specify the kind of modem you have
  2662. set line /dev/ttyS1 ; Specify the device it's connected to
  2663. set speed 57600 ; and the speed
  2664. set flow rts/cts ; and flow control.
  2665. set dial retries 100 ; Try the dial sequence up to 100 times.
  2666. dial {{9-212-555-1212}{9-212-555-1213}{9-212-555-1214}{9-212-555-1215}}
  2667. if fail exit 1
  2668. for \%i 1 16 1 { ; Try up to 16 times to get login prompt
  2669. input 10 Login: ; Wait 10 sec for it to appear
  2670. if success break ; Got it - proceed...
  2671. output \13 ; Send a carriage return and try again
  2672. }
  2673. if ( > \%i 16 ) stop 1 NO LOGIN PROMPT
  2674. lineout \(myuserid) ; Send user ID
  2675. input 30 assword: ; Wait for Password prompt
  2676. if fail stop 1 NO PASSWORD PROMPT
  2677. lineout \m(mypassword) ; Send the password.
  2678. exec /redirect pppd ; Replace ourselves with pppd.
  2679. In this example we assume that the script has already set up the
  2680. myuserid and mypassword variables -- normally the password should be
  2681. prompted for, rather than stored on disk. Notice the advantages over
  2682. the well-known "chat script":
  2683. * You don't have to control the modem itself with AT commands;
  2684. Kermit's DIAL command does this for you.
  2685. * You can have Kermit automatically redial as many times as you want
  2686. until it gets a connection (if this is legal in your country).
  2687. * You can have Kermit fetch the number or numbers from a dialing
  2688. directory.
  2689. * You can have Kermit cycle through a list of phone numbers (this is
  2690. new in C-Kermit 7.0; see Section 2.1.16) without having to
  2691. enter the numbers in a dialing directory.
  2692. * Dialing is location-independent; you can use the same script to
  2693. dial from different areas or countries.
  2694. * Once the connection is made, the full power of Kermit's script
  2695. language is available to manage the dialog with the terminal server
  2696. or other device that answers the phone call.
  2697. NOTE: PPP and SLIP dialing are not available in Windows 95/98/NT/2000,
  2698. whose APIs do not provide a method for an application to hand over a
  2699. connection to the PPP or SLIP driver.
  2700. 1.24. Getting Keyword Lists with '?'
  2701. Suppose you type "te" at the C-Kermit> 6.0 prompt and then Esc or Tab
  2702. to request keyword completion. Kermit beeps, indicating that more than
  2703. one command starts with "te". But if you type '?' to see what they are,
  2704. Kermit shows only "telnet". So why the beep? Because of invisible
  2705. keywords like "telopt", "terminal", and "text". Lots of keywords are
  2706. invisible because they are either synonyms for other keywords or else
  2707. esoteric options to be used only in special circumstances, so we don't
  2708. want them cluttering up the menus.
  2709. But then there is no way for you to discover them. So in C-Kermit 7.0,
  2710. if you type '?' AFTER the beginning of a keyword field, then invisible
  2711. keywords are shown too:
  2712. C-Kermit> te<Esc><BEEP>
  2713. C-Kermit> te? Command, one of the following:
  2714. telnet telopt terminal text
  2715. C-Kermit>te
  2716. But if '?' is typed at the beginning of a field, only visible keywords
  2717. are shown, as before (so, in this example, if '?' is typed at the
  2718. C-Kermit> prompt, "telnet" is the only command shown that starts with
  2719. "te").
  2720. 2. MAKING AND USING CONNECTIONS The SET LINE, SET HOST, and SET PORT (a
  2721. synonym for SET LINE) commands have new synonyms, in which the word SET is
  2722. replaced by the word OPEN: OPEN LINE, etc. There is no new functionality
  2723. here, but OPEN is a better verb, since SET generally takes no action, whereas
  2724. these commands actually try to open a connection. Furthermore, there is the
  2725. symmetry with CLOSE. 2.0. SET LINE and SET HOST Command SwitchesThe SET LINE
  2726. (SET PORT) and SET HOST commands now allow switches before the device or host
  2727. name, in most cases, and under certain circumstances, also at the end. The
  2728. new syntax is backwards compatible with the previous syntax; thus SET LINE,
  2729. SET PORT, and SET HOST commands in command files written for C-Kermit 6.0 or
  2730. earlier still work. The expanded syntax is:
  2731. { OPEN, SET } { LINE, PORT, HOST } [ switches ] device-or-address [ switches
  2732. ]
  2733. The first group of switches is:
  2734. /NETWORK-TYPE:{TCP/IP,X.25,PIPE,PTY...}
  2735. When more than one network type is available, this lets you
  2736. specify the type of network to use for this connection without
  2737. affecting your global SET NETWORK TYPE. See Section 2.7
  2738. about pipes and ptys.
  2739. /USERID:[string]
  2740. This switch is equivalent to SET LOGIN USERID. If a string is
  2741. given, it sent to host during Telnet negotiations; if this
  2742. switch is given but the string is omitted, no user ID is sent to
  2743. the host. If this switch is not given, your current LOGIN USERID
  2744. (\v(userid) value), if any, is sent. Unlike most other switches,
  2745. this one is "sticky", since the value must persist throughout
  2746. the session in case the server requests the ID string at a later
  2747. time.
  2748. /CONNECT
  2749. Enter CONNECT mode immediately and automatically after the
  2750. device or connection is open. On serial devices, however, when
  2751. CARRIER-WATCH is not OFF, wait up to 1 second for the Carrier
  2752. Detect signal to appear before trying to connect, to give the
  2753. device time to react DTR, which might have been off prior to
  2754. opening the device.
  2755. /SERVER
  2756. Enter server mode immediately and automatically after the device
  2757. or connection is open. Treatment of carrier is the same as for
  2758. /CONNECT.
  2759. /WAIT
  2760. /NOWAIT
  2761. For Telnet connections only: Like SET TELNET WAIT { ON, OFF },
  2762. but applies only to this connection, and in fact applies only
  2763. when OPENing this connection (which is usually the only place it
  2764. matters). Typically you would use TELNET /NOWAIT to make a
  2765. connection to a misbehaving Telnet server that does not reply to
  2766. negotiations as required by the Telnet protocol definition.
  2767. Note: /CONNECT and /SERVER switches are not available in the RLOGIN and
  2768. TELNET commands, since these commands already include an implicit
  2769. /CONNECT and preclude automatic entry into server mode.
  2770. The /CONNECT and /SERVER switches are especially useful with "set host
  2771. *" connections. For example, suppose you want to start a Kermit server
  2772. on socket 3000 of your TCP host. Normally you would have to give the
  2773. command:
  2774. set host * 3000
  2775. and then wait for a connection to come in, and only then could you give
  2776. the SERVER command (or else define a macro to do this, and then execute
  2777. the macro). Now you can do it in one step:
  2778. set host /server * 3000
  2779. This tells C-Kermit to wait for the connection and then enter server
  2780. mode once it comes in, no matter how long it takes. Similarly, "set
  2781. host /conn *" can be used to wait for a "chat" connection to come in.
  2782. Another set of switches is available in VMS only, for use only with SET
  2783. LINE:
  2784. /SHARE
  2785. Allows the SET LINE device to be opened in shared mode. Normally
  2786. it makes no sense to open a serial device in shared mode, but
  2787. it's necessary when C-Kermit is running in an environment such
  2788. as DECIntact, that opens your job's controlling terminal in such
  2789. a way that C-Kermit can't open it too, unless it enables SHARE
  2790. privilege. Note: SHARE privilege is required.
  2791. /NOSHARE
  2792. Requires that the SET LINE device not be in use by any other
  2793. process in order for it to be successfully opened by C-Kermit.
  2794. If neither /SHARE nor /NOSHARE is specified, /NOSHARE is used.
  2795. The second group of switches is:
  2796. /NO-TELNET-INIT
  2797. Do not send initial Telnet negotiations even if this is a Telnet
  2798. port.
  2799. /RAW-SOCKET
  2800. This is a connection to a raw TCP socket ( Section 2.3.5).
  2801. /RLOGIN
  2802. Use Rlogin protocol even if this is not an Rlogin port.
  2803. /TELNET
  2804. Send initial Telnet negotiations even if this is not a Telnet
  2805. port.
  2806. As of C-Kermit 7.0 and K95 1.1.19, the TELNET command includes an
  2807. implicit /TELNET switch. So if you TELNET to a non-TELNET port, Kermit
  2808. sends initial Telnet negotiations. This makes sense, since that's what
  2809. "telnet" means.
  2810. If you want to make a connection to a non-Telnet port without sending
  2811. initial Telnet negotiations, use:
  2812. set host [ /connect ] name-or-address port
  2813. or:
  2814. telnet name-or-address port /no-telnet-init
  2815. Additional switches might be added in the future; type "set host ?" or
  2816. "set line ?" to see a current list.
  2817. 2.1. Dialing
  2818. Automatic redialing is illegal or restricted in many countries, so
  2819. until C-Kermit 7.0, it was disabled by default, i.e. until a SET DIAL
  2820. RETRIES command was given. In C-Kermit 7.0, if no SET DIAL RETRIES
  2821. command has been given, a default is picked dynamically at DIAL time
  2822. based on the calling country code, if known. At this writing, the only
  2823. country code known to have no restrictions on automatic redialing is 1.
  2824. So in this case a limit of 10 is chosen; otherwise 1. If you have not
  2825. given an explicit SET DIAL RETRIES command, SHOW DIAL shows the value
  2826. as "(auto)", and then the value actually used is shown when you give
  2827. the DIAL command.
  2828. As of C-Kermit 7.0, automatic redialing is automatically canceled if
  2829. the call could not be placed because no dialtone was detected.
  2830. 2.1.1. The Dial Result Message
  2831. If DIAL DISPLAY is not ON, the "Call complete" message now shows the
  2832. modem's call result message, for example:
  2833. Dialing: ...
  2834. Call complete: "CONNECT 31200/ARQ/V32/LAPM/V42BIS"
  2835. The exact format and contents of this message, of course, depends on
  2836. the make, model, and configuration of your modem, so use your modem
  2837. manual to interpret it. The call result message is also available in
  2838. C-Kermit's \v(dialresult) variable.
  2839. C-Kermit> echo \v(dialresult)
  2840. CONNECT 31200/ARQ/V32/LAPM/V42BIS
  2841. C-Kermit> echo Speed = \fword(\v(dialresult),2)
  2842. Speed = 31200
  2843. C-Kermit>
  2844. Suppose your modem reports the modulation speed as shown above and you
  2845. want to ensure your call is completed at (say) 24000 bps or more. You
  2846. can use a little macro to do the job:
  2847. define HSDIAL { ; High Speed DIAL
  2848. local \%s
  2849. if < \v(argc) 1 if not def \v(dialnumber) end 1 Usage: \%0 number
  2850. set dial retries 100
  2851. set dial interval 1
  2852. while true {
  2853. dial \%*
  2854. if fail end 1 DIAL failed.
  2855. asg \%s \fword(\v(dialresult),2)
  2856. if def \%s if numeric \%s if not < \%s 24000 break
  2857. }
  2858. }
  2859. (See Section 7.5 about the \%* variable.)
  2860. 2.1.2. Long-Distance Dialing Changes
  2861. Due to the glut of cell phones, pagers, fax machines, ISPs, etc, area
  2862. codes and dialing rules are changing all the time. In the North
  2863. American Numbering Plan (NANP) countries (USA, Canada, etc), area codes
  2864. are split or overlayed with increasing frequency, and 10- and 11-digit
  2865. dialing is gradually becoming the norm for local calls. Changes are
  2866. occurring In Europe, too, partly for these reasons and partly because
  2867. of some new EC rules.
  2868. In France, effective 18 October 1996, all calls, even local ones, must
  2869. be dialed with an area code. French area codes are presently 1-digit
  2870. numbers, 1-6, and the long-distance dialing prefix is 0. All calls
  2871. within France are considered long distance and begin with 01, 02, ...,
  2872. 06.
  2873. Effective 1 May 1997, all calls within the US state of Maryland, even
  2874. local ones, must be dialed with an area code but without the
  2875. long-distance prefix -- this is the now widely-known North American
  2876. phenomenon of "ten digit dialing". The same is happening elsewhere --
  2877. many cities in Florida adopted 10-digit dialing in 1998.
  2878. In Italy beginning 19 June 1998, all calls to fixed (as opposed to
  2879. mobile) numbers must be prefixed by 0. When calling into Italy from
  2880. outside, the 0 must follow the country code (39). Calls to cell phones,
  2881. however, must be placed without the 0. Then on 29 December 2000, the 0
  2882. will become a 4 (for calling fixed numbers) and a prefix of 3 must used
  2883. for calling mobile phones. More info at:
  2884. http://www.telecomitalia.it/npnn/.
  2885. In Spain, effective 4 April 1998, with hard cutover on 18 July 1998,
  2886. all calls within the country must be dialed with 9 digits, and all
  2887. calls from outside Spain must also be dialed with 9 digits (after the
  2888. country code, 34). The new 9-digit numbers all begin with "9". More
  2889. info at:http://www.telefonica.es/cambiodenumeracion/
  2890. Several new dialing features and commands have been added in version
  2891. 6.1 and 7.0 to address these changes.
  2892. C-Kermit 6.0 and Kermit 95 1.1.11 and earlier handle the French
  2893. situation via a reasonable subterfuge (setting the local area code to a
  2894. nonexistent one), but did not handle "ten-digit dialing" well at all;
  2895. the recommended technique was to change the long-distance dialing
  2896. prefix to nothing, but this defeated Kermit's "list numbers for one
  2897. name" feature when the numbers were in different locations. For
  2898. example:
  2899. set dial ld-prefix
  2900. dial onlineservice
  2901. where "onlineservice" is a dialing directory entry name corresponding
  2902. to entries that are in (say) Maryland as well as other states, would
  2903. not correctly dial the numbers not in Maryland.
  2904. A new command lets you specify a list of area codes to be considered
  2905. local, except that the area code must be dialed:
  2906. SET DIAL LC-AREA-CODES [ areacode [ areacode [ areacode [ ... ] ] ] ]
  2907. The list may include up to 32 area codes. If a number is called
  2908. whose area code is in this list, it is dialed WITHOUT the
  2909. long-distance prefix, but WITH the area code.
  2910. So in Maryland, which (last time we looked) has two area codes, 410 and
  2911. 301, the setup would be:
  2912. SET DIAL LC-AREA-CODES 410 301
  2913. Example:
  2914. SET DIAL LD-PREFIX 1
  2915. SET DIAL AREA-CODE 301
  2916. SET DIAL LC-AREA-CODES 410 301 <-- Area codes in 10-digit dialing region
  2917. DIAL +1 (301) 765-4321 <-- Dials 3017654321 (local with area code)
  2918. DIAL +1 (410) 765-4321 <-- Dials 4107654321 (local with area code)
  2919. DIAL +1 (212) 765-4321 <-- Dials 12127654321 (long distance)
  2920. The SET DIAL LC-AREA-CODES command does not replace the SET DIAL
  2921. AREA-CODE command. The latter specifies the area code you are dialing
  2922. from. If the called number is in the same area code, then the area code
  2923. is dialed if it is also in the LC-AREA-CODES list, and it is not dialed
  2924. otherwise. So if "301" had not appeared in the LC-AREA-CODES list in
  2925. the previous example:
  2926. SET DIAL LD-PREFIX 1
  2927. SET DIAL AREA-CODE 301
  2928. SET DIAL LC-AREA-CODES 410 <-- Area codes in 10-digit dialing region
  2929. DIAL +1 (301) 765-4321 <-- Dials 7654321 (local)
  2930. DIAL +1 (410) 765-4321 <-- Dials 4107654321 (local with area code)
  2931. DIAL +1 (212) 765-4321 <-- Dials 12127654321 (long distance)
  2932. The new Kermit versions also add a Local Call Prefix and Local Call
  2933. Suffix, in case you have any need for it. These are added to the
  2934. beginning and of local phone numbers (i.e. numbers that are not
  2935. long-distance or international). Examples:
  2936. SET DIAL LD-PREFIX 1
  2937. SET DIAL LC-PREFIX 9
  2938. SET DIAL LC-SUFFIX *
  2939. SET DIAL LC-AREA-CODES 410 <-- Area codes in 10-digit dialing region
  2940. SET DIAL AREA-CODE 301
  2941. DIAL +1 (301) 765-4321 <-- Dials 97654321* (local)
  2942. DIAL +1 (410) 765-4321 <-- Dials 94107654321* (local with area code)
  2943. DIAL +1 (212) 765-4321 <-- Dials 12127654321 (long distance)
  2944. 2.1.3. Forcing Long-Distance Dialing
  2945. Suppose a number is in your country and area, but for some reason you
  2946. need to dial it long-distance anyway (as is always the case in France).
  2947. There have always been various ways to handle this:
  2948. 1. Temporarily set your area code to a different (or nonexistent or
  2949. impossible) one (but this required knowledge of which area codes
  2950. were nonexistent or impossible in each country).
  2951. 2. Dial the number literally instead of using the portable format, but
  2952. this defeats the purpose of the portable dialing directory.
  2953. Now there is also a new command that, very simply, can force
  2954. long-distance dialing:
  2955. SET DIAL FORCE-LONG-DISTANCE { ON, OFF }
  2956. If a call is placed to a portable phone number within the same
  2957. country code as the calling number, it is dialed with the
  2958. long-distance prefix and the area code if FORCE-LONG-DISTANCE is
  2959. ON. If OFF, the regular rules and procedures apply.
  2960. Example (France):
  2961. SET DIAL COUNTRY-CODE 33
  2962. SET DIAL AREA-CODE 6
  2963. SET DIAL FORCE-LONG-DISTANCE ON
  2964. (In fact, SET DIAL COUNTRY-CODE 33 automatically sets DIAL
  2965. FORCE-LONG-DISTANCE ON...)
  2966. Example (USA, for a certain type of reverse-charge calling in which the
  2967. called number must always be fully specified):
  2968. SET DIAL PREFIX 18002666328$ ; 1-800-COLLECT
  2969. SET DIAL COUNTRY-CODE 1
  2970. SET DIAL AREA-CODE 212
  2971. SET DIAL FORCE-LONG-DISTANCE ON
  2972. Example (Toronto, where calls to exchange 976 within area code 416 must
  2973. be dialed as long distance, even when you are dialing from area code
  2974. 416):
  2975. SET DIAL COUNTRY-CODE 1
  2976. SET DIAL AREA-CODE 416
  2977. SET DIAL FORCE-LONG-DISTANCE ON
  2978. DIAL +1 (416) 976-xxxx
  2979. If dialing methods were consistent and sensible, of course it would be
  2980. possible to always dial every domestic call as if it were long
  2981. distance. But in many locations this doesn't work or if it does, it
  2982. costs extra. The following macro can be used for dialing any given
  2983. number with forced long-distance format:
  2984. define LDIAL {
  2985. local \%x
  2986. set dial force-long-distance on
  2987. dial \%*
  2988. asg \%x \v(success)
  2989. set dial force-long-distance off
  2990. end \%x
  2991. }
  2992. (See Section 7.5 about the \%* variable.)
  2993. 2.1.4. Exchange-Specific Dialing Decisions
  2994. This applies mainly to the North American Numbering Plan (NANP). Refer
  2995. to the section "Alternative notations" inUsing C-Kermit 2nd
  2996. Edition, pages 106-107, and the story about Toronto on page 110. Using
  2997. the new LC-AREA-CODES list, we can address the problem by treating the
  2998. exchange as part of the area code:
  2999. SET DIAL LD-PREFIX 1
  3000. SET DIAL AREA-CODE 416
  3001. SET DIAL LC-AREA-CODES 905276
  3002. DIAL +1 416 765 4321 <-- 7654321 (local)
  3003. DIAL +1 905 276 4321 <-- 9052764321 (local with area code)
  3004. DIAL +1 905 528 4321 <-- 19055284321 (long distance)
  3005. The same technique can be used in Massachusetts (story at top of page
  3006. 111) and in any other place where dialing to some exchanges within a
  3007. particular area code is local, but to others in the same area code is
  3008. long distance.
  3009. 2.1.5. Cautions about Cheapest-First Dialing
  3010. Kermit does not maintain a knowledge base of telephony information; it
  3011. only provides the tools to let you enter a phone number in a standard
  3012. format and dial it correctly from any location in most cases.
  3013. In particular, Kermit does not differentiate the charging method from
  3014. the dialing method. If a call that is DIALED as long-distance (e.g.
  3015. from 212 to 718 in country code 1) is not CHARGED as long distance, we
  3016. have no way of knowing that without keeping a matrix of charging
  3017. information for every area-code combination within every country, and
  3018. any such matrix would be obsolete five minutes after it was
  3019. constructed. Thus, "cheapest-first" sorting is only as reliable as our
  3020. assumption that the charging method follows the dialing method. A good
  3021. illustration would be certain online services that have toll-free
  3022. dialup numbers which they charge you a premium (in your online service
  3023. bill) for using.
  3024. 2.1.6. Blind Dialing (Dialing with No Dialtone)
  3025. C-Kermit's init string for Hayes-like modems generally includes an X4
  3026. command to enable as many result codes as possible, so that Kermit can
  3027. react appropriately to different failure reasons. One of the result
  3028. codes that X4 enables is "NO DIALTONE". A perhaps not obvious side
  3029. effect of enabling this result code that the modem must hear dialtone
  3030. before it will dial.
  3031. It is becoming increasingly necessary to force a modem to dial even
  3032. though it does not hear a dialtone on the phone line; for example, with
  3033. PBXs that have strange dialtones, or with phone systems in different
  3034. countries, or with ISDN phones, etc. This is called "blind dialing".
  3035. C-Kermit 7.0 has two new commands to cope with this situation:
  3036. SET DIAL IGNORE-DIALTONE { ON, OFF }
  3037. OFF (the default) means to tell the modem to wait for dialtone
  3038. before dialing. ON means to enable "blind dialing", i.e. tell
  3039. the modem NOT to wait for dialtone before dialing. Generally
  3040. this is accomplished by sending ATX3 to the modem just prior to
  3041. dialing. SET MODEM TYPE xxx and then SHOW MODEM displays
  3042. Kermit's built-in "ignore dialtone" command.
  3043. SET DIAL COMMAND IGNORE-DIALTONE text
  3044. This lets you change the built-in ignore-dialtone command (such
  3045. as ATX3) to whatever you choose, in case the built-in one does
  3046. not work, or another command works better.
  3047. Notes:
  3048. 1. The ignore-dialtone command is not sent unless SET DIAL
  3049. IGNORE-DIALTONE is ON.
  3050. 2. The ATX3 command generally disables not only NO DIALTONE, but also
  3051. BUSY. So this will prevent Kermit from detecting when the line is
  3052. busy. This is a property of the modem, not of Kermit.
  3053. 2.1.7. Trimming the Dialing Dialog
  3054. The command:
  3055. SET MODEM COMMAND action [ command ]
  3056. is used to override Kermit's built-in modem commands for each action,
  3057. for each kind of modem in its internal database. If you include a
  3058. command, this is used instead of the built-in one. If you omit the
  3059. command, this restores the original built-in command.
  3060. If you want to omit the command altogether, so Kermit doesn't send the
  3061. command at all, or wait for a response, use:
  3062. SET MODEM COMMAND action {}
  3063. That is, specify a pair of empty braces as the command, for example:
  3064. SET MODEM COMMAND ERROR-CORRECTION ON {}
  3065. 2.1.8. Controlling the Dialing Speed
  3066. The rate at which characters are sent to the modem during dialing is
  3067. normally controlled by the built-in modem database. You might want to
  3068. override this if Kermit seems to be dialing too slowly, or it is
  3069. sending characters to the modem faster than the modem handle them. A
  3070. new command was added for this in C-Kermit 7.0:
  3071. SET DIAL PACING number
  3072. Specifies the number of milliseconds (thousandths of seconds) to
  3073. pause between each character when sending commands to the modem
  3074. during DIAL or ANSWER command execution. 0 means no pause at
  3075. all, -1 (the default) or any other negative number means to use
  3076. the value from the database. Any number greater than 0 is the
  3077. number of milliseconds to pause.
  3078. HINT: You might also need to control the rate at which the modem
  3079. generates Touch Tones during dialing, for example when sending a
  3080. numeric page. There are two ways to do this. One way is to insert pause
  3081. characters into the dialing string. For modems that use the AT command
  3082. set, the pause character is comma (,) and causes a 2-second pause. On
  3083. most modems, you can use the S8 register to change the pause interval
  3084. caused by comma in the dialing string. The other way is to set your
  3085. modem's tone generation interval, if it has a command for that. Most
  3086. AT-command-set modems use S11 for this; the value is in milliseconds.
  3087. For example on USR modems:
  3088. ATS11=200
  3089. selects an interval of 200 milliseconds to separate each dialing tone.
  3090. Hint: To add S-Register settings or other commands to your dialing
  3091. procedure, use the new SET MODEM COMMAND PREDIAL-INIT command
  3092. ( Section 2.2.2).
  3093. 2.1.9. Pretesting Phone Number Conversions
  3094. The LOOKUP command now accepts telephone numbers as well as
  3095. directory-entry names, for example:
  3096. LOOKUP +1 (212) 7654321
  3097. When given a phone number, LOOKUP prints the result of converting the
  3098. phone number for dialing under the current dialing rules. For example,
  3099. if my country code is 1 and my area code is 212, and I am dialing out
  3100. from a PBX whose outside-line prefix is "93,":
  3101. C-Kermit> lookup +1 (212) 7654321
  3102. +1 (212) 7654321 => 93,7654321
  3103. C-Kermit>
  3104. You can also use the \fdialconvert(phone-number) function (Section
  3105. 2.1.11) to do this programmatically:
  3106. C-Kermit> echo "\fdialconvert(+1 (212) 7654321)"
  3107. "93,7654321"
  3108. C-Kermit>
  3109. So the new LOOKUP behaves as follows:
  3110. LOOKUP portable-format-phone-number
  3111. Displays how the number would actually be dialed Sets FAILURE if
  3112. there was a conversion error, otherwise SUCCESS.
  3113. LOOKUP literal-format-phone-number
  3114. Displays the same literal-format-phone-number Always sets
  3115. SUCCESS.
  3116. LOOKUP dialing-directory-name
  3117. Displays all matching entries and converts portable phone
  3118. numbers. Sets SUCCESS if at least one entry was found, otherwise
  3119. FAILURE.
  3120. LOOKUP =anything
  3121. Displays "=anything" and sets SUCCESS.
  3122. There is, at present, no programmatic way to fetch numbers from the
  3123. dialing directory. This will be considered for a future release.
  3124. 2.1.10. Greater Control over Partial Dialing
  3125. The following rules now apply to partial dialing:
  3126. * Phone number transformations based on country and area code,
  3127. application of prefixes, etc, are performed only on the first
  3128. PDIAL.
  3129. * Each PDIAL argument is looked up in the dialing directory, so it is
  3130. possible have directory entries for pieces of phone numbers or
  3131. other information.
  3132. * Suffixes are not applied automatically, since there is no way for
  3133. C-Kermit to know in which PDIAL segment you want them to be
  3134. applied.
  3135. However, the suffix that *would* have been applied, based on the
  3136. dialing rules that were invoked when processing the first PDIAL
  3137. command, is stored in the variable:
  3138. \v(dialsuffix)
  3139. which you can include in any subsequent PDIAL or DIAL commands.
  3140. Example:
  3141. pdial {\m(my_long_distance_pager_number_part_1)}
  3142. pdial {\m(my_long_distance_pager_number_part_2)}
  3143. pdial {\v(dialsuffix)}
  3144. pdial {\m(my_long_distance_pager_number_part_3)}
  3145. pdial {@\m(numeric_pager_code)#}
  3146. 2.1.11. New DIAL-related Variables and Functions
  3147. \fdialconvert(s)
  3148. s is a phone number in either literal or portable format (not a
  3149. dialing directory entry name). The function returns the dial
  3150. string that would actually be used by the DIAL command when
  3151. dialing from the current location, after processing country
  3152. code, area code, and other SET DIAL values, and should be the
  3153. same as the result of LOOKUP when given a telephone number.
  3154. \v(dialsuffix)
  3155. Contains the suffix, if any, that was applied in the most recent
  3156. DIAL command, or the suffix that would have been applied in the
  3157. most recent PDIAL command. Use this variable to send the dial
  3158. suffix at any desired point in a PDIAL sequence.
  3159. \v(dialtype)
  3160. A number indicating the type of call that was most recently
  3161. placed. Can be used after a normal DIAL command, or after the
  3162. first PDIAL command in a PDIAL sequence. Values are:
  3163. -2: Unknown because TAPI handled the phone number translation.
  3164. -1: Unknown because some kind of error occurred.
  3165. 0: Internal within PBX.
  3166. 1: Toll-free.
  3167. 2: Local within calling area.
  3168. 3: Unknown (e.g. because a literal-format phone number was given).
  3169. 4: Long distance within country.
  3170. 5: International
  3171. \v(dialcount)
  3172. The current value of the DIAL retry counter, for use in a DIAL
  3173. macro ( Section 2.1.13).
  3174. \v(d$px)
  3175. PBX Exchange (see Section 2.1.12).
  3176. Other dial-related variables, already documented inUsing C-Kermit
  3177. (or other sections of this document, e.g. Section 2.1.1), include
  3178. \v(dialnumber), \v(dialstatus), etc. A convenient way to display all of
  3179. them is:
  3180. show variable dial ; hint: abbreviate "sho var dial"
  3181. This shows the values of all the variables whose names start with
  3182. "dial". Also "show variable d$" (to show the \v(d$...) variables).
  3183. 2.1.12. Increased Flexibility of PBX Dialing
  3184. Refer toUsing C-Kermit, 2nd Edition, pages 107-108. Recall that
  3185. three commands are needed to configure C-Kermit for dialing from a PBX:
  3186. SET DIAL PBX-EXCHANGE number
  3187. SET DIAL PBX-INSIDE-PREFIX number
  3188. SET DIAL PBX-OUTSIDE-PREFIX number
  3189. Unfortunately, this model does not accommodate PBXs that have more than
  3190. one exchange. For example our PBX at Columbia University (which must
  3191. handle more than 10,000 phones) has 853-xxxx and 854-xxxx exchanges.
  3192. Beginning in C-Kermit 7.0, the SET DIAL PBX-EXCHANGE command accepts a
  3193. list of exchanges, e.g.:
  3194. SET DIAL PBX-EXCHANGE 853 854
  3195. (multiple exchanges are separated by spaces, not commas).
  3196. So now when dialing a portable-format number that has the same country
  3197. and area codes as those of your dialing location, C-Kermit compares the
  3198. exchange of the dialed number with each number in the PBX Exchange list
  3199. (rather than with a single PBX Exchange number, as it did formerly) to
  3200. determine whether this is an internal PBX number or an external call.
  3201. If it is an external call, then the PBX Outside Prefix is applied, and
  3202. then the normal dialing rules for local or long-distance calls.
  3203. If it is an inside call, the exchange is replaced by the PBX Inside
  3204. Prefix. But if the PBX has more than one exchange, a single fixed PBX
  3205. Inside Prefix is probably not sufficient. For example, at Columbia
  3206. University, we must dial 3-xxxx for an internal call to 853-xxxx, but
  3207. 4-xxxx for a call to 854-xxxx. That is, the inside prefix is the final
  3208. digit of the exchange we are dialing. For this reason, C-Kermit 7.0
  3209. provides a method to determine the inside prefix dynamically at dialing
  3210. time, consisting of a new variable and new syntax for the SET DIAL
  3211. PBX-INSIDE-PREFIX command:
  3212. \v(d$px)
  3213. This variable contains the exchange that was matched when a PBX
  3214. internal call was detected. For example, if the PBX exchange
  3215. list is "853 854" and a call is placed to +1 (212) 854-9999,
  3216. \v(d$px) is set to 854.
  3217. SET DIAL PBX-INSIDE-PREFIX \fxxx(...)
  3218. If the PBX Inside Prefix is defined to be a function, its
  3219. evaluation is deferred until dialing time. Normally, this would
  3220. be a string function having \v(d$px) as an operand. Of course,
  3221. you can still specify a constant string, as before.
  3222. So given the following setup:
  3223. SET DIAL COUNTRY-CODE 1
  3224. SET DIAL AREA-CODE 212
  3225. SET DIAL PBX-OUTSIDE-PREFIX 93,
  3226. SET DIAL PBX-EXCHANGE 853 854
  3227. SET DIAL PBX-INSIDE-PREFIX \fright(\v(d$px),1)
  3228. The following numbers give the results indicated:
  3229. Number Result
  3230. +1 (212) 854-9876 4-9876
  3231. +1 (212) 853-1234 3-1234
  3232. +1 (212) 765-4321 93,765-4321
  3233. +1 (333) 765-4321 93,1333765-4321
  3234. Furthermore, the K_PBX_XCH environment variable may now be set to a
  3235. list of exchanges to automatically initialize C-Kermit's PBX exchange
  3236. list, for example (in UNIX ksh or bash):
  3237. export K_PBX_XCH="853 854"
  3238. (Quotes required because of the space.) Of course, this variable can
  3239. also be set to a single exchange, as before:
  3240. export K_PBX_XCH=853
  3241. 2.1.13. The DIAL macro - Last-Minute Phone Number Conversions
  3242. After a DIAL or LOOKUP command is given, a list of phone numbers is
  3243. assembled from the dialing directory (if any), with all
  3244. location-dependent conversion rules applied as described in Chapter 5
  3245. ofUsing C-Kermit.
  3246. However, additional conversions might still be required at the last
  3247. minute based on local or ephemeral conditions. So that you can have the
  3248. final word on the exact format of the dial string, C-Kermit 7.0 lets
  3249. you pass the converted string through a macro of your own design for
  3250. final processing before dialing. The relevant command is:
  3251. SET DIAL MACRO [ name ]
  3252. Specifies the name of a macro to be run on each phone number
  3253. after all built-in conversions have been applied, just before
  3254. the number is dialed. If no name is given, no macro is run. The
  3255. phone number, as it would have been dialed if there were no dial
  3256. macro, is passed to the macro.
  3257. The dial macro can do anything at all (except start a file transfer).
  3258. However, the normal use for the macro would be to modify the phone
  3259. number. For this reason the phone number is passed to the macro as
  3260. argument number 1 (\%1). To cause a modified number to be dialed, the
  3261. macro should terminate with a RETURN statement specifying a return
  3262. value. To leave the number alone, the macro should simply end. Example:
  3263. define xxx return 10108889999$\%1
  3264. set dial macro xxx
  3265. dial xyzcorp
  3266. This defines a DIAL MACRO called xxx, which puts an access code on the
  3267. front of the number. Another example might be:
  3268. def xxx if equal "\v(modem)" "hayes-1200" return \freplace(\%1,$,{,,,,,})
  3269. set dial macro xxx
  3270. dial xyzcorp
  3271. which replaces any dollar-sign in the dial string by a series of five
  3272. commas, e.g. because this particular modem does not support the "wait
  3273. for bong" feature (remember that commas that are to be included
  3274. literally in function arguments must be enclosed in braces to
  3275. distinguish them from the commas that separate the arguments) and when
  3276. the IF condition is not satisfied, the macro does not return a value,
  3277. and so the number is not modified. Then when a DIAL command is given
  3278. referencing a dialing directory entry, "xyzcorp". The macro is
  3279. automatically applied to each matching number.
  3280. Numerous dial-, modem-, communications-, and time-related variables are
  3281. available for decision making your dial macro. Type SHOW VARIABLES for
  3282. a list. Of particular interest is the \v(dialcount) variable, which
  3283. tells how many times the DIAL command gone through its retry loop: 1 on
  3284. the first try, 2 on the second, 3 on the third, and so on, and the
  3285. \v(dialresult) and \v(dialstatus) variables.
  3286. Here are some other applications for the DIAL MACRO (from users):
  3287. * Phone numbers in the dialing directory are formatted with '-' for
  3288. readability, but some modems don't like the hyphens, so the DIAL
  3289. macro is used to remove them before dialing; e.g 0090-123-456-78-99
  3290. becomes 00901234567899: "def xxx return \freplace(\%1,-)".
  3291. * To set some specific modem (or other) options depending on the
  3292. called customer or telephone number.
  3293. * Choosing the most appropriate provider based on (e.g.) time of day,
  3294. or cycling through a list of providers in case some providers might
  3295. be busy.
  3296. To illustrate the final item, suppose you have a choice among many
  3297. phone service providers; the provider is chosen by dialing an access
  3298. code before the number. Different providers might be better (e.g.
  3299. cheaper) for certain times of day or days of the week, or for dialing
  3300. certain locations; you can use the DIAL macro to add the access for the
  3301. most desirable provider.
  3302. Similarly, when the same number might be reached through multiple
  3303. providers, it's possible that one provider might not be able to
  3304. complete the call, but another one can. In that case, you can use the
  3305. DIAL macro to switch providers each time through the DIAL loop --
  3306. that's where the \v(dialcount) variable comes in handy.
  3307. The following command can be used to debug the DIAL macro:
  3308. SET DIAL TEST { ON, OFF }
  3309. Normally OFF, so the DIAL command actually dials. When ON, the
  3310. DIAL command performs all lookups and number conversions, and
  3311. then goes through the number list and retry loop, but instead of
  3312. actually dialing, lists the numbers it would have called if none
  3313. of the DIAL attempts succeeded (or more precisely, every number
  3314. was always busy).
  3315. 2.1.14. Automatic Tone/Pulse Dialing Selection
  3316. SET DIAL METHOD { AUTO, DEFAULT, PULSE, TONE }
  3317. Chooses the dialing method for subsequent calls.
  3318. Prior to version 7.0, C-Kermit's DIAL METHOD was DEFAULT by default,
  3319. meaning it does not specify a dialing method to the modem, but relies
  3320. on the modem to have an appropriate default dialing method set. So, for
  3321. example, when using Hayes compatible modems, the dial string would be
  3322. something like ATD7654321, rather than ATDT7654321 or ATDP7654321.
  3323. In C-Kermit 7.0 and K95 1.1.19, the dial method can be set from the
  3324. environment variable:
  3325. K_DIAL_METHOD
  3326. when Kermit starts. The values can be TONE, PULSE, or DEFAULT, e.g.
  3327. (UNIX):
  3328. set K_DIAL_METHOD=TONE; export K_DIAL_METHOD
  3329. In the absence of a K_DIAL_METHOD definition, the new default SET DIAL
  3330. METHOD is AUTO rather than DEFAULT. When DIAL METHOD is AUTO and the
  3331. local country code is known, then if tone dialing is universally
  3332. available in the corresponding area, tone dialing is used; if dialing
  3333. from a location where pulse dialing is mandatory, pulse dialing is
  3334. used.
  3335. The "tone country" and "pulse country" lists are preloaded according to
  3336. our knowledge at the time of release. You can see their contents in the
  3337. SHOW DIAL listing. You can change the lists with:
  3338. SET DIAL TONE-COUNTRIES [ cc [ cc [ ... ] ] ]
  3339. Replaces the current TONE-COUNTRIES list with the one given.
  3340. Each cc is a country code; separate them with spaces (not
  3341. commas). Example:
  3342. set dial tone-countries 1 358 44 46 49
  3343. If no country codes are given, the current list, if any, is
  3344. removed, in which case SET DIAL METHOD AUTO is equivalent to SET
  3345. DIAL METHOD DEFAULT.
  3346. SET DIAL PULSE-COUNTRIES [ cc [ cc [ ... ] ] ]
  3347. Replaces the current PULSE-COUNTRIES list with the one give.
  3348. Syntax and operation is like SET DIAL TONE-COUNTRIES.
  3349. If the same country code appears in both lists, Pulse takes precedence.
  3350. The SET DIAL TONE- and PULSE-COUNTRIES commands perform no verification
  3351. whatsoever on the cc's, since almost any syntax might be legal in some
  3352. settings. Furthermore, there is no facility to edit the lists; you can
  3353. only replace the whole list. However, since the only purpose of these
  3354. lists is to establish a basis for picking tone or pulse dialing
  3355. automatically, all you need to override the effect of the list is to
  3356. set a specific dialing method with SET DIAL METHOD TONE or SET DIAL
  3357. METHOD PULSE.
  3358. 2.1.15. Dial-Modifier Variables
  3359. As of C-Kermit 7.0, dial modifiers are available in the following
  3360. variables:
  3361. \v(dm_lp) Long pause
  3362. \v(dm_sp) Short pause
  3363. \v(dm_pd) Pulse dial
  3364. \v(dm_td) Tone dial
  3365. \v(dm_wa) Wait for answer
  3366. \v(dm_wd) Wait for dialtone
  3367. \v(dm_rc) Return to command mode
  3368. You can use these in your dial strings in place of hardwired modifiers
  3369. like "@", ",", etc, for increased portability of scripts. Example:
  3370. C-Kermit>set modem type usrobotics
  3371. C-Kermit>sho variables dm
  3372. \v(dm_lp) = ,
  3373. \v(dm_sp) = /
  3374. \v(dm_pd) = P
  3375. \v(dm_td) = T
  3376. \v(dm_wa) = @
  3377. \v(dm_wd) = W
  3378. \v(dm_rc) = ;
  3379. C-Kermit>exit
  3380. 2.1.16. Giving Multiple Numbers to the DIAL Command
  3381. Prior to C-Kermit 7.0, the only way to give a DIAL command a list of
  3382. phone numbers to try until one answers was to create a dialing
  3383. directory that had multiple entries under the same name, and then use
  3384. that entry name in the DIAL command. Now a list of numbers can be given
  3385. to the DIAL command directly in the following format:
  3386. dial {{number1}{number2}{number3}...}
  3387. This is the same list format used by SEND /EXCEPT: and other commands
  3388. that allow a list where normally a single item is given. Restrictions
  3389. on this form of the DIAL command are:
  3390. * The first two braces must be adjacent; spacing is optional
  3391. thereafter.
  3392. * Each number must be an actual number to dial, not a dialing
  3393. directory entry.
  3394. * Dialing directory entries may not contain number lists in this
  3395. format.
  3396. In all other respects, the numbers are treated as if they had been
  3397. fetched from the dialing directory; they can be in literal or portable
  3398. format, etc. Example:
  3399. dial {{7654321} {+1 (212) 5551212} { 1-212-5556789 }}
  3400. The list can be any length at all, within reason.
  3401. This feature is especially handy for use with the K95 Dialer, allowing
  3402. a list of phone numbers to be specified in the Telephone Number box
  3403. without having to set up or reference a separate dialing directory.
  3404. You can also use it to add commonly-dialed sequences as variables in
  3405. your C-Kermit customization file, e.g.:
  3406. define work {{7654321}{7654322}{7654323}}
  3407. and then:
  3408. dial {\m(work)}
  3409. (the variable name must be enclosed in braces).
  3410. Or more simply:
  3411. define work dial {{7654321}{7654322}{7654323}}
  3412. and then:
  3413. work
  3414. 2.2. Modems
  3415. 2.2.1. New Modem Types
  3416. Since C-Kermit 6.0:
  3417. atlas-newcom-33600ifxC Atlas/Newcom 33600
  3418. att-keepintouch AT&T KeepinTouch PCMCIA V.32bis Card Modem
  3419. att-1900-stu-iii AT&T Secure Data STU-III Model 1900
  3420. att-1910-stu-iii AT&T Secure Data STU-III Model 1910
  3421. bestdata Best Data
  3422. cardinal Cardinal V.34 MVP288X series.
  3423. compaq Compaq Data+Fax (e.g. in Presario)
  3424. fujitsu Fujitsu Fax/Modem Adapter
  3425. generic-high-speed Any modern error-correcting data-compressing modem
  3426. itu-t-v25ter/v250 ITU-T (CCITT) V.25ter (V.250) standard command set
  3427. megahertz-att-v34 Megahertz AT&T V.34
  3428. megahertz-xjack Megahertz X-Jack
  3429. motorola-codex Motorola Codex 326X Series
  3430. motorola-montana Motorola Montana
  3431. mt5634zpx Multitech MT5634ZPX
  3432. rockwell-v90 Rockwell V.90 56K
  3433. rolm-244pc Siemens/Rolm 244PC (AT command set)
  3434. rolm-600-series Siemens/Rolm 600 Series (AT command set)
  3435. spirit-ii QuickComm Spirit II
  3436. suprasonic SupraSonic V288+
  3437. supra-express-v90 Supra Express V.90
  3438. One of the new types, "generic-high-speed" needs a bit of explanation.
  3439. This type was added to easily handle other types that are not
  3440. explicitly covered, without going through the bother of adding a
  3441. complete user-defined modem type. This one works for modern modems that
  3442. use the AT command set, on the assumption that all the default
  3443. ("factory") settings of the modem (a) are appropriate for Kermit, (b)
  3444. include error correction, data compression, and speed buffering; and
  3445. (c) are recallable with the command AT&F.
  3446. If the command to recall your modem's profile is not AT&F, use the SET
  3447. MODEM COMMAND INIT-STRING command to specify the appropriate modem
  3448. command. The default init-string is AT&F\13 (that is, AT, ampersand, F,
  3449. and then carriage return); a survey of about 20 modern modem types
  3450. shows they all support this, but they might mean different things by
  3451. it. For example, the USR Sportster or Courier needs AT&F1 (not AT&F,
  3452. which is equivalent to AT&F0, which recalls an inappropriate profile),
  3453. so for USR modems:
  3454. set modem type generic-high-speed
  3455. set modem command init AT&F1\13
  3456. Of course, USR modems already have their own built-in modem type. But
  3457. if you use this one instead, it will dial faster because it has fewer
  3458. commands to give to the modem; in that sense "&F1" is like a macro that
  3459. bundles numerous commands into a single one. See your modem manual for
  3460. details about factory profiles and commands to recall them.
  3461. WARNING: Do not use the generic-high-speed modem type in operating
  3462. systems like VMS where hardware flow control is not available, at least
  3463. not unless you change the init string from AT&F\13 to something else
  3464. that enables local Xon/Xoff or other appropriate type of flow control.
  3465. Also see Section 2.1.7 for additional hints about making dialing
  3466. go faster.
  3467. 2.2.2. New Modem Controls
  3468. SET MODEM CAPABILITIES list
  3469. In C-Kermit 7.0, this command automatically turns MODEM
  3470. SPEED-MATCHING OFF if SB (Speed Buffering) is in the list, and
  3471. turns it ON if SB is absent.
  3472. SET MODEM COMMAND PREDIAL-INIT [ text ]
  3473. Commands to be sent to the modem just prior to dialing. Normally
  3474. none.
  3475. SET MODEM SPEAKER { ON, OFF }
  3476. Determines whether modem speaker is on or off while call is
  3477. being placed. ON by default. Note: This command does not provide
  3478. fine-grained control over when the speaker is on or off.
  3479. Normally, ON means while the call is being placed, until the
  3480. point at which carrier is successfully established. If your
  3481. modem has a different speaker option that you want to choose,
  3482. then use the SET MODEM COMMAND SPEAKER ON text command to
  3483. specify this option.
  3484. SET MODEM COMMAND SPEAKER { ON, OFF } [ text ]
  3485. Specify or override the commands to turn your modem's speaker on
  3486. and off.
  3487. SET MODEM VOLUME { LOW, MEDIUM, HIGH }
  3488. When MODEM SPEAKER is on, select volume. Note: In some modems,
  3489. especially internal ones, these commands have no effect; this is
  3490. a limitation of the particular modem, not of Kermit.
  3491. SET MODEM COMMAND VOLUME { LOW, MEDIUM, HIGH } [ text ]
  3492. Specify or override the commands to set your modem's speaker
  3493. volume.
  3494. SET MODEM COMMAND IGNORE-DIALTONE [ text ]
  3495. The command to enable blind dialing ( Section 2.1.6).
  3496. SET MODEM ESCAPE-CHARACTER code
  3497. Has been augmented to allow codes of 0 or less: < 0 means the
  3498. escape mechanism is disabled. = 0 means to use (restore) the
  3499. default value from the modem database. > 0 and < 128 is a
  3500. literal value to be used instead of the default one. > 127 means
  3501. the escape mechanism is disabled. This affects "modem hangup".
  3502. When the escape mechanism is disabled, but SET MODEM
  3503. HANGUP-METHOD is MODEM-COMMAND, it sends the hangup command
  3504. immediately, without the <pause>+++<pause> business first. This
  3505. is useful (for example) when sending lots of numeric pages, a
  3506. process in which never we go online, and so never need to escape
  3507. back. Eliminating the unnecessary pauses and escape sequence
  3508. allows a lot more pages to be sent per unit time.
  3509. Recall that C-Kermit can dial modems to which it is connected via
  3510. TCP/IP (Telnet or Rlogin) as described on page 126 ofUsing
  3511. C-Kermit, 2nd Ed. In this case the MODEM HANGUP-METHOD should be
  3512. MODEM-COMMAND, since RS-232 signals don't work over TCP/IP connections.
  3513. As noted in the manual, such connections are set up by the following
  3514. sequence:
  3515. set host host [ port ]
  3516. set modem type name
  3517. dial number
  3518. But this can cause complications when you use Kermit to switch between
  3519. serial and TCP/IP connections. In the following sequence:
  3520. set host name
  3521. set modem type name
  3522. set port name
  3523. the first two commands obey the rules for dialing out over Telnet.
  3524. However, the SET PORT command requires that Kermit close its current
  3525. (Telnet) connection before it can open the serial port (since Kermit
  3526. can only have one connection open at a time). But since a modem type
  3527. was set after the "set host" command was given, Kermit assumes it is a
  3528. Telnet dialout connection and so sends the modem's hangup sequence is
  3529. sent to the Telnet host. To avoid this, close the network connection
  3530. explicitly before opening the serial one:
  3531. set host name
  3532. close
  3533. set modem type name
  3534. set port name
  3535. 2.3. TELNET and RLOGIN
  3536. For additional background, please also read theTELNET.TXT file,
  3537. also available on the Web inHTML format.
  3538. Cautions:
  3539. * If making a Telnet connection with C-Kermit takes a very long time,
  3540. like over a minute, whereas the system Telnet program makes the
  3541. same connection immediately, try including the /NOWAIT switch:
  3542. C-Kermit> telnet /nowait hostname
  3543. SeeTELNET.TXT orTELNET.HTM for details. If it also
  3544. takes a very long time to make a Telnet connection with system
  3545. Telnet, then the delay is most likely caused by reverse DNS lookups
  3546. when your host is not properly registered in DNS.
  3547. * When supplying numeric IP addresses to C-Kermit or to any other
  3548. application (regular Telnet, Rlogin, etc), do not include leading
  3549. 0's in any fields unless you intend for those fields to be
  3550. interpreted as octal (or hex) numbers. The description of the
  3551. Internet address interpreter (the sockets library inet_addr()
  3552. routine) includes these words:
  3553. All numbers supplied as "parts" in a "." notation may be decimal,
  3554. octal, or hexadecimal, as specified in the C language (that is, a
  3555. leading 0x or 0X implies hexadecimal; otherwise, a leading 0 implies
  3556. octal; otherwise, the number is interpreted as decimal).
  3557. To illustrate, 128.59.39.2 and 128.059.039.002 are not the same
  3558. host! Even though most of the fields contain non-octal digits.
  3559. Using system Telnet (not Kermit):
  3560. $ telnet 128.059.039.002
  3561. Trying 128.49.33.2 ...
  3562. Of course the same thing happens with Kermit because it uses (as it
  3563. must) the same system service for resolving network addresses that
  3564. Telnet, FTP, and all other TCP/IP applications use.
  3565. * The RLOGIN section on page 123 does not make it clear that you can
  3566. use the SET TELNET TERMINAL-TYPE command to govern the terminal
  3567. type that is reported by C-Kermit to the RLOGIN server.
  3568. * Note that the SET TCP commands described on pages 122-123 might be
  3569. absent; some platforms that support TCP/IP do not support these
  3570. particular controls.
  3571. New commands:
  3572. TELOPT { AO, AYT, BREAK, CANCEL, EC, EL, EOF, EOR, GA, IP, DMARK,
  3573. DO, DONT, NOP, SB, SE, SUSP, WILL, WONT }
  3574. This command was available previously, but supported only DO,
  3575. DONT, WILL, and WONT. Now it lets you send all the Telnet
  3576. protocol commands. Note that certain commands do not require a
  3577. response, and therefore can be used as nondestructive "probes"
  3578. to see if the Telnet session is still open; e.g.:
  3579. set host xyzcorp.com
  3580. ...
  3581. telopt nop
  3582. if fail stop 1 Connection lost
  3583. SET TCP ADDRESS [ ip-address ]
  3584. Specifies the IP address of the computer that C-Kermit is
  3585. running on. Normally this is not necessary. The exception would
  3586. be if your machine has multiple network adapters (physical or
  3587. virtual) with a different address for each adapter AND you want
  3588. C-Kermit to use a specific address when making outgoing
  3589. connections or accepting incoming connections.
  3590. SET TCP DNS-SERVICE-RECORDS { ON, OFF }
  3591. Tells C-Kermit whether to try to use DNS SRV records to
  3592. determine the host and port number upon which to find an
  3593. advertised service. For example, if a host wants regular Telnet
  3594. connections redirected to some port other than 23, this feature
  3595. allows C-Kermit to ask the host which port it should use. Since
  3596. not all domain servers are set up to answer such requests, this
  3597. feature is OFF by default.
  3598. SET TCP REVERSE-DNS-LOOKUP { ON, OFF, AUTO }
  3599. Tells Kermit whether to perform a reverse DNS lookup on TCP/IP
  3600. connections. This allows Kermit to determine the actual hostname
  3601. of the host it is connected to, which is useful for connections
  3602. to host pools, and is required for Kerberos connections to host
  3603. pools and for incoming connections. If the other host does not
  3604. have a DNS entry, the reverse lookup could take a long time
  3605. (minutes) to fail, but the connection will still be made. Turn
  3606. this option OFF for speedier connections if you do not need to
  3607. know exactly which host you are connected to and you are not
  3608. using Kerberos. AUTO, the default, means the lookup is done on
  3609. hostnames, but not on numeric IP addresses.
  3610. SET TELNET WAIT-FOR-NEGOTIATIONS { ON, OFF }
  3611. Each Telnet option must be fully negotiated either On or Off
  3612. before the session can continue. This is especially true with
  3613. options that require sub-negotiations such as Authentication,
  3614. Encryption, and Kermit; for proper support of these options
  3615. Kermit must wait for the negotiations to complete. Of course,
  3616. Kermit has no way of knowing whether a reply is delayed or not
  3617. coming at all, and so will wait a minute or more for required
  3618. replies before continuing the session. If you know that Kermit's
  3619. Telnet partner will not be sending the required replies, you can
  3620. set this option of OFF to avoid the long timeouts. Or you can
  3621. instruct Kermit to REFUSE specific options with the SET TELOPT
  3622. command.
  3623. SET TELOPT [ { /CLIENT, /SERVER } ] option
  3624. { ACCEPTED, REFUSED, REQUESTED, REQUIRED }
  3625. [ { ACCEPTED, REFUSED, REQUESTED, REQUIRED } ]
  3626. SET TELOPT lets you specify policy requirements for Kermit's
  3627. handling of Telnet option negotiations. Setting an option is
  3628. REQUIRED causes Kermit to offer the option to the peer and
  3629. disconnect if the option is refused. REQUESTED causes Kermit to
  3630. offer an option to the peer. ACCEPTED results in no offer but
  3631. Kermit will attempt to negotiate the option if it is requested.
  3632. REFUSED instructs Kermit to refuse the option if it is requested
  3633. by the peer.
  3634. Some options are negotiated in two directions and accept
  3635. separate policies for each direction; the first keyword applies
  3636. to Kermit itself, the second applies to Kermit's Telnet partner;
  3637. if the second keyword is omitted, an appropriate
  3638. (option-specific) default is applied. You can also include a
  3639. /CLIENT or /SERVER switch to indicate whether the given policies
  3640. apply when Kermit is the Telnet client or the Telnet server; if
  3641. no switch is given, the command applies to the client.
  3642. Note that some of Kermit's Telnet partners fail to refuse
  3643. options that they do not recognize and instead do not respond at
  3644. all. In this case it is possible to use SET TELOPT to instruct
  3645. Kermit to REFUSE the option before connecting to the problem
  3646. host, thus skipping the problematic negotiation.
  3647. Use SHOW TELOPT to view current Telnet Option negotiation
  3648. settings. SHOW TELNET displays current Telnet settings.
  3649. 2.3.0. Bug Fixes
  3650. If "set host nonexistent-host" was given (and it properly failed),
  3651. followed by certain commands like SEND, the original line and modem
  3652. type were not restored and C-Kermit thought that it still had a network
  3653. hostname; fixed in 7.0.
  3654. 2.3.1. Telnet Binary Mode Bug Adjustments
  3655. SET TELNET BUG BINARY-ME-MEANS-U-TOO { ON, OFF } was added to edit 192
  3656. after the book was printed. Also SET TELNET BUG BINARY-U-MEANS-ME-TOO.
  3657. The default for both is OFF. ON should be used when communicating with
  3658. a Telnet partner (client or server) that mistakenly believes that
  3659. telling C-Kermit to enter Telnet binary mode also means that it, too,
  3660. is in binary mode, contrary to the Telnet specification, which says
  3661. that binary mode must be negotiated in each direction separately.
  3662. 2.3.2. VMS UCX Telnet Port Bug Adjustment
  3663. A new command, SET TCP UCX-PORT-BUG, was added for VMS versions with
  3664. UCX (DEC TCP/IP), applying only to early versions of UCX, like 2.2 or
  3665. earlier. If you try to use VMS C-Kermit to make a Telnet connection
  3666. using a port name (like "telnet", which is used by default), the
  3667. underlying UCX getservbyname() function might return the service number
  3668. with its bytes swapped and the connection will fail. If "telnet
  3669. hostname 23" works, then your version of UCX has this bug and you can
  3670. put "set tcp ucx-port-bug on" in your CKERMIT.INI file to get around
  3671. it.
  3672. 2.3.3. Telnet New Environment Option
  3673. The TELNET NEW-ENVIRONMENT option (RFC 1572) is supported as 7.0.
  3674. This option allows the C-Kermit Telnet client to send certain
  3675. well-known variables to the Telnet server, including USER, PRINTER,
  3676. DISPLAY, and several others. This feature is enabled by default in
  3677. Windows and OS/2, disabled by default elsewhere. The command to enable
  3678. and disable it is:
  3679. SET TELNET ENVIRONMENT { ON, OFF }
  3680. When ON, and you Telnet to another computer, you might (or might not)
  3681. notice that the "login:" or "Username:" prompt does not appear --
  3682. that's because your username was sent ahead, in which case the remote
  3683. system might prompt you only for your password (similar to Rlogin). Use
  3684. "set telnet environment off" to defeat this feature, particularly in
  3685. scripts where the dialog must be predictable. You can also use this
  3686. command to specify or override specific well-known environment variable
  3687. values:
  3688. SET TELNET ENVIRONMENT { ACCT,DISPLAY,JOB,PRINTER,SYSTEMTYPE,USER } [ text ]
  3689. 2.3.4. Telnet Location Option
  3690. The TELNET LOCATION option (RFC 779) is supported in 7.0. This
  3691. option allows the C-Kermit Telnet client to send a location string to
  3692. the server if the server indicates its willingness to accept one. If an
  3693. environment variable named LOCATION exists at the time C-Kermit starts,
  3694. its value is used as the location string. If you want to change it,
  3695. use:
  3696. SET TELNET LOCATION text
  3697. If you omit the text from this command, the Telnet location feature is
  3698. disabled.
  3699. SET TELNET ENVIRONMENT DISPLAY is used to set the DISPLAY variable that
  3700. is sent to the host, as well as the XDISPLAY location.
  3701. 2.3.5. Connecting to Raw TCP Sockets
  3702. The SET HOST and TELNET commands now accept an optional switch,
  3703. /RAW-SOCKET, at the end, only if you first give a host and a port.
  3704. Example:
  3705. set host xyzcorp.com 23 /raw-socket
  3706. set host 128.49.39.2:2000 /raw-socket
  3707. telnet xyzcorp.com 3000 /raw
  3708. Without this switch, C-Kermit behaves as a Telnet client when (a) the
  3709. port is 23 or 1649, or (b) the port is not 513 and the server sent what
  3710. appeared to be Telnet negotiations -- that is, messages starting with
  3711. 0xFF (IAC). With this switch, Kermit should treat all incoming bytes as
  3712. raw data, and will not engage in any Telnet negotiations or NVT CRLF
  3713. manipulations. This allows transparent operation through (e.g.) raw TCP
  3714. ports on Cisco terminal servers, through the 'modemd' modem server,
  3715. etc.
  3716. 2.3.6. Incoming TCP Connections
  3717. Accomplished via SET HOST * port, were introduced in C-Kermit 6.0, but
  3718. for UNIX only. In Version 7.0, they are also available for VMS.
  3719. 2.4. The EIGHTBIT Command
  3720. EIGHTBIT is simply a shorthand for: SET PARITY NONE, SET TERMINAL
  3721. BYTESIZE 8, SET COMMAND BYTESIZE 8; that is, a way to set up an 8-bit
  3722. clean connection in a single command.
  3723. 2.5. The Services Directory
  3724. Chapter 7 ofUsing C-Kermit does not mention the ULOGIN macro,
  3725. which is used by our sample services directory, CKERMIT.KND. Unlike
  3726. UNIXLOGIN, VMSLOGIN, etc, this one is for use with systems that require
  3727. a user ID but no password. Therefore it doesn't prompt for a password
  3728. or wait for a password prompt from the remote service.
  3729. In version 7.0, the CALL macro was changed to not execute a SET MODEM
  3730. TYPE command if the given modem type was the same as the current one;
  3731. otherwise the new SET MODEM TYPE command would overwrite any
  3732. customizations that the user had made to the modem settings. Ditto for
  3733. SET LINE / SET PORT and SET SPEED.
  3734. 2.6. Closing Connections
  3735. Until version 7.0, there was never an obvious and general way to close
  3736. a connection. If a serial connection was open, it could be closed by
  3737. "set line" or "set port" (giving no device name); if a network
  3738. connection was open, it could be closed by "set host" (no host name).
  3739. In version 7.0, a new command closes the connection in an obvious and
  3740. straightforward way, no matter what the connection type:
  3741. CLOSE [ CONNECTION ]
  3742. The CLOSE command was already present, and required an operand such as
  3743. DEBUG-LOG, WRITE-FILE, etc, and so could never be given by itself. The
  3744. new CONNECTION operand is now the default operand for CLOSE, so CLOSE
  3745. by itself closes the connection, if one is open, just as you would
  3746. expect, especially if you are a Telnet or Ftp user.
  3747. Also see the description of the new SET CLOSE-ON-DISCONNECT command in
  3748. Section 2.10.
  3749. 2.7. Using C-Kermit with External Communication Programs
  3750. C-Kermit 7.0 includes a new ability to create and conduct sessions
  3751. through other communications programs. Two methods are available:
  3752. 1. Pty (pseudoterminal): The external program is run on a
  3753. "pseudoterminal", which is controlled by Kermit. This method works
  3754. with practically any external program, but it is not portable. At
  3755. this writing, it works only on some (not all) UNIX versions, and
  3756. not on any non-UNIX platforms.
  3757. 2. Pipe: The external program's standard input and output are
  3758. redirected through a "pipe" controlled by Kermit. This method is
  3759. relatively portable -- it should work across all UNIX versions, and
  3760. it also works in Windows and OS/2 -- but it is effective only when
  3761. the external program actually uses standard i/o (and many don't).
  3762. The two methods are started differently but are used the same way
  3763. thereafter.
  3764. The purpose of this feature is to let you use C-Kermit services like
  3765. file transfer, character-set translation, scripting, automatic dialing,
  3766. etc, on connections that Kermit can't otherwise make itself.
  3767. This feature is the opposite of the REDIRECT feature, in which C-Kermit
  3768. makes the connection, and redirects an external (local) command or
  3769. program over this connection. In a pty or pipe connection, C-Kermit
  3770. runs and controls a local command or program, which makes the
  3771. connection. (The same method can be used to simply to control a local
  3772. program without making a connection; see Section 2.8.)
  3773. To find out if your version of Kermit includes PTY support, type "show
  3774. features" and look for NETPTY in the alphabetical list of options. For
  3775. pipes, look for NETCMD.
  3776. The commands are:
  3777. SET NETWORK TYPE PTY or SET NETWORK TYPE PIPE
  3778. SET HOST command
  3779. where command is any interactive command. If the command does
  3780. not use standard i/o, you must use SET NETWORK TYPE PTY.
  3781. Notes:
  3782. * COMMAND is an invisible synonym for PIPE.
  3783. * The command and its arguments are case-sensitive in UNIX.
  3784. The SET NETWORK TYPE, SET HOST sequence sets the given network type for
  3785. all subsequent SET HOST commands until another SET NETWORK TYPE command
  3786. is given to change it.
  3787. You can also use the new /NETWORK-TYPE:PTY or /NETWORK-TYPE:PIPE (or
  3788. simply /PIPE or /PTY) switches on the SET HOST command itself:
  3789. SET HOST /NETWORK-TYPE:PIPE command ; These two are the same
  3790. SET HOST /PIPE command
  3791. SET HOST /NETWORK-TYPE:PTY command ; Ditto
  3792. SET HOST /PTY command
  3793. These are like SET NETWORK TYPE followed by SET HOST, except they apply
  3794. only to the connection being made and do not change the global network
  3795. type setting (see Section 1.5 about the difference between
  3796. switches and SET commands).
  3797. Include any command-line options with the command that might be needed,
  3798. as in this example where C-Kermit uses another copy of itself as the
  3799. communications program:
  3800. SET HOST /PIPE /CONNECT kermit -YQJ xyzcorp.com
  3801. IMPORTANT: In Unix, wildcards and redirectors are interpreted by the
  3802. shell. If you want to run a program with (say) SET HOST /PTY with
  3803. its i/o redirected or with wildcard file arguments, you will need to
  3804. invoke the shell too. Example:
  3805. SET HOST /PTY {sh -c "crypt < foo.x"}
  3806. SET HOST /PTY {sh -c "grep somestring *.txt"}
  3807. As usual, if you include the /CONNECT switch, SET HOST enters CONNECT
  3808. mode immediately upon successful execution of the given command.
  3809. Therefore new commands are available as a shorthand for SET HOST
  3810. /CONNECT /PTY and /PIPE:
  3811. PTY [ command ]
  3812. PIPE [ command ]
  3813. The PTY and PIPE commands work like the TELNET and RLOGIN
  3814. commands: they set up the connection (in this case, using the
  3815. given command) and then enter CONNECT mode automatically (if the
  3816. PIPE or PTY command is given without a command, it continues the
  3817. current session if one is active; otherwise it gives an error
  3818. message).
  3819. The PIPE command is named after the mechanism by which C-Kermit
  3820. communicates with the command: UNIX pipes. C-Kermit's i/o is "piped"
  3821. through the given command. Here is a typical example:
  3822. PIPE rlogin -8 xyzcorp.com
  3823. This is equivalent to:
  3824. SET HOST /PIPE rlogin -8 xyzcorp.com
  3825. CONNECT
  3826. and to:
  3827. SET HOST /PIPE /CONNECT rlogin -8 xyzcorp.com
  3828. IMPORTANT:
  3829. If you are writing a script, do not use the PIPE, PTY, TELNET,
  3830. or RLOGIN command unless you really want C-Kermit to enter
  3831. CONNECT mode at that point. Normally SET HOST is used in scripts
  3832. to allow the login and other dialogs to be controlled by the
  3833. script itself, rather than by an actively participating human at
  3834. the keyboard.
  3835. Throughput of pty and pipe connections is limited by the performance of
  3836. the chosen command or program and by the interprocess communication
  3837. (IPC) method used and/or buffering capacity of the pipe or pty, which
  3838. in turn depends on the underlying operating system.
  3839. In one trial (on SunOS 4.1.3), we observed file transfer rates over an
  3840. rlogin connection proceeding at 200Kcps for downloads, but only 10Kcps
  3841. for uploads on the same connection with the same settings (similar
  3842. disparities were noted in HP-UX). Examination of the logs revealed that
  3843. a write to the pipe could take as long as 5 seconds, whereas reads were
  3844. practically instantaneous. On the other hand, using Telnet as the
  3845. external program rather than rlogin, downloads and uploads were better
  3846. matched at about 177K each.
  3847. Most external communication programs, like C-Kermit itself, have escape
  3848. characters or sequences. Normally these begin with (or consist entirely
  3849. of) a control character. You must be sure that this control character
  3850. is not "unprefixed" when uploading files, otherwise the external
  3851. program will "escape back" to its prompt, or close the connection, or
  3852. take some other unwanted action. When in CONNECT mode, observe the
  3853. program's normal interaction rules. Of course C-Kermit's own escape
  3854. character (normally Ctrl-\) is active too, unless you have taken some
  3855. action to disable it.
  3856. On PTY connections, the underlying PTY driver is not guaranteed to be
  3857. transparent to control characters -- for example, it might expand tabs,
  3858. translate carriage returns, generate signals if it sees an interrupt
  3859. character, and so on. Similar things might happen on a PIPE connection.
  3860. For this reason, if you plan to transfer files over a PTY or PIPE
  3861. connection, tell the file sender to:
  3862. SET PREFIXING ALL
  3863. This causes all control characters to be prefixed and
  3864. transmitted as printable ASCII characters.
  3865. If the external connection program is not 8-bit clean, you should also:
  3866. SET PARITY SPACE
  3867. This causes 8-bit data to be encoded in 7 bits using single
  3868. and/or locking shifts.
  3869. And if it does not make a reliable connection (such as those made by
  3870. Telnet, Rlogin, Ssh, etc), you should:
  3871. SET STREAMING OFF
  3872. This forces C-Kermit to treat the connection as unreliable and
  3873. to engage in its normal ACK/NAK protocol for error detection and
  3874. correction, rather than "streaming" its packets, as it normally
  3875. does on a network connection ( Section 4.20).
  3876. In some cases, buffer sizes might be restricted, so you might also need
  3877. to reduce the Kermit packet length to fit; this is a trial-and-error
  3878. affair. For example, if transfers always fail with 4000-byte packets,
  3879. try 2000. If that fails too, try 1000, and so on. The commands are:
  3880. SET RECEIVE PACKET-LENGTH number
  3881. This tells the file receiver to tell the file sender the longest
  3882. packet length it can accept.
  3883. SET SEND PACKET-LENGTH number
  3884. This tells the file sender not to send packets longer than the
  3885. given length, even if the receiver says longer ones are OK. Of
  3886. course, if the receiver's length is shorter, the shorter length
  3887. is used.
  3888. If none of this seems to help, try falling back to the bare minimum,
  3889. lowest-common-denominator protocol settings:
  3890. ROBUST
  3891. No sliding windows, no streaming, no control-character
  3892. unprefixing, packet length 90.
  3893. And then work your way back up by trial and error to get greater
  3894. throughput.
  3895. Note that when starting a PIPE connection, and the connection program
  3896. (such as telnet or rlogin) prints some greeting or information messages
  3897. before starting the connection, these are quite likely to be printed
  3898. with a stairstep effect (linefeed without carriage return). This is
  3899. because the program is not connected with the UNIX terminal driver;
  3900. there's not much Kermit can do about it. Once the connection is made,
  3901. everything should go back to normal. This shouldn't happen on a PTY
  3902. connection because a PTY is, indeed, a terminal.
  3903. On a similar note, some connection programs (like Solaris 2.5 rlogin)
  3904. might print lots of error messages like "ioctl TIOCGETP: invalid
  3905. argument" when used through a pipe. They are annoying but usually
  3906. harmless. If you want to avoid these messages, and your shell allows
  3907. redirection of stderr, you can redirect stderr in your pipe command, as
  3908. in this example where the user's shell is bash:
  3909. PIPE rlogin xyzcorp.com 2> /dev/null
  3910. Or use PTY rather than PIPE, since PTY is available on Solaris.
  3911. 2.7.0. C-Kermit over tn3270 and tn5250
  3912. Now you can make a connection from C-Kermit "directly" to an IBM
  3913. mainframe and transfer files with it, assuming it has Kermit-370
  3914. installed. Because tn3270 is neither 8-bit clean nor transparent to
  3915. control characters, you must give these commands:
  3916. SET PREFIXING ALL ; Prefix all control characters
  3917. SET PARITY SPACE ; Telnet connections are usually not 8-bit clean
  3918. and then:
  3919. SET HOST /PTY /CONNECT tn3270 abccorp.com
  3920. or simply:
  3921. pty tn3270 abccorp.com
  3922. SET HOST /PIPE does not work in this case, at least not for file
  3923. transfer. File transfer does work, however, with SET HOST /PTY,
  3924. provided you use the default packet length of 90 bytes; anything longer
  3925. seems to kill the session.
  3926. You can also make connections to IBM AS/400 computers if you have a
  3927. tn5250 program installed:
  3928. pty tn5250 hostname
  3929. In this case, however, file transfer is probably not in the cards since
  3930. nobody has ever succeeded in writing a Kermit program for the AS/400.
  3931. Hint:
  3932. define tn3270 {
  3933. check pty
  3934. if fail end 1 Sorry - no PTY support...
  3935. pty tn3270 \%*
  3936. }
  3937. Similarly for tn5250. Note that CHECK PTY and CHECK PIPE can be used in
  3938. macros and scripts to test whether PTY or PIPE support is available.
  3939. 2.7.1. C-Kermit over Telnet
  3940. Although C-Kermit includes its own Telnet implementation, you might
  3941. need to use an external Telnet program to make certain connections;
  3942. perhaps because it has access or security features not available in
  3943. C-Kermit itself. As noted above, the only precautions necessary are
  3944. usually:
  3945. SET PREFIXING ALL ; Prefix all control characters
  3946. SET PARITY SPACE ; Telnet connections might not be 8-bit clean
  3947. and then:
  3948. SET HOST /PTY (or /PIPE) /CONNECT telnet abccorp.com
  3949. or, equivalently:
  3950. PTY (or PIPE) telnet abccorp.com
  3951. 2.7.2. C-Kermit over Rlogin
  3952. C-Kermit includes its own Rlogin client, but this can normally be used
  3953. only if you are root, since the rlogin TCP port is privileged. But ptys
  3954. and pipes let you make rlogin connections with C-Kermit through your
  3955. computer's external rlogin program, which is normally installed as a
  3956. privileged program:
  3957. SET PREFIXING ALL
  3958. and then:
  3959. SET HOST /PTY (or /PIPE) /CONNECT rlogin -8 abccorp.com
  3960. or, equivalently:
  3961. PTY (or PIPE) rlogin -8 abccorp.com
  3962. The "-8" option to rlogin enables transmission of 8-bit data. If this
  3963. is not available, then include SET PARITY SPACE if you intend to
  3964. transfer files.
  3965. Note that the normal escape sequence for rlogin is Carriage Return
  3966. followed by Tilde (~), but only when the tilde is followed by certain
  3967. other characters; the exact behavior depends on your rlogin client, so
  3968. read its documentation.
  3969. 2.7.3. C-Kermit over Serial Communication Programs
  3970. Ptys and pipes also let you use programs that make serial connections,
  3971. such as cu or tip. For example, C-Kermit can be used through cu to make
  3972. connections that otherwise might not be allowed, e.g. because C-Kermit
  3973. is not installed with the required write permissions to the dialout
  3974. device and the UUCP lockfile directory.
  3975. Suppose your UUCP Devices file contains an entry for a serial device
  3976. tty04 to be used for direct connections, but this device is protected
  3977. against you (and Kermit when you run it). In this case you can:
  3978. SET CONTROL PREFIX ALL
  3979. PTY (or PIPE) cu -l tty04
  3980. (Similarly for dialout devices, except then you also need to include
  3981. the phone number in the "cu" command.)
  3982. As with other communication programs, watch out for cu's escape
  3983. sequence, which is the same as the rlogin program's: Carriage Return
  3984. followed by Tilde (followed by another character to specify an action,
  3985. like "." for closing the connection and exiting from cu).
  3986. 2.7.4. C-Kermit over Secure Network Clients
  3987. DISCLAIMER: There are laws in the USA and other countries regarding
  3988. use, import, and/or export of encryption and/or decryption or other
  3989. forms of security software, algorithms, technology, and intellectual
  3990. property. The Kermit Project attempts to follow all known statutes,
  3991. and neither intends nor suggests that Kermit software can or should
  3992. be used in any way, in any location, that circumvents any
  3993. regulations, laws, treaties, covenants, or other legitimate canons
  3994. or instruments of law, international relations, trade, ethics, or
  3995. propriety.
  3996. For secure connections or connections through firewalls, C-Kermit 7.0
  3997. can be a Kerberos, SRP, and/or SOCKS client when built with the
  3998. appropriate options and libraries. But other application-level security
  3999. acronyms and methods -- SSH, SSL, SRP, TLS -- pop up at an alarming
  4000. rate and are (a) impossible to keep up with, (b) usually mutually
  4001. incompatible, and (c) have restrictions on export or redistribution and
  4002. so cannot be included in C-Kermit itself.
  4003. However, if you have a secure text-based Telnet (or other) client that
  4004. employs one of these security methods, you can use C-Kermit "through"
  4005. it via a pty or pipe.
  4006. 2.7.4.1. SSH
  4007. C-Kermit does not and can not incorporate SSH due to licensing, patent,
  4008. and USA export law restrictions.
  4009. The UNIX SSH client does not use standard input/output, and therefore
  4010. can be used only by Kermit's PTY interface, if one is present. The
  4011. cautions about file transfer, etc, are the same as for Rlogin. Example:
  4012. SET PREFIXING ALL
  4013. PTY ssh XYZCORP.COM
  4014. Or, for a scripted session:
  4015. SET PREFIXING ALL
  4016. SET HOST /PTY ssh XYZCORP.COM
  4017. Hint:
  4018. define ssh {
  4019. check pty
  4020. if fail end 1 Sorry - no PTY support...
  4021. pty ssh \%*
  4022. }
  4023. 2.7.4.2. SSL
  4024. Secure Sockets Layer (SSL) is another TCP/IP security overlay, this one
  4025. designed by and for Netscape. An SSL Telnet client is available for
  4026. UNIX from the University of Queensland. More info at:
  4027. http://www.psy.uq.oz.au/~ftp/Crypto/
  4028. Interoperability with C-Kermit is unknown. C-Kermit also includes its
  4029. own built-in SSL/TLS support, but it is not exportable.
  4030. 2.7.4.3. SRP
  4031. SRP(TM) is Stanford University's Secure Remote Password protocol. An
  4032. SRP Telnet client is available from Stanford:
  4033. http://srp.stanford.edu/srp/
  4034. Stanford's SRP Telnet client for UNIX has been tested on SunOS and
  4035. works fine with C-Kermit, as described in Section 2.7.1, e.g.
  4036. SET PREFIX ALL
  4037. PTY (or PIPE) srp-telnet xenon.stanford.edu
  4038. C-Kermit itself can be built as an SRP Telnet client on systems that
  4039. have libsrp.a installed; the C-Kermit support code, however, may not be
  4040. exported outside the USA or Canada.
  4041. 2.7.4.4. SOCKS
  4042. C-Kermit can be built as a SOCKS-aware client on systems that have a
  4043. SOCKS library. See section 8.1.1 of theckccfg.txt file.
  4044. C-Kermit 7.0 can also be run over SOCKSified Telnet or rlogin clients
  4045. with SET NETWORK TYPE COMMAND. Suppose the Telnet program on your
  4046. system is SOCKS enabled but C-Kermit is not. Make Kermit connections
  4047. like this:
  4048. SET PREFIX ALL
  4049. PTY (or PIPE) telnet zzz.com
  4050. 2.7.4.5. Kerberos
  4051. UNIX C-Kermit can be built with MIT Kerberos IV or V authentication and
  4052. encryption. Instructions are available in aseparate document.
  4053. Additional modules are required that can not be exported from the USA
  4054. to any country except Canada, by US law.
  4055. If you have Kerberos installed but you don't have a Kerberized version
  4056. of C-Kermit, you can use ktelnet as C-Kermit's external communications
  4057. program to make secure connections without giving up C-Kermit's
  4058. services:
  4059. SET PREFIX ALL
  4060. PTY (or PIPE) ktelnet cia.gov
  4061. 2.8. Scripting Local Programs
  4062. If your version of Kermit has PTY support built in, then any text-based
  4063. program can be invoked with SET HOST /PTY or equivalent command and
  4064. controlled using the normal sequence of OUTPUT, INPUT, IF SUCCESS
  4065. commands (this is the same service that is provided by the 'expect'
  4066. program, but controlled by the Kermit script language rather than Tcl).
  4067. When PTY service is not available, then any program that uses standard
  4068. input and output can be invoked with SET HOST /PIPE.
  4069. Here's an example in which we start an external Kermit program, wait
  4070. for its prompt, give it a VERSION command, and then extract the numeric
  4071. version number from its response:
  4072. set host /pty kermit -Y
  4073. if fail stop 1 {Can't start external command}
  4074. input 10 C-Kermit>
  4075. if fail stop 1 {No C-Kermit> prompt}
  4076. output version\13
  4077. input 10 {Numeric: }
  4078. if fail stop 1 {No match for "Numeric:"}
  4079. clear input
  4080. input 10 \10
  4081. echo VERSION = "\fsubstr(\v(input),1,6)"
  4082. output exit\13
  4083. This technique could be used to control any other interactive program,
  4084. even those that do screen formatting (like Emacs or Vi), if you can
  4085. figure out the sequence of events. If your Kermit program doesn't have
  4086. PTY support, then the commands are restricted to those using standard
  4087. i/o, including certain shells, interactive text-mode "hardcopy" editors
  4088. like ex, and so on.
  4089. If you are using the PTY interface, you should be aware that it runs
  4090. the given program or command directly on the pty, without any
  4091. intervening shell to interpret metacharacters, redirectors, etc. If you
  4092. need this sort of thing, include the appropriate shell invocation as
  4093. part of your command; for example:
  4094. pty echo *
  4095. just echoes "*"; whereas:
  4096. pty ksh -c "echo *"
  4097. echoes all the filenames that ksh finds matching "*".
  4098. Similarly for redirection:
  4099. set host /pty ksh -c "cat > foo" ; Note: use shell quoting rules here
  4100. set transmit eof \4
  4101. transmit bar
  4102. And for that matter, for built-in shell commands:
  4103. set host /pty ksh -c "for i in *; do echo $i; done"
  4104. The PIPE interface, on the other hand, invokes the shell automatically,
  4105. so:
  4106. pipe echo *
  4107. prints filenames, not "*".
  4108. 2.9. X.25 Networking
  4109. X.25 networking is documented inUsing C-Kermit, 2nd Edition. When
  4110. the book was published, X.25 was available only in SunOS, Solaris, and
  4111. Stratus VOS. Unlike TCP/IP, X.25 APIs are not standardized; each
  4112. vendor's X.25 libraries and services (if they have them at all) are
  4113. unique.
  4114. This section describes new additions.
  4115. 2.9.1. IBM AIXLink/X.25 Network Provider Interface for AIX
  4116. Support for X.25 was added via IBM's Network Provider Interface (NPI),
  4117. AIXLink/X.25 1.1, to the AIX 4.x version of C-Kermit 7.0.
  4118. Unfortunately, AIXLink/X.25 is a rather bare-bones facility, lacking in
  4119. particular any form of PAD support (X.3, X.28, X.29). Thus, the AIX
  4120. version of C-Kermit, when built to include X.25 networking, has neither
  4121. a PAD command, nor a SET PAD command. The same is true for the
  4122. underlying AIX system: no PAD support. Thus it is not possible to have
  4123. an interactive shell session over an X.25 connection into an AIX system
  4124. (as far as we know), even from X.25-capable Kermit versions (such as
  4125. Solaris or VOS) that do include PAD support.
  4126. Thus the X.25 capabilities in AIX C-Kermit are limited to peer-to-peer
  4127. connections, e.g. from a C-Kermit client to a C-Kermit server. Unlike
  4128. the Solaris, SunOS, and VOS versions, the AIX version can accept
  4129. incoming X.25 connections:
  4130. set network type x.25
  4131. if fail stop 1 Sorry - no X.25 support
  4132. ; Put any desired DISABLE or ENABLE or SET commands here.
  4133. set host /server *
  4134. if fail stop 1 X.25 "set host *" failed
  4135. And then access it from the client as follows:
  4136. set network type x.25
  4137. if fail stop 1 Sorry - no X.25 support
  4138. set host xxxxxxx ; Specify the X.25/X.121 address
  4139. if fail stop 1 Can't open connection
  4140. And at this point the client can use the full range of client commands:
  4141. SEND, GET, REMOTE xxx, FINISH, BYE.
  4142. The AIX version also adds two new variables:
  4143. \v(x25local_nua)
  4144. The local X.25 address.
  4145. \v(x25remote_nua)
  4146. The X.25 address of the host on the other end of the connection.
  4147. C-Kermit's AIX X.25 client has not been tested against anything other
  4148. than a C-Kermit X.25 server on AIX. It is not known if it will
  4149. interoperate with C-Kermit servers on Solaris, SunOS, or VOS.
  4150. To make an X.25 connection from AIX C-Kermit, you must:
  4151. set x25 call-user-data xxxx
  4152. where xxxx can be any even-length string of hexadecimal digits, e.g.
  4153. 123ABC.
  4154. 2.9.2. HP-UX X.25
  4155. Although C-Kermit presently does not include built-in support for HP-UX
  4156. X.25, it can still be used to make X.25 connections as follows: start
  4157. Kermit and tell it to:
  4158. set prefixing all
  4159. set parity space
  4160. pty padem address
  4161. This should work in HP-UX 9.00 and later (see Section 2.7). If you
  4162. have an earlier HP-UX version, or the PTY interface doesn't work or
  4163. isn't available, try:
  4164. set prefixing all
  4165. set parity space
  4166. pipe padem address
  4167. Failing that, use Kermit to telnet to localhost and then after logging
  4168. back in, start padem as you would normally do to connect over X.25.
  4169. 2.10. Additional Serial Port Controls
  4170. C-Kermit 7.0 adds the following commands for greater control over
  4171. serial ports. These commands are available only in C-Kermit versions
  4172. whose underlying operating systems provide the corresponding services
  4173. (such as POSIX and UNIX System V), and even then their successful
  4174. operation depends on the capabilities of the specific device and
  4175. driver.
  4176. SET DISCONNECT { ON, OFF }
  4177. On a SET LINE or SET PORT connection with SET CARRIER ON or
  4178. AUTO, if the carrier signal drops during the connection,
  4179. indicating that the connection has been lost, and C-Kermit
  4180. notices it, this setting governs what happens next. With SET
  4181. DISCONNECT OFF, which is consistent with previous behavior, and
  4182. therefore the default, C-Kermit continues to keep the device
  4183. open and allocated. With SET DISCONNECT ON, C-Kermit
  4184. automatically closes and releases the device when it senses a
  4185. carrier on-to-off transition, thus allowing others to use it.
  4186. However, it remains the default device for i/o (DIAL, REDIAL,
  4187. INPUT, SEND, CONNECT, etc), so if a subsequent i/o command is
  4188. given, the device is reopened if it is still available. When it
  4189. has been automatically closed in this manner, SHOW
  4190. COMMUNICATIONS puts "(closed)" after its name, and in UNIX, the
  4191. lockfile disappears -- both from SHOW COMM and from the lockfile
  4192. directory itself. Synonym: SET CLOSE-ON-DISCONNECT.
  4193. SET EXIT ON-DISCONNECT { ON, OFF }
  4194. Like DISCONNECT, but makes the program exit if a connection
  4195. drops.
  4196. Note that SET CLOSE-ON-DISCONNECT and SET EXIT ON-DISCONNECT apply only
  4197. to connections that drop; they do not apply to connections that can't
  4198. be made in the first place. For example, they have no effect when a SET
  4199. LINE, SET HOST, TELNET, or DIAL command fails.
  4200. HANGUP
  4201. If [CLOSE-ON-]DISCONNECT is ON, and the HANGUP command is given
  4202. on a serial device, and the carrier signal is no longer present
  4203. after the HANGUP command, the device is closed and released.
  4204. SET PARITY HARDWARE { EVEN, ODD }
  4205. Unlike SET PARITY { EVEN, ODD, MARK, SPACE }, which selects 7
  4206. data bits plus the indicated kind of parity (to be done in
  4207. software by Kermit itself), SET PARITY HARDWARE selects 8 data
  4208. bits plus even or odd parity, to be done by the underlying
  4209. hardware, operating system, or device driver. This command is
  4210. effective only with a SET LINE or SET PORT device. That is, it
  4211. has no effect in remote mode, nor on network connections. There
  4212. is presently no method for selecting 8 data bits plus mark or
  4213. space parity. If hardware parity is in effect, the variable
  4214. \v(hwparity) is set to "even" or "odd". Note: some platforms
  4215. might also support settings of SPACE, MARK, or NONE.
  4216. SET STOP-BITS { 1, 2 }
  4217. This tells the number of 1-bits to insert after an outbound
  4218. character's data and parity bits, to separate it from the next
  4219. character. Normally 1. Choosing 2 stop bits should do no harm,
  4220. but will slow down serial transmission by approximately 10
  4221. percent. Historically, 2 stop bits were used with Teletypes (at
  4222. 110 bps or below) for print-head recovery time. There is
  4223. presently no method for choosing any number of stop bits besides
  4224. 1 and 2.
  4225. SET SERIAL [ dps ]
  4226. dps stands for Data-bits, Parity, Stop-bits. This is the
  4227. notation familiar to many people for serial port configuration:
  4228. 7E1, 8N1, 7O2, etc. The data bits number also becomes the
  4229. TERMINAL BYTESIZE setting. The second character is E for Even, O
  4230. for Odd, M for Mark, S for Space, or N for None. The list of
  4231. available options depends on the capabilities of the specific
  4232. platform. If dps is omitted, 8N1 is used. Type "set serial ?"
  4233. for a list of available choices. Examples:
  4234. SET SERIAL 7E1
  4235. Equivalent to SET PARITY EVEN, SET STOP-BITS 1, SET TERM
  4236. BYTE 7.
  4237. SET SERIAL 8N1
  4238. Equivalent to SET PARITY NONE, SET STOP-BITS 1, SET TERM
  4239. BYTE 8.
  4240. SET SERIAL 7E2
  4241. Equivalent to SET PARITY EVEN and SET STOP-BITS 2, SET
  4242. TERM BYTE 7.
  4243. SET SERIAL 8E2
  4244. Same as SET PARITY HARDWARE EVEN, SET STOP-BITS 2, SET
  4245. TERM BYTE 8.
  4246. SET SERIAL
  4247. Same as SET PARITY NONE and SET STOP-BITS 1, SET TERM BYTE
  4248. 8.
  4249. Notes:
  4250. * The SET SERIAL xx2 options are available only in Kermit versions
  4251. where the SET PARITY HARDWARE command is also available. (SHOW
  4252. FEATURES includes "HWPARITY" in its options list.)
  4253. * The SET SERIAL 7xx and 8N1 options affect the software parity
  4254. setting, even for network connections.
  4255. * As noted in the manual, selecting 8 data bits does not give you
  4256. 8-bit terminal sessions in CONNECT mode unless you also SET
  4257. TERMINAL BYTESIZE 8. The default terminal bytesize remains 7, to
  4258. protect against the situation where the remote host is generating
  4259. parity but you don't know about it. If the terminal bytesize was 8
  4260. by default and you CONNECTed to such a host, you would see only
  4261. garbage on your screen.
  4262. * If you do not give a SET STOP-BITS or SET SET SERIAL command,
  4263. C-Kermit does not attempt to set the device's stop bits; instead,
  4264. it uses whatever setting the device uses when not given explicit
  4265. instructions about stop bits.
  4266. SHOW COMMUNICATIONS displays the current settings. Stop bits and
  4267. hardware parity are shown only for SET PORT / SET LINE (serial)
  4268. devices, since they do not apply to network connections or to remote
  4269. mode. STOP-BITS is shown as "(default)" if you have not given an
  4270. explicit SET STOP-BITS or SET SERIAL command.
  4271. The \v(serial) variable shows the SET SERIAL setting (8N1, 7E1, etc).
  4272. 2.11. Getting Access to the Dialout Device
  4273. This section is for UNIX only; note the special words about QNX at
  4274. the end. Also see Section 2.0 for SET LINE switches,
  4275. particularly the /SHARE switch for VMS only.
  4276. C-Kermit does its best to obey the UUCP lockfile conventions of each
  4277. platform (machine, operating system, OS version) where it runs, if that
  4278. platform uses UUCP.
  4279. But simply obeying the conventions is often not good enough, due to the
  4280. increasing likelihood that a particular serial device might have more
  4281. than one name (e.g. /dev/tty00 and /dev/term/00 are the same device in
  4282. Unixware 7; /dev/cua and /dev/cufa are the same device in NeXTSTEP),
  4283. plus the increasingly widespread use of symlinks for device names, such
  4284. as /dev/modem.
  4285. C-Kermit 7.0 goes to greater lengths than previous versions to
  4286. successfully interlock with other communications program (and other
  4287. instances of Kermit itself); for example, by:
  4288. * Creation of dual lockfiles whenever a symlink is used; one for the
  4289. link name and one for the real name.
  4290. * Creation of dual lockfiles in HP-UX according to HP rules.
  4291. * Creation of dual uppercase/lowercase lockfile names in SCO
  4292. UNIX/ODT/OSR5.
  4293. * The use of ttylock() in versions of AIX where it works.
  4294. * The use, wherever possible, of lockfile names based on
  4295. inode/major/minor device number rather than device name.
  4296. See theckuins.txt andckubwr.txt files for details.
  4297. QNX is almost unique among UNIX varieties in having no UUCP programs
  4298. nor UUCP-oriented dialout-device locking conventions. QNX does,
  4299. however, allow a program to get the device open count. This can not be
  4300. a reliable form of locking unless all applications do it (and they
  4301. don't), so by default, Kermit uses this information only for printing a
  4302. warning message such as:
  4303. C-Kermit>set line /dev/ser1
  4304. WARNING - "/dev/ser1" looks busy...
  4305. However, if you want to use it as a lock, you can do so with:
  4306. SET QNX-PORT-LOCK { ON, OFF }
  4307. QNX-PORT-LOCK is OFF by default; if you set in ON, C-Kermit fails to
  4308. open any dialout device when its open count indicates that another
  4309. process has it open. SHOW COMM (in QNX only) displays the setting, and
  4310. if you have a port open, it also shows the current open count (with
  4311. C-Kermit's own access always counting as 1).
  4312. 2.12. The Connection Log
  4313. C-Kermit 7.0 adds the ability to log connections, so you can see where
  4314. you've been and have a record of calls you've made. A connection is
  4315. defined as any communications session that is begun by SET LINE, SET
  4316. PORT, DIAL, SET HOST, TELNET, or RLOGIN. Connections are not logged
  4317. unless you request it; the command is:
  4318. LOG CX [ filename [ { NEW, APPEND } ] ]
  4319. Enables logging of connections in the given file. If the
  4320. trailing { NEW, APPEND } keyword is omitted, the file is opened
  4321. for appending; i.e. new records are written to the end. If NEW
  4322. is specified, a new file is created; if a file of the same name
  4323. already existed, it is overwritten. If the filename is omitted,
  4324. CX.LOG in your home (login) directory is used (note: uppercase).
  4325. To accept all defaults, just use "log connections" (or "l c" for
  4326. short). Synonym: LOG CONNECTIONS.
  4327. CLOSE CX-LOG
  4328. This closes the connection log if it was open. (Note, the CLOSE
  4329. CONNECTION command closes the connection itself).
  4330. SHOW CX
  4331. This shows your current connection, if any, including the
  4332. elapsed time (since you opened it). Synonym: SHOW CONNECTION.
  4333. \v(cx_time)
  4334. This variable shows the elapsed time of your current connection,
  4335. or if there is no current connection, of your most recent
  4336. connection, of if there have been no connections, 0.
  4337. The connection contains one line per connection, of the form:
  4338. yyyymmdd hh:mm:ss username pid p=v [ p=v [ ... ] ]
  4339. where the timestamp (in columns 1-18) shows when the connection was
  4340. made; username is the login identity of the person who made the
  4341. connection; pid is Kermit's process ID when it made the connection. The
  4342. p's are parameters that depend on the type of connection, and the v's
  4343. are their values:
  4344. T = Connection Type (TCP, SERIAL, DIAL, DECNET, etc).
  4345. H = The name of the Host from which the connection was made.
  4346. N = Destination phone Number or Network host name or address.
  4347. D = Serial connections only: Device name.
  4348. O = Dialed calls only: Originating country code & area code if known.
  4349. E = Elapsed time in hh:mm:ss format (or hhh:mm:ss, etc).
  4350. If you always want to keep a connection log, simply add:
  4351. log connections
  4352. to your C-Kermit customization file. Note, however, that if you make a
  4353. lot of connections, your CX.LOG will grow and grow. You can handle this
  4354. by adding a "logrotate" procedure like the following to your
  4355. customization file, before the "log connections" command:
  4356. define LOGROTATE { ; Define LOGROTATE macro
  4357. local \%i \%m \%d \%n \%f MAX
  4358. def MAX 4 ; How many months to keep
  4359. if not def \%1 - ; No argument given
  4360. end 1 \%0: No filename given
  4361. if not = 1 \ffiles(\%1) - ; Exactly 1 file must match
  4362. end 1 \%0: \%1 - File not found
  4363. .\%d := \fsubstr(\fdate(\%1),1,6) ; Arg OK - get file year & month
  4364. if = \%d - ; Compare file year & month
  4365. \fsubstr(\v(ndate),1,6) - ; with current year & month
  4366. end 0 ; Same year & month - done
  4367. rename \%1 \%1.\%d ; Different - rename file
  4368. .\%n := \ffiles(\%1.*) ; How many old files
  4369. if < \%n \m(MAX) end 0 ; Not enough to rotate
  4370. .\%m := \%1.999999 ; Initial compare string
  4371. for \%i 1 \%n 1 { ; Loop thru old logs
  4372. .\%f := \fnextfile() ; Get next file name
  4373. if llt \%f \%m .\%m := \%f ; If this one older remember it
  4374. }
  4375. delete \%m ; Delete the oldest one
  4376. }
  4377. log connections ; Now open the (possibly new) log
  4378. logrotate \v(home)CX.LOG ; Run the LOGROTATE macro
  4379. As you can see, this compares the yyyymm portion of the modification
  4380. date (\fdate()) of the given file (\%1) with the current yyyymm. If
  4381. they differ, the current file has the yyyymm suffix (from its most
  4382. recent modification date) appended to its name. Then we search through
  4383. all other such files, find the oldest one, and delete it. Thus the
  4384. current log, plus the logs from the most recent four months, are kept.
  4385. This is all done automatically every time you start C-Kermit.
  4386. On multiuser systems, it is possible to keep a single, shared,
  4387. system-wide connection log, but this is not recommended since (a) it
  4388. requires you keep a publicly write-accessible logfile (a glaring target
  4389. for mischief), and (b) it would require each user to log to that file
  4390. and not disable logging. A better method for logging connections, in
  4391. UNIX at least, is syslogging (seeckuins.txt Section 15 and
  4392. Section 4.2 of theIKSD Administration Guide for details).
  4393. 2.13. Automatic Connection-Specific Flow Control Selection
  4394. Beginning in C-Kermit 7.0, the appropriate flow-control method for each
  4395. connection type is kept in a table, for example:
  4396. Remote: NONE
  4397. Modem: RTS/CTS
  4398. Direct-Serial: NONE
  4399. TCPIP: NONE
  4400. The size of the table and values for each connection type can vary from
  4401. platform to platform. Type "set flow ?" for a list of available
  4402. flow-control types.
  4403. The table is used to automatically select the appropriate kind of flow
  4404. control whenever you make a connection. You can display the table with:
  4405. SHOW FLOW-CONTROL
  4406. The defaults are as follows:
  4407. Remote:
  4408. NONE or XON/XOFF. This is because C-Kermit is not allowed to
  4409. find out what type of connection the incoming user has (*). No
  4410. kind of flow control will work on every kind of connection,
  4411. including (unexpectedly) KEEP, which we would have liked to use,
  4412. but not turning off flow control at the remote end during file
  4413. transfer on TCP/IP connections is fatal to the transfer (except
  4414. in VMS and HP-UX, where it must be set to Xon/Xoff!) Therefore
  4415. if you are dialing in to a serial port on a server (UNIX or VMS)
  4416. where C-Kermit is running, you will need to tell C-Kermit to
  4417. "set flow keep" before transferring files (assuming the modem
  4418. and port are configured correctly by the system administrator;
  4419. otherwise you'll need to give a specific kind of flow control,
  4420. e.g. "set flow xon/xoff"), so in this case C-Kermit will not
  4421. disable flow control, as it must do when you are coming via
  4422. Telnet (directly or through a terminal server, except on VMS and
  4423. HP-UX).
  4424. Modem:
  4425. This applies when you dial out with a modem. In this case, the
  4426. MODEM FLOW-CONTROL setting takes affect after the SET FLOW
  4427. setting, so it can pick the most appropriate flow control for
  4428. the combination of the particular modem and the
  4429. computer/port/driver that is dialing.
  4430. Direct-Serial:
  4431. The default here is NONE because C-Kermit has no way of knowing
  4432. what kind of flow control, if any, is or can be done by the
  4433. device at the other end of the connection. RTS/CTS would be a
  4434. bad choice here, because if the CTS signal is not asserted, the
  4435. connection will hang. And since direct connections are often
  4436. made with 3-wire cables, there is a good chance the CTS signal
  4437. will not be received.
  4438. TCPIP:
  4439. NONE, since TCP and IP provide their own flow control
  4440. transparently to the application, except in VMS, where Xon/Xoff
  4441. is the default due to the requirements of the VMS TCP/IP
  4442. products.
  4443. Other networks:
  4444. NONE, since networks should provide their flow control
  4445. transparently to the application.
  4446. (*) This is possibly the worst feature of UNIX, VMS, and other
  4447. platforms where C-Kermit runs. If C-Kermit was able to ask the
  4448. operating system what kind of connection it had to the user, it could
  4449. set up many things for you automatically.
  4450. You can modify the default-flow-control table with:
  4451. SET FLOW-CONTROL /xxx { NONE, KEEP, RTS/CTS, XON/XOFF, ... }
  4452. where "xxx" is the connection type, e.g.
  4453. SET FLOW /REMOTE NONE
  4454. SET FLOW /DIRECT RTS/CTS
  4455. If you leave out the switch, SET FLOW works as before, choosing the
  4456. flow control method to be used on the current connection:
  4457. SET FLOW XON/XOFF
  4458. Thus, whenever you make a connection with SET PORT, SET LINE, DIAL, SET
  4459. HOST, TELNET, RLOGIN, etc, an appropriate form of flow control is
  4460. selected automatically. You can override the automatic selection with a
  4461. subsequent SET FLOW command, such as SET FLOW NONE (no switch
  4462. included).
  4463. The flow control is changed automatically too when you give a SET MODEM
  4464. TYPE command. For example, suppose your operating system (say Linux)
  4465. supports hardware flow control (RTS/CTS). Now suppose you give the
  4466. following commands:
  4467. set line /dev/ttyS2 ; Automatically sets flow to NONE
  4468. set modem type usr ; Automatically sets flow to RTS/CTS
  4469. set modem type rolm ; Doesn't support RTS/CTS so now flow is XON/XOFF
  4470. IMPORTANT: This new feature tends to make the order of SET LINE/HOST
  4471. and SET FLOW commands matter, where it didn't before. For example, in
  4472. VMS:
  4473. SET FLOW KEEP
  4474. SET LINE TTA0:
  4475. the SET LINE undoes the SET FLOW KEEP command; the sequence now must
  4476. be:
  4477. SET FLOW /DIRECT KEEP
  4478. SET LINE TTA0:
  4479. or:
  4480. SET LINE TTA0:
  4481. SET FLOW KEEP
  4482. 2.14. Trapping Connection Establishment and Loss
  4483. If you define a macro called ON_OPEN, it is executed any time that a
  4484. SET LINE, SET PORT, SET HOST, TELNET, RLOGIN or similar command
  4485. succeeds in opening a connection. The argument is the host or device
  4486. name (as shown by SHOW COMMUNICATIONS, and the same as \v(line)). This
  4487. macro can be used for all sorts of things, like automatically setting
  4488. connection- or host-specific parameters when the connection is opened.
  4489. Example:
  4490. def ON_OPEN {
  4491. switch \%1 {
  4492. :abccorp.com, set reliable off, break
  4493. :xyzcorp.com, set receive packet-length 1000, break
  4494. etc etc...
  4495. }
  4496. }
  4497. If you define a macro called ON_CLOSE, it will be executed any time
  4498. that a SET LINE, SET PORT, SET HOST, TELNET, RLOGIN or any other kind
  4499. of connection that C-Kermit has made is closed, either by the remote or
  4500. by a local CLOSE, HANGUP, or EXIT command or other local action, such
  4501. as when a new connection is opened before an old one was explicitly
  4502. closed.
  4503. As soon as C-Kermit notices the connection has been closed, the
  4504. ON_CLOSE macro is invoked at (a) the top of the command parsing loop,
  4505. or (b) when a connection is closed implicitly by a command such as SET
  4506. LINE that closes any open connection prior to making a new connection,
  4507. or (c) when C-Kermit closes an open connection in the act of exiting.
  4508. The ON_CLOSE macro was inspired by the neverending quest to unite
  4509. Kermit and SSH. In this case using the "tunnel" mechanism:
  4510. def TUNNEL { ; \%1 = host to tunnel to
  4511. local \%p
  4512. if not def \%1 stop 1
  4513. assign tunnelhost \%1 ; Make global copy
  4514. undef on_close
  4515. set macro error off
  4516. close connection ; Ignore any error
  4517. open !read tunnel start \%1
  4518. read \%p ; Get port number
  4519. if fail stop 1 Tunnel failure: \%1
  4520. close read
  4521. if fail stop 1 Tunnel failure: \%1 ; See Section 4.2.8.1
  4522. assign on_close { ; Set up close handler
  4523. echo Closing tunnel: \m(tunnelhost)
  4524. !tunnel stop \m(tunnelhost)
  4525. undef on_close
  4526. }
  4527. set host localhost:\%p /telnet
  4528. if success end 0
  4529. undef on_close
  4530. stop 1 Connection failure: \%1
  4531. }
  4532. In this case, when the connection stops, we also need to shut down the
  4533. tunnel, even if it is at a later time after TUNNEL has finished
  4534. executing. This way we can escape back, reconnect, transfer files, and
  4535. so on until the connection is broken by logging out from the remote, or
  4536. by explicitly closing it, or by EXITing from C-Kermit, at which time
  4537. the tunnel is shut down.
  4538. When the connection is closed, no matter how, the ON_CLOSE macro
  4539. executes and then undefines (destroys) itself, since we don't want to
  4540. be closing tunnels in the future when we close subsequent connections.
  4541. Other such tricks can be imagined, including ending ON_CLOSE with a
  4542. STOP command to force the command stack to be peeled all the way back
  4543. to the top, for example in a deeply nested script that depends on the
  4544. connection being open:
  4545. def on_close { stop 1 CONNECTION LOST }
  4546. When C-Kermit invokes the ON_CLOSE macro, it supplies one argument
  4547. (\%1): the reason the connection was closed as a number, one of the
  4548. following:
  4549. 2 - Fatal failure to negotiate a required item on a network connection.
  4550. 1 - Closed by C-Kermit command.
  4551. 0 - All others (normally closed by remote).
  4552. which may be used for any purpose; for example, to add a comment to the
  4553. connection log:
  4554. def on_close {
  4555. local \%m
  4556. if not open cx end 0
  4557. switch \%1 {
  4558. :0, .\%m = Closed by remote, break
  4559. :1, .\%m = Closed by me, break
  4560. :2, .\%m = Network protocol negotiation failure, break
  4561. }
  4562. if def \%m writeln cx {# \%m}
  4563. }
  4564. 2.15. Contacting Web Servers with the HTTP Command
  4565. C-Kermit 7.0 (at this writing, the UNIX version only) supports direct
  4566. contact and interaction with Web servers via HTTP 1.0 protocol. To make
  4567. a connection, use Kermit's normal method for making a TCP/IP
  4568. connection, but specify the HTTP port:
  4569. SET HOST host http [ switches ]
  4570. where host is the IP hostname or address, and http is the name of the
  4571. TCP port for the Web server. Relevant switches include:
  4572. /RAW
  4573. Treat the connection as a transparent binary pipe. This switch
  4574. may be required if a port other than 'http' is used.
  4575. /SSL
  4576. Make an secure private connection with SSL (only if SSL support
  4577. is included in your version of Kermit). In this case the port
  4578. name might need to be https rather than http, e.g. "set host
  4579. secureserver.xyzcorp.com https /ssl".
  4580. /TLS
  4581. Make an secure private connection with TLS (only if TLS support
  4582. is included in your version of Kermit). In this case the port
  4583. name would be https rather than http.
  4584. Then you can issue an HTTP command. In most cases, the server closes
  4585. the connection when the command is complete. Example:
  4586. SET HOST www.columbia.edu http
  4587. IF FAIL EXIT 1 Can't contact server
  4588. HTTP GET kermit/index.html
  4589. At this point the connection is closed, since that's how HTTP 1.0
  4590. works. If you want to perform additional operations, you must establish
  4591. a new connection with another SET HOST command.
  4592. The HTTP command acts as a client to the Web server, except instead of
  4593. displaying the results like a Web browser would, it stores them. Any
  4594. HTTP command can (but need not) include any or all of the following
  4595. switches:
  4596. /AGENT:user-agent
  4597. Identifies the client to the server; "C-Kermit" or "Kermit-95"
  4598. by default.
  4599. /HEADER:header-line
  4600. Used for specifying any optional headers. A list of headers is
  4601. provided using braces for grouping:
  4602. /HEADER:{{tag:value}{tag:value}...}
  4603. For a listing of valid tag value and value formats seeRFC
  4604. 1945: Hypertext Transfer Protocol -- HTTP/1.0. A maximum of
  4605. eight headers may be specified.
  4606. /USER:name
  4607. In case a page requires a username for access.
  4608. /PASSWORD:password
  4609. In case a page requires a password for access.
  4610. /ARRAY:arrayname
  4611. Tells Kermit to store the response headers in the given array,
  4612. one line per element. The array need not be declared in advance.
  4613. Example:
  4614. C-Kermit? http /array:c get kermit/index.html
  4615. C-Kermit? show array c
  4616. Dimension = 9
  4617. 1. Date: Fri, 26 Nov 1999 23:12:22 GMT
  4618. 2. Server: Apache/1.3.4 (Unix)
  4619. 3. Last-Modified: Mon, 06 Sep 1999 22:35:58 GMT
  4620. 4. ETag: "bc049-f72-37d441ce"
  4621. 5. Accept-Ranges: bytes
  4622. 6. Content-Length: 3954
  4623. 7. Connection: close
  4624. 8. Content-Type: text/html
  4625. As you can see, the header lines are like MIME e-mail header lines:
  4626. identifier, colon, value. The /ARRAY switch is the only method
  4627. available to a script to process the server responses for a POST or PUT
  4628. command.
  4629. The HTTP commands are:
  4630. HTTP [ switches ] GET remote-filename [ local-filename ]
  4631. Retrieves the named file. If a local-filename is given, the file
  4632. is stored locally under that name; otherwise it is stored with
  4633. its own name.
  4634. HTTP [ switches ] HEAD remote-filename local-filename
  4635. Like GET except without actually getting the file; instead it
  4636. gets only the headers, storing them into the given file, whose
  4637. name must be given, one line per header item, as shown above in
  4638. the /ARRAY: switch description.
  4639. HTTP [ switches ] INDEX remote-directory [ local-filename ]
  4640. Retrieves the file listing for the given server directory. NOTE:
  4641. This command is not supported by most Web servers.
  4642. HTTP [ switches ] POST [ /MIME-TYPE:type ] local-file remote-file
  4643. Used to send a response as if it were sent from a form. The data
  4644. to be posted must be read from a file.
  4645. HTTP [ switches ] PUT [ /MIME-TYPE:type ] local-file remote-file
  4646. Uploads a local file to a server file.
  4647. HTTP [ switches ] DELETE remote-filename
  4648. Instructs the server to delete the specified filename.
  4649. 3. TERMINAL CONNECTION
  4650. 3.1. CONNECT Command Switches
  4651. The following switches (see Section 1.5) were added to the CONNECT
  4652. command in 7.0:
  4653. /QUIETLY
  4654. Don't print the "Connecting to..." or "Back at..." messages. CQ
  4655. is an invisible command synonym for CONNECT /QUIETLY.
  4656. /TRIGGER:string
  4657. Specify a trigger or triggers ( Section 3.2) effective for
  4658. this CONNECT command only, temporarily overriding any current
  4659. SET TERMINAL TRIGGER values ( Section 3.2).
  4660. Note: Other switches might also be available; type "connect ?" for a
  4661. list, "help connect" for a description of each.
  4662. 3.2. Triggers
  4663. Triggers were added for UNIX, VMS, AOS/VS, and K95 in C-Kermit 7.0.
  4664. SET TERMINAL TRIGGER string
  4665. Tells C-Kermit to look for the given string during all
  4666. subsequent CONNECT sessions, and if seen, to return to command
  4667. mode automatically, as if you had escaped back manually. If the
  4668. string includes any spaces, you must enclose it in braces.
  4669. Example:
  4670. set terminal trigger {NO CARRIER}
  4671. Comparisons are made after character-set translation.
  4672. If a string is to include a literal brace character, precede it with a
  4673. backslash:
  4674. ; My modem always makes this noise when the connection is lost:
  4675. set terminal trigger |||ppp\{\{\{\{UUUUUUU
  4676. If you want Kermit to look for more than one string simultaneously, use
  4677. the following syntax:
  4678. set terminal trigger {{string1}{string2}...{stringn}}
  4679. In this case, C-Kermit will return to command mode automatically if any
  4680. of the given strings is encountered. Up to 8 strings may be specified.
  4681. If the most recent return to command mode was caused by a trigger, the
  4682. new variable, \v(trigger), shows the trigger value; otherwise
  4683. \v(trigger) is empty.
  4684. The SHOW TRIGGER command displays the SET TERMINAL TRIGGER values as
  4685. well as the \v(trigger) value.
  4686. 3.3. Transparent Printing
  4687. As noted in the manual, C-Kermit's CONNECT command on UNIX is not a
  4688. terminal emulator, but rather a "semitransparent pipe" between the
  4689. terminal or emulator you are using to access C-Kermit, and the remote
  4690. host to which C-Kermit is connected. The "semitransparent" qualifier is
  4691. because of character-set translation as well as several actions taken
  4692. by the emulator in response to the characters or strings that pass
  4693. through it, such as APCs, Kermit packets (autodownload), triggers, etc.
  4694. The UNIX version of C-Kermit 7.0 adds another such action: Transparent
  4695. printing, also called Controller printing (as distinct from Autoprint
  4696. or line or screen print). It is intended mainly for use on UNIX
  4697. workstation consoles (as opposed to remote logins), but with some care
  4698. can also be used when accessing C-Kermit remotely.
  4699. Transparent printing is related to APC by sharing C-Kermit's built-in
  4700. ANSI escape-sequence parser to detect "printer on" and "printer off"
  4701. sequences from the host. When the printer-on sequence is received, all
  4702. subsequent arriving characters -- including NUL, control characters,
  4703. and escape sequences -- are sent to the SET PRINTER device instead of
  4704. to your screen until the printer-off sequence is received, or you
  4705. escape back, whichever happens first. These bytes are not translated or
  4706. modified or filtered in any way by Kermit (except for possibly
  4707. stripping of the 8th bit, as noted below), but if filtering or
  4708. translation is desired, this can be accomplished by your SET PRINTER
  4709. selection (e.g. by choosing a pipeline of filters).
  4710. By default, your SET PRINTER device is your default UNIX printer, but
  4711. it can also be a file, a command, or the null device (which causes all
  4712. printer material to be discarded). SeeUsing C-Kermit, 2nd Ed.,
  4713. p.41 for details.
  4714. Transparent printing is controlled by the command:
  4715. SET TERMINAL PRINT { ON, OFF }
  4716. When ON, transparent-print sequences are obeyed, and printing
  4717. occurs on the system where C-Kermit is running. When OFF,
  4718. transparent print sequences are ignored and passed through to
  4719. your actual terminal or emulator, along with the data they
  4720. enclose. OFF is the default, for compatibility with earlier
  4721. C-Kermit releases. As noted in the manual, when the current SET
  4722. PRINTER device is a file, transparent-print material is appended
  4723. to it; the file is not overwritten.
  4724. SET TERMINAL BYTESIZE { 7, 8 }
  4725. SET PARITY { EVEN, ODD, MARK, SPACE, NONE }
  4726. If the terminal bytesize is 7, or PARITY is not NONE, the 8th
  4727. bit of each byte is stripped prior to printing.
  4728. The transparent-print escape sequences are:
  4729. <ESC>[5i
  4730. Printer On. Send all subsequent incoming bytes to the printer
  4731. without any kind of filtering, translation, or alteration. Note:
  4732. <ESC> stands for ASCII character number 27 (decimal), Escape.
  4733. <ESC>[4i
  4734. Printer Off. Resume displaying incoming bytes on the screen.
  4735. These are the same sequences used by DEC VT100 and higher terminals and
  4736. other ANSI X3.64 and ISO 6429 compatible terminals. There is no
  4737. provision for selecting other printer-control sequences.
  4738. Restrictions:
  4739. 1. You must SET TERM TRANSPARENT-PRINT ON before you can use this
  4740. feature.
  4741. 2. Only the 7-bit forms of the escape sequences are supported. The
  4742. 8-bit CSI C1 control is not recognized.
  4743. 3. Autoprint is not supported, since this requires a full-fledged
  4744. terminal emulator with direct access to the screen.
  4745. 4. The start-print and stop-print sequences pass through to the screen
  4746. (there is no way to avoid this without causing unacceptable delays
  4747. or deadlocks in CONNECT mode). Thus if your terminal or emulator
  4748. also supports transparent printing via these same sequences, an
  4749. empty file will be sent to its printer. Normally this has no
  4750. effect.
  4751. Point (4) is similar to the situation with autodownload and APC -- when
  4752. you have several Kermit clients in a chain, you should take care that
  4753. these features are enabled in only one of them.
  4754. Example 1:
  4755. set printer {|lpr -Plaser} ; Specify the printer (if not default).
  4756. set term print on ; Enable transparent printing.
  4757. set term byte 8 ; Enable 8-bit characters.
  4758. connect ; Enter CONNECT mode.
  4759. Example 2:
  4760. set printer /home/users/olga/printer.log ; Send printer material to a file.
  4761. Example 3:
  4762. set printer {| grep -v ^Received | lpr} ; Filter out some lines
  4763. Then use "pcprint" or "vtprint" commands on the host to initiate
  4764. transparent print operations. SeeUsing C-Kermit, 2nd Ed., p.406
  4765. for details.
  4766. Here is a sample "pcprint" shell script for UNIX:
  4767. #!/bin/sh
  4768. echo -n '<ESC>[5i'
  4769. if [ $# -eq 0 ]; then
  4770. cat
  4771. else
  4772. cat $*
  4773. fi
  4774. echo -n '<FF><ESC>[4i'
  4775. # (end)
  4776. (Replace "<ESC>" by the actual ASCII Escape character and "<FF>" by the
  4777. ASCII Formfeed character).
  4778. If you always want transparent printing enabled, put "set term print
  4779. on" in your C-Kermit customization file (~/.mykermrc in UNIX). The "set
  4780. term bytesize" selection, however, is a property of each separate
  4781. connection.
  4782. 3.4. Binary and Text Session Logs
  4783. C-Kermit 7.0 corrects an oversight in earlier releases, in which binary
  4784. session logs (SET SESSION-LOG BINARY) translated character sets and
  4785. performed various formatting transformations (e.g. "newline mode")
  4786. before writing characters to the session log. In C-Kermit 7.0,
  4787. binary-mode session logging writes characters as they come in, before
  4788. anything (other that parity-bit stripping) is done to them. Text-mode
  4789. session logging records the characters after processing.
  4790. 4. FILE TRANSFER
  4791. Every file is transferred either in text mode (which implies
  4792. record-format and character-set translation) or binary mode (in which
  4793. each byte is sent literally without any kind of conversion). The mode
  4794. in which a file is transferred is controlled by (a) the default mode,
  4795. in the absence of any other indications; (b) the SET FILE TYPE command;
  4796. (c) various automatic mechanisms based on client/server negotiations,
  4797. directory information or filename patterns, etc.
  4798. The default FILE TYPE was changed from TEXT to BINARY in C-Kermit 7.0
  4799. because:
  4800. * Transferring a text file in binary mode does less damage than
  4801. transferring a binary file in text mode.
  4802. * Only binary-mode transfers can be recovered from the point of
  4803. failure.
  4804. * The automatic transfer-mode mechanisms switch to text mode on a
  4805. per-file basis anyway, so only those files that are not covered by
  4806. the automatic mechanisms are affected.
  4807. * All file transfers on the Web are done in binary mode, so people
  4808. are accustomed to it and expect it.
  4809. 4.0. BUG FIXES, MINOR CHANGES, AND CLARIFICATIONS
  4810. 4.0.0. Filenames with Spaces
  4811. Filenames that contain spaces are a major nuisance to a program like
  4812. Kermit, whose command language is line- and word-oriented, in which
  4813. words are separated by spaces and a filename is assumed to be a "word".
  4814. In general (unless noted otherwise in the description of a particular
  4815. command), there is only one way to refer to such files in Kermit
  4816. commands, and that is to enclose the name in braces:
  4817. send {this file}
  4818. Tells Kermit to send the file whose name is "this file" (two words, no
  4819. quotes). Of course, various circumlocutions are also possible, such as:
  4820. define \%a this file
  4821. send \%a
  4822. BUT, perhaps contrary to expectation, you can't use "\32" to represent
  4823. the space:
  4824. send this\32file
  4825. does not work. Why? Because the Kermit parser, which must work on many
  4826. operating systems including Windows, has no way of knowing what you
  4827. mean by "this\32file". Do you mean a file whose name is "this file" in
  4828. the current directory? Or do you mean a file whose name is "32file" in
  4829. the "this" subdirectory of the current directory? Guessing won't do
  4830. here; Kermit must behave consistently and deterministically in all
  4831. cases on all platforms.
  4832. Note that you can't use Esc or Tab within {...} for filename
  4833. completion, or question mark to get a filename list. However, you can
  4834. include wildcards; for example:
  4835. send {* *}
  4836. sends all files whose name contains a space.
  4837. All things considered, it is best to avoid spaces in file and directory
  4838. names if you can. Also see Section 5.4 on this topic.
  4839. 4.0.1. Packet out of Window
  4840. C-Kermit 6.0 could send packets "out of window" if the window size was
  4841. greater than 1 and ACKs had arrived out of order. Fixed in 6.1.
  4842. 4.0.2. MOVE after ADD SEND-LIST
  4843. ADD SEND-LIST followed by MOVE did not delete original files; fixed in
  4844. 6.1. Carrier loss was not detected during transfer; in 7.0 C-Kermit
  4845. checks for this (but results can not be guaranteed). In any case, the
  4846. protocol will eventually time out if the connection is lost.
  4847. 4.0.3. GET and RECEIVE As-Names
  4848. In 5A(190) through 6.0.192, the GET and RECEIVE as-name did not
  4849. properly override the RECEIVE PATHNAMES setting. In 7.0 it does.
  4850. 4.0.4. New Brief Statistics Listing
  4851. Version 7.0 adds a /BRIEF switch to the STATISTICS command, to display
  4852. a short file-transfer statistics report. /BRIEF is now the default. Use
  4853. /VERBOSE to see the full display, which is about 25 lines long.
  4854. 4.0.5. Improved FAST Command
  4855. The preinstalled definition of the FAST macro did not take enough
  4856. factors into account. Now it sets packet lengths and window sizes
  4857. appropriate to the configuration. Furthermore, in IRIX only, it might
  4858. restrict the SEND packet length to 4000, to work around a bug in the
  4859. IRIX Telnet server, depending on the IRIX version (seeckubwr.txt,
  4860. IRIX section). To see the built-in definition of the FAST macro, type
  4861. "show macro fast". To change it, simply define it to be whatever you
  4862. want -- it's just a macro, like any other.
  4863. 4.0.6. The SET SEND BACKUP Command
  4864. Version 7.0 adds SET SEND BACKUP { ON, OFF }. This tells whether backup
  4865. files should be sent. Backup files are the ones created by Kermit (and
  4866. EMACS, and possibly other applications) to preserve old copies of files
  4867. when creating new ones with the same name. Kermit does this when
  4868. receiving a file and its FILE COLLISION setting is BACKUP (or RENAME,
  4869. in which case it the new file gets the backup name). On most platforms,
  4870. the backup name is formed by adding:
  4871. .~n~
  4872. to the end of the filename, where "n" is a number. For example, if the
  4873. original file is oofa.txt, a backup file might be called:
  4874. oofa.txt.~1~
  4875. (or oofa.txt.~2~, etc). If you SET SEND BACKUP OFF, this tells Kermit
  4876. not to send files that have backup names. Normally, SET SEND BACKUP is
  4877. ON (as shown by SHOW PROTOCOL), and backup files are sent if their
  4878. names match the SEND file specification.
  4879. Also see PURGE, SET FILE COLLISION, SEND /NOBACKUP, DIRECTORY
  4880. /[NO]BACKUP.
  4881. 4.0.7. The SET { SEND, RECEIVE } VERSION-NUMBERS Command
  4882. VMS Only. Normally when sending files, VMS C-Kermit strips the version
  4883. number. For example, if the file is FOO.BAR;34, the name is sent as
  4884. FOO.BAR (without the ";34"). If you want to keep version numbers on
  4885. when sending files, use SET SEND VERSION-NUMBERS ON. The effect depends
  4886. on the receiver.
  4887. Normally when receiving files, and an incoming filename includes a
  4888. VMS-style version number (such as FOO.BAR;34) VMS C-Kermit strips it
  4889. before trying to create the new file; this way the new file receives
  4890. the next highest version number in the customary manner for VMS. If you
  4891. want version numbers on incoming filenames to be used in creating the
  4892. new files, use SET RECEIVE VERSION-NUMBERS ON.
  4893. Normally these commands would be effective only when VMS C-Kermit is
  4894. exchanging files with a non-VMS Kermit program, since VMS-to-VMS
  4895. transfers use labeled mode unless you have gone out of your way to
  4896. defeat it.
  4897. Example: You want to send all versions of all files in the current
  4898. directory from a VMS C-Kermit client to a UNIX C-Kermit server. Use:
  4899. set send version-numbers on
  4900. send *.*;*
  4901. The resulting Unix files will have VMS-style version numbers as part of
  4902. their name, for example "foo.bar;1", "foo.bar;2", etc.
  4903. Now suppose you want to send these files from Unix to another VMS
  4904. system and preserve the version numbers. Again we have a Unix C-Kermit
  4905. server and VMS C-Kermit client. Give these commands to the client:
  4906. set receive version-numbers on
  4907. get *
  4908. 4.0.8. The SET { SEND, RECEIVE } { MOVE-TO, RENAME-TO } Commands
  4909. These commands are persistent global versions of the /MOVE-TO: and
  4910. /RENAME-TO: switches of the SEND, GET, and RECEIVE commands. They
  4911. should normally be used only when setting up a dedicated
  4912. transaction-processing application, in which each file is to be moved
  4913. or renamed immediately after, and only if, it is transferred
  4914. successfully, so that (for example) an independent, concurrent process
  4915. can notice when new files appear and process them immediately without
  4916. having to guess whether they are complete.
  4917. 4.0.9. SET FILE INCOMPLETE AUTO
  4918. SET FILE INCOMPLETE { KEEP, DISCARD }, which tells whether to keep or
  4919. discard incompletely received files, has a new option, AUTO, which is
  4920. also the default. It means KEEP the incomplete file if the transfer is
  4921. in binary mode, otherwise DISCARD it. This reduces the chances that a
  4922. subsequent recovery operation (RESEND, REGET, etc) could produce a
  4923. corrupt file, since recovery works only for binary-mode transfers.
  4924. 4.1. FILE-TRANSFER FILENAME TEMPLATES
  4925. File-transfer filename templates allow files to be renamed
  4926. automatically by the file sender, the receiver, or both, during
  4927. transfer of groups of files.
  4928. 4.1.1. Templates in the As-Name
  4929. Prior to C-Kermit 6.1 and Kermit 95 1.1.12 the only options that could
  4930. be used to affect the names of files being transferred were SET
  4931. FILENAMES { LITERAL, CONVERTED } and SET { SEND, RECEIVE } PATHNAMES {
  4932. ON, OFF }, plus the "as-name" feature of the SEND (MOVE, etc) and
  4933. RECEIVE commands.
  4934. Previously, the as-name could be used only for a single file. For
  4935. example:
  4936. SEND FOO BAR
  4937. would send the file FOO under the name BAR, but:
  4938. SEND *.TXT anything
  4939. was not allowed, since it would give the same name to each file that
  4940. was sent. When receiving:
  4941. RECEIVE FOO
  4942. would rename the first incoming file to FOO before storing it on the
  4943. disk, but subsequent files would not be renamed to FOO, since this
  4944. would result in overwriting the same file repeatedly. Instead, they
  4945. were stored under the names they arrived with.
  4946. Beginning in C-Kermit 6.1 and Kermit 95 1.1.12, it is possible to
  4947. specify as-names in SEND, RECEIVE, and related commands even for file
  4948. groups. This is accomplished by using replacement variables in the
  4949. as-name, along with optional material such character-string functions
  4950. and/or constant strings. An as-name containing replacement variables is
  4951. called a filename template.
  4952. The key to filename templates is the new variable:
  4953. \v(filename)
  4954. During file transfer it is replaced by the name of each file currently
  4955. being transferred (after transfer, it is the name of the last file
  4956. transferred).
  4957. So, for example:
  4958. send *.txt \v(filename).new
  4959. sends each file with its own name, but with ".new" appended to it. Of
  4960. course if the name already contains periods, this could confuse the
  4961. file receiver, so you can also achieve fancier effects with
  4962. constructions like:
  4963. send *.txt \freplace(\v(filename),.,_).new
  4964. which replaces all periods in the original filename by underscores, and
  4965. then appends ".new" to the result. So, for example, oofa.txt would be
  4966. sent as oofa_txt.new.
  4967. Another new variable that is useful in this regard is \v(filenumber),
  4968. which is the ordinal number of the current file in the file group, so
  4969. you can also:
  4970. send *.txt FILE\flpad(\v(filenum),2,0)
  4971. resulting in a series of files called FILE00, FILE01, FILE02, etc. (At
  4972. the end of the transfer, \v(filenum) tells the number of files that
  4973. were transferred).
  4974. If you specify a constant as-name when sending a file group:
  4975. send *.txt thisnameonly
  4976. Kermit complains and asks you to include replacement variables in the
  4977. as-name. You should generally use \v(filename) or \v(filenumber) for
  4978. this purpose, since other variables (with the possible exception of
  4979. date/time related variables) do not change from one file to the next.
  4980. But Kermit accepts any as-name at all that contains any kind of
  4981. variables for file group, even if the variable will not change. So:
  4982. send *.txt \%a
  4983. is accepted, but all files are sent with the same name (the value of
  4984. \%a, if it has one and it is constant). If the variable has no value at
  4985. all, the files are sent under their own names.
  4986. Of course, the value of \%a in the previous example need not be
  4987. constant:
  4988. define \%a FILE\flpad(\v(filenum),2,0)_at_\v(time)
  4989. send *.txt \%a
  4990. The RECEIVE command, when given without an as-name, behaves as always,
  4991. storing all incoming files under the names they arrive with, subject to
  4992. SET FILE NAME and SET RECEIVE PATHNAMES modifications (Section
  4993. 4.10).
  4994. However, when an as-name is given in the RECEIVE command, it is applied
  4995. to all incoming files rather than to just the first. If it does not
  4996. contain replacement variables, then the current FILE COLLISION setting
  4997. governs the result. For example:
  4998. receive foo
  4999. will result in incoming files named foo, foo.~1~, foo.~2~, and so on,
  5000. with the default FILE COLLISION setting of BACKUP. If it does contain
  5001. replacement variables, of course they are used.
  5002. When receiving files, the \v(filename) variable refers to the name that
  5003. was received in the incoming file-header packet, BEFORE any processing
  5004. by SET FILE NAMES or SET RECEIVE PATHNAMES. Since the filenames in
  5005. file-header packets are usually in uppercase, you would need to convert
  5006. them explicitly if you want them in lowercase, e.g.:
  5007. receive \flower(\v(filename)).new
  5008. 4.1.2. Templates on the Command Line
  5009. On the command-line, use templates as shown above as the -a option
  5010. argument, bearing in mind the propensity of UNIX and perhaps other
  5011. shells to treat backslash as a shell escape character. So in UNIX (for
  5012. example):
  5013. kermit -s oofa.* -a x.\\v(filenum)
  5014. By the way, this represents a change from 6.0 and earlier releases in
  5015. which the as-name (-a argument or otherwise) was not evaluated by the
  5016. command parser. Thus, for example, in VMS (where the shell does not
  5017. care about backslashes), it was possible to:
  5018. kermit -s oofa.txt -a c:\tmp\oofa.txt
  5019. Now backslashes in the as-name must be quoted not only for the shell
  5020. (if necessary) but also for Kermit itself:
  5021. kermit -s oofa.txt -a c:\\tmp\\oofa.txt ; Kermit only
  5022. kermit -s oofa.txt -a c:\\\\tmp\\\\oofa.txt ; Shell and Kermit
  5023. You can also use the \fliteral() function for this:
  5024. kermit -s oofa.txt -a \fliteral(c:\tmp\oofa.txt) ; Kermit only
  5025. kermit -s oofa.txt -a \\fliteral(c:\\tmp\\oofa.txt) ; Shell and Kermit
  5026. 4.1.3. Post-Transfer Renaming
  5027. Filename templates are now also useful in SET { SEND, RECEIVE }
  5028. RENAME-TO and in the /RENAME-TO: switch, that can be given to the SEND,
  5029. GET, or RECEIVE commands; this is similar to an as-name, but is
  5030. effective on a per-file basis if and only if the file was transferred
  5031. successfully.
  5032. MOVE-TO and RENAME-TO address a requirement commonly stated for
  5033. transaction processing and similar systems. Suppose, for example, a
  5034. central system "X" accepts connections from multiple clients
  5035. simultaneously; a process on X waits for a file to appear and then
  5036. processes the file. This process must have a way of knowing when the
  5037. file has been completely and successfully transferred before it starts
  5038. to process it. This can be accomplished easily using C-Kermit's SET {
  5039. SEND, RECEIVE } { MOVE-TO, RENAME-TO } command or /MOVE-TO: or
  5040. /RENAME-TO: switches, described inSections 4.7.1 through
  5041. 4.7.3.
  5042. Here's an example for the client side, in which files to be sent are
  5043. placed in a certain directory (/usr/olga/tosend in this example) by
  5044. another process when they are ready to go. This might be in a hospital
  5045. or big doctor's office, where medical insurance claims are entered at a
  5046. number of workstations, and then deposited in the "tosend" directory,
  5047. from which they are sent to a claims clearinghouse. We assume the
  5048. connection is already made and a Kermit server is on the other end.
  5049. local srcdir findir ; Declare local (automatic) variables
  5050. assign srcdir /usr/olga/tosend ; Local source directory (files to send)
  5051. assign findir /usr/olga/sent ; Where to move files after they are sent
  5052. log transactions ; Keep a log of transfers
  5053. cd \m(srcdir) ; Change to the source directory
  5054. while true { ; Loop forever...
  5055. send /move-to:\m(findir) * ; Send all files
  5056. sleep 60 ; Sleep a minute
  5057. } ; Go back and do it again
  5058. Note how simple this is. Once each file is sent, it is moved so it
  5059. won't be sent again (you could also use SEND /RENAME-TO: or even SEND
  5060. /DELETE). If a transfer fails, the file is not moved and so we try
  5061. again to send it next time around. If there are no files to send, the
  5062. SEND command does nothing but a message is printed; you can avoid the
  5063. message by checking first to see if any files are in the directory:
  5064. while true { ; Loop forever...
  5065. if > \ffiles(*) 0 - ; If there are any files
  5066. send /move-to:\m(findir) * ; send them.
  5067. sleep 60 ; Sleep a minute.
  5068. } ; Go back and do it again.
  5069. It's even simpler on the server side (here again we assume the
  5070. connection is already in place):
  5071. local rcvdir findir ; Declare local (automatic) variables
  5072. assign rcvdir /usr/ivan/tmp ; Temporary receiving directory
  5073. assign findir /usr/ivan/new ; Where to move files after reception
  5074. log transactions ; Keep a log of transfers
  5075. cd \m(rcvdir) ; Change to the source directory
  5076. set receive move-to \m(findir) ; Declare move-to directory.
  5077. server ; Enter server mode.
  5078. A separate process (e.g. the medical claim-form decoder) can look for
  5079. files appearing in the /usr/ivan/new directory and process them with
  5080. every confidence that they have been completely received.
  5081. Note that the use of MOVE-TO can result in moved files overwriting one
  5082. another (the application would normally avoid this by assigning each
  5083. transaction a unique, e.g. based on customer number and claim number).
  5084. But if filename collisions are a possibility in your application,
  5085. RENAME-TO might be a better choice; you can use any variables you like
  5086. in the template to ensure uniqueness of the RENAME-TO filename; for
  5087. example:
  5088. SET RECEIVE RENAME-TO \v(filename)_\v(ndate)_\v(ntime)_\v(userid)_\v(pid)
  5089. 4.2. FILE-TRANSFER PIPES AND FILTERS
  5090. 4.2.1. INTRODUCTION
  5091. Beginning in C-Kermit 6.1 and Kermit 95 1.1.12, it is possible to send
  5092. from a command, or "pipe", as well as from a file, and to receive to a
  5093. pipe or command. In a typical example, we might want to transfer an
  5094. entire directory tree from one UNIX system to another (but without
  5095. using the methods described inSections 4.3 ,4.10,
  5096. 4.11, and4.15). We could do this in multiple steps as
  5097. follows:
  5098. 1. Create a tar archive of the desired directory tree
  5099. 2. Compress the tar archive
  5100. 3. Transfer it in binary mode to the other computer
  5101. 4. Decompress it
  5102. 5. Extract the directory tree from the tar archive
  5103. But this is inconvenient and it requires a temporary file, which might
  5104. be larger than we have room for.
  5105. The new pipe-transfer feature lets you do such things in a single step,
  5106. and without intermediate files.
  5107. Additional new features, also discussed here, let you specify pre- and
  5108. post- processing filters for outbound and incoming files, and give you
  5109. a way to insert the output from shell or system commands into C-Kermit
  5110. commands.
  5111. The file-transfer related features are available only with Kermit
  5112. protocol, not with any external protocols, nor with K95's built-in
  5113. XYZMODEM protocols (because XYZMODEM recovers from transmission errors
  5114. by rewinding the source file, and you can't rewind a pipe).
  5115. This section begins by discussing the simple and straightforward use of
  5116. these features in UNIX, in which pipes and input/output redirection are
  5117. a fundamental component and therefore "just work", and then goes on to
  5118. discuss their operation in Windows and OS/2, where matters are much
  5119. more complicated.
  5120. 4.2.1.1. TERMINOLOGY
  5121. Standard Input
  5122. This is a precise technical term denoting the normal source of
  5123. input for a command or program, which is the keyboard of your
  5124. terminal by default, but which can be redirected to a file or
  5125. pipe.
  5126. Stdin
  5127. Abbreviation for Standard Input.
  5128. Standard Output
  5129. A precise technical term denoting the normal destination for
  5130. output from a command or program, which is your terminal screen
  5131. by default, but which can be redirected to a file.
  5132. Stdout
  5133. Abbreviation for Standard Output.
  5134. Stdio
  5135. Abbreviation for Standard Input / Standard Output.
  5136. I/O
  5137. Abbreviation for Input / Output.
  5138. Shell
  5139. Text-based system command processor, such as the UNIX shell, DOS
  5140. COMMAND.COM, etc.
  5141. Pipe
  5142. A mechanism by which the standard output of one program is sent
  5143. to the standard input of another.
  5144. Pipeline
  5145. A series of programs connected by pipes.
  5146. 4.2.1.2. NOTATION
  5147. In command descriptions, "command" is replaced by a shell or system
  5148. command or pipeline. The command names specified in these commands are
  5149. interpreted by your shell, just as if you were typing them at the shell
  5150. prompt, and so if they are in your PATH, they will be found in the
  5151. expected manner. Therefore you don't have to specify complete pathnames
  5152. for commands that are programs (but it shouldn't hurt if you do).
  5153. The normal notation for I/O redirection is as follows:
  5154. < Read Stdin from the given file.
  5155. > Send Stdout to the given file.
  5156. | Send Stdout from the command on the left to the command on the right.
  5157. Examples:
  5158. sort < foo > bar
  5159. Sorts the lines in file "foo" and writes the results to file
  5160. "bar"
  5161. grep -c "some text" *.txt | grep -v ":0" | sort | pr -3 | lpr
  5162. This is a command pipeline composed of 5 commands:
  5163. grep -c "some text" *.txt
  5164. Looks in all files whose names end with ".txt" for the string
  5165. "some text" and writes to Stdout the names of each file followed
  5166. by a colon and the number of occurrences in each.
  5167. grep -v ":0"
  5168. Prints to Stdout the lines from Stdin that do NOT contain the
  5169. string ":0", in this case, it removes the names of files that do
  5170. not contain "some text".
  5171. sort
  5172. Sorts the lines from Stdin alphabetically to Stdout.
  5173. pr -3
  5174. Arranges the lines from Stdin in three columns.
  5175. lpr
  5176. Prints its Stdin on the default printer.
  5177. Note that the Kermit features described here work only with commands
  5178. that use Stdio. If you attempt to use them with commands whose input
  5179. and output can not be redirected, Kermit will most likely get stuck.
  5180. Kermit has no way of telling how an external command works, nor what
  5181. the syntax of the shell is, so it's up to you to make sure you use
  5182. these features only with redirectable commands.
  5183. The quoting rules of your shell apply to the command. Thus in UNIX,
  5184. where C-Kermit tries to use your preferred shell for running commands,
  5185. shell "metacharacters" within commands must be escaped if they are to
  5186. be taken literally, using the methods normal for your shell. For
  5187. example, the UNIX tr (translate) command must have its arguments in
  5188. quotes:
  5189. tr "[a-z]" "[A-Z]"
  5190. otherwise the shell is likely to replace them by all filenames that
  5191. match, which is probably not what you want. This is also true when
  5192. using your shell directly, and has nothing to do with Kermit.
  5193. 4.2.1.3. SECURITY
  5194. Some sites might not wish to allow access to system commands or
  5195. external programs from within Kermit. Such access, including all the
  5196. features described here, can be disabled in various ways:
  5197. 1. When building from source code, include -DNOPUSH among the CFLAGS.
  5198. 2. At runtime, give the NOPUSH command.
  5199. 3. For server mode, give the DISABLE HOST command.
  5200. 4. Implicit use of pipes can be disabled as described inSection
  5201. 4.2.4.
  5202. Note: 3 and 4 are not necessary if you have done 1 or 2.
  5203. 4.2.2. Commands for Transferring from and to Pipes
  5204. SEND /COMMAND sends data from a command or command pipeline, and
  5205. RECEIVE /COMMENT writes data to a command or pipeline. The GET /COMMAND
  5206. command asks a server to send material, and then writes the incoming
  5207. material to a command or pipeline. These features, along with switches
  5208. (like "/COMMAND", described in Section 4.7) are new to C-Kermit
  5209. 6.1. The following synonyms are also provided:
  5210. CSEND = SEND /COMMAND
  5211. CRECEIVE = RECEIVE /COMMAND
  5212. CGET = GET /COMMAND
  5213. None of these commands can be used if a SEND or RECEIVE FILTER
  5214. (respectively, Section 4.2.3) is in effect, or if a NOPUSH command
  5215. ( Section 4.2.1.3) has been given, or if the current protocol is
  5216. not Kermit.
  5217. 4.2.2.1. Sending from a Command
  5218. SEND /COMMAND command [ as-name ]
  5219. SEND /AS-NAME:as-name /COMMAND command
  5220. CSEND command [ as-name ]
  5221. These three forms are the same. They work like the SEND command,
  5222. but instead of sending a file, it sends the standard output of
  5223. the given command, either under the command's own name, or else
  5224. with the given as-name. If the command contains spaces, it must
  5225. be enclosed in braces. Braces should also be used for the
  5226. as-name if it contains spaces. If braces are included around
  5227. either the command or the as-name, they are removed after
  5228. parsing but before use. As with SEND, the transfer is in text or
  5229. binary mode according the current FILE TYPE setting, unless you
  5230. override the global transfer mode by including a /TEXT or
  5231. /BINARY switch. The command must require no input.
  5232. When sending from a command or pipeline, C-Kermit has no way of knowing
  5233. in advance how much data will be sent, and so it can not send the size
  5234. to the other Kermit in the Attribute packet, and so the receiving
  5235. Kermit has no way of displaying "percent done" or a progress bar
  5236. (thermometer).
  5237. Examples that make sense in text mode (illustrated by common UNIX
  5238. commands):
  5239. SEND /COMMAND finger
  5240. CSEND finger
  5241. sends the current "finger" listing (who's logged in) under the
  5242. name "finger". The two forms "send /command" and "csend" are
  5243. equivalent; we won't bother showing them both in the rest of the
  5244. examples.
  5245. SEND /COMMAND:{finger}
  5246. CSEND {finger}
  5247. Same as previous example (braces are removed from "{finger}").
  5248. SEND /COMMAND:{ finger }
  5249. CSEND { finger }
  5250. Same as previous example, but note that the spaces are kept.
  5251. This does not prevent the shell from running the "finger"
  5252. program, but its output is sent under the name " finger " (with
  5253. a leading and trailing space).
  5254. SEND /COMMAND:finger /AS-NAME:userlist
  5255. CSEND finger userlist
  5256. sends the current finger listing under the name "userlist".
  5257. SEND /COMMAND:{finger | sort -r} /AS-NAME:userlist
  5258. CSEND {finger | sort -r} userlist
  5259. sends the current finger listing, sorted in reverse order, under
  5260. the name "userlist". The braces are needed to distinguish the
  5261. command from the as-name.
  5262. SEND /COMMAND:{finger | sort -r} /AS-NAME:{userlist}
  5263. CSEND {finger | sort -r} {userlist}
  5264. Same as previous example (braces are removed from "{userlist}").
  5265. SEND /COMMAND:{finger | sort -r}
  5266. /AS-NAME:{\freplace(\v(filename),\32,_)}
  5267. CSEND {finger | sort -r} {\freplace(\v(filename),\32,_)}
  5268. Like the previous example, but sends the output of the command
  5269. under the name of the command, but with all spaces (\32)
  5270. replaced by underscores, so the as-name is "finger_|_sort_-r".
  5271. Examples that make sense in binary mode (three equivalent forms are
  5272. shown):
  5273. SEND /COMMAND /BINARY {tar cf - . | gzip -c} mydir.tar.gz
  5274. SEND /COMMAND /BINARY /AS-NAME:mydir.tar.gz {tar cf - . | gzip -c}
  5275. CSEND /BINARY {tar cf - . | gzip -c} mydir.tar.gz
  5276. Makes a tar archive of the current directory, compresses it with
  5277. the GNU gzip program, and sends it as "mydir.tar.gz". The other
  5278. Kermit can, of course, just store it as a file, or it can use
  5279. CRECEIVE to uncompress and dearchive it as part of the transfer
  5280. process.
  5281. When using a "pipeline" of commands in the command field, obviously,
  5282. the first command must not require any input, and the last command
  5283. should produce some output, and all intermediate commands should get
  5284. some input and produce some output.
  5285. 4.2.2.2. Receiving to a Command
  5286. RECEIVE /COMMAND command
  5287. CRECEIVE command
  5288. This is like RECEIVE, except incoming material is written to the
  5289. standard input of the given command, in text or binary mode
  5290. according to the normal rules for file reception. Be sure to
  5291. include a redirector to a file (if the command normally writes
  5292. to standard output), or the output of the command won't go
  5293. anywhere. The command may contain spaces; braces are not needed,
  5294. but they are removed if used.
  5295. WARNING: C-Kermit has no way of knowing anything about the command, or
  5296. even whether it is a command. Thus this command will always cause
  5297. C-Kermit to enter protocol mode, as long as some text is specified in
  5298. the command field. However, if the text does not correspond to a
  5299. command, the transfer will eventually fail with a message such as
  5300. "Error writing data" or "Failure to close file".
  5301. Examples for text mode (in UNIX):
  5302. RECEIVE /COMMAND sort -r > reverse.txt
  5303. CRECEIVE sort -r > reverse.txt
  5304. The text that is received is sorted in reverse order and stored
  5305. in the file "reverse.txt". The two forms shown are equivalent.
  5306. RECEIVE /COMMAND {sort -r > reverse.txt}
  5307. CRECEIVE {sort -r > reverse.txt}
  5308. The same as the previous example; if braces are included, they
  5309. are simply removed.
  5310. RECEIVE /COMMAND {sort -r > \flower(\v(filename)).reverse}
  5311. CRECEIVE {sort -r > \flower(\v(filename)).reverse}
  5312. Same but stores result under the incoming filename, lowercased,
  5313. and with ".reverse" appended to it.
  5314. RECEIVE /COMMAND sort
  5315. CRECEIVE sort
  5316. Does nothing useful, since the output of sort has nowhere to go.
  5317. RECEIVE /COMMAND sort -r | pr -3 | lpr -Plaserjet
  5318. CRECEIVE sort -r | pr -3 | lpr -Plaserjet
  5319. The text that is received is sorted in reverse order, arranged
  5320. into three columns, and sent to the "laserjet" printer.
  5321. Examples for binary mode:
  5322. RECEIVE /COMMAND:{gunzip -c | tar xf -}
  5323. CRECEIVE {gunzip -c | tar xf -}
  5324. Assuming the data that is received is a compressed tar archive,
  5325. uncompresses the archive and passes it to tar for extraction. In
  5326. this case the braces are needed because otherwise the final "-"
  5327. would be taken as a command continuation character (see
  5328. Using C-Kermit, 2nd Edition, p.33).
  5329. GET /COMMAND remote-file command
  5330. GET /COMMAND /AS-NAME:command remote-file
  5331. CGET remote-file command
  5332. This command tells the Kermit client to send a GET request for
  5333. the given remote file to a Kermit server. Unlike GET, however,
  5334. the incoming material is written to a command, rather than to a
  5335. file. If the remote-file or the command contain spaces, they
  5336. must be enclosed in braces. The same cautions about the command
  5337. apply as for CRECEIVE.
  5338. Examples (for UNIX):
  5339. GET /COMMAND oofa.txt sort -r > oofa.new
  5340. GET /COMMAND {oofa.txt} {sort -r > oofa.new}
  5341. CGET oofa.txt sort -r > oofa.new
  5342. CGET {oofa.txt} {sort -r > oofa.new}
  5343. These four are equivalent. Each of them requests the server to
  5344. send its "oofa.txt" file, and as it arrives, it is sorted in
  5345. reverse order and written to "oofa.new".
  5346. GET /COMMAND {profile exec a} lpr
  5347. GET /COMMAND {profile exec a} {lpr}
  5348. GET /COMMAND /AS-NAME:lpr {profile exec a}
  5349. GET /COMMAND /AS-NAME:{lpr} {profile exec a}
  5350. GET /COMMAND /AS:lpr {profile exec a}
  5351. CGET {profile exec a} lpr
  5352. CGET {profile exec a} {lpr}
  5353. Here the remote filename contains spaces so it MUST be enclosed
  5354. in braces. As it arrives it is sent to the lpr program for
  5355. printing. Braces are optional around "lpr" since it contains no
  5356. spaces.
  5357. GET /COMMAND *.txt {cat >> new.txt}
  5358. GET /AS-NAME:{cat >> new.txt} /COMMAND *.txt
  5359. CGET *.txt {cat >> new.txt}
  5360. This gets all the ".txt" files from the server and concatenates
  5361. them all into a single "new.txt" file on the client.
  5362. GET /COMMAND *.txt {echo \v(filename)>>new.txt;cat>>new.txt}
  5363. CGET *.txt {echo \v(filename)>>new.txt;cat>>new.txt}
  5364. As above, but inserts each file's name before its contents.
  5365. 4.2.3. Using File-Transfer Filters
  5366. The commands described in Section 4.2.2 let you send the output of
  5367. a command, or receive data into a command. But what if you want to
  5368. specify preprocessing for files that you send, or postprocessing of
  5369. files that you receive, even when multiple files are involved? For this
  5370. you need a way to specify send and receive filters. The commands are
  5371. SET SEND FILTER and SET RECEIVE FILTER; SHOW PROTOCOL displays the
  5372. current settings.
  5373. 4.2.3.1. The SEND Filter
  5374. SET SEND FILTER [ command ]
  5375. This command specifies a command to be run on any file that you
  5376. SEND (or MOVE, MSEND, etc). It also applies to files sent when
  5377. in server mode, in response to GET commands, but not to the
  5378. results of REMOTE commands like REMOTE DIRECTORY, REMOTE TYPE,
  5379. REMOTE HOST, etc. The command may be, but need not be, enclosed
  5380. in braces; if it is, the braces are stripped before use. The
  5381. output of this command is sent, rather than the file itself. The
  5382. current FILE TYPE setting (TEXT or BINARY) applies to the output
  5383. of the command. The command must contain at least one instance
  5384. of \v(filename), for which the name of the actual file is
  5385. substituted. If the command is omitted, the send filter is
  5386. removed and files are sent in the normal manner.
  5387. The SET SEND FILTER sets up a "global" filter -- that is, one that
  5388. applies to all subsequent file-sending commands until you change or
  5389. remove it. You can also specify a "local" filter to be used in a
  5390. specific file-sending command by using the /FILTER switch (see
  5391. Section 1.5); for example:
  5392. SEND /FILTER:command [ other-switches ] filename
  5393. Besides \v(filename), you can include any other script programming
  5394. notation in the send filter: variable names, array references, calls to
  5395. built-in string or other functions, and so on. These are evaluated
  5396. during file transfer, NOT during parsing, and they are evaluated
  5397. separately for each file.
  5398. When the SEND or MOVE (SEND /DELETE) command is used with a send
  5399. filter, the output from the filter is sent under the file's original
  5400. name unless you specify an "as-name" or template. The Attribute packet
  5401. (if any) contains the original file's attributes (size, creation date,
  5402. etc). So (for example) if the filter changes the file's size, the
  5403. progress thermometer might be wrong. (We can't send the size of the
  5404. output from the filter, because it is not known until the transfer is
  5405. finished.) If you prefer that the size not be sent, use "set attributes
  5406. size off".
  5407. You can not use send filters with RESEND (SEND /RECOVER) or PSEND (SEND
  5408. /START).
  5409. Examples for text mode:
  5410. SET SEND FILTER sort -r \v(filename) ; Braces may be omitted
  5411. SET SEND FILTER {sort -r \v(filename)} ; Braces may be included
  5412. SEND *.txt
  5413. This sends every file in the current directory whose name ends
  5414. with ".txt" under its own name, but with its lines sorted in
  5415. reverse order.
  5416. SEND /FILTER:{sort -r \v(filename)} *.txt
  5417. Same as above, but the filter applies only to this SEND command.
  5418. Braces are required in this case.
  5419. SET SEND FILTER {sort -r \v(filename)}
  5420. SEND oofa.txt reverse.txt
  5421. Sends the oofa.txt file with its lines sorted in reverse order
  5422. under the name "reverse.txt".
  5423. SET SEND FILTER {sort -r \v(filename)}
  5424. SEND oofa.* \v(filename).reverse
  5425. Sends all the oofa.* files with their lines sorted in reverse
  5426. order; each file is sent under its own name but with ".reverse"
  5427. appended to it.
  5428. SET SEND FILTER {tr "[a-z]" "[A-Z]" < \v(filename)}
  5429. SEND *.txt
  5430. Sends all ".txt" files under their own names, but uppercasing
  5431. their contents.
  5432. Note that the SEND FILTER applies not only to files that are sent with
  5433. SEND, MOVE, MSEND, etc, but also to files sent by the C-Kermit server
  5434. in response to GET requests.
  5435. Examples for binary mode:
  5436. SET SEND FILTER {gzip -c \v(filename)}
  5437. SEND /BINARY oofa.txt oofa.txt.gz
  5438. Sends the oofa.txt file, compressed by gzip, as oofa.txt.gz.
  5439. SEND /BINARY /FILTER:{gzip -c \v(filename)} oofa.txt oofa.txt.gz
  5440. As above, but the filter applies only to this SEND command.
  5441. SET SEND FILTER {gzip -c \v(filename)}
  5442. SEND /BINARY oofa.* \fupper(\replace(\v(filename),.,_)).GZ
  5443. Sends all the oofa.* files, compressed by gzip, each under its
  5444. own name, but with the name uppercased, all periods within the
  5445. name converted to underscores, and ".GZ" appended to it. So, for
  5446. example, "oofa.txt" is sent as "OOFA_TXT.GZ".
  5447. In the gzip examples, note that the amount of data that is sent is
  5448. normally less than the original file size because gzip compresses the
  5449. file. But Kermit sends the original file size ahead in the attribute
  5450. packet anyway (unless you tell it not too). Thus the transfer will
  5451. probably appear to terminate early, e.g. when the receiver's
  5452. file-transfer display thermometer is only at 40%. If this annoys you,
  5453. tell Kermit to "set attribute length off". On the other hand, you can
  5454. use the final position of the thermometer as a measure of the
  5455. effectiveness of compression.
  5456. 4.2.3.2. The RECEIVE Filter
  5457. SET RECEIVE FILTER [ command ]
  5458. This command specifies that the given command will be run on any
  5459. file that is received before it is written to disk. The command
  5460. may be, but need not be, enclosed in braces; if it is the braces
  5461. are stripped before use. The following two commands are
  5462. equivalent:
  5463. SET RECEIVE FILTER sort -r > \v(filename)
  5464. SET RECEIVE FILTER {sort -r > \v(filename)}
  5465. The RECEIVE filter command may contain a "\v(filename)" sequence to be
  5466. replaced by the incoming filename from the file header packet, but it
  5467. is not required. However you must use it whenever your filter would
  5468. normally write to Stdout, otherwise its output will be lost.
  5469. The RECEIVE filter command may contain one or more "\v(filename)"
  5470. sequence to be replaced by the incoming filename from the file header
  5471. packet, but it is not required. However you must use it whenever your
  5472. filter would normally write to Stdout, otherwise its output will be
  5473. lost.
  5474. RECEIVE /FILTER:command and GET /FILTER:command can also be used to
  5475. specify a filter to be used for only one file-transfer operation.
  5476. UNIX examples for text mode:
  5477. SET RECEIVE FILTER lpr
  5478. RECEIVE
  5479. All the files that are received are sent to the default UNIX
  5480. print spooler.
  5481. RECEIVE /FILTER:lpr
  5482. Same as above, except the lpr filter is used only with this
  5483. RECEIVE command.
  5484. RECEIVE lpr
  5485. This is probably not what you want; it creates a file called
  5486. lpr.
  5487. SET RECEIVE FILTER {sort -r > \v(filename)}
  5488. RECEIVE
  5489. Stores each incoming file with its lines sorted in reverse
  5490. order, under its own name.
  5491. RECEIVE /FILTER:{sort -r > \v(filename)}
  5492. As above, but the filter is used only for this RECEIVE command.
  5493. SET RECEIVE FILTER sort -r > \v(filename)
  5494. RECEIVE reverse.txt
  5495. Stores each incoming file with its lines sorted in reverse
  5496. order, under the name "reverse.txt". The actual result depends
  5497. on the FILE COLLISION setting. If it is OVERWRITE and multiple
  5498. files arrive, then each incoming file destroys the previous one.
  5499. If it is BACKUP (the default), filename conflicts are resolve by
  5500. adding "version numbers" to the filenames: reverse.txt,
  5501. reverse.txt.~1~, reverse.txt.~2~, etc.
  5502. SET RECEIVE FILTER sort -r > \v(filename)
  5503. RECEIVE \v(filename).reverse
  5504. Stores each incoming file with its lines sorted in reverse
  5505. order, under the name it arrived with, but with ".reverse"
  5506. appended to it.
  5507. SET RECEIVE FILTER sort -r > \v(filename)
  5508. RECEIVE \flower(\v(filename)).reverse
  5509. Like the previous example, but ensures that the filename is
  5510. lowercase.
  5511. Examples for binary mode:
  5512. SET RECEIVE FILTER gunzip -c > \v(filename)
  5513. RECEIVE
  5514. This receives one or more presumably compressed file and
  5515. uncompresses each one into a file having the same name it was
  5516. sent with. For example, if the file is sent with the name
  5517. OOFA.TXT.GZ, it is stored with that name, even after
  5518. decompression.
  5519. SET RECEIVE FILTER gunzip -c > \v(filename)
  5520. RECEIVE \flower(\fsubstring(\v(filename),1,\flength(\v(filename))-3))
  5521. Like the previous example, but the resulting filename has its
  5522. rightmost three characters removed from it and the remainder is
  5523. lowercased. So if the incoming filename is OOFA.TXT.GZ, it is
  5524. stored as oofa.txt after decompression.
  5525. Of course you don't want to type such long hideous commands, so we have
  5526. also introduced several new functions:
  5527. \fstripx(string[,character])
  5528. This function removes the rightmost segment of the string that
  5529. starts with the given character. If no character is given,
  5530. period (.) is used. Thus it is most conveniently used for
  5531. stripping the extension from a filename (or the decimal portion
  5532. from a floating-point number written in US/UK style). Examples:
  5533. \fstripx(OOFA.TXT.GZ) => OOFA.TXT
  5534. \fstripx(OOFA.TXT.GZ,.) => OOFA.TXT
  5535. \fstripx(OOFA.TXT.GZ,X) => OOFA.T
  5536. \fstripx(\fstripx(OOFA.TXT.GZ)) => OOFA
  5537. \fstripx($100.00) => $100
  5538. \fstripn(string,number)
  5539. Removes the rightmost number characters from the string.
  5540. Examples:</