aboutsummaryrefslogtreecommitdiffstats
path: root/biology/clustalw/files/patch-aj
blob: 4e7cb3c21c94ac90388b46a018161f433dc634e4 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
--- util.c.orig Thu Feb 13 16:19:35 2003
+++ util.c  Thu Feb 13 16:21:40 2003
@@ -171,10 +171,11 @@
    return str;
 }
 
-void getstr(char *instr,char *outstr)
+void getstr(char *instr,char *outstr, int len)
 {  
    fprintf(stdout,"%s: ",instr);
-   gets(outstr);
+   fgets(outstr, len, stdin);
+   outstr[strlen(outstr)-1] = '\0';
 }
 
 double getreal(char *instr,double minx,double maxx,double def)
@@ -185,7 +186,7 @@
    
    while(TRUE) {
        fprintf(stdout,"%s (%.1f-%.1f)   [%.1f]: ",instr,minx,maxx,def);
-       gets(line);
+       fgets(line, MAXLINE, stdin);
        status=sscanf(line,"%f",&ret);
        if(status == EOF) return def;
        if(ret>maxx) {
@@ -210,7 +211,7 @@
    while(TRUE) {
        fprintf(stdout,"%s (%d..%d)    [%d]: ",
        instr,(pint)minx,(pint)maxx,(pint)def);
-       gets(line);
+       fgets(line, MAXLINE, stdin);
        status=sscanf(line,"%d",&ret);
        if(status == EOF) return def;
        if(ret>maxx) {
@@ -230,7 +231,7 @@
 {
    char line[MAXLINE];
    
-   getstr("\n\nEnter system command",line);
+   getstr("\n\nEnter system command",line,MAXLINE);
    if(*line != EOS)
        system(line);
    fprintf(stdout,"\n\n");