- Add an end-of-string to each line of the input

when parsing the input files

PR:		56043
Submitted by:	maintainer
This commit is contained in:
Kirill Ponomarev 2003-08-28 04:51:02 +00:00
parent 8c5dce9aef
commit c101866e9f
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=87827

View file

@ -77,7 +77,7 @@
strcat(local_prompt," [%s]: "); strcat(local_prompt," [%s]: ");
fprintf(stdout,local_prompt,file_name); fprintf(stdout,local_prompt,file_name);
- gets(temp); - gets(temp);
+ fgets(temp,FILENAMELEN+1,stdin); + fgets(temp,FILENAMELEN+1,stdin); if(*temp != EOS) temp[strlen(temp)-1]=EOS;
if(*temp != EOS) strcpy(file_name,temp); if(*temp != EOS) strcpy(file_name,temp);
} }
} }
@ -86,7 +86,7 @@
strcat(local_prompt," [%s]: "); strcat(local_prompt," [%s]: ");
fprintf(stdout,local_prompt,file_name); fprintf(stdout,local_prompt,file_name);
- gets(temp); - gets(temp);
+ fgets(temp,FILENAMELEN+1,stdin); + fgets(temp,FILENAMELEN+1,stdin); if(*temp != EOS) temp[strlen(temp)-1]=EOS;
if(*temp != EOS) strcpy(file_name,temp); if(*temp != EOS) strcpy(file_name,temp);
} }
@ -95,7 +95,7 @@
fprintf(stdout,"\nUse the existing GUIDE TREE file, %s (y/n) ? [y]: ", fprintf(stdout,"\nUse the existing GUIDE TREE file, %s (y/n) ? [y]: ",
tree_name); tree_name);
- gets(temp); - gets(temp);
+ fgets(temp,MAXLINE,stdin); + fgets(temp,MAXLINE,stdin); if(*temp != EOS) temp[strlen(temp)-1]=EOS;
if(*temp != 'n' && *temp != 'N') { if(*temp != 'n' && *temp != 'N') {
strcpy(phylip_name,tree_name); strcpy(phylip_name,tree_name);
use_tree = TRUE; use_tree = TRUE;
@ -104,7 +104,7 @@
fprintf(stdout,"\nEnter a name for the guide tree file [%s]: ", fprintf(stdout,"\nEnter a name for the guide tree file [%s]: ",
phylip_name); phylip_name);
- gets(temp); - gets(temp);
+ fgets(temp,MAXLINE,stdin); + fgets(temp,MAXLINE,stdin); if(*temp != EOS) temp[strlen(temp)-1]=EOS;
if(*temp != EOS) if(*temp != EOS)
strcpy(phylip_name,temp); strcpy(phylip_name,temp);
} }
@ -113,7 +113,7 @@
fprintf(stdout,"\nUse the existing GUIDE TREE file for Profile 1, %s (y/n) ? [y]: ", fprintf(stdout,"\nUse the existing GUIDE TREE file for Profile 1, %s (y/n) ? [y]: ",
tree_name); tree_name);
- gets(temp); - gets(temp);
+ fgets(temp,MAXLINE,stdin); + fgets(temp,MAXLINE,stdin); if(*temp != EOS) temp[strlen(temp)-1]=EOS;
if(*temp != 'n' && *temp != 'N') { if(*temp != 'n' && *temp != 'N') {
strcpy(p1_tree_name,tree_name); strcpy(p1_tree_name,tree_name);
use_tree1 = TRUE; use_tree1 = TRUE;
@ -122,7 +122,7 @@
fprintf(stdout,"\nUse the existing GUIDE TREE file for Profile 2, %s (y/n) ? [y]: ", fprintf(stdout,"\nUse the existing GUIDE TREE file for Profile 2, %s (y/n) ? [y]: ",
tree_name); tree_name);
- gets(temp); - gets(temp);
+ fgets(temp,MAXLINE,stdin); + fgets(temp,MAXLINE,stdin); if(*temp != EOS) temp[strlen(temp)-1]=EOS;
if(*temp != 'n' && *temp != 'N') { if(*temp != 'n' && *temp != 'N') {
strcpy(p2_tree_name,tree_name); strcpy(p2_tree_name,tree_name);
use_tree2 = TRUE; use_tree2 = TRUE;
@ -131,7 +131,7 @@
fprintf(stdout,"\nEnter a name for the parameter output file [%s]: ", fprintf(stdout,"\nEnter a name for the parameter output file [%s]: ",
parname); parname);
- gets(temp); - gets(temp);
+ fgets(temp,FILENAMELEN+1,stdin); + fgets(temp,FILENAMELEN+1,stdin); if(*temp != EOS) temp[strlen(temp)-1]=EOS;
if(*temp != EOS) if(*temp != EOS)
strcpy(parname,temp); strcpy(parname,temp);
} }