OSDN Git Service

(split) Convert contrib and obsolete pages to UTF-8.
[linuxjm/LDP_man-pages.git] / obsolete / man3 / snprintf.3
index ee81f06..9e4a8ca 100644 (file)
 .TH SNPRINTF 3  "16 September 1995" "GNU" "Linux Programmer's Manual"
 .\"O .SH NAME
 .\"O .snprintf, vsnprintf \- formatted output conversion
-.SH Ì¾Á°
-snprintf, vsnprintf \- »ØÄꤷ¤¿½ñ¼°¤Ç½ÐÎϤò¹Ô¤¦
+.SH 名前
+snprintf, vsnprintf \- 指定した書式で出力を行う
 .\"O .SH SYNOPSIS
-.SH ½ñ¼°
+.SH 書式
 .B #define _GNU_SOURCE
 .br
 .B #include <stdio.h>
@@ -54,18 +54,18 @@ snprintf, vsnprintf \- 
 .\"O \fIn\fP specifies the maximum number of characters to produce.  The
 .\"O trailing null character is counted towards this limit, so you should
 .\"O allocate at least \fIn\fP characters for the string \fIstr\fP.
-.SH ÀâÌÀ
-\fBsnprintf\fP ´Ø¿ô¤Ï¡¢\fIformat\fP ¤Ç»ØÄꤵ¤ì¤¿½ñ¼°¤Ë½¾¤¤¡¢¤½¤ì°Ê¹ß¤Ë
-Í¿¤¨¤é¤ì¤¿°ú¿ô¤òÀ°·Á¤·¤Æ½ÐÎϤ·¡¢½ÐÎϤÏʸ»úÎó \fIstr\fP ¤Ë½ñ¤­¹þ¤Þ¤ì¤ë¡£
-¤³¤Î´Ø¿ô¤Ï \fBsprintf\fP(3) ¤Ë»÷¤Æ¤¤¤ë¤¬¡¢ ½ÐÎϤµ¤ì¤ë
-ºÇÂçʸ»ú¿ô \fIn\fP ¤ò»ØÄê¤Ç¤­¤ëÅÀ¤¬°Û¤Ê¤ë¡£
-ʸ»úÎó¤Î½ªÃ¼¤ò¼¨¤¹¥Ì¥ëʸ»ú¤âºÇÂçʸ»ú¿ô¤Ë´Þ¤Þ¤ì¤ë¤¿¤á¡¢
-½ÐÎÏʸ»úÎó \fIstr\fP ¤Ë¤Ï¾¯¤Ê¤¯¤È¤â \fIn\fP Ê¸»ú³ä¤êÅö¤Æ¤ëɬÍפ¬¤¢¤ë¡£
+.SH 説明
+\fBsnprintf\fP 関数は、\fIformat\fP で指定された書式に従い、それ以降に
+与えられた引数を整形して出力し、出力は文字列 \fIstr\fP に書き込まれる。
+この関数は \fBsprintf\fP(3) に似ているが、 出力される
+最大文字数 \fIn\fP を指定できる点が異なる。
+文字列の終端を示すヌル文字も最大文字数に含まれるため、
+出力文字列 \fIstr\fP には少なくとも \fIn\fP 文字割り当てる必要がある。
 .PP
 .\"O \fBvsnprintf\fP is the equivalent of \fBsnprintf\fP with the variable
 .\"O argument list specified directly as for \fBvprintf\fP.
-\fBvsnprintf\fP ´Ø¿ô¤Ï²ÄÊѤΰú¿ô¥ê¥¹¥È¤ò¤â¤Ã¤¿ \fBsnprintf\fP ¤ÈÅù²Á¤Ç¤¢¤ë¡£
-°ú¿ô¥ê¥¹¥È¤Ë¤Ä¤¤¤Æ¤Ï \fBvprintf\fP ¤Î¹à¤ÇÀâÌÀ¤µ¤ì¤Æ¤¤¤ë¡£
+\fBvsnprintf\fP 関数は可変の引数リストをもった \fBsnprintf\fP と等価である。
+引数リストについては \fBvprintf\fP の項で説明されている。
 .\"O .SH "RETURN VALUE"
 .\"O If the output was truncated, the return value is -1, otherwise it is
 .\"O the number of characters stored, not including the terminating null.
@@ -73,42 +73,42 @@ snprintf, vsnprintf \- 
 .\"O return the  number of characters (excluding the trailing null)
 .\"O which would have been written to the final string if enough space
 .\"O had been available.)
-.SH ÊÖ¤êÃÍ
-½ÐÎϤ¬Ä¹¤¯ÅÓÃæ¤Ç¥«¥Ã¥È¤µ¤ì¤¿¾ì¹ç¤Ë¤Ï -1 ¤òÊÖ¤·¡¢¤½¤ì°Ê³°¤Ï \fIstr\fP ¤ËÊݸ
-¤µ¤ì¤¿Ê¸»ú¿ô(ʸ»úÎó¤Î½ªÃ¼¤ò¼¨¤¹'\e0'¤ò½ü¤¯)¤òÊÖ¤¹¡£
-(⤷ glibc 2.0.6 ¤Þ¤Ç¤Î»ÅÍͤǤ¢¤ë¡£
-glibc 2.1 °Ê¹ß¤Ç¤Ï¡¢¤³¤ì¤é¤Î´Ø¿ô¤Ï¡¢¤â¤·ÍøÍѲÄǽ¤Ê½½Ê¬¤Ê¥¹¥Ú¡¼¥¹¤¬¤¢¤ì¤Ð
-½ñ¤­¹þ¤Þ¤ì¤¿¤Ç¤¢¤í¤¦Ê¸»ú¿ô(ʸ»úÎó¤Î½ªÃ¼¤ò¼¨¤¹'\e0'¤ò½ü¤¯)¤òÊÖ¤¹¡£)
+.SH 返り値
+出力が長く途中でカットされた場合には -1 を返し、それ以外は \fIstr\fP に保存
+された文字数(文字列の終端を示す'\e0'を除く)を返す。
+(但し glibc 2.0.6 までの仕様である。
+glibc 2.1 以降では、これらの関数は、もし利用可能な十分なスペースがあれば
+書き込まれたであろう文字数(文字列の終端を示す'\e0'を除く)を返す。)
 .\"O .SH EXAMPLE
-.SH Îã
+.SH 
 .br
 .\"O Here is an example program which dynamically enlarges its output buffer,
 .\"O and works correctly under both glibc 2.0 and glibc 2.1.
-½ÐÎϥХåե¡¤òưŪ¤Ë³ÈÄ¥¤¹¤ë¥×¥í¥°¥é¥àÎã¤ò°Ê²¼¤Ë¼¨¤¹¡£
-¤³¤Î¥×¥í¥°¥é¥à¤Ï¡¢glibc 2.0 ¤È glibc 2.1 ¤Î¤É¤Á¤é¤Ç¤âÀµ¤·¤¯Æ°ºî¤¹¤ë¡£
+出力バッファを動的に拡張するプログラム例を以下に示す。
+このプログラムは、glibc 2.0 と glibc 2.1 のどちらでも正しく動作する。
 .br
 .sp
 .nf
 .\"O      /* Construct a message describing the value of a 
 .\"O         variable whose name is NAME and whose value is 
 .\"O         VALUE. */
-    /* ÊÑ¿ô̾¤È¤½¤ÎÃͤòµ­½Ò¤¹¤ë "value of ÊÑ¿ô̾ is ÃÍ"
-       ¤È¤¤¤¦¥á¥Ã¥»¡¼¥¸¤òºîÀ®¤¹¤ë´Ø¿ô */
+    /* 変数名とその値を記述する "value of 変数名 is 値"
+       というメッセージを作成する関数 */
     char *
     make_message (char *name, char *value)
     {
 .\"O       /* Guess we need no more than 100 chars of space. */
-      /* ½ÐÎϥХåե¡¤Ï100ʸ»úʬ¤Ç½½Ê¬¤Ç¤¢¤ë¤È²¾Äê */
+      /* 出力バッファは100文字分で十分であると仮定 */
       int size = 100;
       char *buffer = (char *) xmalloc (size);
       while (1)
         {
 .\"O           /* Try to print in the allocated space. */
-          /* ³ÎÊݺѤߤΥХåե¡¤Ë½ÐÎϤ·¤è¤¦¤È¤¹¤ë */
+          /* 確保済みのバッファに出力しようとする */
           int nchars = snprintf (buffer, size,
                         "value of %s is %s", name, value);
 .\"O           /* If that worked, return the string. */
-          /* À®¸ù¤¹¤ì¤Ð¡¢¥Ð¥Ã¥Õ¥¡Æâ¤Îʸ»úÎó¤òÊÖ¤¹ */
+          /* 成功すれば、バッファ内の文字列を返す */
           if (nchars > -1 && nchars < size)
             return buffer;
 .\"O           /* Else try again with more space. */
@@ -116,11 +116,11 @@ glibc 2.1 
 .\"O             size = nchars+1;  /* precisely what is needed */
 .\"O           else
 .\"O             size *= 2;        /* twice the old size */
-          /* ¼ºÇÔ¤¹¤ì¤Ð¡¢¤µ¤é¤Ë¥Ð¥Ã¥Õ¥¡¤ò³ÎÊݤ·¤ÆºÆ»î¹Ô */
+          /* 失敗すれば、さらにバッファを確保して再試行 */
           if (nchars > -1)
-            size = nchars+1;  /* É¬ÍפʥХåե¡Ä¹¤òÀµ³Î¤Ë³ÎÊÝ */
+            size = nchars+1;  /* 必要なバッファ長を正確に確保 */
           else
-            size *= 2;        /* ¥Ð¥Ã¥Õ¥¡Ä¹¤ò£²Çܤˤ¹¤ë */
+            size *= 2;        /* バッファ長を2倍にする */
           buffer = (char *) xrealloc (buffer, size);
         }
     }
@@ -128,8 +128,8 @@ glibc 2.1 
 .RE
 .\"O .SH "CONFORMING TO"
 .\"O These are GNU extensions, expected to become part of ISO C9x.
-.SH ½àµò
-¤³¤ì¤é¤Î´Ø¿ô¤Ï GNU ¤Ë¤è¤ë³ÈÄ¥¤Ç¤¢¤ë¡£ISO C9x ¤Î°ìÉô¤È¤Ê¤ëͽÄê¤Ç¤¢¤ë¡£
+.SH 準拠
+これらの関数は GNU による拡張である。ISO C9x の一部となる予定である。
 .\"O .SH "SEE ALSO"
-.SH ´ØÏ¢¹àÌÜ
+.SH 関連項目
 .BR printf "(3), " sprintf "(3), " vsprintf "(3), " stdarg (3)