2 |
7u83 |
1 |
/*
|
|
|
2 |
Crown Copyright (c) 1997
|
|
|
3 |
|
|
|
4 |
This TenDRA(r) Computer Program is subject to Copyright
|
|
|
5 |
owned by the United Kingdom Secretary of State for Defence
|
|
|
6 |
acting through the Defence Evaluation and Research Agency
|
|
|
7 |
(DERA). It is made available to Recipients with a
|
|
|
8 |
royalty-free licence for its use, reproduction, transfer
|
|
|
9 |
to other parties and amendment for any purpose not excluding
|
|
|
10 |
product development provided that any such use et cetera
|
|
|
11 |
shall be deemed to be acceptance of the following conditions:-
|
|
|
12 |
|
|
|
13 |
(1) Its Recipients shall ensure that this Notice is
|
|
|
14 |
reproduced upon any copies or amended versions of it;
|
|
|
15 |
|
|
|
16 |
(2) Any amended version of it shall be clearly marked to
|
|
|
17 |
show both the nature of and the organisation responsible
|
|
|
18 |
for the relevant amendment or amendments;
|
|
|
19 |
|
|
|
20 |
(3) Its onward transfer from a recipient to another
|
|
|
21 |
party shall be deemed to be that party's acceptance of
|
|
|
22 |
these conditions;
|
|
|
23 |
|
|
|
24 |
(4) DERA gives no warranty or assurance as to its
|
|
|
25 |
quality or suitability for any purpose and DERA accepts
|
|
|
26 |
no liability whatsoever in relation to any use to which
|
|
|
27 |
it may be put.
|
|
|
28 |
*/
|
|
|
29 |
|
|
|
30 |
|
|
|
31 |
/**** file-name.h --- File name manipulation routines.
|
|
|
32 |
*
|
|
|
33 |
** Author: Steve Folkes <smf@hermes.mod.uk>
|
|
|
34 |
*
|
|
|
35 |
**** Commentary:
|
|
|
36 |
*
|
|
|
37 |
***=== INTRODUCTION =========================================================
|
|
|
38 |
*
|
|
|
39 |
* This file defines some file name manipulation routines. It should be
|
|
|
40 |
* replaced on operating systems with a different file name syntax to that
|
|
|
41 |
* used here ('/' seperated path names).
|
|
|
42 |
*
|
|
|
43 |
***=== FUNCTIONS ============================================================
|
|
|
44 |
*
|
|
|
45 |
** Function: CStringP file_name_basename
|
|
|
46 |
* PROTO_S ((CStringP path))
|
|
|
47 |
** Exceptions: XX_dalloc_no_memory
|
|
|
48 |
*
|
|
|
49 |
* This function returns a dynamically allocated copy of the file name
|
|
|
50 |
* component of the specifed path.
|
|
|
51 |
*
|
|
|
52 |
** Function: CStringP file_name_dirname
|
|
|
53 |
* PROTO_S ((CStringP path))
|
|
|
54 |
** Exceptions: XX_dalloc_no_memory
|
|
|
55 |
*
|
|
|
56 |
* This function returns a dynamically allocated copy of the directory name
|
|
|
57 |
* component of the specifed path.
|
|
|
58 |
*
|
|
|
59 |
** Function: CStringP file_name_expand
|
|
|
60 |
* PROTO_S ((CStringP dir, CStringP name,
|
|
|
61 |
* CStringP suffix))
|
|
|
62 |
** Exceptions: XX_dalloc_no_memory
|
|
|
63 |
*
|
|
|
64 |
* This function returns a dynamically allocated copy of the path name
|
|
|
65 |
* obtained by expanding the specified name in the specified dir. If the
|
|
|
66 |
* suffix is non nil, it is also appended to the path name, following the
|
|
|
67 |
* suffix seperator character.
|
|
|
68 |
*
|
|
|
69 |
** Function: CStringP file_name_is_basename
|
|
|
70 |
* PROTO_S ((CStringP path))
|
|
|
71 |
** Exceptions:
|
|
|
72 |
*
|
|
|
73 |
* This function returns true if the specified path has no directory
|
|
|
74 |
* component.
|
|
|
75 |
*
|
|
|
76 |
** Function: CStringP file_name_is_absolute
|
|
|
77 |
* PROTO_S ((CStringP path))
|
|
|
78 |
** Exceptions:
|
|
|
79 |
*
|
|
|
80 |
* This function returns true if the specified path is an absolute path name.
|
|
|
81 |
*
|
|
|
82 |
** Function: void file_name_populate
|
|
|
83 |
* PROTO_S ((CStringP path))
|
|
|
84 |
** Exceptions:
|
|
|
85 |
*
|
|
|
86 |
* This function tries to create all of the directories on the specified path.
|
|
|
87 |
* The final component of the path is considered to be a file, and is not
|
|
|
88 |
* created as a directory. There is no confirmation of whether the function
|
|
|
89 |
* succeeds or not - this must be determined in another manner.
|
|
|
90 |
*
|
|
|
91 |
**** Change Log:
|
|
|
92 |
* $Log: file-name.h,v $
|
|
|
93 |
* Revision 1.1.1.1 1998/01/17 15:57:18 release
|
|
|
94 |
* First version to be checked into rolling release.
|
|
|
95 |
*
|
|
|
96 |
* Revision 1.2 1994/12/12 11:45:39 smf
|
|
|
97 |
* Performing changes for 'CR94_178.sid+tld-update' - bringing in line with
|
|
|
98 |
* OSSG C Coding Standards.
|
|
|
99 |
*
|
|
|
100 |
* Revision 1.1.1.1 1994/07/25 16:06:14 smf
|
|
|
101 |
* Initial import of os-interface shared files.
|
|
|
102 |
*
|
|
|
103 |
**/
|
|
|
104 |
|
|
|
105 |
/****************************************************************************/
|
|
|
106 |
|
|
|
107 |
#ifndef H_FILE_NAME
|
|
|
108 |
#define H_FILE_NAME
|
|
|
109 |
|
|
|
110 |
#include "os-interface.h"
|
|
|
111 |
#include "dalloc.h"
|
|
|
112 |
|
|
|
113 |
/*--------------------------------------------------------------------------*/
|
|
|
114 |
|
|
|
115 |
extern CStringP file_name_basename
|
|
|
116 |
PROTO_S ((CStringP));
|
|
|
117 |
extern CStringP file_name_dirname
|
|
|
118 |
PROTO_S ((CStringP));
|
|
|
119 |
extern CStringP file_name_expand
|
|
|
120 |
PROTO_S ((CStringP, CStringP, CStringP));
|
|
|
121 |
extern BoolT file_name_is_basename
|
|
|
122 |
PROTO_S ((CStringP));
|
|
|
123 |
extern BoolT file_name_is_absolute
|
|
|
124 |
PROTO_S ((CStringP));
|
|
|
125 |
extern void file_name_populate
|
|
|
126 |
PROTO_S ((CStringP));
|
|
|
127 |
|
|
|
128 |
#endif /* !defined (H_FILE_NAME) */
|