📄 yaps.doc
字号:
Increase the verbosity of yaps, more -v's give more debug output. -p, --print-config This is used to printout configuration values for testing purpose. The remaining paramters are variables to print out with their value. Following the options the user has to give receiver/message pairs, all using the same service. A receiver is either the pager id itself or an alias. If the first character is a colon, then the colon is cut off and the remaining part is taken as an alias, if the first character is a slash, it is cut off as well and the remaining is taken as the pager id. If the first character is a digit, it is taken as a pager id, otherwise as an alias. It is possible to specify multiple receiver, if the receiver is a comma seperate list of individual receivers. If the first character of the message is a plus sign, then the remaining message is treated as a filename and the real message is read from this file. If the message is just a minus (-), then the message is read from stdin, if it is just a dot (.), then the message is empty. The options -d and -e accept a date representation which must be (according to option parsing) one argument, e.g. if it contains spaces it must be quoted. If the first character of date is a plus (+) sign, then the date is taken as an offset to the current time. All further definitions are seperated by spaces: * <hour>:<min>:<sec> * <day>.<month>.<year> * <month>/<day>/<year> * <numeric> if less than 30 is taken as the hour * <numeric> if greater or equal than 30 is taken as minutes Sending/Expecting Syntax Whenever communication over the serial line takes place the send/expect functions are comming into play. There are three important functions, which are called from several parts: sending of data, expecting data and a send/expect function. Each is explained in detail here (including the supported syntax): Sending Sending itself is nothing fancy, just all data will be written to the serial line. Expecting Expecting means to wait for some pattern to arrive. It is possible to expect more than one sequence and the function returns the matching entry, a timeout or an error condition. Send/Expect Most communication parts call this function (which then calls the functions above.) This function requires a string with tokens seperated by whitespaces. A token may contain whitespaces, if the token is enclosed in single or double quotes. These quotes (as any other quotes) are removed during the preparse. The first character of the token is relevant for the method to be executed. Each token is preparsed to remove/interpret special characters. Following special characters are interpreted: * Backslash \ The backslash is used to escape any other special character (inclusive quotes and the backslash itself) or to insert typical control characters. These are supported: + \a -> Bel + \b -> Bs + \f -> Ff + \l -> Lf + \n -> Nl (system depended) + \r -> CR + \s -> Space + \t -> Tab * Up arrow ^ This is used to insert control characters, e.g. ^M means CR. * Percent %<nr> This inserts optional paramter nr, if supplied. These character initiate the behaviour of the token: < Expect The rest of the token is for expecting. If the token contains - then the token is split again and each subtoken is treated as expect/send, if the expect failed. The expect token may be seperated by | to indicate alternatives. The expect is failed, if an error occurs, a timeout arised or not the first alternatives matches. The < may be appended by a numeric value, which is used as the timeout in seconds. ! Command To insert dynamic commands into the sequence use this construct. Following is an optional numeric value n and a command character. If n is not set, its default value is one. Following characters are supported: + d - sleep n seconds + D - sleep n miliseconds + b - send break (length depends on n and the implementation) + h - hangup the line (lowering DTR by n * 0,5 seconds.) + o - waits for output to drain + < - flushes the input queue + > - flushes the output queue + f - forces the sequence to fail + s - forces the sequence to succeed Any other character This string is just send to the remote side. Scripting Scripting has the advantage (compared to the ASCII protocol) that one is more flexible. As there are a lot of scripting languages around, there will be no specific one for this package. As long as such a language is embeddable into C programs, it should not be too complicate to integrate it into this package. This section explains the additional function (or simular) for the available scripting languages. The syntax itself is explained in the distribution of each scripting package. SLang Beside the new functions there is an extension to the string class, so you can use (beside others) the plus sign to concaternate strings. One time this part should make its way into the main SLang distribution. Variable index int NO_ERR; This is the return value for a function, that ended successful. int ERR_FAIL; This is the return value for a function, that encountered an error, but which allowes the script to continue. int ERR_FATAL; Dito, but the script should not continue any more. int ERR_ABORT; Dito, but no further action should take place. int rds; Is set to True, if a delivery status should be requested. int delay_day, delay_mon, delay_year, delay_hour, delay_min, delay_sec; This is the time/date to delay the delivery of the message. int expire_day, expire_mon, expire_year, expire_hour, expire_min, expire_sec; This is the time/date to expire a buffered message. int False; The numeric value for False. int True; Dito for True. Function index void setcb (string func, string sep); This enable the line callback facility and stores each line into a local variable, which will be overwritten after each new encountered line. A line is considered as complete, if one character in sep is received. If func is the name of a defined function, then this function is called on every completed new line. The line is passed as the paramter to this function. void clrcb (void); Clears the line callback facility. string line (void); Returns the last complete read in line, if the line callback facility is enabled. void hangup (void); Tries to hangup, if the modem is currently off-hook. This is done by lowering the DTR line. int send (string str); Sends the string to the remote side. Returns True on success, False otherwise. int csend (string str); Dito, but the string is converted before it is sended to the remote side. int expect (int tout, string str1, ..., string strn, int cnt); The function waits tout seconds until one of the strings is received. If no string is received, 0 is returned, -1 on error. Otherwise the number of the string is returned (1 for str1, 2 for str2, etc). cnt is the number of strings to wait for. int send_expect (int tout, string expr); This function executes the expr with its internal send/expect evaluater and returns True, when the sequence had been executed completely, otherwies False. void drain (int secs); This function reads and discards any character for secs seconds. void cvdef (int src, int dst); Defines a converion rule. Every character src will be replaced by dst. The conversion is used in csend(). void cvundef (int ch); Undefines the conversion rule for ch. void cvinval (int ch); Marks the character ch as invalid. string conv (string str); Converts the string str using the defined conversion rules and returns the converted string. Lua Examples Here are some examples that may help you to understand the software a bit better. First you should read the example configuration file yaps.rc. This could be used as a base for your own global configuration file. Calling Typically the program is called yaps <pagerid> <message>. pagerid is either the exact pagerid of the receiver or an alias found in the alias section. message is the message to send by itself. If a pager-id leads to more than one provider, then the first is used. To force a special service use the -s <service> switch. Script protocol In the contrib directory, you can find tap.sl, an example on how to use the scripting facility to emulate a protocol. This is a minimal, but working reimplemetation of TAP. Changelog This is a list of changes: 9. May 1997: V 0.90 released + Minor cleanup on calling sending routines + Added optional multiple receiver per message + Changing UCP to prepare the real implementation + Preparing the creation of a client/server solution + Compile configuration moved to seperate file 13. May 1997: V 0.91 released + Converted `char *' to `string_t *' in several places + Added max-messages configuration option + Moved some configuration stuff to config.h + Got UCP docu! Implemented it partial (as much as it makes sense) + Added option -d/-e as UCP (in extended mode) can support it + Added special date handling functions for this purpose + Changed copyright to the GPL + Use transparent data in extended UCP, if characters with set 8th bit are found + Better message splitting + Added some sanity checks 22. May 1997: V 0.92 released + Added handling of configuration variants + Added include option in configuration files + First bugs encountered by tester fixed + Message can now be read from stdin, if message == '-' (idea by <markus@mail.yezz.de>) + Message can now be empty, if message == '.' + Minor bugfixing/Makefilehandling (reported by Frank K鋐er) + Enhanced lockfile handling, including SysV4 lockfiles (inspirated by Frank K鋐er) + Total rewrite of UCP sending 26. May 1997: V 0.93 released + UCP works again including delivery report + Added checking of pager id for a service + Added signature in configuration file + Added value start escaping with backslash + Changed checking of pager id for service + Automatic assign of a pager id to a service + Could now handle more than one service at one call 30. May 1997: V 0.94 released + Workaround for serial bug in sunos/solaris (by Frank K鋐er) + If the system does not support Posix regular expression, a simple replacement is added + More comments in yaps.rc (as wished by Frank K鋐er ;-) + Change handling of control chars in TAP/pre V1.6 (hint by <markus@mail.yezz.de>) + Added default conversion rules + Added force/-f + Added long options support + Added getopt() for systems without this function + Added valid-cid/change-cid/rm-invalids-cid/rm-invalids-pid 3. June 1997: V 0.95 released + Added final status report + Added a 2nd checking scheme + Added support for lua (another scripting language) + Removed porting approach, should be done by someone who has access to such an OS. + Added reading of pager-id/message pairs from file + Added cost calculation + Enhanced logfile handling 14. June 1997: V 0.96 released
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -