normalize_path() rewritten
[k8jam.git] / src / pathsys.h
blobce46362ae066787863614190c4c972e383ed12ed
1 /*
2 * Copyright 1993-2002 Christopher Seiwald and Perforce Software, Inc.
4 * This file is part of Jam - see jam.c for Copyright information.
5 */
6 /*
7 * pathsys.h - PATHNAME struct
9 * 11/04/02 (seiwald) - const-ing for string literals
11 #ifndef JAMH_PATHSYS_H
12 #define JAMH_PATHSYS_H
15 * PATHNAME - a name of a file, broken into <grist>dir/base/suffix(member)
17 * <grist> is salt to distinguish between targets that otherwise would
18 * have the same name: it never appears in the bound name of a target.
19 * (member) is an archive member name: the syntax is arbitrary, but must
20 * agree in path_parse(), path_build() and the Jambase.
22 * On VMS, we keep track of whether the original path was a directory
23 * (without a file), so that $(VAR:D) can climb to the parent.
26 typedef struct _pathname PATHNAME;
27 typedef struct _pathpart PATHPART;
29 struct _pathpart {
30 const char *ptr;
31 int len;
35 #define f_grist part[0]
36 #define f_root part[1]
37 #define f_dir part[2]
38 #define f_base part[3]
39 #define f_suffix part[4]
40 #define f_member part[5]
42 struct _pathname {
43 PATHPART part[6];
47 extern void path_build (char *file, const PATHNAME *f);
48 extern void path_parse (const char *file, PATHNAME *f);
49 extern void path_parent (PATHNAME *f);
51 /* if 'pwd'is NULL, use getcwd() */
52 extern char *normalize_path (const char *path, char *buffer, size_t bufferSize, const char *pwd);
55 #endif