#, fuzzy msgid "" msgstr "" "Project-Id-Version: man-pages-l10n VERSION\n" "POT-Creation-Date: 2014-07-17 17:58+0900\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" #. type: TH #: man-pages-posix/man3p/bsearch.3p:2 #, no-wrap msgid "BSEARCH" msgstr "" #. type: TH #: man-pages-posix/man3p/bsearch.3p:2 #, no-wrap msgid "2013" msgstr "" #. type: TH #: man-pages-posix/man3p/bsearch.3p:2 #, no-wrap msgid "IEEE/The Open Group" msgstr "" #. type: TH #: man-pages-posix/man3p/bsearch.3p:2 #, no-wrap msgid "POSIX Programmer's Manual" msgstr "" #. type: SH #: man-pages-posix/man3p/bsearch.3p:3 #, no-wrap msgid "PROLOG" msgstr "" #. type: Plain text #: man-pages-posix/man3p/bsearch.3p:8 msgid "" "This manual page is part of the POSIX Programmer's Manual. The Linux " "implementation of this interface may differ (consult the corresponding Linux " "manual page for details of Linux behavior), or the interface may not be " "implemented on Linux." msgstr "" #. type: SH #: man-pages-posix/man3p/bsearch.3p:9 #, no-wrap msgid "NAME" msgstr "" #. type: Plain text #: man-pages-posix/man3p/bsearch.3p:12 msgid "bsearch \\(em binary search a sorted table" msgstr "" #. type: SH #: man-pages-posix/man3p/bsearch.3p:12 #, no-wrap msgid "SYNOPSIS" msgstr "" #. type: Plain text #: man-pages-posix/man3p/bsearch.3p:16 #, no-wrap msgid "#include Estdlib.hE\n" msgstr "" #. type: Plain text #: man-pages-posix/man3p/bsearch.3p:19 #, no-wrap msgid "" "void *bsearch(const void *I, const void *I, size_t I,\n" " size_t I, int (*I)(const void *, const void *));\n" msgstr "" #. type: SH #: man-pages-posix/man3p/bsearch.3p:20 #, no-wrap msgid "DESCRIPTION" msgstr "" #. type: Plain text #: man-pages-posix/man3p/bsearch.3p:24 msgid "" "The functionality described on this reference page is aligned with the ISO\\ " "C standard. Any conflict between the requirements described here and the " "ISO\\ C standard is unintentional. This volume of POSIX.1\\(hy2008 defers to " "the ISO\\ C standard." msgstr "" #. type: Plain text #: man-pages-posix/man3p/bsearch.3p:40 msgid "" "The I() function shall search an array of I objects, the " "initial element of which is pointed to by I, for an element that " "matches the object pointed to by I. The size of each element in the " "array is specified by I. If the I argument has the value zero, " "the comparison function pointed to by I shall not be called and no " "match shall be found." msgstr "" #. type: Plain text #: man-pages-posix/man3p/bsearch.3p:46 msgid "" "The comparison function pointed to by I shall be called with two " "arguments that point to the I object and to an array element, in that " "order." msgstr "" #. type: Plain text #: man-pages-posix/man3p/bsearch.3p:52 msgid "" "The application shall ensure that the comparison function pointed to by " "I does not alter the contents of the array. The implementation may " "reorder elements of the array between calls to the comparison function, but " "shall not alter the contents of any individual element." msgstr "" #. type: Plain text #: man-pages-posix/man3p/bsearch.3p:55 msgid "" "The implementation shall ensure that the first argument is always a pointer " "to the key." msgstr "" #. type: Plain text #: man-pages-posix/man3p/bsearch.3p:61 msgid "" "When the same objects (consisting of width bytes, irrespective of their " "current positions in the array) are passed more than once to the comparison " "function, the results shall be consistent with one another. That is, the " "same object shall always compare the same way with the key." msgstr "" #. type: Plain text #: man-pages-posix/man3p/bsearch.3p:72 msgid "" "The application shall ensure that the function returns an integer less than, " "equal to, or greater than 0 if the I object is considered, " "respectively, to be less than, to match, or to be greater than the array " "element. The application shall ensure that the array consists of all the " "elements that compare less than, all the elements that compare equal to, and " "all the elements that compare greater than the I object, in that order." msgstr "" #. type: SH #: man-pages-posix/man3p/bsearch.3p:72 #, no-wrap msgid "RETURN VALUE" msgstr "" #. type: Plain text #: man-pages-posix/man3p/bsearch.3p:78 msgid "" "The I() function shall return a pointer to a matching member of " "the array, or a null pointer if no match is found. If two or more members " "compare equal, which member is returned is unspecified." msgstr "" #. type: SH #: man-pages-posix/man3p/bsearch.3p:78 #, no-wrap msgid "ERRORS" msgstr "" #. type: Plain text #: man-pages-posix/man3p/bsearch.3p:80 msgid "No errors are defined." msgstr "" #. type: Plain text #: man-pages-posix/man3p/bsearch.3p:82 msgid "I" msgstr "" #. type: SH #: man-pages-posix/man3p/bsearch.3p:82 #, no-wrap msgid "EXAMPLES" msgstr "" #. type: Plain text #: man-pages-posix/man3p/bsearch.3p:86 msgid "" "The example below searches a table containing pointers to nodes consisting " "of a string and its length. The table is ordered alphabetically on the " "string in the node pointed to by each entry." msgstr "" #. type: Plain text #: man-pages-posix/man3p/bsearch.3p:90 msgid "" "The code fragment below reads in strings and either finds the corresponding " "node and prints out the string and its length, or prints an error message." msgstr "" #. type: Plain text #: man-pages-posix/man3p/bsearch.3p:97 #, no-wrap msgid "" "B<\n" "#include Estdio.hE\n" "#include Estdlib.hE\n" "#include Estring.hE>\n" msgstr "" #. type: Plain text #: man-pages-posix/man3p/bsearch.3p:99 #, no-wrap msgid "#define\\ TABSIZE 1000\n" msgstr "" #. type: Plain text #: man-pages-posix/man3p/bsearch.3p:138 #, no-wrap msgid "" "struct node { /* These are stored in the table. */\n" " char *string;\n" " int length;\n" "};\n" "struct node table[TABSIZE]; /* Table to be searched. */\n" " .\n" " .\n" " .\n" "{\n" " struct node *node_ptr, node;\n" " /* Routine to compare 2 nodes. */\n" " int node_compare(const void *, const void *);\n" " .\n" " .\n" " .\n" " while (scanf(\"%ms\", &node.string) != EOF) {\n" " node_ptr = (struct node *)bsearch((void *)(&node),\n" " (void *)table, TABSIZE,\n" " sizeof(struct node), node_compare);\n" " if (node_ptr != NULL) {\n" " (void)printf(\"string = %20s, length = %d\\en\",\n" " node_ptr-Estring, node_ptr-Elength);\n" " } else {\n" " (void)printf(\"not found: %s\\en\", node.string);\n" " }\n" " free(node.string);\n" " }\n" "}\n" "/*\n" " This routine compares two nodes based on an\n" " alphabetical ordering of the string field.\n" "*/\n" "int\n" "node_compare(const void *node1, const void *node2)\n" "{\n" " return strcoll(((const struct node *)node1)-Estring,\n" " ((const struct node *)node2)-Estring);\n" "}\n" msgstr "" #. type: SH #: man-pages-posix/man3p/bsearch.3p:141 #, no-wrap msgid "APPLICATION USAGE" msgstr "" #. type: Plain text #: man-pages-posix/man3p/bsearch.3p:144 msgid "" "The pointers to the key and the element at the base of the table should be " "of type pointer-to-element." msgstr "" #. type: Plain text #: man-pages-posix/man3p/bsearch.3p:148 msgid "" "The comparison function need not compare every byte, so arbitrary data may " "be contained in the elements in addition to the values being compared." msgstr "" #. type: Plain text #: man-pages-posix/man3p/bsearch.3p:151 msgid "" "In practice, the array is usually sorted according to the comparison " "function." msgstr "" #. type: SH #: man-pages-posix/man3p/bsearch.3p:151 #, no-wrap msgid "RATIONALE" msgstr "" #. type: Plain text #: man-pages-posix/man3p/bsearch.3p:157 msgid "" "The requirement that the second argument (hereafter referred to as I

) to " "the comparison function is a pointer to an element of the array implies that " "for every call all of the following expressions are non-zero:" msgstr "" #. type: Plain text #: man-pages-posix/man3p/bsearch.3p:164 #, no-wrap msgid "" "B<\n" "((char *)p \\(mi (char *(base) % width == 0\n" "(char *)p E= (char *)base\n" "(char *)p E (char *)base + nel * width>\n" msgstr "" #. type: SH #: man-pages-posix/man3p/bsearch.3p:167 #, no-wrap msgid "FUTURE DIRECTIONS" msgstr "" #. type: Plain text #: man-pages-posix/man3p/bsearch.3p:169 msgid "None." msgstr "" #. type: SH #: man-pages-posix/man3p/bsearch.3p:169 #, no-wrap msgid "SEE ALSO" msgstr "" #. type: Plain text #: man-pages-posix/man3p/bsearch.3p:174 msgid "I\\^(\\|), I\\^(\\|), I\\^(\\|), I\\^(\\|)" msgstr "" #. type: Plain text #: man-pages-posix/man3p/bsearch.3p:177 msgid "The Base Definitions volume of POSIX.1\\(hy2008, Bstdlib.hE>" msgstr "" #. type: SH #: man-pages-posix/man3p/bsearch.3p:177 #, no-wrap msgid "COPYRIGHT" msgstr "" #. type: Plain text #: man-pages-posix/man3p/bsearch.3p:188 msgid "" "Portions of this text are reprinted and reproduced in electronic form from " "IEEE Std 1003.1, 2013 Edition, Standard for Information Technology -- " "Portable Operating System Interface (POSIX), The Open Group Base " "Specifications Issue 7, Copyright (C) 2013 by the Institute of Electrical " "and Electronics Engineers, Inc and The Open Group. (This is POSIX.1-2008 " "with the 2013 Technical Corrigendum 1 applied.) In the event of any " "discrepancy between this version and the original IEEE and The Open Group " "Standard, the original IEEE and The Open Group Standard is the referee " "document. The original Standard can be obtained online at http://www.unix." "org/online.html ." msgstr "" #. type: Plain text #: man-pages-posix/man3p/bsearch.3p:193 msgid "" "Any typographical or formatting errors that appear in this page are most " "likely to have been introduced during the conversion of the source files to " "man page format. To report such errors, see https://www.kernel.org/doc/man-" "pages/reporting_bugs.html ." msgstr ""