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

📄 0950-0951.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="0946-0949.html">Previous</A> | <a href="../ewtoc.html">Table of Contents</A> | <a href="0952-0954.html">Next</A></CENTER></P>







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





<P><B>

EXAMPLES

</P></B>



<P>One example of use is the following code, which simulates typing in the shell:</P>



<!-- CODE //-->

<PRE>

ls -l *.c ../*.c



glob_t globbuf;

globbuf.gl_offs = 2;

glob(&quot;*.c&quot;, GLOB_DOOFS, NULL, &amp;globbuf);

glob(&quot;../*.c&quot;, GLOB_DOOFS | GLOB_APPEND, NULL, &amp;globbuf);

globbuf.gl_pathv[0] = &quot;ls&quot;;

globbuf.gl_pathv[1] = &quot;-l&quot;;

execvp(&quot;ls&quot;, &amp;globbuf.gl_pathv[0]);

</PRE>

<!-- END CODE //-->



<P><B>CONFORMS TO

</P></B>



<P>Proposed POSIX.2</P>



<P><B>BUGS

</P></B>



<P>The glob()function may fail due to failure of underlying function calls, such as

malloc() or opendir(). These will store their error code in

errno.</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

</P></B>



<P>ls(1), sh(1), exec(2), stat(2), malloc(3),

opendir(3), readdir(3), wordexp(3), glob(7)</P>



<P>GNU, 13 May 1996</P>



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

hosts_access, hosts_ctl

</A></H3>



<P>hosts_access, hosts_ctl&#151;Access-control library functions</P>



<P><B>SYNOPSIS

</P></B>



<!-- CODE //-->

<PRE>

#include &quot;log_tcp.h&quot;

extern int allow_severity;

extern int deny_severity;

int hosts_access(daemon, client)

char *daemon;

struct client_info *client;

int hosts_ctl(daemon, client_name, client_addr, client_user)

char *daemon;

char *client_name;

char *client_addr;

char *client_user;

</PRE>

<!-- END CODE //-->



<P><B>DESCRIPTION

</P></B>



<P>The routines described in this document are part of the

libwrap.a library. They implement a pattern-based

access-control language with optional shell commands that are executed when a pattern fires.</P>



<P>In all cases, the daemon argument should specify a daemon process name

(argv[0] value). The client host address should be

a valid address, or FROM_UNKNOWN if the address lookup failed. The client hostname and username should be empty strings if

no information is available, FROM_UNKNOWN if the lookup failed, or an actual hostname or username.</P>



<P>hosts_access() consults the access-control tables described in the

hosts_access(5) manual page. hosts_access() returns

0 if access should be denied.</P>



<P>hosts_ctl() is a wrapper around the

hosts_access() routine with a perhaps more convenient interface (although it does

not pass on enough information to support automated remote username lookups).

hosts_ctl() returns 0 if access should be denied.</P>





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





<P>The allow_severity and deny_severity variables determine how accepted and rejected requests can be logged. They must

be provided by the caller and can be modified by rules in the access-control tables.</P>



<P><B>

DIAGNOSTICS

</P></B>



<P>Problems are reported via the syslog daemon.</P>



<P></B>SEE ALSO

</P></B>



<P>hosts_access(5) (format of the access control tables),

hosts_options(5), optional extensions to the base language</P>



<P><B>

FILES

</P></B>



<P>/etc/hosts.access, /etc/hosts.deny access-control tables</P>



<P><B>BUGS

</P></B>



<P>The functions described here do not make copies of their string-valued arguments. Beware of data from functions

that overwrite their results on each call.</P>



<P>hosts_access() uses the strtok() library function. This may interfere with other code that relies on

strtok().</P>



<P><B>

AUTHOR

</P></B>



<BLOCKQUOTE>

Wietse Venema (wietse@wzv.win.tue.nl)<BR>

Department of Mathematics and Computing Science<BR>

Eindhoven University of Technology<BR>

Den Dolech 2, P.O. Box 513, 5600 MB Eindhoven, The Netherlands

</BLOCKQUOTE>



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

hcreate, hdestroy, hsearch

</A></H3>



<P>hcreate, hdestroy, hsearch&#151;Hash table management</P>



<P><B>SYNOPSIS

</P></B>



<!-- CODE SNIP //-->

<PRE>

#include &lt;search.h&gt;

ENTRY *hsearch(ENTRY item, ACTION action);

int hcreate(unsigned nel);

void hdestroy(void);

</PRE>

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



<P><B>DESCRIPTION

</P></B>



<P>These three functions allow the user to create a hash table that associates a key with any data.</P>



<P>First, the table must be created with the function

hcreate(). nel is an estimate of the number of entries in the

table. hcreate() may adjust this value upward to improve the performance of the resulting hash table. The GNU

implementation of hsearch() will also enlarge the table if it gets nearly full.

malloc(3) is used to allocate space for the table.</P>



<P>The corresponding function hdestroy() frees the memory occupied by the hash table so that a new table can be constructed.</P>



<P>item is of type ENTRY, which is a typedef defined in

&lt;search.h&gt; and includes these elements:</P>



<!-- CODE SNIP //-->

<PRE>

typedef struct entry

{

  char *key;

  char *data;

} ENTRY;

</PRE>

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



<P>key points to the zero-terminated ASCII string that is the search key.

data points to the data associated with that key.

(A pointer to a type other than character should be cast to pointer-to-character.)

hsearch()searches the hash table for an item with the same key as

item, and if successful returns a pointer to it.

action determines what hsearch() does after an

unsuccessful search. A value of ENTER instructs it to insert the new item, whereas a value of

FIND means to return NULL.</P>









<P><CENTER>

<a href="0946-0949.html">Previous</A> | <a href="../ewtoc.html">Table of Contents</A> | <a href="0952-0954.html">Next</A></CENTER></P>







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

<!-- begin footer information -->







</body></html>

⌨️ 快捷键说明

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