AT&T UNIX™PC Unix System V Users Manual - tenox
AT&T UNIX™PC Unix System V Users Manual - tenox AT&T UNIX™PC Unix System V Users Manual - tenox
REGCMP {3X) REGCMP {3X) ( . . . ) Parentheses are used for grouping. An operator, e.g. *, +, { }, can work on a single character or a regular expression enclosed in parenthesis. For example, (a*( cb+ )* )$0. By necessity, all the above defined symbols are special. They must, therefore, be escaped to be used as themselves. EXAMPLES Example 1: char •cursor, •newcursor, *ptr; newcursor = regex((ptr = regcmp("�\n", 0)), cursor); free(ptr); This example will match a leading new-line in the subject string pointed at by cursor. Example 2: char ret0[9]; char •newcursor, •name; name = regcmp("([A-Za-z] [A-za- z0-9_] {0,7})$0", 0); newcursor = regex(name, "123Testing321", reto); This example will match through the string "Testing3" and will return the address of the character after the last matched character (cursor+ll). The string "Testing3" will be copied to the character array retO. /� Example 3: #include "file.i" char •string, •newcursor; newcursor = regex(name, string); This example applies a precompiled regular expression in file.i (see regcmp ( l)) against string . This routine is kept in /lib/libPW.a. SEE ALSO ed(l), regcmp(l), malloc(3C). BUGS The user program may run out of memory if regcmp is called iteratively without freeing the vectors no longer required. The following user-supplied replacement for malloc(3C) reuses the same vector saving time and space: /* user's program */ malloc(n) { static int rebuf[256] ; return rebuf; } - 2-
SCANF ( 3S ) SCANF(3S) NAME scanf, fscanf, sscanf - convert formatted input SYNOPSIS #include int scanf (format [ , pointer ] . . . ) char *format; int fscanf (stream, format [ , pointer ] . .. FILE *stream; char *format; int sscanf (s, format [ , pointer ] . . . ) char *s, *format; DESCRIPTION Scanf reads from the standard input stream stdin . Fscanf reads from the named input stream. Sscanf reads from the character string s . Each function reads characters, interprets them according to a format, and stores the results in its arguments. Each expects, as arguments, a control string format described below, and a set of pointer arguments indicating where the converted input should be stored. The control string usually contains conversion specifications, which are used to direct interpretation of input sequences. The control string may contain: 1. White-space characters (blanks, tabs, new-lines, or form-feeds) which, except in two cases described below, cause input to be read up to the next non-white-space character. 2. An ordinary character (not %), which must match the next character of the input stream. 3. Conversion specifications, consisting of the character %, an optional assignment suppressing character *, an optional numerical maximum field width, an optional I or h indicating the size of the receiving variable, and a conversion code. A conversion specification directs the conversion of the next input field; the result is placed in the variable pointed to by the corresponding argument, unless assignment suppression was indicated by *· The suppression of assignment provides a way of describing an input field which is to be skipped. An input field is defined as a string of non-space characters; it extends to the next inappropriate character or until the field width, if specified, is exhausted. The conversion code indicates the interpretation of the input field; the corresponding pointer argument must usually be of a restricted type. For a suppressed field, no pointer argument should be given. The following conversion codes are legal: % a single % is expected in the input at this point; no assignment is done. d a decimal integer is expected; the corresponding argument should be an integer pointer. - 1 -
- Page 918 and 919: I� ' .... ._ .·
- Page 920 and 921: LSEARCH ( 3C ) LSEARCH ( 3C ) unsig
- Page 922 and 923: MALLOC (3C) MALLOC (3C) M_NLBLKS Se
- Page 924 and 925: MA THERR (3M) MATHERR (3M) } BESSEL
- Page 926 and 927: () . -�
- Page 928 and 929: MEMORY (3C} MEMORY (3C) Character m
- Page 930 and 931: MENU (3T) (AT&T UNIX PC only ) MENU
- Page 932 and 933: MENU (3T) (AT&T UNIX PC only ) mite
- Page 934 and 935: MENU (3T) (AT&T UNIX PC only ) FILE
- Page 936 and 937: MESSAGE ( 3T ) ( AT&T UNIX PC only
- Page 939: MONITOR ( 3C ) MONITOR ( 3C ) NAME
- Page 943 and 944: PASTE (3T) (AT&T UNIX PC only ) PAS
- Page 945 and 946: PASTE ( 3T ) ( AT&T UNIX PC only )
- Page 947: PERROR (3C) PERROR (3C) NAME perror
- Page 950 and 951: (� / I I I I I I I I I I I I I I
- Page 952 and 953: PRINTF (3S) PRINTF (3S) A field wid
- Page 955 and 956: PUTC ( 3S ) PUTC ( 3S ) NAME putc,
- Page 957: PUTENV (3C) PUTENV (3C) NAME putenv
- Page 960 and 961: ···- ·
- Page 962 and 963: I� ·-.---·
- Page 964 and 965: ' ' .} ' 1 . ' .____.,.:
- Page 966 and 967: � ·�
- Page 970 and 971: SCANF(3S) u 0 X SCANF(3S) an unsign
- Page 973 and 974: � I SETBUF (3S) SETBUF (3S) NAME
- Page 975 and 976: SETJMP (3C) SETJMP ( 3C ) NAME setj
- Page 977 and 978: SINII ( 3M ) SINH ( 3M ) NAME sinh,
- Page 979 and 980: SLEEP (3C) SLEEP ( 3C ) NAME sleep
- Page 981: SPUTL ( 3X ) SPUTL ( 3X ) NAME sput
- Page 985: STDI0 ( 3S ) ( AT&T UNIX PC Only )
- Page 989 and 990: STRING ( 3C ) STRING (3C) NAME strc
- Page 991 and 992: STRTOD (3C) STRTOD (3C) NAME strtod
- Page 993: STRTOL ( 3C ) STRTOL ( 3C ) NAME st
- Page 996 and 997: C) / I I I I I I I I I () �� /
- Page 998 and 999: n "--- --'•
- Page 1000 and 1001: TAM (3T) (AT&T UNIX PC only ) int w
- Page 1002 and 1003: TAM (3T) (AT&T UNIX PC only ) TAM(3
- Page 1004 and 1005: TAM (3T) wputc() wputs() wprintf()
- Page 1006 and 1007: TAM (3T) (AT&T UNIX PC only ) TAM(3
- Page 1008 and 1009: I I I I I I I II I I I I � r"j I
- Page 1010 and 1011: TMPNAM (3S) TMPNAM (3S) SEE ALSO cr
- Page 1012 and 1013: TRACK (3T) (AT&T UNIX PC only ) TRA
- Page 1015: TRIG ( 3M ) TRIG ( 3M) NAME sin, co
REGCMP {3X) REGCMP {3X)<br />
( . . . ) Parentheses are used for grouping. An operator, e.g. *,<br />
+, { }, can work on a single character or a regular<br />
expression enclosed in parenthesis. For example,<br />
(a*( cb+ )* )$0.<br />
By necessity, all the above defined symbols are special. They<br />
must, therefore, be escaped to be used as themselves.<br />
EXAMPLES<br />
Example 1:<br />
char •cursor, •newcursor, *ptr;<br />
newcursor = regex((ptr = regcmp("�\n", 0)), cursor);<br />
free(ptr);<br />
This example will match a leading new-line in the subject string<br />
pointed at by cursor.<br />
Example 2:<br />
char ret0[9];<br />
char •newcursor, •name;<br />
name = regcmp("([A-Za-z] [A-za- z0-9_] {0,7})$0", 0);<br />
newcursor = regex(name, "123Testing321", reto);<br />
This example will match through the string "Testing3" and will<br />
return the address of the character after the last matched character<br />
(cursor+ll). The string "Testing3" will be copied to the character<br />
array retO. /�<br />
Example 3:<br />
#include "file.i"<br />
char •string, •newcursor;<br />
newcursor = regex(name, string);<br />
This example applies a precompiled regular expression in file.i (see<br />
regcmp ( l)) against string .<br />
This routine is kept in /lib/libPW.a.<br />
SEE ALSO<br />
ed(l), regcmp(l), malloc(3C).<br />
BUGS<br />
The user program may run out of memory if regcmp is called<br />
iteratively without freeing the vectors no longer required. The following<br />
user-supplied replacement for malloc(3C) reuses the same<br />
vector saving time and space:<br />
/* user's program */<br />
malloc(n) {<br />
static int rebuf[256] ;<br />
return rebuf;<br />
}<br />
- 2-