summaryrefslogtreecommitdiff
path: root/lang/bwbasic/files/patch-renum.c
diff options
context:
space:
mode:
authorJason E. Hale <jhale@FreeBSD.org>2017-01-19 00:37:17 +0000
committerJason E. Hale <jhale@FreeBSD.org>2017-01-19 00:37:17 +0000
commitf6c38015ec47b6ef8c45335774a50779f5882ae8 (patch)
tree7c2ae00e9b69f681675533850768de3687867899 /lang/bwbasic/files/patch-renum.c
parentUpdate to b41. (diff)
Update to 3.10
Install additional PORTEXAMPLES added in this release Add WWW to pkg-descr Changes: From the README CHANGES FROM 3.00 to 3.10 * Implements most of the following BASIC dialects: OPTION VERSION DARTMOUTH ' Dartmouth DTSS BASIC OPTION VERSION MARK-I ' GE 265 Mainframe BASIC OPTION VERSION MARK-II ' GE 435 Mainframe BASIC OPTION VERSION SYSTEM-360 ' IBM System/360 BASIC OPTION VERSION SYSTEM-370 ' IBM System/370 BASIC OPTION VERSION CBASIC-II ' CBASIC-II for CP/M OPTION VERSION ECMA-55 ' ANSI Minimal BASIC OPTION VERSION HANDBOOK1 ' The BASIC Handbook, 1st Edition OPTION VERSION HANDBOOK2 ' The BASIC Handbook, 2nd Edition OPTION VERSION TRS-80 ' TRS-80 Model I/III/4 LBASIC OPTION VERSION BASIC-80 ' Microsoft BASIC-80 for Xenix OPTION VERSION ECMA-116 ' ANSI Full BASIC
Notes
Notes: svn path=/head/; revision=431832
Diffstat (limited to 'lang/bwbasic/files/patch-renum.c')
-rw-r--r--lang/bwbasic/files/patch-renum.c77
1 files changed, 77 insertions, 0 deletions
diff --git a/lang/bwbasic/files/patch-renum.c b/lang/bwbasic/files/patch-renum.c
new file mode 100644
index 000000000000..17979dc66f61
--- /dev/null
+++ b/lang/bwbasic/files/patch-renum.c
@@ -0,0 +1,77 @@
+Fix various warnings. Don't use unsafe gets().
+
+--- renum.c.orig 2017-01-19 00:10:01 UTC
++++ renum.c
+@@ -7,6 +7,7 @@
+
+ #include <stdio.h>
+ #include <string.h>
++#include <stdlib.h>
+
+ int instr();
+ char *midstr1();
+@@ -17,14 +18,14 @@ int f2, l2, n, x;
+ int sidx[1500][2];
+ char rstr[255];
+
+-main(argc, argv)
++int main(argc, argv)
+ int argc;
+ char *argv[];
+ {
+ int f, d, s, p, s1, t, l, g;
+ int c, f1, c1, i, f8, r, l1, l3;
+ int v1, f6, l6, b, f9, x9, b1, p8, p9, a, d9;
+- char pstr[255], sstr[255], f9str[255], s9str[255], tempstr[255];
++ char pstr[255], f9str[255], s9str[255], tempstr[255];
+ FILE *fdin, *fdout;
+ int skip, bp, temp, getout, disp_msg;
+
+@@ -34,7 +35,10 @@ main(argc, argv)
+ else
+ {
+ printf("Program in file? ");
+- gets(pstr);
++ fgets(pstr, 255, stdin);
++ if (pstr[0] != '\n' || pstr[0] != '\0') {
++ pstr[strlen(pstr) - 1] = '\0';
++ }
+ }
+ if (strlen(pstr) == 0) strcpy(pstr, "0.doc");
+
+@@ -124,7 +128,7 @@ main(argc, argv)
+ skip = 0;
+ bp = 0;
+ printf("RENUMBER-");
+- gets(pstr);
++ fgets(pstr, 255, stdin);
+ p = strlen(pstr);
+
+ if (g == 0)
+@@ -268,7 +272,7 @@ main(argc, argv)
+ printf("%d -> %d\n", sidx[r][0], sidx[r][1]); */
+
+ printf("VERIFY? ");
+- gets(pstr);
++ fgets(pstr, 255, stdin);
+ v1 = 0;
+ if (strcmp(midstr2(pstr, 1, 1), "N") == 0) v1 = 1;
+
+@@ -473,7 +477,7 @@ main(argc, argv)
+ fclose(fdin);
+ fclose(fdout);
+ #if !defined(__MVS__) && !defined(__CMS__)
+- sprintf(tempstr, "mv editfl %s\0", f9str);
++ sprintf(tempstr, "mv editfl %s", f9str);
+ system(tempstr);
+ #endif
+ return (0);
+@@ -542,7 +546,7 @@ void binary_search(void)
+
+ if (sidx[m][0] == n)
+ {
+- sprintf(rstr, "%d\0", sidx[m][1]);
++ sprintf(rstr, "%d", sidx[m][1]);
+ x = 0;
+ return;
+ }