compinfo.c rewrite
[unres.git] / source / unres / src_CSA / compinfo.c
index d20b2c9..c7eecbe 100644 (file)
@@ -28,9 +28,8 @@ uname(&Name);
 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);
@@ -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");
+}
+system("rm tmptmp");
+fclose(in1);
 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);
-    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';