1 /*************************************************************************
3 * $Id: doc_scanf.h,v 1.1 2001/12/27 17:29:20 breese Exp $
5 * Copyright (C) 2001 Bjorn Reese and Daniel Stenberg.
7 * Permission to use, copy, modify, and distribute this software for any
8 * purpose with or without fee is hereby granted, provided that the above
9 * copyright notice and this permission notice appear in all copies.
11 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
12 * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
13 * MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE AUTHORS AND
14 * CONTRIBUTORS ACCEPT NO RESPONSIBILITY IN ANY CONCEIVABLE MANNER.
16 ************************************************************************/
18 /** @addtogroup Scanf Formatted Scanning Functions.
19 Variations of formatted scanning functions.
31 This documentation is incomplete.
32 The documentation of the scanf family in [C99] and [UNIX98] also applies
33 to the trio counterparts.
37 The scanning is controlled by the format string.
38 The format string can contain normal text and conversion indicators.
39 The normal text can be any character except the nil character
40 (\000) and the percent character (\045 = '\%').
41 Conversion indicators consists of an indication character (%), followed by
42 zero or more conversion modifiers, and exactly one conversion specifier.
46 @em Positional ( @c 9$ ) [UNIX98]
54 @em Character ( @c c )
58 @em Floating-point ( @c a, @c A, @c e, @c E, @c f, @c F, @c g, @c G )
72 @em Hex ( @c x, @c X )
74 @em Scanlist ( @c [] )
76 Scanlist Exclusion (@c ^ )
78 Scanlist Range ( @c - ) [TRIO]
80 @li Only increasing ranges, i.e. @c [a-b], but not @c [b-a].
81 @li Transitive ranges, ie. @c [a-b-c] equals @c [a-c].
82 @li Trailing minus, ie. @c [a-] is interpreted as an @c a and a @c -.
83 @li Duplicates are ignored.
85 Scanlist Equivalence Class Expression ( @c [= @c =] ) [TRIO]
87 Locale dependent (LC_COLLATE).
88 Only one expression can appear inside the delimiters.
89 @li @c [=a=] All letters in the same equivalence class as the letter @c a.
91 trio_scanf("%[[=a=]b]\n", buffer);
92 trio_scanf("%[[=a=][=b=]]\n", buffer);
95 Scanlist Character Class Expression ( @c [: @c :]) [TRIO]
96 Locale dependent (LC_CTYPE).
97 Only one expression can appear inside the delimiters.
98 @li @c [:alnum:] Same as @c [:alpha:] and @c [:digit:]
99 @li @c [:alpha:] Same as @c [:lower:] and @c [:upper:]
100 @li @c [:cntrl:] Control characters
101 @li @c [:digit:] Decimal digits
102 @li @c [:graph:] Printable characters except space
103 @li @c [:lower:] Lower case alphabetic letters
104 @li @c [:print:] Printable characters
105 @li @c [:punct:] Punctuation
106 @li @c [:space:] Whitespace characters
107 @li @c [:upper:] Upper case alphabetic letters
108 @li @c [:xdigit:] Hexadecimal digits
110 trio_scanf("%[[:alnum:]]\n", buffer);
111 trio_scanf("%[[:alpha:][:digit:]]\n", buffer);