OpenCores
URL https://opencores.org/ocsvn/or1k_old/or1k_old/trunk

Subversion Repositories or1k_old

[/] [or1k_old/] [trunk/] [insight/] [tcl/] [doc/] [SplitPath.3] - Blame information for rev 578

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 578 markom
'\"
2
'\" Copyright (c) 1996 Sun Microsystems, Inc.
3
'\"
4
'\" See the file "license.terms" for information on usage and redistribution
5
'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
6
'\"
7
'\" RCS: @(#) $Id: SplitPath.3,v 1.1.1.1 2002-01-16 10:25:24 markom Exp $
8
'\"
9
.so man.macros
10
.TH Tcl_SplitPath 3 7.5 Tcl "Tcl Library Procedures"
11
.BS
12
.SH NAME
13
Tcl_SplitPath, Tcl_JoinPath, Tcl_GetPathType \- manipulate platform-dependent file paths
14
.SH SYNOPSIS
15
.nf
16
\fB#include \fR
17
.sp
18
\fBTcl_SplitPath\fR(\fIpath, argcPtr, argvPtr\fR)
19
.sp
20
char *
21
\fBTcl_JoinPath\fR(\fIargc, argv, resultPtr\fR)
22
.sp
23
Tcl_PathType
24
\fBTcl_GetPathType\fR(\fIpath\fR)
25
.SH ARGUMENTS
26
.AS Tcl_DString ***argvPtr
27
.AP char *path in
28
File path in a form appropriate for the current platform (see the
29
\fBfilename\fR manual entry for acceptable forms for path names).
30
.AP int *argcPtr out
31
Filled in with number of path elements in \fIpath\fR.
32
.AP char ***argvPtr out
33
\fI*argvPtr\fR will be filled in with the address of an array of
34
pointers to the strings that are the extracted elements of \fIpath\fR.
35
There will be \fI*argcPtr\fR valid entries in the array, followed by
36
a NULL entry.
37
.AP int argc in
38
Number of elements in \fIargv\fR.
39
.AP char **argv in
40
Array of path elements to merge together into a single path.
41
.AP Tcl_DString *resultPtr in/out
42
A pointer to an initialized \fBTcl_DString\fR to which the result of
43
\fBTcl_JoinPath\fR will be appended.
44
.BE
45
 
46
.SH DESCRIPTION
47
.PP
48
These procedures may be used to disassemble and reassemble file
49
paths in a platform independent manner: they provide C-level access to
50
the same functionality as the \fBfile split\fR, \fBfile join\fR, and
51
\fBfile pathtype\fR commands.
52
.PP
53
\fBTcl_SplitPath\fR breaks a path into its constituent elements,
54
returning an array of pointers to the elements using \fIargcPtr\fR and
55
\fIargvPtr\fR.  The area of memory pointed to by \fI*argvPtr\fR is
56
dynamically allocated; in addition to the array of pointers, it also
57
holds copies of all the path elements.  It is the caller's
58
responsibility to free all of this storage.
59
For example, suppose that you have called \fBTcl_SplitPath\fR with the
60
following code:
61
.CS
62
int argc;
63
char *path;
64
char **argv;
65
\&...
66
Tcl_SplitPath(string, &argc, &argv);
67
.CE
68
Then you should eventually free the storage with a call like the
69
following:
70
.CS
71
Tcl_Free((char *) argv);
72
.CE
73
.PP
74
\fBTcl_JoinPath\fR is the inverse of \fBTcl_SplitPath\fR: it takes a
75
collection of path elements given by \fIargc\fR and \fIargv\fR and
76
generates a result string that is a properly constructed path. The
77
result string is appended to \fIresultPtr\fR.  \fIResultPtr\fR must
78
refer to an initialized \fBTcl_DString\fR.
79
.PP
80
If the result of \fBTcl_SplitPath\fR is passed to \fBTcl_JoinPath\fR,
81
the result will refer to the same location, but may not be in the same
82
form.  This is because \fBTcl_SplitPath\fR and \fBTcl_JoinPath\fR
83
eliminate duplicate path separators and return a normalized form for
84
each platform.
85
.PP
86
\fBTcl_GetPathType\fR returns the type of the specified \fIpath\fR,
87
where \fBTcl_PathType\fR is one of \fBTCL_PATH_ABSOLUTE\fR,
88
\fBTCL_PATH_RELATIVE\fR, or \fBTCL_PATH_VOLUME_RELATIVE\fR.  See the
89
\fBfilename\fR manual entry for a description of the path types for
90
each platform.
91
 
92
.SH KEYWORDS
93
file, filename, join, path, split, type

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.