0914-0915.html

来自「linux-unix130.linux.and.unix.ebooks130 l」· HTML 代码 · 共 389 行

HTML
389
字号
<HTML>

<HEAD>

<TITLE>Linux Complete Command Reference:Library Functions:EarthWeb Inc.-</TITLE>

</HEAD>

<META NAME="ROBOTS" CONTENT="NOINDEX, NOFOLLOW">
<SCRIPT>
<!--
function displayWindow(url, width, height) {
        var Win = window.open(url,"displayWindow",'width=' + width +
',height=' + height + ',resizable=1,scrollbars=yes');
}
//-->
</SCRIPT>
</HEAD>

 -->




<!-- ISBN=0672311046 //-->

<!-- TITLE=Linux Complete Command Reference//-->

<!-- AUTHOR=Red Hat//-->

<!-- PUBLISHER=Macmillan Computer Publishing//-->

<!-- IMPRINT=Sams//-->

<!-- CHAPTER=03 //-->

<!-- PAGES=0891-1062 //-->

<!-- UNASSIGNED1 //-->

<!-- UNASSIGNED2 //-->



<P><CENTER>

<a href="0911-0913.html">Previous</A> | <a href="../ewtoc.html">Table of Contents</A> | <a href="0916-0920.html">Next</A></CENTER></P>







<A NAME="PAGENUM-914"><P>Page 914</P></A>





<P>

stored in decpt. A negative value for decpt means that the decimal point is to the left of the start of the string. If the sign

of number is negative, sign is set to a nonzero value; otherwise, it's set to 0.

</P>



<P>The fcvt() function is identical to ecvt(), except that

ndigits specifies the number of digits after the decimal point.

</P>



<P><b>

RETURN VALUE</b>

</P>



<P>Both the ecvt()and fcvt() functions return a pointer to a static string containing the ASCII representation of

number. The static string is overwritten by each call to

ecvt() or fcvt().

</P>



<b><P>

SEE ALSO</b>

</P>



<P>gcvt(3), sprintf(3)</P>



<P>28 March 1993</P>



<H3><A NAME="ch03_ 42">

erf, erfc

</A></H3>



<P>erf, erfc&#151;Error function and complementary error function

</P>

<P><b>

SYNOPSIS</b>

</P>

<!-- CODE SNIP //-->

<PRE WIDTH="1">

#include  &lt;math.h&gt;

double    erf(double x);

double    erfc (double x);

</PRE>

<!-- END CODE SNIP //-->



<P><b>

DESCRIPTION</b>

</P>



<P>The erf() function returns the error function of

x, defined as

</P>

<!-- CODE SNIP //-->

<PRE>

erf(x) = 2/sqrt(pi)* integral from 0 to x of exp(-t*t) dt

</PRE>

<!-- END CODE SNIP //-->

<P>The erfc() function returns the complementary error function of

x&#151;that is, 1.0_erf(x).

</P>

<P><b>

CONFORMS TO</b>

</P>

<P>SVID 3, BSD 4.3</P>



<P><b>

SEE ALSO</b>

</P>



<P>exp(3)</P>



<P>BSD, 25 June 1993</P>



<H3><A NAME="ch03_ 43">

execl, execlp, execle, exect, execv, execvp

</A></H3>

<P>execl, execlp, execle, exect, execv, execvp&#151;Execute a file

</P>

<P><b>

SYNOPSIS</b>

</P>



<!-- CODE //-->

<PRE WIDTH="1">

#include &lt;unistd.h&gt;

extern char **environ;

int execl(const char *path, const char *arg, ...);

int execlp(const char *file, const char *arg, ...);

int execle(const char *path, const char *arg, ...);

int execlp(const char *file, const char *arg, ...);

int execle(const char *path, const char *arg, ...);

int execle(const char *path, const char *arg , ..., char * const envp[]);

int exect(const char *path, char *const argv[]);

int execv(const char *path, char *const argv[]);

int execvp(const char *file, char *const argv[]);

</PRE>

<!-- END CODE //-->

<P>execl, execlp, execle, exect, execv, execvp</P>



<b><P>DESCRIPTION</b>

</P>

<P>The exec family of functions replaces the current process image with a new process image. The functions described in

this manual page are front ends for the function

execve(2). (See the manual page for execve for detailed information about

the replacement of the current process.)

</P>

<P>The initial argument for these functions is the pathname of a file that is to be executed.

<P>The const char *arg and subsequent ellipses in the

execl, execlp, and execle functions can be thought of as

arg0, arg1, &#133;, argn. Together they describe a list of one or more pointers to null-terminated strings that represent the argument

list available to the executed program. The first argument, by convention, should point to the file name associated with the

file being executed. The list of arguments must be terminated by a

NULL pointer.

</P>

<P>The exect, execv, and execvp functions provide an array of pointers to null-terminated strings that represent the

argument list available to the new program. The first argument, by convention, should point to the filename associated with the

file being executed. The array of pointers must be terminated by a

NULL pointer.

</P>

<P>The execle and exect functions also specify the environment of the executed process by following the

NULL pointer that terminates the list of arguments in the parameter list or the pointer to the

argv array with an additional parameter. This additional parameter is an array of pointers to null-terminated strings and must be terminated by a

NULL pointer. The other functions take the environment for the new process image from the external variable

environ in the current process.

</P>

<P>Some of these functions have special semantics.

</P>

<P>The functions execlp and execvp will duplicate the actions of the shell in searching for an executable file if the

specified filename does not contain a slash (/) character. The search path is the path specified in the environment by the

PATH variable. If this variable isn't specified, the default path

/bin:/usr/bin: is used (is this true for Linux?). In addition, certain errors

are treated specially.

</P>

<P>If permission is denied for a file (the attempted

execve returned EACCES), these functions will continue searching the rest

of the search path. If no other file is found, however, they will return with the global variable

errno set to EACCES.

</P>

<P>If the header of a file isn't recognized (the attempted

execve returned ENOEXEC), these functions will execute the shell

with the path of the file as its first argument. (If this attempt fails, no further searching is done.)

</P>

<P>If the file is currently busy (the attempted

execve returned ETXTBUSY), these functions will sleep for several seconds,

periodically re-attempting to execute the file. (Is this true for Linux?)

</P>

<P>The function exect executes a file with the program-tracing facilities enabled (see

ptrace(2)).

</P>

<b><P>

RETURN VALUES

</P></b>

<P>If any of the exec functions returns, an error will have occurred. The return value is

_1, and the global variable errno will be set to indicate the error.

</P>

<b><P>

FILES</b>

</P>



<P>/bin/sh</P>



<b><P>

ERRORS

</b>

</P>



<P>execl, execle, execlp, and execvp may fail and set

errno for any of the errors specified for the library functions

execve(2) and malloc(3).

</P>



<P>exect and execv may fail and set errno for any of the errors specified for the library function

execve(2).

</P>



<b><P>

SEE ALSO

</P></b>



<P>sh(1), execve(2), fork(2), trace(2), environ(5),

ptrace(2)

</P>



<P><B>

COMPATIBILITY</b>

</P>



<P>Historically, the default path for the execlp and

execvp functions was /bin:/usr/bin. This was changed to place the

current directory last to enhance system security.

</P>



<A NAME="PAGENUM-915"><P>Page 915</P></A>





<P>The behavior of execlp and execvp when errors occur while attempting to execute the file is historic practice, but has

not traditionally been documented and is not specified by the POSIX standard.

</P>

<P>Traditionally, the functions execlp and execvp ignored all errors except for the ones described above and

ENOMEM and E2BIG, upon which they returned. They now return if any error other than the ones described in the &quot;Errors&quot; section occurs.

</P>

<P><B>

STANDARDS

</B></P>



<P>execl, execv, execle, execlp, and execvp conform to IEEE Std1003.1-88 (POSIX.1).

</P>

<P>BSD Man Page, 29 November 1993

</P>



<H3><A NAME="ch03_ 44">

errno

</A></H3>



<P>errno&#151;Number of last error

</P>



<P><B>SYNOPSIS</B>

</P>



<!-- CODE SNIP //-->

<PRE WIDTH="1">

#include &lt;errno.h&gt;

extern int errno;

</PRE>

<!-- END CODE SNIP //-->



<P><B>DESCRIPTION

</P></B>



<P>The integer errno is set by system calls (and some library functions) to indicate what went wrong. Its value is significant

only when the call returns an error (usually _1), and a library function that does succeed is allowed to change

errno.

</P>

<P>Sometimes, when _1 is also a legal return value, you have to set

errno to 0 before the call in order to detect possible errors.

</P>

<P>POSIX lists the following symbolic error names:

</P>



<TABLE>



<TR><TD>

E2BIG

</TD><TD>

Arg list too long

</TD></TR><TR><TD>

EACCES

</TD><TD>

Permission denied

</TD></TR><TR><TD>

EAGAIN

</TD><TD>

Resource temporarily unavailable

</TD></TR><TR><TD>

EBADF

</TD><TD>

Bad file descriptor

</TD></TR><TR><TD>

EBUSY

</TD><TD>

Resource busy

</TD></TR><TR><TD>

ECHILD

</TD><TD>

No child processes

</TD></TR><TR><TD>

EDEADLK

</TD><TD>

 Resource deadlock avoided

</TD></TR><TR><TD>

EDOM

</TD><TD>

Domain error

</TD></TR><TR><TD>

EEXIST

</TD><TD>

File exists

</TD></TR><TR><TD>

EFAULT

</TD><TD>

Bad address

</TD></TR><TR><TD>

EFBIG

</TD><TD>

File too large

</TD></TR><TR><TD>

EINTR

</TD><TD>

Interrupted function call

</TD></TR><TR><TD>

EINVAL

</TD><TD>

Invalid argument

</TD></TR><TR><TD>

EIO

</TD><TD>

Input/output error

</TD></TR><TR><TD>

EISDIR

</TD><TD>

Is a directory

</TD></TR><TR><TD>

EMFILE

</TD><TD>

Too many open files

</TD></TR><TR><TD>

EMLINK

</TD><TD>

Too many links

</TD></TR><TR><TD>

ENAMETOOLONG

</TD><TD>

Filename too long

</TD></TR><TR><TD>

ENFILE

</TD><TD>

Too many open files in system

</TD></TR><TR><TD>

ENODEV

</TD><TD>

No such device

</TD></TR><TR><TD>

ENOENT

</TD><TD>

No such file or directory

</TD></TR><TR><TD>

ENOEXEC

</TD><TD>

Exec format error

</TD></TR><TR><TD>

ENOLCK

</TD><TD>

No locks available

</TD></TR><TR><TD>

ENOMEM

</TD><TD>

Not enough space

</TD></TR></TABLE>





<P><CENTER>

<a href="0911-0913.html">Previous</A> | <a href="../ewtoc.html">Table of Contents</A> | <a href="0916-0920.html">Next</A></CENTER></P>







</td>
</tr>
</table>

<!-- begin footer information -->







</body></html>

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?