projects
/
unres.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
a9b59dc
)
compinfo.c rewrite
author
Dawid Jagiela
<lightnir@chem.univ.gda.pl>
Sat, 26 May 2012 17:01:29 +0000
(19:01 +0200)
committer
Dawid Jagiela
<lightnir@chem.univ.gda.pl>
Sat, 26 May 2012 17:01:29 +0000
(19:01 +0200)
source/unres/src_CSA/compinfo.c
patch
|
blob
|
history
source/unres/src_MD-M/compinfo.c
patch
|
blob
|
history
source/unres/src_MD/compinfo.c
patch
|
blob
|
history
source/wham/src/compinfo.c
patch
|
blob
|
history
diff --git
a/source/unres/src_CSA/compinfo.c
b/source/unres/src_CSA/compinfo.c
index
d20b2c9
..
c7eecbe
100644
(file)
--- a/
source/unres/src_CSA/compinfo.c
+++ b/
source/unres/src_CSA/compinfo.c
@@
-28,9
+28,8
@@
uname(&Name);
time(&Tp);
system("whoami > tmptmp");
in1=fopen("tmptmp","r");
time(&Tp);
system("whoami > tmptmp");
in1=fopen("tmptmp","r");
-fscanf(in1,"%s",buf1);
-fclose(in1);
-system("rm tmptmp");
+if (fscanf(in1,"%s",buf1) != NULL)
+{
p1=ctime(&Tp);
p1[strlen(p1)-1]='\0';
fprintf(out," write(iout,*)'compiled %s'\n",p1);
p1=ctime(&Tp);
p1[strlen(p1)-1]='\0';
fprintf(out," write(iout,*)'compiled %s'\n",p1);
@@
-40,6
+39,9
@@
fprintf(out," write(iout,*)'OS release: %s '\n",Name.release);
fprintf(out," write(iout,*)'OS version:',\n");
fprintf(out," & ' %s '\n",Name.version);
fprintf(out," write(iout,*)'flags:'\n");
fprintf(out," write(iout,*)'OS version:',\n");
fprintf(out," & ' %s '\n",Name.version);
fprintf(out," write(iout,*)'flags:'\n");
+}
+system("rm tmptmp");
+fclose(in1);
in1=fopen("Makefile","r");
while(fgets(buf,498,in1) != NULL)
{
in1=fopen("Makefile","r");
while(fgets(buf,498,in1) != NULL)
{
@@
-57,8
+59,8
@@
while(fgets(buf,498,in1) != NULL)
{
strcat(buf,"\\");
fprintf(out," write(iout,*)'%s'\n",buf);
{
strcat(buf,"\\");
fprintf(out," write(iout,*)'%s'\n",buf);
- fgets(buf,498,in1);
- buf[strlen(buf)-1]='\0';
+ if (fgets(buf,498,in1) != NULL)
+ buf[strlen(buf)-1]='\0';
if(strlen(buf) > 49)
{
buf[47]='\0';
if(strlen(buf) > 49)
{
buf[47]='\0';
diff --git
a/source/unres/src_MD-M/compinfo.c
b/source/unres/src_MD-M/compinfo.c
index
cbe8ed9
..
c7eecbe
100644
(file)
--- a/
source/unres/src_MD-M/compinfo.c
+++ b/
source/unres/src_MD-M/compinfo.c
@@
-14,10
+14,10
@@
time_t Tp;
in=fopen("cinfo.f","r");
out=fopen("cinfo.f.new","w");
in=fopen("cinfo.f","r");
out=fopen("cinfo.f.new","w");
-(void)fgets(buf,498,in);
-fprintf(out,"C DO NOT EDIT THIS FILE - IT HAS BEEN GENERATED BY COMPINFO.C\n");
-(void)fgets(buf,498,in);
-sscanf(&buf[1],"%d %d %d",&iv1,&iv2,&iv3);
+if (fgets(buf,498,in) != NULL)
+ fprintf(out,"C DO NOT EDIT THIS FILE - IT HAS BEEN GENERATED BY COMPINFO.C\n");
+if (fgets(buf,498,in) != NULL)
+ sscanf(&buf[1],"%d %d %d",&iv1,&iv2,&iv3);
iv3++;
fprintf(out,"C %d %d %d\n",iv1,iv2,iv3);
fprintf(out," subroutine cinfo\n");
iv3++;
fprintf(out,"C %d %d %d\n",iv1,iv2,iv3);
fprintf(out," subroutine cinfo\n");
@@
-28,9
+28,8
@@
uname(&Name);
time(&Tp);
system("whoami > tmptmp");
in1=fopen("tmptmp","r");
time(&Tp);
system("whoami > tmptmp");
in1=fopen("tmptmp","r");
-(void)fscanf(in1,"%s",buf1);
-fclose(in1);
-system("rm tmptmp");
+if (fscanf(in1,"%s",buf1) != NULL)
+{
p1=ctime(&Tp);
p1[strlen(p1)-1]='\0';
fprintf(out," write(iout,*)'compiled %s'\n",p1);
p1=ctime(&Tp);
p1[strlen(p1)-1]='\0';
fprintf(out," write(iout,*)'compiled %s'\n",p1);
@@
-40,6
+39,9
@@
fprintf(out," write(iout,*)'OS release: %s '\n",Name.release);
fprintf(out," write(iout,*)'OS version:',\n");
fprintf(out," & ' %s '\n",Name.version);
fprintf(out," write(iout,*)'flags:'\n");
fprintf(out," write(iout,*)'OS version:',\n");
fprintf(out," & ' %s '\n",Name.version);
fprintf(out," write(iout,*)'flags:'\n");
+}
+system("rm tmptmp");
+fclose(in1);
in1=fopen("Makefile","r");
while(fgets(buf,498,in1) != NULL)
{
in1=fopen("Makefile","r");
while(fgets(buf,498,in1) != NULL)
{
@@
-57,7
+59,7
@@
while(fgets(buf,498,in1) != NULL)
{
strcat(buf,"\\");
fprintf(out," write(iout,*)'%s'\n",buf);
{
strcat(buf,"\\");
fprintf(out," write(iout,*)'%s'\n",buf);
- if (fgets(buf,498,in1) != NULL )
+ if (fgets(buf,498,in1) != NULL)
buf[strlen(buf)-1]='\0';
if(strlen(buf) > 49)
{
buf[strlen(buf)-1]='\0';
if(strlen(buf) > 49)
{
diff --git
a/source/unres/src_MD/compinfo.c
b/source/unres/src_MD/compinfo.c
index
33cf08c
..
c7eecbe
100644
(file)
--- a/
source/unres/src_MD/compinfo.c
+++ b/
source/unres/src_MD/compinfo.c
@@
-14,10
+14,10
@@
time_t Tp;
in=fopen("cinfo.f","r");
out=fopen("cinfo.f.new","w");
in=fopen("cinfo.f","r");
out=fopen("cinfo.f.new","w");
-(void)fgets(buf,498,in);
-fprintf(out,"C DO NOT EDIT THIS FILE - IT HAS BEEN GENERATED BY COMPINFO.C\n");
-(void)fgets(buf,498,in);
-sscanf(&buf[1],"%d %d %d",&iv1,&iv2,&iv3);
+if (fgets(buf,498,in) != NULL)
+ fprintf(out,"C DO NOT EDIT THIS FILE - IT HAS BEEN GENERATED BY COMPINFO.C\n");
+if (fgets(buf,498,in) != NULL)
+ sscanf(&buf[1],"%d %d %d",&iv1,&iv2,&iv3);
iv3++;
fprintf(out,"C %d %d %d\n",iv1,iv2,iv3);
fprintf(out," subroutine cinfo\n");
iv3++;
fprintf(out,"C %d %d %d\n",iv1,iv2,iv3);
fprintf(out," subroutine cinfo\n");
@@
-28,9
+28,8
@@
uname(&Name);
time(&Tp);
system("whoami > tmptmp");
in1=fopen("tmptmp","r");
time(&Tp);
system("whoami > tmptmp");
in1=fopen("tmptmp","r");
-(void)fscanf(in1,"%s",buf1);
-fclose(in1);
-system("rm tmptmp");
+if (fscanf(in1,"%s",buf1) != NULL)
+{
p1=ctime(&Tp);
p1[strlen(p1)-1]='\0';
fprintf(out," write(iout,*)'compiled %s'\n",p1);
p1=ctime(&Tp);
p1[strlen(p1)-1]='\0';
fprintf(out," write(iout,*)'compiled %s'\n",p1);
@@
-40,6
+39,9
@@
fprintf(out," write(iout,*)'OS release: %s '\n",Name.release);
fprintf(out," write(iout,*)'OS version:',\n");
fprintf(out," & ' %s '\n",Name.version);
fprintf(out," write(iout,*)'flags:'\n");
fprintf(out," write(iout,*)'OS version:',\n");
fprintf(out," & ' %s '\n",Name.version);
fprintf(out," write(iout,*)'flags:'\n");
+}
+system("rm tmptmp");
+fclose(in1);
in1=fopen("Makefile","r");
while(fgets(buf,498,in1) != NULL)
{
in1=fopen("Makefile","r");
while(fgets(buf,498,in1) != NULL)
{
@@
-57,8
+59,8
@@
while(fgets(buf,498,in1) != NULL)
{
strcat(buf,"\\");
fprintf(out," write(iout,*)'%s'\n",buf);
{
strcat(buf,"\\");
fprintf(out," write(iout,*)'%s'\n",buf);
- (void)fgets(buf,498,in1);
- buf[strlen(buf)-1]='\0';
+ if (fgets(buf,498,in1) != NULL)
+ buf[strlen(buf)-1]='\0';
if(strlen(buf) > 49)
{
buf[47]='\0';
if(strlen(buf) > 49)
{
buf[47]='\0';
diff --git
a/source/wham/src/compinfo.c
b/source/wham/src/compinfo.c
index
33cf08c
..
c7eecbe
100644
(file)
--- a/
source/wham/src/compinfo.c
+++ b/
source/wham/src/compinfo.c
@@
-14,10
+14,10
@@
time_t Tp;
in=fopen("cinfo.f","r");
out=fopen("cinfo.f.new","w");
in=fopen("cinfo.f","r");
out=fopen("cinfo.f.new","w");
-(void)fgets(buf,498,in);
-fprintf(out,"C DO NOT EDIT THIS FILE - IT HAS BEEN GENERATED BY COMPINFO.C\n");
-(void)fgets(buf,498,in);
-sscanf(&buf[1],"%d %d %d",&iv1,&iv2,&iv3);
+if (fgets(buf,498,in) != NULL)
+ fprintf(out,"C DO NOT EDIT THIS FILE - IT HAS BEEN GENERATED BY COMPINFO.C\n");
+if (fgets(buf,498,in) != NULL)
+ sscanf(&buf[1],"%d %d %d",&iv1,&iv2,&iv3);
iv3++;
fprintf(out,"C %d %d %d\n",iv1,iv2,iv3);
fprintf(out," subroutine cinfo\n");
iv3++;
fprintf(out,"C %d %d %d\n",iv1,iv2,iv3);
fprintf(out," subroutine cinfo\n");
@@
-28,9
+28,8
@@
uname(&Name);
time(&Tp);
system("whoami > tmptmp");
in1=fopen("tmptmp","r");
time(&Tp);
system("whoami > tmptmp");
in1=fopen("tmptmp","r");
-(void)fscanf(in1,"%s",buf1);
-fclose(in1);
-system("rm tmptmp");
+if (fscanf(in1,"%s",buf1) != NULL)
+{
p1=ctime(&Tp);
p1[strlen(p1)-1]='\0';
fprintf(out," write(iout,*)'compiled %s'\n",p1);
p1=ctime(&Tp);
p1[strlen(p1)-1]='\0';
fprintf(out," write(iout,*)'compiled %s'\n",p1);
@@
-40,6
+39,9
@@
fprintf(out," write(iout,*)'OS release: %s '\n",Name.release);
fprintf(out," write(iout,*)'OS version:',\n");
fprintf(out," & ' %s '\n",Name.version);
fprintf(out," write(iout,*)'flags:'\n");
fprintf(out," write(iout,*)'OS version:',\n");
fprintf(out," & ' %s '\n",Name.version);
fprintf(out," write(iout,*)'flags:'\n");
+}
+system("rm tmptmp");
+fclose(in1);
in1=fopen("Makefile","r");
while(fgets(buf,498,in1) != NULL)
{
in1=fopen("Makefile","r");
while(fgets(buf,498,in1) != NULL)
{
@@
-57,8
+59,8
@@
while(fgets(buf,498,in1) != NULL)
{
strcat(buf,"\\");
fprintf(out," write(iout,*)'%s'\n",buf);
{
strcat(buf,"\\");
fprintf(out," write(iout,*)'%s'\n",buf);
- (void)fgets(buf,498,in1);
- buf[strlen(buf)-1]='\0';
+ if (fgets(buf,498,in1) != NULL)
+ buf[strlen(buf)-1]='\0';
if(strlen(buf) > 49)
{
buf[47]='\0';
if(strlen(buf) > 49)
{
buf[47]='\0';