1
<?xml version="1.0" encoding="ISO8859-1"?>
6
====================================================================
8
====================================================================
11
<module name="unixutil">
12
<short>Unix utility routines.</short>
15
The <file>UnixUtil</file> unit contains some of the routines that were
16
present in the old <file>Linux</file> unit, but which do not really belong
17
in the <link id="#rtl.unix">unix</link> or <link id="#rtl.baseunix">baseunix</link>
21
Most of the functions described here have cross-platform counterparts in the
22
<link id="#rtl.sysutils">SysUtils</link> unit. It is therefore recommended
27
<!-- variable Visibility: default -->
28
<element name="tzseconds">
29
<short>Seconds west of GMT</short>
32
<element name="ComStr">
33
<short>Command-line string type.</short>
36
<element name="PathStr">
37
<short>Filename full path string type.</short>
40
<element name="DirStr">
41
<short>Filename directory part string type.</short>
44
<element name="NameStr">
45
<short>Filename name part string type.</short>
48
<element name="ExtStr">
49
<short>Filename extension part string type.</short>
52
<!-- function Visibility: default -->
53
<element name="Dirname">
54
<short>Extract directory part from filename</short>
57
Returns the directory part of <var>Path</var>.
58
The directory is the part of <var>Path</var> before the last slash,
59
or empty if there is no slash.
60
The last character of the result is not a slash, unless the directory is the
70
<example file="unutilex/ex47"/>
73
<!-- function Visibility: default -->
74
<element name="StringToPPChar">
75
<short>Split string in list of null-terminated strings</short>
78
<var>StringToPPChar</var> splits the string <var>S</var> in words, replacing any
79
whitespace with zero characters. It returns a pointer to an array of pchars
80
that point to the first letters of the words in <var>S</var>. This array is terminated
81
by a <var>Nil</var> pointer.
84
The function does <em> not</em> add a zero character to the end of the string
85
unless it ends on whitespace.
88
The function reserves memory on the heap to store the array of <var>PChar</var>;
89
The caller is responsible for freeing this memory.
92
This function can be called to create arguments for the various <var>Exec</var>
100
<link id="ArrayStringToPPchar"/>
101
<link id="#rtl.baseunix.FpExecve"/>
103
<example file="unutilex/ex70"/>
106
<!-- function Visibility: default -->
107
<element name="ArrayStringToPPchar">
108
<short>Concert an array of string to an array of null-terminated strings</short>
111
<var>ArrayStringToPPchar</var> creates an array of null-terminated strings
112
that point to strings which are the same as the strings in the array
113
<var>S</var>. The function returns a pointer to this array. The array and
114
the strings it contains must be disposed of after being used, because it
115
they are allocated on the heap.
118
The <var>ReserveEntries</var> parameter tells <var>ArrayStringToPPchar</var>
119
to allocate room at the end of the array for another <var>ReserveEntries</var>
124
If not enough memory is available, an error may occur.
127
<link id="StringToPPChar"/>
131
<!-- function Visibility: default -->
132
<element name="Basename">
133
<short>Return basename of a file</short>
136
Returns the filename part of <var>Path</var>, stripping off <var>Suf</var> if it
138
The filename part is the whole name if <var>Path</var> contains no slash,
139
or the part of <var>Path</var> after the last slash.
140
The last character of the result is not a slash, unless the directory is the
150
<example file="unutilex/ex48"/>
153
<!-- function Visibility: default -->
154
<element name="FNMatch">
155
<short>Check whether filename matches wildcard specification</short>
158
<var>FNMatch</var> returns <var>True</var> if the filename in <var>Name</var>
159
matches the wildcard pattern in <var>Pattern</var>, <var>False</var> otherwise.
162
<var>Pattern</var> can contain the wildcards <var>*</var> (match zero or more
163
arbitrary characters) or <var>?</var> (match a single character).
170
<link id="#rtl.unix.FSearch"/>
172
<example file="unutilex/ex69"/>
175
<!-- function Visibility: default -->
176
<element name="GetFS">
177
<short>Return file selector</short>
179
<var>GetFS</var> returns the file selector that the kernel provided for your
180
file. In principle you don' need this file selector. Only for some calls
181
it is needed, such as the <link id="#rtl.baseunix.fpSelect"/> call or so.
184
In case the file was not opened, then -1 is returned.
187
<link id="#rtl.baseunix.fpSelect"/>
189
<example file="unutilex/ex34"/>
192
<!-- procedure Visibility: default -->
193
<element name="FSplit">
194
<short>Split filename into path, name and extension</short>
196
<var>FSplit</var> splits a full file name into 3 parts : A <var>Path</var>, a
197
<var>Name</var> and an extension (in <var>ext</var>).
198
The extension is taken to be all letters after the last dot (.).
204
<link id="#rtl.unix.FSearch"/>
206
<example file="unutilex/ex67"/>
209
<!-- function Visibility: default -->
210
<element name="LocalToEpoch">
211
<short>Convert local time to epoch (unix) time</short>
213
Converts the Local time to epoch time (=Number of seconds since 00:00:00 , January 1,
220
<link id="EpochToLocal"/>
222
<example file="unutilex/ex4"/>
225
<!-- procedure Visibility: default -->
226
<element name="EpochToLocal">
227
<short>Convert epoch time to local time</short>
230
Converts the epoch time (=Number of seconds since 00:00:00 , January 1,
231
1970, corrected for your time zone ) to local date and time.
234
This function takes into account the timzeone settings of your system.
241
<link id="LocalToEpoch"/>
243
<example file="unutilex/ex3"/>
246
<!-- procedure Visibility: default -->
247
<element name="JulianToGregorian">
248
<short>Converts a julian date to a gregorian date</short>
250
<var>JulianToGregorian</var> takes a julian day and converts it to a
251
gregorian date. (Start of the Julian Date count is from 0 at 12 noon 1 JAN -4712
258
<link id="GregorianToJulian"/>
262
<!-- function Visibility: default -->
263
<element name="GregorianToJulian">
264
<short>Converts a gregorian date to a julian date</short>
266
<var>GregorianToJulian</var> takes a gregorian date and converts it to a
273
<link id="JulianToGregorian"/>
277
</module> <!-- unixutil -->
279
</fpdoc-descriptions>