PatchworkOS  3984a1d
A non-POSIX operating system.
Loading...
Searching...
No Matches
vscan.c File Reference
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
#include <sys/io.h>
#include "common/scan.h"
Include dependency graph for vscan.c:

Go to the source code of this file.

Macros

#define _SCAN_GET(ctx)
 
#define _SCAN_UNGET(ctx, c)
 

Functions

uint64_t vscan (fd_t fd, const char *format, va_list args)
 Wrapper for reading from a file descriptor using scan formatting with va_list.
 

Macro Definition Documentation

◆ _SCAN_GET

#define _SCAN_GET (   ctx)
Value:
({ \
fd_t fd = (fd_t)(ctx)->private; \
int res = EOF; \
char c; \
if (read(fd, &c, 1) == 1) \
{ \
res = c; \
} \
res; \
})
int64_t y
Definition main.c:153
size_t read(fd_t fd, void *buffer, size_t count)
System call for reading from files.
Definition read.c:8
__UINT64_TYPE__ fd_t
A file descriptor.
Definition fd_t.h:12
#define EOF
Definition stdio.h:25

Definition at line 6 of file vscan.c.

◆ _SCAN_UNGET

#define _SCAN_UNGET (   ctx,
  c 
)
Value:
({ \
fd_t fd = (fd_t)(ctx)->private; \
if ((c) != EOF) \
{ \
seek(fd, -1, SEEK_CUR); \
} \
})
#define SEEK_CUR
Definition SEEK.h:5

Definition at line 18 of file vscan.c.