📄 _p_sfunc.txt
字号:
.*s 1 "String Functions".*s 2 "%argv"usage: %argv(int0)This function returns the string value of an argument passedto the procedure by the 'do' command. Argument 0 is thename of the procedure itself.The integer function %argc may be used to determine thenumber of arguments passed to the procedure. Specifyingan argument number greater than the number of argumentspassed returns a null string (if procedure tracing is enabledwith the 'ptrace' comand, a warning will be displayedin this case)..DS IExample: invocation from shell: ecu -p test Quick Brown Fox invocation from interactive command line: do test Quick Brown Fox invocation from procedure: do 'test' 'Quick' 'Brown' 'Fox' results in: %argv(0) = 'test' %argv(1) = 'Quick' %argv(2) = 'Brown' %argv(3) = 'Fox' %argv(4) = ''.DE.B NOTE:the interactive.B dialcommand, the dialing directory menu and the initial setup menuall can automatically execute a procedure which matchesa dialed.Blogical telephone number..RThere two arguments passed to these procedures, %argv(0) beingthe procedure name as always. %argv(1) is set according to the followingtable:.DS I invoker %argv(1)------------------- -------------initial setup menu !INITIALinteractive dial !INTERACTIVEdialing menu !MENU.DEThus it is possible for the invoked procedureto determine that it has been automatically executedby testing %argv(1) for an exclamation point, or possiblythe entire argument..*s 2 "%basename"Usage: %basename(str0,str1)This function is similar to the UNIX basename(1) utility inthat it returns a filename minus a supplied suffix, if it is present.Unlike the UNIX basename(C) program, %basename does not removethe directory part of the filename.See also.B %dirpartand.B %filepart ..DS LExamples: %basename('/u1/src/ecu/ecu.c','.c') = /u1/src/ecu/ecu %basename('ecu.c','.c') = ecu %basename('ecu.c','.x') = ecu.c.DE.*s 2 "%cgetc"usage: %cgetcThis function reads one character from the console keyboardand returns it. The character is not echoed..*s 2 "%cgets"usage: %cgetsThis function reads a string from the console keyboardand returns it. Each character is echoed as it is typedand the user's normal erase and kill character is availableto edit the input before terminating the read with ENTER..*s 2 "%chr"usage: %chr(int0)This function returns the character value whose ASCII valueis supplied in int0..DS LExample: set $s0 = %chr(4) places a ^D (EOT) character into $s0.DE.*s 2 "%date"usage: %dateThis function returns the current date in the form 'mm-dd-yyyy'in the local time zone (daylight time if it applies)..*s 2 "%datez"usage: %datezThis function returns the current date in the form 'mm-dd-yyyy'in the UTC (Z) time zone..*s 2 "%day"usage: %dayThis function returns the current day of the week as a three characterabbreviation: 'Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'in the local time zone (daylight time if it applies)..*s 2 "%dayz"usage: %dayzThis function returns the current day of the week as a three characterabbreviation: 'Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'in the UTC (Z) time zone..*s 2 "%dir"usage: %dirThis function returns thefull pathname of the current working directory..*s 2 "%dirpart"usage: %dirpart(str0)This function returns thedirectory portion of the pathname supplied in str0.See also.B %basenameand.B %filepart ..DS LExamples:%dirpart('/u1/src/src/foo.c') = "/u1/src/src"%dirpart('foo.c') = "foo.c"%dirpart('/usr') = "".DE.*s 2 "%edate"usage: %edate(int0)The value in int0 is expected to be a number of seconds since January 1,1970 00:00 UTC (Universal Coordinated Time) as returned bythe integer functions %fatime and %fmtime.This function converts the value into a string representing theequivalent local time in the form 'mm-dd-yyyy hh:mm:ss'..DS LExample:set $i0=%fmtime('/xenix')$i00 = 601178971 (0x23d5435b,04365241533)set $s0=%edate($i0)$s00 = '01-18-1989 21:09:31'.DE.*s 2 "%envvar"usage: %envvar()This function returns the string value of an environmentvariable..DS LExample: set $s0=%envvar('HOME') might set $s0 '/usr/user'.DE.DF LTypical Environment Variables: HOME pathname of home directory EDITOR user's preferred editor PATH program execution searchlist TERM terminal type SHELL user's preferred shell MAIL user's mail box file ECUPROMPT ECU interactive command prompt at beginning of execution.DE.*s 2 "%errstr"usage: %errstr(int0)This function returns the system error message, given int0 as an.B errnoas returned by a file-related command..B fopen..DS LExample: echo %errstr(1) Not owner.DE.*s 2 "%etime"usage: %etime(int0)This function returns a string representation of elapsed timein the format 'hh:mm:ss'for the integer parameter int0, a number of seconds..DS LExample: echo %etime(62) 00:01:02.DE.*s 2 "%filepart"usage: %filepart(str0)This function returns thefilename portion of the pathname supplied in str0.See also.B %basenameand.B %dirpart ..DS LExamples:%filepart('/u1/src/src/foo.c') = "foo.c"%filepart('foo.c') = "foo.c".DE.*s 2 "%fmodestr"usage: %fmodestr(int0)This function returns a string representation of thefamiliar file mode string given the file mode integer int0..DS LExample: echo %fmodestr(0100755) -rwxr-xr-x echo %fmodestr(%fmode('/usr/lib')) drwxr-xr-x.DE.*s 2 "%itos"usage: %itos(int0[,format])This function converts integer int0 to a string, optionallycontrolling the format of the conversion.If the format parameter is missing, the conversion is toa minimum number of decimal characters necessary tohold the result.If the format parameter is present, it must of consist ofa non-null string made of one or both optional parts:.DS L decimal number of digits to be part of result string (a leading zero indicates leading zeroes are to appear in the string; no leading zero pads with leading spaces a lower case letter from the following list: d - decimal conversion x - hexadecimal conversion o - octal conversion.DE.DS LExample: %itos(33) '33' %itos(33,d) '33' %itos(33,x) '21' %itos(33,5d) ' 33' %itos(33,010d) '0000000033' %itos(33,10d) ' 33' %itos(33,x) '21' %itos(33,04x) '0021' %itos(33,4x) ' 21' %itos(33,o) '41' %itos(33,4o) ' 41'.DE.*s 2 "%left"usage: %left(str0,int0)This function returns the leftmost int0 characters of str0.If the length of the string is less than int0,the entire str0 is returned..DS LExample: if $s0 == 'abcdefg' %left($s0,3) returns 'abc'.DE.*s 2 "%line"usage: %lineThis function returns the name of the attached communicationsline in the form "/dev/ttyxx". If no line is currentlyattached, the function returns null..*s 2 "%logname"usage: %lognameThis function returns the login name of the user executingECU. Note: the name returned is the name supplied to a loginprompt, not any current su(C) username that may be in effect..*s 2 "%mid"usage: %mid(str0,int0[,int1])This function returns the middle portion of a string str0beginning with the character at position int0 and for a lengthof int1 characters.If int0 is greater than or equal to the length ofstro, a null string is returned.If the optional argument int1 is not supplied, orif the length of the string is less than int1,the entire str0 is returned..DS LExample: if $s0 == '0123456789abc' %mid($s0,3,4) returns '3456' %mid($s0,3) returns '3456789abc' %mid($s0,10,2) returns 'ab' %mid($s0,10,5) returns 'abc'.DE.*s 2 "%month"usage: %monthThis function returns the current month as a three characterabbreviation: 'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'..*s 2 "%rdesc"usage: %rdescThis function returns thedescriptionportion of thedialing directory entry for the currently connected remote.If no connection exists, the function returns null..*s 2 "%right"usage: %right(str0,int0)This function returns the rightmost int0 characters of str0.If the length of the string is less than int0,the entire str0 is returned..DS LExample: if $s0 == 'abcdefg' %right($s0,3) returns 'efg'.DE.*s 2 "%rname"usage: %rnameThis function returns thelogical nameportion of thedialing directory entry for the currently connected remote.If the remote was dialed directly, as in dial 5551212, thereturned value is the phone number.If no connection exists, the function returns null.The value returned by this command may be overridden by use of the.B rnameprocedure command..*s 2 "%rtelno"usage: %rtelnoThis function returns thetelephone numberportion of thedialing directory entry for the currently connected remote.If no connection exists, the function returns null..*s 2 "%time"usage: %timeThis function returns the current time in the form 'hh:mm'in the local time zone (daylight time if it applies)..*s 2 "%times"usage: %timesThis function returns the current time in the form 'hh:mm:ss'in the local time zone (daylight time if it applies)..*s 2 "%timez"usage: %timezThis function returns the current time in the form 'hh:mm'in the UTC (Z) time zone..*s 2 "%timezs"usage: %timezsThis function returns the current time in the form 'hh:mm:ss'in the UTC (Z) time zone..*s 2 "%tty"usage: %ttyThis function returns the console tty name in the form "/dev/ttynn"..*s 2 "%uname"usage: %unameThis function returns the system name you are executing ECU on asreported by uname(2)/uname(S). On SCO systems, if /etc/systemidexists and is readable, the name in that file isused in place ofthe name from uname.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -