carta
chr(3)

chr3

Character constant conversion routines

Overview

$1$2chrescchrescchrescchrescchrescchrescchrescchresc converts and returns the next character constant in the 0-terminated string s. If e is not 0 then *e is set to point to the next character in s on return. 0 is returned and e is not modified when the end of s is reached.

$1$2chrtoichrtoichrtoichrtoichrtoichrtoichrtoichrtoi converts the 0-terminated string s to an int and returns the value. The characters in s are converted in order from the left and shifted into the int value until up to the number of characters in an int is reached. This operation is inherently machine-dependent, but at least its defined in one place.

The following \ escape sequences are recognized:

\ooo

The character represented by the octal code ooo.

\xxx

The character represented by the hex code xx.

$1$2\a\a\a\a\a\a\a\a

Alert (bell).

$1$2\b\b\b\b\b\b\b\b

Backspace.

$1$2\f\f\f\f\f\f\f\f

Formfeed.

$1$2\n\n\n\n\n\n\n\n

Newline.

$1$2\r\r\r\r\r\r\r\r

Carriage return.

$1$2\t\t\t\t\t\t\t\t

Horizontal tab.

$1$2\v\v\v\v\v\v\v\v

Vertical tab.

$1$2\E\E\E\E\E\E\E\E

ESC (escape).

$1$2\\\\\\\\\\\\\\\\

Backslash.

Other characters following \ are undefined (although for backwards compatibility they translate to themselves).

History

  • macOS 26.5 to Mac OS X 10.8: the text shown here
  • Mac OS X 10.7.5 to Mac OS X 10.4

From ksh 42 in macOS 26.5. Parsed by carta from the page's man source.