Line 0
Link Here
|
|
|
1 |
--- recombine.c.orig 2019-08-03 09:14:33 UTC |
2 |
+++ recombine.c |
3 |
@@ -169,7 +169,7 @@ void openfile(FILE **fp, char *filename, |
4 |
file[0] = '\0'; |
5 |
while (file[0] =='\0'){ |
6 |
fprintf(stdout,"Please enter a new filename>"); |
7 |
- gets(file); |
8 |
+ fgets(file,100,stdin); |
9 |
} |
10 |
break; |
11 |
case 'w': |
12 |
@@ -177,7 +177,7 @@ void openfile(FILE **fp, char *filename, |
13 |
file[0] = '\0'; |
14 |
while (file[0] =='\0'){ |
15 |
fprintf(stdout,"Please enter a new filename>"); |
16 |
- gets(file); |
17 |
+ fgets(file,100,stdin); |
18 |
} |
19 |
break; |
20 |
} |
21 |
@@ -1864,28 +1864,28 @@ if (strchr("#FLAHONESPGUMVRTD",ch) != NU |
22 |
case 'R': |
23 |
do { |
24 |
printf("Relative mutation rate of trait?\n"); |
25 |
- gets(input); |
26 |
+ fgets(input,LINESIZE,stdin); |
27 |
op->mutrait = atof(input); |
28 |
} while (op->mutrait <= 0.0); |
29 |
break; |
30 |
case 'T': |
31 |
do { |
32 |
printf("Ratio of forward to back trait mutation?\n"); |
33 |
- gets(input); |
34 |
+ fgets(input,LINESIZE,stdin); |
35 |
op->traitratio = atof(input); |
36 |
} while (op->traitratio <= 0.0); |
37 |
break; |
38 |
case 'D': |
39 |
do { |
40 |
printf("Frequency of trait?\n"); |
41 |
- gets(input); |
42 |
+ fgets(input,LINESIZE,stdin); |
43 |
op->pd = atof(input); |
44 |
} while (op->pd <= 0.0 || op->pd >= 1.0); |
45 |
break; |
46 |
case 'A': |
47 |
do { |
48 |
printf("Number of drops while resimulating (0-2)?\n"); |
49 |
- gets(input); |
50 |
+ fgets(input,LINESIZE,stdin); |
51 |
op->hapdrop = atol(input); |
52 |
} while (op->hapdrop != 0 && op->hapdrop != 1 && op->hapdrop != 2); |
53 |
default: |
54 |
@@ -1972,7 +1972,7 @@ if(strchr("#NQPDITFCRVHWZS12L34AB",ch) ! |
55 |
case 'T': |
56 |
do { |
57 |
printf("Transition/transversion ratio?\n"); |
58 |
- gets(input); |
59 |
+ fgets(input,LINESIZE,stdin); |
60 |
locus_ttratio = atof(input); |
61 |
if (locus_ttratio < 0.5) |
62 |
printf("TTratio cannot be less than 0.5\n"); |
63 |
@@ -1991,13 +1991,13 @@ if(strchr("#NQPDITFCRVHWZS12L34AB",ch) ! |
64 |
op->panel = !op->panel; |
65 |
if (op->panel) { |
66 |
printf("Number of populations?\n"); |
67 |
- gets(input); |
68 |
+ ; |
69 |
*numpop = atol(input); |
70 |
op->numpanel = (long *)calloc(*numpop,sizeof(long)); |
71 |
for(i = 0; i < *numpop; i++) { |
72 |
printf("Number of panel haplotypes for population"); |
73 |
printf(" %ld?\n",i+1); |
74 |
- gets(input); |
75 |
+ fgets(input,LINESIZE,stdin); |
76 |
op->numpanel[i] = atol(input); |
77 |
} |
78 |
} else |
79 |
@@ -2012,7 +2012,7 @@ if(strchr("#NQPDITFCRVHWZS12L34AB",ch) ! |
80 |
if (op->ctgry) { |
81 |
do { |
82 |
printf("Number of categories ?"); |
83 |
- gets(input); |
84 |
+ fgets(input,LINESIZE,stdin); |
85 |
op->categs = atoi(input); |
86 |
} while (op->categs < 1); |
87 |
free(op->rate); |
88 |
@@ -2091,7 +2091,7 @@ if(strchr("#NQPDITFCRVHWZS12L34AB",ch) ! |
89 |
if (!op->watt) { |
90 |
do { |
91 |
printf("Initial theta estimate?\n"); |
92 |
- gets(input); |
93 |
+ fgets(input,LINESIZE,stdin); |
94 |
theta0 = atof(input); |
95 |
} while (theta0 <= 0.0); |
96 |
} |
97 |
@@ -2099,7 +2099,7 @@ if(strchr("#NQPDITFCRVHWZS12L34AB",ch) ! |
98 |
case 'Z': |
99 |
printf("What recombination rate?\n"); |
100 |
do { |
101 |
- gets(input); |
102 |
+ fgets(input,LINESIZE,stdin); |
103 |
rec0 = atof(input); |
104 |
if (rec0 < 0.0) |
105 |
printf("recombination rate must be non-negative\n"); |
106 |
@@ -2108,7 +2108,7 @@ if(strchr("#NQPDITFCRVHWZS12L34AB",ch) ! |
107 |
case 'S': |
108 |
do { |
109 |
printf("How many Short Chains?\n"); |
110 |
- gets(input); |
111 |
+ fgets(input,LINESIZE,stdin); |
112 |
op->numchains[0] = atoi(input); |
113 |
if (op->numchains[0] < 0) |
114 |
printf("Must be non-negative\n"); |
115 |
@@ -2118,7 +2118,7 @@ if(strchr("#NQPDITFCRVHWZS12L34AB",ch) ! |
116 |
done = FALSE; |
117 |
while (!done) { |
118 |
printf("How often to sample trees?\n"); |
119 |
- gets(input); |
120 |
+ fgets(input,LINESIZE,stdin); |
121 |
op->increm[0] = atoi(input); |
122 |
if (op->increm[0] > 0) done = TRUE; |
123 |
else printf("Must be a positive integer\n"); |
124 |
@@ -2128,7 +2128,7 @@ if(strchr("#NQPDITFCRVHWZS12L34AB",ch) ! |
125 |
done = FALSE; |
126 |
while (!done) { |
127 |
printf("How many short steps?\n"); |
128 |
- gets(input); |
129 |
+ fgets(input,LINESIZE,stdin); |
130 |
op->steps[0] = atoi(input); |
131 |
if (op->steps[0] > 0) done = TRUE; |
132 |
else printf("Must be a positive integer\n"); |
133 |
@@ -2137,7 +2137,7 @@ if(strchr("#NQPDITFCRVHWZS12L34AB",ch) ! |
134 |
case 'L': |
135 |
do { |
136 |
printf("How many Long Chains?\n"); |
137 |
- gets(input); |
138 |
+ fgets(input,LINESIZE,stdin); |
139 |
op->numchains[1] = atoi(input); |
140 |
if (op->numchains[1] < 1) |
141 |
printf("Must be a positive integer\n"); |
142 |
@@ -2147,7 +2147,7 @@ if(strchr("#NQPDITFCRVHWZS12L34AB",ch) ! |
143 |
done = FALSE; |
144 |
while (!done) { |
145 |
printf("How often to sample trees?\n"); |
146 |
- gets(input); |
147 |
+ fgets(input,LINESIZE,stdin); |
148 |
op->increm[1] = atoi(input); |
149 |
if (op->increm[1] > 0) done = TRUE; |
150 |
else printf("Must be a positive integer\n"); |
151 |
@@ -2157,7 +2157,7 @@ if(strchr("#NQPDITFCRVHWZS12L34AB",ch) ! |
152 |
done = FALSE; |
153 |
while (!done) { |
154 |
printf("How many long steps?\n"); |
155 |
- gets(input); |
156 |
+ fgets(input,LINESIZE,stdin); |
157 |
op->steps[1] = atoi(input); |
158 |
if (op->steps[1] > 0) done = TRUE; |
159 |
else printf("Must be a positive integer\n"); |
160 |
@@ -2239,7 +2239,7 @@ do { |
161 |
if (menu1) print_startmenu(op,writeout); |
162 |
else {print_datamenu(op); print_searchmenu(op);} |
163 |
print_menuend(); |
164 |
- gets(input); |
165 |
+ fgets(input,LINESIZE,stdin); |
166 |
ch = toupper((int)input[0]); |
167 |
done = (ch == 'Y'); |
168 |
if (!done) { |