mirror of
https://gitlab.os-k.eu/os-k-team/os-k.git
synced 2023-08-25 14:03:10 +02:00
Revert "scanf (proto)"
This reverts commit e0b3c3d81e46e9e4f90b58eb8b5a8d4c4f590dc7.
This commit is contained in:
parent
f6e07ec33e
commit
e4c09a29ef
@ -167,8 +167,8 @@ size_t vbprintf(Buffer_t *, const char *, va_list);
|
|||||||
|
|
||||||
error_t bgetc(Buffer_t *, uchar *);
|
error_t bgetc(Buffer_t *, uchar *);
|
||||||
size_t bread(Buffer_t *, uchar *, size_t);
|
size_t bread(Buffer_t *, uchar *, size_t);
|
||||||
size_t bscanf(Buffer_t *, const char *, ...);
|
size_t bscanf(Buffer_t *, size_t *, const char *, ...);
|
||||||
size_t vbscanf(Buffer_t *, const char *, va_list);
|
size_t vbscanf(Buffer_t *, size_t *, const char *, va_list);
|
||||||
|
|
||||||
error_t bemptybuf(Buffer_t *);
|
error_t bemptybuf(Buffer_t *);
|
||||||
error_t bscrolldown(Buffer_t *);
|
error_t bscrolldown(Buffer_t *);
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
// You should have received a copy of the GNU General Public License //
|
// You should have received a copy of the GNU General Public License //
|
||||||
// along with OS/K. If not, see <https://www.gnu.org/licenses/>. //
|
// along with OS/K. If not, see <https://www.gnu.org/licenses/>. //
|
||||||
//----------------------------------------------------------------------------//
|
//----------------------------------------------------------------------------//
|
||||||
|
#if 0
|
||||||
#include <lib/buf.h>
|
#include <lib/buf.h>
|
||||||
|
|
||||||
//
|
//
|
||||||
@ -43,7 +43,7 @@ size_t BScanFromBuf(Buffer_t *buf, const char *fmt, ...)
|
|||||||
|
|
||||||
size_t BScanFromBufV(Buffer_t *buf, const char *fmt, va_list ap)
|
size_t BScanFromBufV(Buffer_t *buf, const char *fmt, va_list ap)
|
||||||
{
|
{
|
||||||
size_t sz;
|
size_t rc;
|
||||||
|
|
||||||
ExAcquireLock(&buf->lock);
|
ExAcquireLock(&buf->lock);
|
||||||
sz = vbscanf(buf, fmt, ap);
|
sz = vbscanf(buf, fmt, ap);
|
||||||
@ -70,14 +70,13 @@ size_t vbscanf(Buffer_t *buf, const char *fmt, va_list ap)
|
|||||||
|
|
||||||
size_t readcnt = 0;
|
size_t readcnt = 0;
|
||||||
uchar ch = 0;
|
uchar ch = 0;
|
||||||
char *chptr;
|
|
||||||
|
|
||||||
bool l, h;
|
bool l, h;
|
||||||
|
|
||||||
size_t width;
|
size_t width;
|
||||||
bool ignore; // '*' modifier, don't write to va_list for current mod
|
bool ignore; // '*' modifier, don't write to va_list for current mod
|
||||||
|
|
||||||
if (!buf || !fmt) { seterrno(EINVAL); return 0; }
|
if (!buf || !fmt) { seterrnp(EINVAL); return 0; }
|
||||||
if (buf->flags & (BF_EOF|BF_ERR)) { seterrno(EENDF); return 0; }
|
if (buf->flags & (BF_EOF|BF_ERR)) { seterrno(EENDF); return 0; }
|
||||||
if (buf->state != BS_RDWR && buf->state != BS_WRONLY) {
|
if (buf->state != BS_RDWR && buf->state != BS_WRONLY) {
|
||||||
seterrno(EBADF);
|
seterrno(EBADF);
|
||||||
@ -85,7 +84,7 @@ size_t vbscanf(Buffer_t *buf, const char *fmt, va_list ap)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Progress in format string
|
// Progress in format string
|
||||||
while (*fmt && !rc) {
|
for (*fmt && !rc) {
|
||||||
|
|
||||||
// Skip all kinds of whitespaces
|
// Skip all kinds of whitespaces
|
||||||
if (isspace(*fmt)) {
|
if (isspace(*fmt)) {
|
||||||
@ -155,6 +154,8 @@ size_t vbscanf(Buffer_t *buf, const char *fmt, va_list ap)
|
|||||||
fmt++;
|
fmt++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
assert(!(width < 0));
|
||||||
|
|
||||||
//
|
//
|
||||||
// Extract length field
|
// Extract length field
|
||||||
//
|
//
|
||||||
@ -166,7 +167,7 @@ size_t vbscanf(Buffer_t *buf, const char *fmt, va_list ap)
|
|||||||
|
|
||||||
else if (*fmt == 'h') {
|
else if (*fmt == 'h') {
|
||||||
h = 1;
|
h = 1;
|
||||||
fmt++;
|
fmt++
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
@ -182,9 +183,8 @@ size_t vbscanf(Buffer_t *buf, const char *fmt, va_list ap)
|
|||||||
for (; width; width--) {
|
for (; width; width--) {
|
||||||
rc = bgetc(buf, &ch);
|
rc = bgetc(buf, &ch);
|
||||||
if (!rc) break;
|
if (!rc) break;
|
||||||
if (ignore) continue;
|
|
||||||
|
|
||||||
chptr = va_arg(ap, char *);
|
char *chptr = va_arg(ap, char *);
|
||||||
*chptr = (char)ch;
|
*chptr = (char)ch;
|
||||||
readcnt++;
|
readcnt++;
|
||||||
}
|
}
|
||||||
@ -192,7 +192,7 @@ size_t vbscanf(Buffer_t *buf, const char *fmt, va_list ap)
|
|||||||
|
|
||||||
// Decimal integer
|
// Decimal integer
|
||||||
else if (*fmt == 'd') {
|
else if (*fmt == 'd') {
|
||||||
;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -205,6 +205,10 @@ size_t vbscanf(Buffer_t *buf, const char *fmt, va_list ap)
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user