Hamilton LaboratoriesHamilton C shell 2012User guideLanguage reference

Builtin procedures

Oregon Coast

Builtin procedures
Previous | Next

Name Function
Filename Functions
childpath(p, c)

Test whether filename c could be in a subdirectory of p. (Does not test for actual existence of either c or p.)

driveno(p)

Drive number implied by pathname p.

fullpath(p)

Fully resolve pathname p.

fullmixedpath(p)

Fully resolve pathname p and set it into the mixed-case representation actually stored in the filesystem.

longname(p)

Return the long filename corresponding to the path p.

mixedpath(p)

Resolve pathname p into the precise mixed-case representation actually stored in the filesystem. Any shortname segments will be expanded into the long form.

samepath(a, b)

Test whether two filenames, a and b, point to the same file. The calculation is done by fully resolving the two names and comparing them but can be mistaken if the two paths are based on different UNC names which refer to the same directories.

shortname(p)

Return the 8.3 short filename corresponding to the path p, assuming there is one.

Math Functions
abs(x)

Absolute value

acos(x) asin(x) atan(x) cos(x) sin(x) tan(x)

Trigonometric functions

cosh(x) sinh(x) tanh(x)

Hyperbolic functions

ceil(x)

Ceiling (lowest integer >= x)

exp(x) log(x) log2(x) log10(x)

Exponential and logarithmic functions

floor(x)

Floor (highest integer <= x)

round(x)

floor(x + 0.5)

sqrt(x)

Square root

String Functions
ansi(color)

Return an ANSI escape sequence which will produce the specified screen colors. If the argument is ambiguous, e.g., simply "bright," it's taken as a modification of the default colors specified by the COLORS variable.

char(i)

Return the character corresponding to the numeric value i.

code(c)

Return the numeric encoding of the character c.

concat(a, b, ...)

Concatenation of a series of strings.

isinteger(x)

Test whether x is an integer. (Remember that null strings and strings consisting only of white space are considered equal to 0.)

isnumber(x)

Test whether x is a number.

printf(fmt, ... )

Perform C language-style print formatting, returning the result as a string.

Argument formats
%c

Single character.

%d

Decimal number.

%e [-]d.dddddde[+-]ddd
%f [-]ddd.dddddd
%g

%e or %f formatting, whichever is shorter.

%o

Unsigned octal number.

%s

String.

%x

Unsigned hexadecimal number.

%%

Literal % character.

Options after the %
- Left-justify expression in its field.
width Pad field to this width as needed; leading 0 pads with zeros.
.prec Maximum string width or digits to right of decimal point.

reverse(s)

Reverse the order of characters in s.

strindex(a, b)

Return the position in a of the first occurrence of b. (0 means b was not found.)

strlen(s)

Number of characters in s, represented as a string.

substr(s, b, i)

Substring of length i beginning at bth character of s. i = 0 means "rest of s")

upper(s) lower(s)

Translate a string to all upper- or all lower-case.

Defined in Startup.csh
help(errno)

Provides a help mechanism that gives the Win32 error message corresponding to an error code or runs the Windows help.exe command for anything else.

safecopy(files)

Wrapper used by the copy alias to run the Windows copy command with wildcarding turned off.

safedel(files)

Wrapper used by the del alias to run the Windows del command with wildcarding turned off.

saferename(files)

Wrapper used by the ren alias to run the Windows rename command with wildcarding turned off.

safexcopy(files)

Wrapper used by the xcopy alias to run the Windows xcopy command with wildcarding turned off.

Previous | Next

Getting started with Hamilton C shell

Hamilton C shell, as it first wakes up.

Getting started with Hamilton C shell

A first few commands.

You can set the screen colors to your taste.

You can set the screen colors to your taste.