diff --git a/fcc/driver/fcc.c b/fcc/driver/fcc.c index 6421f9067..101fa3fce 100644 --- a/fcc/driver/fcc.c +++ b/fcc/driver/fcc.c @@ -21,9 +21,14 @@ #include #include -#include #include #include +#if __STDC__ +#include +#else +#include +#endif + /* Version producing cc-compatible .o files in one pass. @@ -117,7 +122,11 @@ int c_flag = 0; int v_flag = 0; int O_flag = 0; +#if __STDC__ +char *mkstr(char *, ...); +#else char *mkstr(); +#endif char *malloc(); char *alloc(); char *extension(); @@ -483,6 +492,32 @@ concat(al1, al2) } } +#if __STDC__ +/*VARARGS*/ +char * +mkstr(char *dst, ...) +{ + va_list ap; + + va_start(ap, dst); + { + register char *p; + register char *q; + + q = dst; + p = va_arg(ap, char *); + + while (p) { + while (*q++ = *p++); + q--; + p = va_arg(ap, char *); + } + } + va_end(ap); + + return dst; +} +#else /*VARARGS*/ char * mkstr(va_alist) @@ -509,6 +544,7 @@ mkstr(va_alist) return dst; } +#endif basename(str, dst) char *str; diff --git a/util/ceg/EM_parser/common/help.c b/util/ceg/EM_parser/common/help.c index 85a54a0d0..a997354bb 100644 --- a/util/ceg/EM_parser/common/help.c +++ b/util/ceg/EM_parser/common/help.c @@ -1,6 +1,11 @@ #include #include +#if __STDC__ +#include +extern out(char *, ...); +#else #include +#endif #define CODE_EXPANDER #include "em.h" @@ -99,6 +104,17 @@ int seg; } } +#if __STDC__ +/*VARARGS*/ +out(char *fmt, ...) +{ + va_list pvar; + + va_start(pvar, fmt); + doprnt( outfile, fmt, pvar); + va_end(pvar); +} +#else /*VARARGS*/ out(va_alist) va_dcl @@ -111,6 +127,7 @@ va_dcl doprnt( outfile, fmt, pvar); va_end(pvar); } +#endif char *suffix( str, suf) char *str, *suf; diff --git a/util/ceg/as_parser/help.c b/util/ceg/as_parser/help.c index 4fb4b608e..4f3575018 100644 --- a/util/ceg/as_parser/help.c +++ b/util/ceg/as_parser/help.c @@ -1,4 +1,10 @@ -#include "varargs.h" +#if __STDC__ +#include +extern out(char *, ...); +extern error(char *, ...); +#else +#include +#endif #include "decl.h" /* All the functions in this file will be called by the parser. @@ -208,6 +214,32 @@ operand_clean() n_ops = 0; } +#if __STDC__ +/*VARARGS*/ +out(char *fmt, ...) +{ + va_list pvar; + + va_start(pvar, fmt); + doprnt( outfile, fmt, pvar); + va_end(pvar); +} + +extern int nerrors; + +/*VARARGS*/ +error(char *fmt, ...) +{ + va_list pvar; + + nerrors++; + va_start(pvar, fmt); + fprint( STDERR, "!! ERROR : "); + doprnt( STDERR, fmt, pvar); + fprint( STDERR, " !!\n"); + va_end(pvar); +} +#else /*VARARGS*/ out(va_alist) va_dcl @@ -238,6 +270,7 @@ va_dcl fprint( STDERR, " !!\n"); va_end(pvar); } +#endif inc_ops() { diff --git a/util/ceg/assemble/obj_assemble/assemble.c b/util/ceg/assemble/obj_assemble/assemble.c index f5113e1c4..abd801798 100644 --- a/util/ceg/assemble/obj_assemble/assemble.c +++ b/util/ceg/assemble/obj_assemble/assemble.c @@ -1,7 +1,12 @@ #include #include #include +#if __STDC__ +#include +extern error(char *, ...); +#else #include +#endif #include "as.h" #include "const.h" @@ -224,6 +229,22 @@ char *mnem; /*** Error ****************************************************************/ +#if __STDC__ +/*VARARGS*/ +error(char *fmt, ...) +{ + va_list args; + extern int yylineno; + extern int nerrors; + + va_start(args, fmt); + fprint( STDERR, "ERROR in line %d : ", yylineno); + doprnt( STDERR, fmt, args); + fprint( STDERR, "\n"); + va_end(args); + nerrors++; +} +#else /*VARARGS*/ error(va_alist) va_dcl @@ -241,3 +262,4 @@ error(va_alist) va_end(args); nerrors++; } +#endif diff --git a/util/ceg/ce_back/obj_back/extnd.c b/util/ceg/ce_back/obj_back/extnd.c index 2fda33b83..e367d0faf 100644 --- a/util/ceg/ce_back/obj_back/extnd.c +++ b/util/ceg/ce_back/obj_back/extnd.c @@ -4,7 +4,11 @@ #include "header.h" #include "back.h" #include "mach.h" +#if __STDC__ +#include +#else #include +#endif /* Mysprint() stores the string directly in the string_arae. This saves * a copy action. It is assumed that the strings stored in the string-table @@ -13,6 +17,22 @@ #define MAXSTRLEN 1024 +#if __STDC__ +/*VARARGS*/ +static int mysprint(char *fmt, ...) +{ + va_list args; + int retval; + + va_start(args, fmt); + while (string + MAXSTRLEN - string_area > size_string) + mem_string(); + retval = _format(string, fmt, args); + string[retval] = '\0'; + va_end(args); + return retval; +} +#else /*VARARGS*/ static int mysprint(va_alist) va_dcl @@ -30,6 +50,7 @@ static int mysprint(va_alist) va_end(args); return retval; } +#endif /* The extnd_*()s make a name unique. The resulting string is directly stored * in the symbol_table (by mysprint()). Later additional fields in the