OSDN Git Service

Retire LDP man-pages repository
[linuxjm/LDP_man-pages.git] / release / man3 / qsort.3
diff --git a/release/man3/qsort.3 b/release/man3/qsort.3
deleted file mode 100644 (file)
index 44ac516..0000000
+++ /dev/null
@@ -1,138 +0,0 @@
-.\" Copyright 1993 David Metcalfe (david@prism.demon.co.uk)
-.\"
-.\" %%%LICENSE_START(VERBATIM)
-.\" Permission is granted to make and distribute verbatim copies of this
-.\" manual provided the copyright notice and this permission notice are
-.\" preserved on all copies.
-.\"
-.\" Permission is granted to copy and distribute modified versions of this
-.\" manual under the conditions for verbatim copying, provided that the
-.\" entire resulting derived work is distributed under the terms of a
-.\" permission notice identical to this one.
-.\"
-.\" Since the Linux kernel and libraries are constantly changing, this
-.\" manual page may be incorrect or out-of-date.  The author(s) assume no
-.\" responsibility for errors or omissions, or for damages resulting from
-.\" the use of the information contained herein.  The author(s) may not
-.\" have taken the same level of care in the production of this manual,
-.\" which is licensed free of charge, as they might when working
-.\" professionally.
-.\"
-.\" Formatted or processed versions of this manual, if unaccompanied by
-.\" the source, must acknowledge the copyright and authors of this work.
-.\" %%%LICENSE_END
-.\"
-.\" References consulted:
-.\"     Linux libc source code
-.\"     Lewine's _POSIX Programmer's Guide_ (O'Reilly & Associates, 1991)
-.\"     386BSD man pages
-.\"
-.\" Modified 1993-03-29, David Metcalfe
-.\" Modified 1993-07-24, Rik Faith (faith@cs.unc.edu)
-.\" 2006-01-15, mtk, Added example program.
-.\" Modified 2012-03-08, Mark R. Bannister <cambridge@users.sourceforge.net>
-.\"                  and Ben Bacarisse <software@bsb.me.uk>
-.\"     Document qsort_r()
-.\"
-.\"*******************************************************************
-.\"
-.\" This file was generated with po4a. Translate the source file.
-.\"
-.\"*******************************************************************
-.\"
-.\" Japanese Version Copyright (c) 1997 YOSHINO Takashi
-.\"       all rights reserved.
-.\" Translated 1997-01-21, YOSHINO Takashi <yoshino@civil.jcn.nihon-u.ac.jp>
-.\" Updated & Modified 2004-06-06, Yuichi SATO <ysato444@yahoo.co.jp>
-.\" Updated 2006-01-18, Akihiro MOTOKI <amotoki@dd.iij4u.or.jp>
-.\" Updated 2012-04-30, Akihiro MOTOKI <amotoki@gmail.com>
-.\"
-.TH QSORT 3 2012\-03\-08 "" "Linux Programmer's Manual"
-.SH 名前
-qsort, qsort_r \- 配列を並べ変える
-.SH 書式
-.nf
-\fB#include <stdlib.h>\fP
-.sp
-\fBvoid qsort(void *\fP\fIbase\fP\fB, size_t \fP\fInmemb\fP\fB, size_t \fP\fIsize\fP\fB,\fP
-\fB           int (*\fP\fIcompar\fP\fB)(const void *, const void *));\fP
-.sp
-\fBvoid qsort_r(void *\fP\fIbase\fP\fB, size_t \fP\fInmemb\fP\fB, size_t \fP\fIsize\fP\fB,\fP
-\fB           int (*\fP\fIcompar\fP\fB)(const void *, const void *, void *),\fP
-\fB           void *\fP\fIarg\fP\fB);\fP
-.fi
-.sp
-.in -4n
-glibc 向けの機能検査マクロの要件 (\fBfeature_test_macros\fP(7)  参照):
-.in
-.sp
-.ad l
-\fBqsort_r\fP(): _GNU_SOURCE
-.ad b
-.SH 説明
-\fBqsort\fP()  関数は、 \fInmemb\fP 個の大きさ \fIsize\fP の要素をもつ配列を並べ変える。 \fIbase\fP
-引き数は配列の先頭へのポインターである。
-.PP
-\fIcompar\fP をポインターとする比較関数によって、 配列の中身は昇順 (値の大きいものほど後に並ぶ順番) に並べられる。
-比較関数の引き数は比較されるふたつのオブジェクトのポインターである。
-.PP
-比較関数は、第一引き数が第二引き数に対して、 1) 小さい、2) 等しい、3) 大きいのそれぞれに応じて、 1) ゼロより小さい整数、2) ゼロ、3)
-ゼロより大きい整数の いずれかを返さなければならない。 二つの要素の比較結果が等しいとき、 並べ変えた後の配列では、これら二つの順序は規定されていない。
-.PP
-\fBqsort_r\fP() 関数は \fBqsort\fP() と同じだが、比較関数 \fIcompar\fP が第 3 引き数を
-取る点が異なる。ポインターが \fIarg\fP 経由で比較関数に渡される。
-これにより、比較関数は任意の引き数を渡すためにグローバル変数を使う必要がなくなり、
-そのため、リエントラント (再入可能) で安全にスレッドで使用できるようになる。
-.SH 返り値
-関数 \fBqsort\fP() と \fBqsort_r\fP() は値を返さない。
-.SH バージョン
-\fBqsort_r\fP() は glibc バージョン 2.8 で追加された。
-.SH 準拠
-\fBqsort\fP() 関数は SVr4, 4.3BSD, C89, C99 に準拠している。
-.SH 注意
-\fBqsort\fP() の \fIcompar\fP 引き数に使用するのに適しているライブラリルーチンと
-しては \fBalphasort\fP(3), \fBversionsort\fP(3) がある。 C の文字列を比較する場合、
-以下の例にあるように比較関数で \fBstrcmp\fP(3) を呼び出すこともできる。
-.SH 例
-使用例については、 \fBbsearch\fP(3)  にある例を参照すること。
-
-以下のプログラムに別の使用例を示す。このプログラムは、 コマンドライン引き数で指定された文字列の並び換えを行う。
-.sp
-.nf
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-static int
-cmpstringp(const void *p1, const void *p2)
-{
-    /* この関数の実際の引き数は "char 型へのポインターのポインター" だが、
-       strcmp(3) の引き数は "char 型へのポインター" である。
-       そこで、以下のようにキャストをしてからポインターの逆参照を行う。*/
-
-    return strcmp(* (char * const *) p1, * (char * const *) p2);
-}
-
-int
-main(int argc, char *argv[])
-{
-    int j;
-
-    if (argc < 2) {
-        fprintf(stderr, "Usage: %s <string>...\en", argv[0]);
-        exit(EXIT_FAILURE);
-    }
-
-    qsort(&argv[1], argc \- 1, sizeof(char *), cmpstringp);
-
-    for (j = 1; j < argc; j++)
-        puts(argv[j]);
-    exit(EXIT_SUCCESS);
-}
-.fi
-.SH 関連項目
-\fBsort\fP(1), \fBalphasort\fP(3), \fBstrcmp\fP(3), \fBversionsort\fP(3)
-.SH この文書について
-この man ページは Linux \fIman\-pages\fP プロジェクトのリリース 3.79 の一部
-である。プロジェクトの説明とバグ報告に関する情報は
-http://www.kernel.org/doc/man\-pages/ に書かれている。