Welcome to mirror list, hosted at ThFree Co, Russian Federation.

path.xml « doc « winsup - cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: f56614bb68bfd31aa12f170787a3f965b3ba5756 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
<?xml version="1.0" encoding='UTF-8'?>
<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook V4.5//EN"
    "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd">

<sect1 id="func-cygwin-path">
<title>Path conversion functions</title>

<refentry id="func-cygwin-conv-path">
  <refmeta>
    <refentrytitle>cygwin_conv_path</refentrytitle>
    <manvolnum>3</manvolnum>
    <refmiscinfo class="manual">Cygwin API Reference</refmiscinfo>
  </refmeta>

  <refnamediv>
    <refname>cygwin_conv_path</refname>
  </refnamediv>

  <refsynopsisdiv>
<funcsynopsis>
<funcsynopsisinfo>
#include &lt;sys/cygwin.h&gt;
</funcsynopsisinfo>
<funcprototype>
<funcdef>ssize_t
<function>cygwin_conv_path</function></funcdef>
<paramdef>cygwin_conv_path_t <parameter>what</parameter></paramdef>
<paramdef>const void * <parameter>from</parameter></paramdef>
<paramdef>void * <parameter>to</parameter></paramdef>
<paramdef>size_t <parameter>size</parameter></paramdef>
</funcprototype></funcsynopsis>
  </refsynopsisdiv>

  <refsect1 id="func-cygwin-conv-path-desc">
    <title>Description</title>
<para>Use this function to convert POSIX paths in
<parameter>from</parameter> to Win32 paths in <parameter>to</parameter>
or, vice versa, Win32 paths in <parameter>from</parameter> to POSIX paths
in <parameter>to</parameter>.  <parameter>what</parameter>
defines the direction of this conversion and can be any of the below
values.</para>

<programlisting>
  CCP_POSIX_TO_WIN_A      /* from is char *posix, to is char *win32       */
  CCP_POSIX_TO_WIN_W,     /* from is char *posix, to is wchar_t *win32    */
  CCP_WIN_A_TO_POSIX,     /* from is char *win32, to is char *posix       */
  CCP_WIN_W_TO_POSIX,     /* from is wchar_t *win32, to is char *posix    */
</programlisting>

<para>You can additionally or the following values to
<parameter>what</parameter>, to define whether you want the resulting
path in <parameter>to</parameter> to be absolute or if you want to keep
relative paths in relative notation.  Creating absolute paths is the
default.</para>

<programlisting>
  CCP_ABSOLUTE = 0,         /* Request absolute path (default).             */
  CCP_RELATIVE = 0x100      /* Request to keep path relative.               */
  CCP_PROC_CYGDRIVE = 0x200 /* Request to return /proc/cygdrive path
                               (only with CCP_*_TO_POSIX).                  */
</programlisting>

<para><parameter>size</parameter> is the size of the buffer pointed to
by <parameter>to</parameter> in bytes.  If <parameter>size</parameter>
is 0, <function>cygwin_conv_path</function> just returns the required
buffer size in bytes.  Otherwise, it returns 0 on success, or -1 on
error and errno is set to one of the below values.</para>

<programlisting>
    EINVAL        what has an invalid value or from is NULL.
    EFAULT        from or to point into nirvana.
    ENAMETOOLONG  the resulting path is longer than 32K, or, in case
                  of what == CCP_POSIX_TO_WIN_A, longer than MAX_PATH.
    ENOSPC        size is less than required for the conversion.
</programlisting>
  </refsect1>

  <refsect1 id="func-cygwin-conv-path-example">
    <title>Example</title>
<example id="func-cygwin-conv-path-example-example">
<title>Example use of cygwin_conv_path</title>
<programlisting>
<![CDATA[
#include <sys/cygwin.h>

/* Conversion from incoming Win32 path given as wchar_t *win32 to POSIX path.
   If incoming path is a relative path, stick to it.  First ask how big
   the output buffer has to be and allocate space dynamically. */
ssize_t size;
char *posix;
size = cygwin_conv_path (CCP_WIN_W_TO_POSIX | CCP_RELATIVE, win32, NULL, 0);
if (size < 0)
  perror ("cygwin_conv_path");
else
  {
    posix = (char *) malloc (size);
    if (cygwin_conv_path (CCP_WIN_W_TO_POSIX | CCP_RELATIVE, win32,
                          posix, size))
      perror ("cygwin_conv_path");
  }
]]>
</programlisting>
</example>
  </refsect1>
</refentry>

<refentry id="func-cygwin-conv-path-list">
  <refmeta>
    <refentrytitle>cygwin_conv_path_list</refentrytitle>
    <manvolnum>3</manvolnum>
    <refmiscinfo class="manual">Cygwin API Reference</refmiscinfo>
  </refmeta>

  <refnamediv>
    <refname>cygwin_conv_path_list</refname>
  </refnamediv>

  <refsynopsisdiv>
<funcsynopsis>
<funcsynopsisinfo>
#include &lt;sys/cygwin.h&gt;
</funcsynopsisinfo>
<funcprototype>
<funcdef>ssize_t
<function>cygwin_conv_path_list</function></funcdef>
<paramdef>cygwin_conv_path_t <parameter>what</parameter></paramdef>
<paramdef>const void * <parameter>from</parameter></paramdef>
<paramdef>void * <parameter>to</parameter></paramdef>
<paramdef>size_t <parameter>size</parameter></paramdef>
</funcprototype></funcsynopsis>
  </refsynopsisdiv>

  <refsect1 id="func-cygwin-conv-path-list-desc">
    <title>Description</title>
<para>This is the same as <function>cygwin_conv_path</function>, but the
input is treated as a path list in $PATH or %PATH% notation.</para>
<para>If <parameter>what</parameter> is CCP_POSIX_TO_WIN_A or
CCP_POSIX_TO_WIN_W, given a POSIX $PATH-style string (i.e. /foo:/bar)
convert it to the equivalent Win32 %PATH%-style string (i.e. d:\;e:\bar).</para>
<para>If <parameter>what</parameter> is CCP_WIN_A_TO_POSIX or
CCP_WIN_W_TO_POSIX, given a Win32 %PATH%-style string (i.e. d:\;e:\bar)
convert it to the equivalent POSIX $PATH-style string (i.e. /foo:/bar).</para>
<para><parameter>size</parameter> is the size of the buffer pointed to by
<parameter>to</parameter> in bytes.</para>
  </refsect1>

<refsect1 id="func-cygwin-conv-path-list-also">
  <title>See also</title>
<para>See also <link linkend="func-cygwin-conv-path">cygwin_conv_path</link></para>
  </refsect1>
</refentry>

<refentry id="func-cygwin-create-path">
  <refmeta>
    <refentrytitle>cygwin_create_path</refentrytitle>
    <manvolnum>3</manvolnum>
    <refmiscinfo class="manual">Cygwin API Reference</refmiscinfo>
  </refmeta>

  <refnamediv>
    <refname>cygwin_create_path</refname>
  </refnamediv>

  <refsynopsisdiv>
<funcsynopsis>
<funcsynopsisinfo>
#include &lt;sys/cygwin.h&gt;
</funcsynopsisinfo>
<funcprototype>
<funcdef>void *
<function>cygwin_create_path</function></funcdef>
<paramdef>cygwin_conv_path_t <parameter>what</parameter></paramdef>
<paramdef>const void * <parameter>from</parameter></paramdef>
</funcprototype></funcsynopsis>
  </refsynopsisdiv>

  <refsect1 id="func-cygwin-create-path-desc">
    <title>Description</title>
<para>This is equivalent to the <function>cygwin_conv_path</function>, except
that <function>cygwin_create_path</function> does not take a buffer pointer
for the result of the conversion as input.  Rather it allocates the buffer
itself using <function>malloc</function>(3) and returns a pointer to this
buffer.  In case of error it returns NULL and sets errno to one of the
values defined for <function>cygwin_conv_path</function>.  Additionally
errno can be set to the below value.</para>

<programlisting>
    ENOMEM        Insufficient memory was available.
</programlisting>

<para>When you don't need the returned buffer anymore, use
<function>free</function>(3) to deallocate it.</para>
  </refsect1>

<refsect1 id="func-cygwin-create-path-also">
  <title>See also</title>
<para>See also <link linkend="func-cygwin-conv-path">cygwin_conv_path</link></para>
  </refsect1>
</refentry>

<refentry id="func-cygwin-posix-path-list-p">
  <refmeta>
    <refentrytitle>cygwin_posix_path_list_p</refentrytitle>
    <manvolnum>3</manvolnum>
    <refmiscinfo class="manual">Cygwin API Reference</refmiscinfo>
  </refmeta>

  <refnamediv>
    <refname>cygwin_posix_path_list_p</refname>
  </refnamediv>

  <refsynopsisdiv>
<funcsynopsis>
<funcsynopsisinfo>
#include &lt;sys/cygwin.h&gt;
</funcsynopsisinfo>
<funcprototype>
<funcdef>int
<function>cygwin_posix_path_list_p</function></funcdef>
<paramdef>const char *<parameter>path</parameter></paramdef>
</funcprototype></funcsynopsis>
  </refsynopsisdiv>

  <refsect1 id="func-cygwin-posix-path-list-p-desc">
    <title>Description</title>
<para>This function tells you if the supplied
<parameter>path</parameter> is a POSIX-style path (i.e. posix names,
forward slashes, colon delimiters) or a Win32-style path (drive
letters, reverse slashes, semicolon delimiters.  The return value is
true if the path is a POSIX path.  Note that "_p" means "predicate", a
lisp term meaning that the function tells you something about the
parameter.</para>
  </refsect1>
</refentry>

<refentry id="func-cygwin-split-path">
  <refmeta>
    <refentrytitle>cygwin_split_path</refentrytitle>
    <manvolnum>3</manvolnum>
    <refmiscinfo class="manual">Cygwin API Reference</refmiscinfo>
  </refmeta>

  <refnamediv>
    <refname>cygwin_split_path</refname>
  </refnamediv>

  <refsynopsisdiv>
<funcsynopsis>
<funcsynopsisinfo>
#include &lt;sys/cygwin.h&gt;
</funcsynopsisinfo>
<funcprototype>
<funcdef>void
<function>cygwin_split_path</function>
</funcdef>
<paramdef>const char * <parameter>path</parameter></paramdef>
<paramdef>char * <parameter>dir</parameter></paramdef>
<paramdef>char * <parameter>file</parameter></paramdef>
</funcprototype></funcsynopsis>
  </refsynopsisdiv>

  <refsect1 id="func-cygwin-split-path-desc">
    <title>Description</title>
<para>Split a path into the directory and the file portions.  Both
<parameter>dir</parameter> and <parameter>file</parameter> are
expected to point to buffers of sufficient size.  </para>
  </refsect1>

  <refsect1 id="func-cygwin-split-path-example">
    <title>Example</title>
<example id="func-cygwin-split-path-example-example">
<title>Example use of cygwin_split_path</title>
<programlisting>
char dir[200], file[100];
cygwin_split_path("c:/foo/bar.c", dir, file);
printf("dir=%s, file=%s\n", dir, file);
</programlisting>
</example>
  </refsect1>
</refentry>

</sect1>