⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 0905-0908.html

📁 linux-unix130.linux.and.unix.ebooks130 linux and unix ebookslinuxLearning Linux - Collection of 12 E
💻 HTML
字号:
<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="0902-0904.html">Previous</A> | <a href="../ewtoc.html">Table of Contents</A> | <a href="0909-0910.html">Next</A></CENTER></P>







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





<P>getserverbyfile calls GetConfigValue to get the name of the local NNTP server. It returns a pointer to static space. The

file parameter is ignored.

</P>



<P>server_init opens a connect to the NNTP server at the specified

host. It returns the server's response code or _1 on error.

If a connection was made, ser_rd_fp and ser_wr_fp can be used to read from and write to the server, respectively, and

ser_line will contain the server's response.

ser_line can also be used in other routines.

</P>



<P>handle_server_response decodes the response, which comes from the server on

host. If the client is authorized, it returns 0. A client that is only allowed to read is authorized, but

handle_server_response will print a message on the standard output.

If the client is not authorized to talk to the server, a message is printed, and the routine returns

_1.

</P>



<P>put_server sends the text in buff to the server, adding the necessary NNTP line terminators and flushing the I/O buffer.

</P>



<P>get_server reads a line of text from the server into

buff, reading at most buffsize characters. Any trailing

\r\n terminators are stripped off. get_server returns

_1 on error.

</P>



<P>close_server sends a quit command to the server and closes the connection.

</P>



<P><B>HISTORY</B>

</P>



<P>Written by Rich $alz (rsalz@uunet.uu.net) for InterNetNews.

</P>



<P></B>SEE ALSO</B>

</P>



<!-- CODE SNIP //-->

<PRE>

libinn(3)

</PRE>

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



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

clock

</A></H3>



<P>clock&#151;Determine processor time

</P>



<P><B>SYNOPSIS</B>

</P>



<!-- CODE SNIP //-->

<PRE WIDTH="1">

#include &lt;time.h&gt;

clock_t clock(void);

</PRE>

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



<P><B>DESCRIPTION</B>

</P>



<P>The clock() function returns an approximation of processor time used by the program.

</P>



<P><B>RETURN VALUE</B>

</P>



<P>The value returned is the CPU time used so far as a

clock_t; to get the number of seconds used, divide by

CLOCKS_PER_SEC.

</P>



<P><B>CONFORMS TO</B>

</P>



<P>ANSI C

</P>



<P><B>BUGS</B>

</P>



<P>The C standard allows for arbitrary values at the start of the program; take the difference between the value returned from

a call to clock() at the start of the program and the value returned at the end for maximum portability.

</P>



<P>The times() function call returns more information.

</P>



<P></B>SEE ALSO</B>

</P>



<!-- CODE SNIP //-->

<PRE>

times(2)

</PRE>

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



<P>GNU, 21 April 1993

</P>



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

closedir

</A></H3>



<P>closedir&#151;Close a directory

</P>



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





<P><B>SYNOPSIS</B>

</P>



<!-- CODE SNIP //-->

<PRE WIDTH="1">

#include &lt;sys/types.h&gt;

#include &lt;dirent.h&gt;

int closedir(DIR *dir);

</PRE>

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



<P><B>DESCRIPTION</B>

</P>



<P>The closedir() function closes the directory stream associated with

dir. The directory stream descriptor dir is not

available after this call.

</P>



<P><B>RETURN VALUE</B>

</P>



<P>The closedir() function returns 0 on success or

_1 on failure.

</P>



<P><B>ERRORS</B>

</P>



<TABLE>



<TR><TD>

EBADF

</TD><TD>

Invalid directory stream descriptor dir.

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



<P><B>CONFORMS TO</B>

</P>



<P>SVID 3, POSIX, BSD 4.3

</P>



<P></B>SEE ALSO</B>

</P>



<!-- CODE SNIP //-->

<PRE>

close(2), opendir(3), readdir(3), rewinddir(3),

seekdir(3), telldir(3), scandir(3)

</PRE>

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



<P>11 June 1995

</P>



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

confstr

</A></H3>



<P>confstr&#151;Get configuration-dependent string variables

</P>



<P><B>SYNOPSIS</B>

</P>



<!-- CODE SNIP //-->

<PRE WIDTH="1">

#define __USE_POSIX_2

#include &lt;unistd.h&gt;

size_t confstr(int name, char *buf, size_t len);

</PRE>

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



<P><B>DESCRIPTION</B>

</P>





<BLOCKQUOTE>

<P>confstr() gets the value of configuration-dependent string variables.

</P>



<P>The name argument is the system variable to be queried. The following variables are supported:

</P>



<P>CS_PATH     A value for the PATH variable that indicates where all the POSIX.2 standard utilities can be found.

</P>



<P>If buf is not NULL, and len is not 0, confstr() copies the value of the string to

buf truncated to len_1 characters if necessary, with a null character as termination. This can be detected by comparing the return value of

confstr() against len.

<P>If len is 0 and buf is NULL, confstr() just returns the value in

Return Value.

</P>

</BLOCKQUOTE>



<P><B>RETURN VALUE</B>

</P>



<P>If name does not correspond to a valid configuration variable,

confstr() returns 0.

</P>



<P><B>EXAMPLES</B>

</P>



<P>The following code fragment determines the path where you can find the POSIX.2 system utilities:

</P>



<!-- CODE //-->

<PRE WIDTH="1">

char *pathbuf; size_t n;

n = confstr(_CS_PATH,NULL,(size_t)0);

if ((pathbuf = malloc(n)) == NULL) abort();

confstr(_CS_PATH, pathbuf, n);

</PRE>

<!-- END CODE //-->





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







<P><B>ERRORS</B>

</P>



<P>If the value of name is invalid, errno is set to EINVAL.

</P>



<P><B>CONFORMS TO</B>

</P>



<P>Proposed POSIX.2

</P>



<P><B>BUGS</B>

</P>



<P>POSIX.2 is not yet an approved standard; the information in this man page is subject to change.

</P>



<P></B>SEE ALSO</B>

</P>



<!-- CODE SNIP //-->

<PRE>

sh(1), exec(2), system(3)

</PRE>

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



<P>GNU, 17 April 1993

</P>



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

copysign

</A></H3>



<P>copysign&#151;Copies the sign of a number

</P>



<P><B>SYNOPSIS</B>

</P>



<!-- CODE SNIP //-->

<PRE WIDTH="1">

#include &lt;math.h&gt;

double copysign(double x, double y);

</PRE>

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





<P><B>DESCRIPTION</B>

</P>



<P>The copysign() function returns a value whose absolute value matches

x, but whose sign matches that of y.

</P>



<P><B>CONFORMS TO</B>

</P>



<P>BSD 4.3

</P>



<P>GNU, 6 June 1993

</P>



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

cos

</A></H3>



<P>cos&#151;Cosine function

</P>



<P><B>SYNOPSIS</B>

</P>



<!-- CODE SNIP //-->

<PRE WIDTH="1">

#include &lt;math.h&gt;

double cos(double x);

</PRE>

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





<P><B>DESCRIPTION</B>

</P>



<P>The cos() function returns the cosine of x, where

x is given in radians.

</P>



<P><B>RETURN VALUE</B>

</P>



<P>The cos() function returns a value between _1 and 1.

</P>



<P><B>CONFORMS TO</B>

</P>



<P>SVID 3, POSIX, BSD 4.3, ISO 9899

</P>



<P></B>SEE ALSO</B>

</P>



<!-- CODE SNIP //-->

<PRE>

acos(3), asin(3), atan(3), atan2(3), sin(3), tan(3)

</PRE>

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



<P>8 June 1993

</P>



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





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

cosh

</A></H3>



<P>cosh&#151;Hyperbolic cosine function

</P>



<P><B>SYNOPSIS</B>

</P>



<!-- CODE SNIP //-->

<PRE WIDTH="1">

#include &lt;math.h&gt;

double cosh(double x);

</PRE>

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





<P><B>DESCRIPTION</B>

</P>



<P>The cosh() function returns the hyperbolic cosine of

x, which is defined mathematically as(exp(x)+exp(-x))/2.

</P>



<P><B>CONFORMS TO</B>

</P>



<P>SVID 3, POSIX, BSD 4.3, ISO 9899

</P>



<P></B>SEE ALSO</B>

</P>



<!-- CODE SNIP //-->

<PRE>

acosh(3), asinh(3), atanh(3), sinh(3), tanh(3)

</PRE>

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



<P>13 June 1993

</P>



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

crypt

</A></H3>



<P>crypt&#151;Password and data encryption

</P>



<P><B>SYNOPSIS</B>

</P>



<!-- CODE SNIP //-->

<PRE WIDTH="1">

#include &lt;unistd.h&gt;

char *crypt(const char *key, const char *salt);

</PRE>

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





<P><B>DESCRIPTION</B>

</P>

<BLOCKQUOTE>



<P>crypt is the password-encryption function. It is based on the Data Encryption Standard algorithm, with variations

intended (among other things) to discourage the use of hardware implementations of a key search.

</P>



<P>key is a user's typed password.

</P>



<P>salt is a two-character string chosen from the set

[a-zA-Z0-9./]. This string is used to perturb the algorithm in one of

4,096 different ways.

</P>



<P>By taking the lowest seven bits of each character of the key, a 56-bit key is obtained. This 56-bit key is used to

repeatedly encrypt a constant string (usually a string consisting of all

0s). The returned value points to the encrypted password, a

series of 13 printable ASCII characters (with the first two characters representing the salt itself). The return value points to

static data whose content is overwritten by each call.

</P>



<P>Warning: The key space consists of equal 7.2e16 possible values. Exhaustive searches of this key space are possible

using massively parallel computers. Software, such as

crack(1), is available to search the portion of this key space that is

generally used by humans for passwords. Hence, password selection should, at minimum, avoid common words and names. Using

a passwd(1) program that checks for crackable passwords during the selection process is recommended.

</P>



<P>The DES algorithm itself has a few quirks that make using the

crypt(3) interface a very poor choice for anything other

than password authentication. If you are planning to use the

crypt(3) interface for a cryptography project, don't do it; get a

good book on encryption and one of the widely available DES libraries instead.

</P>

</BLOCKQUOTE>



<P><B>CONFORMS TO</B>

</P>



<P>SVID, X/OPEN, BSD 4.3

</P>







<P><CENTER>

<a href="0902-0904.html">Previous</A> | <a href="../ewtoc.html">Table of Contents</A> | <a href="0909-0910.html">Next</A></CENTER></P>







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

<!-- begin footer information -->







</body></html>

⌨️ 快捷键说明

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