/[gcl]/gcl/o/mingwin.c
ViewVC logotype

Diff of /gcl/o/mingwin.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.2 by mjthomas, Tue Jul 30 02:51:51 2002 UTC revision 1.3 by mjthomas, Wed Jul 31 07:16:44 2002 UTC
# Line 582  error: Line 582  error:
582    
583  int  int
584  TcpOutputProc ( int fd, char *buf, int toWrite, int *errorCodePtr, int block )  TcpOutputProc ( int fd, char *buf, int toWrite, int *errorCodePtr, int block )
 #if 0      
      int fd;       /* socket */  
     char *buf;                          /* Where to get data. */  
     int toWrite;                        /* Maximum number of bytes to write. */  
     int *errorCodePtr;                  /* Where to store error codes. */  
      int block;  
 #endif      
585  {  {
586      int bytesWritten;      int bytesWritten;
587      int error;      int error;
# Line 931  sigprocmask (int how , const sigset_t *s Line 924  sigprocmask (int how , const sigset_t *s
924    
925  fix_filename(object pathname, char *filename1)  fix_filename(object pathname, char *filename1)
926  {  {
927    char current_directory[MAXPATHLEN];      char current_directory[MAXPATHLEN];
928    char directory[MAXPATHLEN];      char directory[MAXPATHLEN];
929    char *filename = filename1;      char *filename = filename1;
930    extern char *getwd();      char *p;
931        extern char *getwd();
932        /*    fprintf ( stderr, "fix_filename: At start %s\n", filename1 );*/
933        p = filename;
934        while ( *p ) {
935            if (*p=='\\') *p='/';
936            p++;
937        }
938   AGAIN:   AGAIN:
939          /* grok filename to have only '/' not '\',      /* grok filename to have only '/' not '\',
940             fix up for cygnus:  /cygdrive/h/   becomes h:/         fix up for cygnus:  /cygdrive/h/   becomes h:/
941             //h/ab is h:/ab         //h/ab and /h/ab become h:/ab
942             and         and
943             change h:a/b to check what the current directory         change h:a/b to check what the current directory
944             is on 'h:' and then prepend this to a/b         is on 'h:' and then prepend this to a/b
945          */           */  
946          if (filename[0]=='/' && filename[1]=='c' &&  
947              strncmp(filename,"/cygdrive/",10)==0 && filename[11]=='/')      if ( filename[0] == '/' &&
948            {           filename[1] == 'c' &&
949              filename[9]=filename[10];           strncmp ( filename, "/cygdrive/", 10 ) == 0 &&
950              filename[10]=':';           filename[11] == '/' ) {
951              filename += 9;          /* /cygdrive/... */
952            } else if (filename[0]=='/' && filename[1]=='/' && filename[3]=='/')          /*        fprintf ( stderr, "fix_filename: In cygdrive phase\n" );*/
953              {          filename[9]  = filename[10];
954              filename[1]=filename[2];          filename[10] = ':';
955              filename[2] = ':';          filename    += 9;
956              filename += 1;      } else {
957            }          if ( filename[0]=='/' &&
958          { char *p = filename;               filename[1]=='/' &&
959          while ( *p )               filename[3]=='/' ) {
960            {if (*p=='\\') *p='/';              /* //h/... */
961            p++;              /*            fprintf ( stderr, "fix_filename: In // phase\n" );*/
962            }              filename[1] = filename[2];
963          if (filename[1]==':' && filename[2]!='/') {              filename[2] = ':';
964            char buf[4];              filename   += 1;
965            bcopy(filename,buf,2);          } else {
966            buf[2]='/';              if ( filename[0] == '/' &&
967            buf[3]=0;                   filename[2] == '/' &&
968            getwd(current_directory);                   isalpha ( filename[1] ) ) {
969            if (chdir(buf) < 0)                  /* /h/... */
970              FEerror("Cannot get the truename of ~S.", 1, pathname);                  /*                fprintf ( stderr, "fix_filename: In / phase\n" );*/
971            p = getwd(directory);                  filename[0] = filename[1];
972            chdir(current_directory);                  filename[1] = ':';
973            /*      strncat(directory,"/",2); */              }
974            strncat(directory,filename+2,MAXPATHLEN-strlen(directory)-2);          }
975            strcpy(filename1,directory);      }
976            filename=filename1;  
977            goto AGAIN;      if ( filename[1] == ':' && filename[2] != '/' ) {
978          }          char buf[4];
979          }          /*        fprintf ( stderr, "fix_filename: In current dir fixup phase\n" );*/
980          /* move the name back to beginning of buffer */          bcopy(filename,buf,2);
981          if (filename > filename1) {          buf[2]='/';
982            while (*filename) {          buf[3]=0;
983            getwd(current_directory);
984            if ( chdir(buf) < 0 ) {
985                FEerror("fix_filename: Cannot get the truename of ~S.", 1, pathname);
986            }
987            p = getwd ( directory );
988            chdir ( current_directory );
989            strncat ( directory, filename+2, MAXPATHLEN-strlen(directory)-2 );
990            strcpy ( filename1, directory );
991            filename = filename1;
992            goto AGAIN;
993        }
994    
995        /* move the name back to beginning of buffer */
996        if ( filename > filename1 ) {
997            while ( *filename ) {
998              *filename1++ = *filename++;              *filename1++ = *filename++;
999            }          }
1000            *filename1=0;          *filename1=0;
1001          }      }
1002        /*    fprintf ( stderr, "fix_filename: At end %s\n", filename1 );*/
1003    
1004  }  }
1005            
         /* done fixup for mingwin ...*/  
1006    
1007    

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

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26