[29] | 1 | /* |
---|
| 2 | * Copyright 1993-2002 Christopher Seiwald and Perforce Software, Inc. |
---|
| 3 | * |
---|
| 4 | * This file is part of Jam - see jam.c for Copyright information. |
---|
| 5 | */ |
---|
| 6 | |
---|
| 7 | /* |
---|
| 8 | * pathsys.h - PATHNAME struct |
---|
| 9 | */ |
---|
| 10 | |
---|
| 11 | /* |
---|
| 12 | * PATHNAME - a name of a file, broken into <grist>dir/base/suffix(member) |
---|
| 13 | * |
---|
| 14 | * <grist> is salt to distinguish between targets that otherwise would |
---|
| 15 | * have the same name: it never appears in the bound name of a target. |
---|
| 16 | * (member) is an archive member name: the syntax is arbitrary, but must |
---|
| 17 | * agree in path_parse(), path_build() and the Jambase. |
---|
| 18 | * |
---|
| 19 | * On VMS, we keep track of whether the original path was a directory |
---|
| 20 | * (without a file), so that $(VAR:D) can climb to the parent. |
---|
| 21 | */ |
---|
| 22 | |
---|
| 23 | #ifndef PATHSYS_VP_20020211_H |
---|
| 24 | # define PATHSYS_VP_20020211_H |
---|
| 25 | |
---|
| 26 | #include "strings.h" |
---|
| 27 | |
---|
| 28 | typedef struct _pathname PATHNAME; |
---|
| 29 | typedef struct _pathpart PATHPART; |
---|
| 30 | |
---|
| 31 | struct _pathpart { |
---|
| 32 | char *ptr; |
---|
| 33 | int len; |
---|
| 34 | }; |
---|
| 35 | |
---|
| 36 | struct _pathname { |
---|
| 37 | PATHPART part[6]; |
---|
| 38 | # ifdef OS_VMS |
---|
| 39 | int parent; |
---|
| 40 | # endif |
---|
| 41 | |
---|
| 42 | # define f_grist part[0] |
---|
| 43 | # define f_root part[1] |
---|
| 44 | # define f_dir part[2] |
---|
| 45 | # define f_base part[3] |
---|
| 46 | # define f_suffix part[4] |
---|
| 47 | # define f_member part[5] |
---|
| 48 | |
---|
| 49 | } ; |
---|
| 50 | |
---|
| 51 | void path_build( PATHNAME *f, string *file, int binding ); |
---|
| 52 | void path_build1( PATHNAME *f, string *file ); |
---|
| 53 | |
---|
| 54 | void path_parse( char *file, PATHNAME *f ); |
---|
| 55 | void path_parent( PATHNAME *f ); |
---|
| 56 | |
---|
| 57 | #ifdef NT |
---|
| 58 | |
---|
| 59 | /** Returns newstr-allocated string with long equivivalent of 'short_name'. |
---|
| 60 | If none exists -- i.e. 'short_path' is already long path, it's returned |
---|
| 61 | unaltered. */ |
---|
| 62 | char* short_path_to_long_path(char* short_path); |
---|
| 63 | |
---|
| 64 | #endif |
---|
| 65 | |
---|
| 66 | #ifdef USE_PATHUNIX |
---|
| 67 | /** Returns a static pointer to the system dependent path to the temporary |
---|
| 68 | directory. NOTE: *without* a trailing path separator. |
---|
| 69 | */ |
---|
| 70 | const char * path_tmpdir(void); |
---|
| 71 | |
---|
| 72 | /** Returns a new temporary name. |
---|
| 73 | */ |
---|
| 74 | const char * path_tmpnam(void); |
---|
| 75 | |
---|
| 76 | /** Returns a new temporary path. |
---|
| 77 | */ |
---|
| 78 | const char * path_tmpfile(void); |
---|
| 79 | #endif |
---|
| 80 | |
---|
| 81 | #endif |
---|