1
0
mirror of https://git.FreeBSD.org/ports.git synced 2024-12-15 03:14:23 +00:00

Remove the two gets() calls and replace with fgets()

https://reviews.freebsd.org/D12298
Whilst here redo the patches with make makepatch

PR:		ports/222796
Reported by:	emaste@
This commit is contained in:
Diane Bruce 2017-10-07 01:24:16 +00:00
parent b7cefa5b5e
commit 7f932a1d60
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=451423
7 changed files with 58 additions and 31 deletions

View File

@ -1,5 +1,5 @@
--- src/gain.c.orig Tue Jul 19 12:24:45 2005
+++ src/gain.c Tue Jul 19 12:24:50 2005
--- src/gain.c.orig 2000-10-28 11:45:51 UTC
+++ src/gain.c
@@ -3,7 +3,6 @@
#endif
#include <stdio.h>

View File

@ -1,17 +1,17 @@
--- src/genetic_algorithm_lib.c.orig Tue Jul 19 12:25:24 2005
+++ src/genetic_algorithm_lib.c Tue Jul 19 12:35:51 2005
--- src/genetic_algorithm_lib.c.orig 2000-10-28 13:04:39 UTC
+++ src/genetic_algorithm_lib.c
@@ -3,9 +3,8 @@
#endif
#include <string.h>
-#include <values.h>
-#include <math.h>
#include <sys/types.h>
+#include <math.h>
#include <errno.h>
#include "yagi.h"
@@ -245,7 +244,7 @@
@@ -245,7 +244,7 @@ int Selection(FILE *fd, int gen)
GeneRecord *temp ;
double minfit,maxfit ;
sigma=0.0 ;
@ -19,4 +19,4 @@
+ minfit=MAXFLOAT;
maxfit=-minfit ;
/* minfit=1e308; maxfit=-1e308; XXXXXXXXXXXXXXXXXXXXXX */
for(a=0 ; a<population_size ; a++ )
for(a=0 ; a<population_size ; a++ )

View File

@ -1,10 +1,37 @@
--- src/input.c.orig Tue Jul 19 12:24:11 2005
+++ src/input.c Tue Jul 19 12:24:18 2005
@@ -16,7 +16,6 @@
--- src/input.c.orig 2005-07-10 09:16:31 UTC
+++ src/input.c
@@ -16,7 +16,6 @@ manually!
*/
#include <stdio.h>
-#include <malloc.h>
#include <math.h>
#include "nrutil.h"
#include "yagi.h"
@@ -32,8 +31,9 @@ int main(int argc, char **argv)
char response, *filename, *notes, *type, data_entry;
FILE *fp;
- filename = string(0L, 1000L);
- notes = string(0L, 1000L);
+#define MAXINPUTLINE 1000
+ filename = string(0L, MAXINPUTLINE);
+ notes = string(0L, MAXINPUTLINE);
type = string(0L, 1000L);
while ((c = getoptions(argc,argv,"h")) != -1)
@@ -56,10 +56,10 @@ int main(int argc, char **argv)
printf("\nThis program asks for length, diameter and position of antenna elements then\n");
printf("writes them to a file you specify. Data is written in m (metres)\n \n");
printf("Enter any notes on this design (up to 400 characters): ");
- gets(notes);
- printf("Enter a filename to write data to ");
- gets(filename);
- printf("Enter the centre frequency in MHz ");
+ fgets(notes, MAXINPUTLINE-1, stdin);
+ printf("Enter a filename to write data to ");
+ fgets(filename, MAXINPUTLINE-1, stdin);
+ printf("Enter the centre frequency in MHz ");
scanf("%lf", &frequency);
printf("Enter the minimum frequency in MHz ");
scanf("%lf", &min_f);

View File

@ -1,8 +1,8 @@
--- src/output.c.orig Tue Jul 19 12:24:27 2005
+++ src/output.c Tue Jul 19 12:24:35 2005
@@ -11,7 +11,6 @@
--- src/output.c.orig 2000-10-29 14:43:15 UTC
+++ src/output.c
@@ -11,7 +11,6 @@ of system memory.
#ifdef HAVE_STDLIB_H
#endif
-#include <malloc.h>
#include <math.h>

View File

@ -1,10 +1,10 @@
--- src/random.c.orig Tue Jul 19 12:36:04 2005
+++ src/random.c Tue Jul 19 12:36:13 2005
@@ -42,7 +42,6 @@
--- src/random.c.orig 2000-10-28 11:43:17 UTC
+++ src/random.c
@@ -42,7 +42,6 @@ return(VAX_integer_random_number_generat
#endif
-#include <values.h>
#include "yagi.h"
double randreal(void)

View File

@ -1,10 +1,10 @@
--- src/string.c.orig Tue Jul 19 12:23:46 2005
+++ src/string.c Tue Jul 19 12:23:56 2005
--- src/string.c.orig 2000-10-28 13:54:45 UTC
+++ src/string.c
@@ -2,7 +2,6 @@
#include <stdlib.h>
#endif
#include <stdio.h>
-#include <malloc.h>
#include "yagi.h"

View File

@ -1,8 +1,8 @@
--- src/yagi.c.orig Tue Jul 19 12:23:10 2005
+++ src/yagi.c Tue Jul 19 12:23:33 2005
@@ -19,7 +19,7 @@
--- src/yagi.c.orig 2005-07-09 19:59:56 UTC
+++ src/yagi.c
@@ -19,7 +19,7 @@ formulae */
#include <stdio.h>
-#include <malloc.h>
+#include <stdlib.h>