From 51467658c699591a615afe8a4861a8ce2fba7f1b Mon Sep 17 00:00:00 2001 From: eck Date: Thu, 3 May 1990 10:50:23 +0000 Subject: [PATCH] scan with %p didn't work properly on 2-4 machines --- lang/cem/libcc.ansi/stdio/doscan.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/lang/cem/libcc.ansi/stdio/doscan.c b/lang/cem/libcc.ansi/stdio/doscan.c index 51ac50dcd..40e906a63 100644 --- a/lang/cem/libcc.ansi/stdio/doscan.c +++ b/lang/cem/libcc.ansi/stdio/doscan.c @@ -9,6 +9,15 @@ #include #include "loc_incl.h" +#if _EM_WSIZE == _EM_PSIZE +#define set_pointer(flags) /* nothing */ +#elif _EM_LSIZE == _EM_PSIZE +#define set_pointer(flags) (flags |= FL_LONG) +#else +#error garbage pointer size +#define set_pointer(flags) /* compilation might continue */ +#endif + #define NUMLEN 512 #define NR_CHARS 256 @@ -251,11 +260,13 @@ _doscan(register FILE *stream, const char *format, va_list ap) *va_arg(ap, int *) = (int) nrchars; } break; + case 'p': /* pointer */ + set_pointer(flags); + /* fallthrough */ case 'b': /* binary */ case 'd': /* decimal */ case 'i': /* general integer */ case 'o': /* octal */ - case 'p': /* pointer */ case 'u': /* unsigned */ case 'x': /* hexadecimal */ case 'X': /* ditto */ -- 2.34.1