slackbuilds_ponce/development/ieee-pilot/gencode.diff

39 lines
1.2 KiB
Diff
Raw Normal View History

diff --git a/gencode.c b/gencode.c
index 0909641..4d4ec8b 100644
--- a/gencode.c
+++ b/gencode.c
@@ -529,8 +529,11 @@ void solhook(char *s) {
vp->v.label.addr <= ftell(yyin) &&
vp->v.label.addr >=
ftell(yyin) - (int)strlen(s)) {
- (void)fprintf(yyout, "plt_%s:\n",
- vp->name);
+ static char *last_emitted;
+ if(last_emitted != vp->name) {
+ (void)fprintf(yyout, "plt_%s:\n", vp->name);
+ last_emitted = vp->name;
+ }
}
}
@@ -1227,6 +1230,10 @@ int execfile(char *t) {
(void)fprintf(yyout, "/* %s -- generated C code for %s */\n",
outfile, source);
(void)fputs("#include <stdio.h>\n", yyout);
+ (void)fputs("#include <string.h>\n", yyout);
+ (void)fputs("#include <unistd.h>\n", yyout);
+ (void)fputs("#include <stdlib.h>\n", yyout);
+ (void)fputs("extern char *gets(char *s);\n", yyout);
(void)fputs("#include \"pilot.h\"\n", yyout);
/* generate declarations for all non-system variables */
@@ -1256,7 +1263,7 @@ int execfile(char *t) {
(void)fputs(PASS2, stderr);
}
- (void)fputs("\nmain()\n{\n do_scrinit();\n", yyout);
+ (void)fputs("\nint main(int argc, char **argv)\n{\n do_scrinit();\n", yyout);
indent = 1;
}