1 .\"(c) Copyright 1992 by Panagiotis Tsirigotis
2 .\"All rights reserved. The file named COPYRIGHT specifies the terms
3 .\"and conditions for redistribution.
5 .\" $Id: misc.3,v 1.1.1.1 2003/02/19 17:29:27 bbraun Exp $
6 .TH MISC 3X "25 January 1992"
8 make_string, make_pathname, argv_copy_and_clear, basename, dirname - miscellaneous functions
16 char *make_string( count, ... )
20 char *make_pathname( count, ... )
24 char **argv_copy_and_clear( argv, start, count )
33 char *basename( path )
37 This library contain miscellaneous functions, hence the name.
40 creates a string by catenating the list of strings passed as arguments.
41 \fIcount\fR indicates how many strings there are.
45 \fBmake_string()\fR returns malloc'ed memory.
48 creates a pathname by catenating the list of pathname components passed
49 as arguments and inserting slashes between them.
50 \fIcount\fR indicates how many components there are.
51 \fBmake_pathname()\fR returns malloc'ed memory.
53 .B argv_copy_and_clear()
54 creates a new argv array of size \fIcount\fR, and fills it with the
55 contents of \fIargv\fR from \fIstart\fR up to \fIstart+count-1\fR.
56 The original \fIargv\fR entries in that range are cleared by filling
61 returns in a malloced string containing all but the last of
62 component of \fIpath\fR. There are 2 special cases:
64 \fIpath\fR is "/", \fBdirname()\fR will return "/",
65 and second, when the \fIpath\fR does not contain any '/',
66 \fBdirname()\fR will return ".".
69 returns a pointer to the last component of \fIpath\fR.
72 \fBmake_string()\fR returns a pointer to the new string.
77 \fBmake_pathname()\fR returns a pointer to the new pathname.
82 \fBargv_copy_and_clear()\fR returns the new argv array. It returns
84 if \fImalloc\fR fails to allocate more memory.
86 \fBdirname()\fR returns a new string or
88 if \fImalloc\fR fails to allocate more memory.
90 \fBbasename()\fR returns a pointer to the last component of \fIpath\fR.
93 The behavior of \fBdirname()\fR and \fBbasename()\fR is undefined if
94 they are given a zero-length string.