/[ascend]/trunk/base/generic/general/ospath.c
ViewVC logotype

Diff of /trunk/base/generic/general/ospath.c

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

revision 863 by johnpye, Thu Jul 27 12:04:19 2006 UTC revision 864 by johnpye, Thu Sep 28 13:39:16 2006 UTC
# Line 497  int ospath_isvalid(struct FilePath *fp){ Line 497  int ospath_isvalid(struct FilePath *fp){
497  }  }
498    
499    
500  char *ospath_str(struct FilePath *fp){  char *ospath_str(const struct FilePath *fp){
501      char *s;      char *s;
502  #ifdef WINPATHS  #ifdef WINPATHS
503      s = (char *)MALLOC(sizeof(char)*(strlen(fp->drive)+strlen(fp->path) +1) );      s = (char *)MALLOC(sizeof(char)*(strlen(fp->drive)+strlen(fp->path) +1) );
# Line 835  struct FilePath *ospath_root(struct File Line 835  struct FilePath *ospath_root(struct File
835  struct FilePath *ospath_getdir(struct FilePath *fp){  struct FilePath *ospath_getdir(struct FilePath *fp){
836      char *pos;      char *pos;
837      char s[PATH_MAX];      char s[PATH_MAX];
838    #ifdef WINPATHS
839        char *e;
840    #endif
841    
842      pos = strrchr(fp->path,PATH_SEPARATOR_CHAR);      pos = strrchr(fp->path,PATH_SEPARATOR_CHAR);
843      if(pos==NULL){      if(pos==NULL){
# Line 842  struct FilePath *ospath_getdir(struct Fi Line 845  struct FilePath *ospath_getdir(struct Fi
845      }      }
846  #ifdef WINPATHS  #ifdef WINPATHS
847      strncpy(s,fp->drive,PATH_MAX);      strncpy(s,fp->drive,PATH_MAX);
848        e = strlen(s);
849      strncat(s,fp->path,pos - fp->path);      strncat(s,fp->path,pos - fp->path);
850        s[e+pos-fp->path]='\0';
851  #else  #else
852      strncpy(s,fp->path,pos - fp->path);      strncpy(s,fp->path,pos - fp->path);
853        s[pos-fp->path]='\0';
854        CONSOLE_DEBUG("DIRECTORY: '%s'",s);
855  #endif  #endif
856      return ospath_new(s);      return ospath_new(s);
857  }  }

Legend:
Removed from v.863  
changed lines
  Added in v.864

john.pye@anu.edu.au
ViewVC Help
Powered by ViewVC 1.1.22