Subversion Repositories Kolibri OS

Rev

Rev 6431 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 6431 Rev 6432
Line 16... Line 16...
16
 
16
 
17
#include 
17
#include 
18
#include 
18
#include 
19
#include 
19
#include 
-
 
20
#include 
-
 
21
typedef int (*virtual_getc)(void *sp, const void *obj);
Line 20... Line 22...
20
#include 
22
typedef void (*virtual_ungetc)(void *sp, int c, const void *obj);
21
 
23
 
22
enum flags_t
24
enum flags_t
23
{
25
{
Line 168... Line 170...
168
 
170
 
169
    if (ch == '0')  // octal or hex, read next
171
    if (ch == '0')  // octal or hex, read next
170
    {
172
    {
171
        base = 8;
173
        base = 8;
172
        ch = vgetc(save, src);
174
        ch = vgetc(save, src);
-
 
175
        if (ch == EOF || isspace(ch))
-
 
176
            have_digits++;
173
        if (ch == EOF) return EOF;
177
        else
174
        if (ch == 'x' || ch == 'X')
178
        if (ch == 'x' || ch == 'X')
175
        {
179
        {
176
            base = 16;
180
            base = 16;
177
            ch = vgetc(save, src);
181
            ch = vgetc(save, src);
Line 199... Line 203...
199
            *digit = *digit * base + ch;
203
            *digit = *digit * base + ch;
200
            have_digits++;
204
            have_digits++;
201
            ch = vgetc(save, src);
205
            ch = vgetc(save, src);
202
            if (ch == EOF || isspace(ch)) break; // ok, just finish num
206
            if (ch == EOF || isspace(ch)) break; // ok, just finish num
203
        }
207
        }
-
 
208
        else if (ch == EOF || isspace(ch))
-
 
209
            break;
204
        else
210
        else
205
        {
211
        {
206
            vungetc(save, ch, src);
212
            vungetc(save, ch, src);
207
            break;
213
            break;
208
        }
214
        }
Line 363... Line 369...
363
            break;
369
            break;
364
        case 'c':  // read width chars, ever spaces
370
        case 'c':  // read width chars, ever spaces
365
            arg_str = va_arg(argp, char*);
371
            arg_str = va_arg(argp, char*);
366
            if (fmt1 == 0) length = 1;
372
            if (fmt1 == 0) length = 1;
367
            else length = fmt1;
373
            else length = fmt1;
368
            for (i = 0; i < length; i++)
374
            for (i = 0; i < length;)
369
            {
375
            {
370
                *arg_str++ = ch;
376
                *arg_str++ = ch; i++;
371
                ch = vgetc(&save, src);
377
                ch = vgetc(&save, src);
372
                if (ch == EOF) break;
378
                if (ch == EOF) break;
373
            }
379
            }
374
            if (i < length) goto exit_me; // not enough chars
380
            if (i < length) goto exit_me; // not enough chars
375
            break;
381
            break;