⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 doc.me

📁 通讯程序源码
💻 ME
📖 第 1 页 / 共 5 页
字号:
CHG_DIR directory.brChange the current working directory to the given directory..sp.ti -0.5iHANG_UP.brHang up the phone, but remain in Pcomm..sp.ti -0.5iPRINTER [ ON | OFF ].brControl the logging of data to the printer..sp.ti -0.5iMODEM_BREAK.brSend a modem break to the remote system.  This is typically used totell the remote to switch to a different baud rate..sp.ti -0.5iSEND protocol filename.brSend a file to the remote.  The valid protocols are XMODEM, XMODEM_1K,MODEM7, YMODEM, YMODEM_G, ASCII, EXT_1, EXT_2, and EXT_3..sp.ti -0.5iRECEIVE protocol filename.brReceive a file from the remote.  The valid protocols are XMODEM,XMODEM_1K, MODEM7, YMODEM, YMODEM_G, ASCII, EXT_1, EXT_2, and EXT_3..sp.ti -0.5iSCREEN_DUMP.brDump the current contents of the screen to the DUMPFILE.  If the filealready exists, the new contents are appended to the file..sp.ti -0.5iDATA_LOG [ ON | OFF ].brControl logging of the terminal session to the LOGFILE.  If the filealready exists, the new contents are appended to the file..in.sh 2 "Waitfor command".(x  \*($n Waitfor command.)x.lpThe waitfor command has the following syntax:.sp.in +0.5iwaitfor \-n string.in.lpwhere \*(lqn\*(rq is the number of seconds to wait and \*(lqstring\*(rqis the string to wait for..lpWaitfor returns a 0 if the string was found, a 1 if it didn't find thestring within the allotted time, and a \-1 if there was an error.Waitfor returns immediately if the string is found..lpThe waitfor command would typically be used in a script to indicate thatthe desired prompt has appeared.  For example:.sp.in +0.5i.CS.(b Lwaitfor \-5 "ogin:"if [ "$?" \-eq 0 ]then.in +0.5iecho "egray".infi.)b.Cs.in.lpwould wait up to 5 seconds for the string \*(lqogin:\*(rq.  If thereturn code is 0 (the strings did appear), send the string\*(lqegray\*(rq (my user ID)..lp.ft INOTE:\ \ Upper and lower case letters are considered different.  If youare not sure if the prompt is \*(lqLogin:\*(rq or \*(lqlogin:\*(rq, thenskip the first letter in the string and use \*(lqogin:\*(rq..ft .sh 2 "Matches command".(x  \*($n Matches command.)x.lpThe matches command has the following syntax:.in +0.5i.spmatches string1 string2.in.lpMatches returns a 0 if string2 is contained in string1, and returns a 1if it does not.  Unlike waitfor, the matches command does not read theTTY port..lpThe matches command could be used to test string values such as:.sp.in +0.5i.CS.(b Lread junkmatches $junk "login failed"if [ "$?" \-eq 0 ]then.in +0.5iexit.infi.)b.Cs.in.sh 2 "Examples".(x  \*($n Examples.)x.lpIt is not my intention to teach the reader the fundamentals of Unixshell programming.  There are several good books on the subjectavailable in stores..lpRemember to add execute permission to the file and remove the readpermission to all others..lp.(b LThe simplest auto-login script may contain the following:.sp.in +0.5i.CS# send a <CR>echo ""# wait 5 seconds for the login promptwaitfor \-5 ogin:# send my user IDecho "egray"# wait 5 seconds for the password promptwaitfor \-5 assword:# send my passwordecho "abcdefg"# return to Pcommexit 0.Cs.)b.in.lp.(b LA more complex script is required if the user must send a modem break tosynchronize the baud rate of the remote.  For example:.sp.in +0.5i.CSecho ""try=0# loop until donewhile truedo.in +0.5i# wait 5 seconds for the login promptwaitfor \-5 ogin:# test the exit code of the waitfor commandif [ "$?" \-eq 0 ]then.in +0.5i# send my user ID and exit the loopecho "egray"break.infi.sp# increment the number of attemptstry=\`expr $try + 1\`# test to see if we should give upif [ "$try" \-eq 5 ]then.in +0.5iexit 1.infi.sp# send a modem break and loop againpcomm_cmd modem_breakecho "".in 0.5idone# wait 5 seconds for the password promptwaitfor \-5 assword:# test the return code from waitforif [ "$?" \-eq 0 ]then.in +0.5i# send my passwordecho "abcdefg".inelse.in +0.5iexit 1.infi# return to Pcommexit 0.Cs.)b.in 0.lp.(b LThe following is an example of a shell script that will dial a system,log a user on, transfer a file called junk using xmodem, log out, andexit Pcomm..sp.in +0.5i.CS# are we already connected?answer=`pcomm_cmd if connected`if [ "$answer" -eq 0 ]then.in +0.5i# dial entry number 23 in my dialing directorypcomm_cmd dial 23.in -0.5ifi# wait for the login promptwaitfor ogin:# send my user idecho egray# wait for the password promptwaitfor assword:# send my passwordecho abcdefg# wait for a Unix promptwaitfor $# start up an xmodem file transferecho sx junk# wait for the sx command to say its readywaitfor nowsleep 1# do a file transferpcomm_cmd receive xmodem junk# wait for the promptwaitfor $# log me outecho "^D"sleep 1# exit pcommpcomm_cmd exit.Cs.)b.in 0.bp.if e \{.ep.bp\}.uh "Appendix A \- Typical Modem Configuration".(x .)x _.(xAppendix A \- Typical Modem Configuration.)x.lpI can't begin to describe how to configure every modem to work withPcomm.  There are, however, several guidelines that will apply tovirtually any modem..ba +0.5i.lp1) Pcomm doesn't care about the DCD (Data Carrier Detect) settings ofthe modem..lp2) It would be nice (but not essential) if the loss of the DTR (DataTerminal Ready) caused the modem to hang up..lp3) Pcomm doesn't care if commands are echoed back by the modem (it mightsave a few milliseconds if echoing was turned off)..lp4) Some sort of result codes are required.  Numeric result codes areok...  but since they are displayed on the screen, word result codeswill make more sense..lp5) If the modem can return different result codes for each baud rate atwhich it answers, then by all means, use them.  Match the odd-ballcodes (such as CONNECT FAST for Telebit PEP) to the closet matching speed..lp6) Anything that is returned by the modem, but not listed in the modemsetup, is ignored..lp7) Systems running older versions of uugetty (the bi-directional versionof getty that comes with HDB uucp) may require extra commands in theinitialization string to assure that uugetty switches to its dial outmode.  Normally, \*(lqAT!~AT!~\*(rq causes enough dialogue to forceuugetty to release the line..ba.lpFor example, a 2400 baud Hayes compatible modem might be configured withthe following command:.sp.in +0.5i.nfAT\ S7=60\ S11=70\ E0\ Q0\ V1\ X4\ &D2.fi.in +0.5i.(b L.TSl l.AT	Hayes attention commandS7=60	Wait 60 seconds for an answerS11=70	70 ms touch tone dialingE0	Don't echo commands (not essential)Q0	Turn result codes onV1	Return word result codesX4	Use as many result codes as you've got&D2	Hang up when DTR is lost (nice to have).TE.)b.in 0.bp.if e \{.ep.bp\}.uh "Appendix B \- AT&T Unix PC 7300/3b1 Dial Codes".(x .)x _.(xAppendix B \- AT&T Unix PC 7300/3b1 Dial Codes.)x.lpThe dialing codes used by the OBM (On Board Modem) are notstraight-forward.  The modem setup, as included in the Unixpc.shar file,looks like this:.br.CS.(b L.(c-------------------------- Modem Setup --------------------------.sp           1) Modem name (1 of 2) ... OBM           2) Modem init string .....           3) Dialing command ....... %           4) Dialing cmd suffix .... @           5) Hang up string ........           6) Auto baud detect ...... N           7) 300 baud connect ...... CONNECT           8) 1200 baud connect ..... CONNECT           9) 2400 baud connect .....          10) 4800 baud connect .....          11) 9600 baud connect .....          12) 19200 baud connect ....          13) 38400 baud connect ....          14) No connect string 1 ...          15) No connect string 2 ...          16) No connect string 3 ...          17) No connect string 4 ...-----------------------------------------------------------------OPTION ==> _                                Press <ESC> to return.)c.)b.Cs.lpThe relevant fields of the modem setup are:.ba +0.5i.lp1) Modem name.  This must be \*(lqOBM\*(rq..lp.ft INOTE:\ \ Pcomm uses the modem name as a flag to determine which dialingmethod to use.  The string \*(lqOBM\*(rq is a \*(lqreserved word\*(rqthat Pcomm uses to switch to the AT&T Unix PC 7300/3b1 dialing method..ft.lp3) Dialing command.  This should be \*(lq%\*(rq for touch tone dialingor \*(lq^\*(rq for pulse dialing..lp4) Dialing cmd suffix.  This must be the \*(lq@\*(rq character..lp6) Auto baud detect.  The OBM cannot use the auto baud detect feature..lp7\-8) Connect strings.  Although the OBM doesn't actually return anyresult codes, these fake fields are required..ba.lpAdditional OBM dialing codes from the phone(7) manual:.br.in +0.5i.(b L.TSl l.\*(lq~\*(rq	wait for next dial tone\*(lq,\*(rq	pause 2 seconds\*(lq:\*(rq	pause 10 seconds\*(lq&\*(rq	perform a hookflash\*(lq%\*(rq	begin tone dialing\*(lq^\*(rq	begin pulse dialing.TE.)b.in.lpThese codes can be inserted into the phone number string, for example:.br.in +0.5i.(b L.TSl l.555-1234~56	dial 555-1234, wait for tone, dial 569,555-1234	dial 9, wait 2 seconds, dial 555-1234%555^1234	dial 555 using tone, 1234 using pulse.TE.)b.in.lp.ft INOTE:\ \ The dialing codes for the OBM are not subject to charactersynonym translations, therefore the \*(lq%\*(rq, \*(lq^\*(rq, and\*(lq~\*(rq characters do NOT have to be preceded by the \*(lq\e\*(rqcharacter to remove their special meaning..ft.bp.if e \{.ep.bp\}.uh "Appendix C \- Using High Speed Modems".(x .)x _.(xAppendix C \- Using High Speed Modems.)x.ba.lpThe features and complexities of the newer high speed intelligent modemsavailable today warrants a more detailed discussion..lp1) Locked interface speed.ba +0.5i.lpNewer modems have the ability to maintain a locked interface speedwith the computer without regard to the connected baud rate.  Forexample, it is a good idea to lock the interface speed at19200 baud (or 38400) when the modem is \*(lqtalking\*(rq at 14400 baud..lpThe \*(lqlocked speed\*(rq field of the TTY database was created tosolve this problem.  If this value is non-zero, Pcomm will only use thisbaud rate when talking to the modem.  The true connected baud rate(14400 for example) will continue to be displayed in the status line..ba.lp2) Multiple setups.ba +0.5i.lpUsers of newer modems may require a different \*(lqinit string\*(rq or\*(lqdial string\*(rq depending on the target machine being called.  Forexample, when trying to connect to older V.32 modems, the V.42 and V.42bisfeatures may have to be disabled.  In this case, the dial string wouldcontain the command to disable the unwanted features..lpThis problem is solved by creating additional modem entries in the modemdatabase.  For example, you could have an entry called \*(lqTELEBIT\*(rqfor normal connections, one called \*(lqTELEBIT_V.32\*(rq for connectingto older V.32 modems, and another called \*(lqTELEBIT_PEP\*(rq for connections to other PEP modems..lpPcomm uses the connect strings to determine if the modem can handle therequested baud rate.  If there are multiple modems that satisfy that baudrate, then the first modem entry is used.  You can influence the choice ofsuitable modems by placing the name of the modem in the Auxiliary field ofthe dialing directory.  In this way, you can have a default modem and a specific modem for each dialing directory that my require one..lp.ft INOTE:\ \ The default modem configuration (in a multiple setup situation)must appear first in the modem database..ft.lpYour choices are virtually unlimited...  you can have a separate modemsetup to control modem features such as error control, compression,protocol spoofing, etc..ba.lp3) Telebit WorldBlazer settings.ba +0.5i.lpThe following configuration is what I personally use for my TelebitWorldBlazer on bi-directional lines (ones with uugetty).  Your mileagemay vary..in +0.5i.(b L.TSl l.~&F 	Restores fa

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -