Platon Technologies
not logged in Login Registration
EnglishSlovak
open source software development celebrating 10 years of open source development! Friday, October 16, 2026

Diff for libplaton/platon/misc/fileplus.c between version 1.2 and 1.3

version 1.2, 2002/02/05 22:37:04 version 1.3, 2002/07/16 22:26:16
Line 1 
Line 1 
 #include<stdio.h>  #include<stdio.h>
 #include<string.h>  #include<string.h>
   
   #ifdef __MSDOS__
   /* here goes MS-DOS header files inclusion */
   #else
   #       include<unistd.h>
   #       include<stdlib.h>
   #endif
   
 #include "fileplus.h"  #include "fileplus.h"
   
 int __fsort(const char*filename,int(*fsfnc)(const char*,const char*),__FSORT_MODE mode){  int __fsort(const char*filename,int(*fsfnc)(const char*,const char*),__FSORT_MODE mode){
         register int fsorted;          register int fsorted;
         char ftmpname[L_tmpnam],buf[FSORT_LINESIZE+1],buftmp[FSORT_LINESIZE+1];          FILE *f, *ftmp;
         FILE*f,*ftmp;          char buf[FSORT_LINESIZE+1],buftmp[FSORT_LINESIZE+1];
   
   #ifdef __MSDOS__
           char ftmpname[L_tmpnam + 1];
         tmpnam(ftmpname);          tmpnam(ftmpname);
   #else
           /* note that this case is not possible for MS-DOS systems
              because maximum length of filename is 8 */
           char ftmpname[] = "_platon_utils_fileplus_h_XXXXXX";
           close(mkstemp(ftmpname));
   #endif
   
         /* Hlavna slucka funkcie fsort(). */          /*
            * Main loop of function __fsort()
            */
         while(1){          while(1){
   
                 if((f=fopen(filename,"rt"))==NULL)return(-1);                  if((f=fopen(filename,"rt"))==NULL)return(-1);
                 if((ftmp=fopen(ftmpname,"wt"))==NULL)return(-1);                  if((ftmp=fopen(ftmpname,"wt"))==NULL)return(-1);
   
                 /* Utiedenie do pomocneho suboru. */                  /* Sorting of temporary file. */
                 if(fgets(buf,sizeof(buf),f)==NULL)break;                  if(fgets(buf,sizeof(buf),f)==NULL)break;
                 while(1){                  while(1){
                         if(fgets(buftmp,sizeof(buftmp),f)==NULL){                          if(fgets(buftmp,sizeof(buftmp),f)==NULL){
Line 35  int __fsort(const char*filename,int(*fsf
Line 52  int __fsort(const char*filename,int(*fsf
                 if((f=fopen(filename,"wt"))==NULL)return(-1);                  if((f=fopen(filename,"wt"))==NULL)return(-1);
                 if((ftmp=fopen(ftmpname,"rt"))==NULL)return(-1);                  if((ftmp=fopen(ftmpname,"rt"))==NULL)return(-1);
   
                 /* Utriedenie do vystupneho suboru. */                  /* Sorting of output file. */
                 fsorted=1;                  fsorted=1;
                 if(fgets(buf,sizeof(buf),ftmp)==NULL)break;                  if(fgets(buf,sizeof(buf),ftmp)==NULL)break;
                 while(1){                  while(1){
Line 75  int main(void)
Line 92  int main(void)
 }  }
   
 #endif  #endif
   

Legend:
Removed from v.1.2  
changed lines
  Added in v.1.3

Platon Group <platon@platon.org> http://platon.org/
Copyright © 2002-2006 Platon Group
Site powered by Metafox CMS
Go to Top