+ Invert = 0;
+ /* Clear the set */
+ memset (CharSet, 0, sizeof (CharSet));
+ F = *format++;
+ if (F == '^') {
+ Invert = 1;
+ F = *format++;
+ }
+ if (F == ']') {
+ AddCharToSet (']');
+ F = *format++;
+ }
+ /* Read the characters that are part of the set */
+ while (F != ']' && F != '\0') {
+ if (*format == '-') {
+ /* A range. Get start and end, skip the '-' */
+ Start = F;
+ F = *++format;
+ ++format;
+ if (F == ']') {
+ /* '-' as last char means: include '-' */
+ AddCharToSet (Start);
+ AddCharToSet ('-');
+ } else if (F != '\0') {
+ /* Include all chars in the range */
+ while (1) {
+ AddCharToSet (Start);
+ if (Start == F) {
+ break;
+ }
+ ++Start;
+ }
+ /* Get next char after range */
+ F = *format++;
+ }
+ } else {
+ /* Just a character */
+ AddCharToSet (F);
+ /* Get next char */
+ F = *format++;
+ }
+ }
+
+ /* Invert the set if requested */
+ if (Invert) {
+ for (Start = 0; Start < sizeof (CharSet); ++Start) {
+ CharSet[Start] ^= 0xFF;
+ }
+ }
+
+ /* We have the set in CharSet. Read characters and
+ * store them into a string while they are part of
+ * the set.
+ */
+ if (!NoAssign) {
+ S = va_arg (ap, char*);
+ while (IsCharInSet (C) && Width--) {
+ *S++ = C;
+ ReadChar ();
+ }
+ *S = '\0';
+ } else {
+ while (IsCharInSet (C) && Width--) {
+ ReadChar ();
+ }
+ }
+ ++Conversions;