📄 misc.3
字号:
.\"(c) Copyright 1992 by Panagiotis Tsirigotis.\"All rights reserved. The file named COPYRIGHT specifies the terms .\"and conditions for redistribution..\".\" $Id: misc.3,v 1.1.1.1 2003/02/19 17:29:27 bbraun Exp $.TH MISC 3X "25 January 1992".SH NAMEmake_string, make_pathname, argv_copy_and_clear, basename, dirname - miscellaneous functions.SH SYNOPSIS.LP.nf.ft B#include "misc.h".LP.ft Bchar *make_string( count, ... )unsigned count ;.LP.ft Bchar *make_pathname( count, ... )unsigned count ;.LP.ft Bchar **argv_copy_and_clear( argv, start, count )char **argv ;int start, count ;.LP.ft Bchar *dirname( path )char *path ;.LP.ft Bchar *basename( path )char *path ;.SH DESCRIPTION.LPThis library contain miscellaneous functions, hence the name..LP.B make_string()creates a string by catenating the list of strings passed as arguments.\fIcount\fR indicates how many strings there are.Strings that are.SM NULLpointers are ignored.\fBmake_string()\fR returns malloc'ed memory..LP.B make_pathname()creates a pathname by catenating the list of pathname components passedas arguments and inserting slashes between them.\fIcount\fR indicates how many components there are.\fBmake_pathname()\fR returns malloc'ed memory..LP.B argv_copy_and_clear()creates a new argv array of size \fIcount\fR, and fills it with thecontents of \fIargv\fR from \fIstart\fR up to \fIstart+count-1\fR.The original \fIargv\fR entries in that range are cleared by fillingthem with.SM SPACEs..LP.B dirname()returns in a malloced string containing all but the last of component of \fIpath\fR. There are 2 special cases:first when the\fIpath\fR is "/", \fBdirname()\fR will return "/", and second, when the \fIpath\fR does not contain any '/',\fBdirname()\fR will return "."..LP.B basename()returns a pointer to the last component of \fIpath\fR..SH "RETURN VALUES".LP\fBmake_string()\fR returns a pointer to the new string.It returns.SM NULLif \fIcount\fR is 0..LP\fBmake_pathname()\fR returns a pointer to the new pathname.It returns.SM NULLif \fIcount\fR is 0..LP\fBargv_copy_and_clear()\fR returns the new argv array. It returns.SM NULLif \fImalloc\fR fails to allocate more memory..LP\fBdirname()\fR returns a new string or.SM NULLif \fImalloc\fR fails to allocate more memory..LP\fBbasename()\fR returns a pointer to the last component of \fIpath\fR..SH BUGS.LPThe behavior of \fBdirname()\fR and \fBbasename()\fR is undefined ifthey are given a zero-length string.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -