X-Git-Url: http://git.osdn.net/view?a=blobdiff_plain;f=src%2Ffiles.c;h=8d6f218642f99245a17c2f94292d9f41d6c06e82;hb=97c7a62d7abe963c7a9abcb22a35273101a09081;hp=cd0cab82e88de41af57e97feb71be71fffaf50c7;hpb=cd2a9643bf7f291ac379d9011aa13b5609d9283e;p=hengband%2Fhengband.git diff --git a/src/files.c b/src/files.c index cd0cab82e..8d6f21864 100644 --- a/src/files.c +++ b/src/files.c @@ -1,14 +1,17 @@ -/* File: files.c */ - -/* +/*! + * @file files.c + * @brief ファイル入出力管理 / Purpose: code dealing with files (and death) + * @date 2014/01/28 + * @author + *
  * Copyright (c) 1997 Ben Harrison, James E. Wilson, Robert A. Koeneke
- *
  * This software may be copied and distributed for educational, research,
  * and not for profit purposes provided that this copyright and statement
  * are included in all such copies.  Other copyrights may also apply.
+ * 2014 Deskull rearranged comment for Doxygen.\n
+ * 
*/ -/* Purpose: code dealing with files (and death) */ #include "angband.h" @@ -19,8 +22,8 @@ /* #undef _POSIX_SAVED_IDS */ -/* - * Hack -- drop permissions +/*! + * @brief ファイルのドロップパーミッションチェック / Hack -- drop permissions */ void safe_setuid_drop(void) { @@ -33,42 +36,22 @@ void safe_setuid_drop(void) if (setuid(getuid()) != 0) { -#ifdef JP -quit("setuid(): Àµ¤·¤¯µö²Ä¤¬¼è¤ì¤Þ¤»¤ó¡ª"); -#else - quit("setuid(): cannot set permissions correctly!"); -#endif - + quit(_("setuid(): 正しく許可が取れません!", "setuid(): cannot set permissions correctly!")); } if (setgid(getgid()) != 0) { -#ifdef JP -quit("setgid(): Àµ¤·¤¯µö²Ä¤¬¼è¤ì¤Þ¤»¤ó¡ª"); -#else - quit("setgid(): cannot set permissions correctly!"); -#endif - + quit(_("setgid(): 正しく許可が取れません!", "setgid(): cannot set permissions correctly!")); } # else if (setreuid(geteuid(), getuid()) != 0) { -#ifdef JP -quit("setreuid(): Àµ¤·¤¯µö²Ä¤¬¼è¤ì¤Þ¤»¤ó¡ª"); -#else - quit("setreuid(): cannot set permissions correctly!"); -#endif - + quit(_("setreuid(): 正しく許可が取れません!", "setreuid(): cannot set permissions correctly!")); } if (setregid(getegid(), getgid()) != 0) { -#ifdef JP -quit("setregid(): Àµ¤·¤¯µö²Ä¤¬¼è¤ì¤Þ¤»¤ó¡ª"); -#else - quit("setregid(): cannot set permissions correctly!"); -#endif - + quit(_("setregid(): 正しく許可が取れません!", "setregid(): cannot set permissions correctly!")); } # endif @@ -80,8 +63,8 @@ quit("setregid(): } -/* - * Hack -- grab permissions +/*! + * @brief ファイルのグラブパーミッションチェック / Hack -- grab permissions */ void safe_setuid_grab(void) { @@ -94,42 +77,22 @@ void safe_setuid_grab(void) if (setuid(player_euid) != 0) { -#ifdef JP -quit("setuid(): Àµ¤·¤¯µö²Ä¤¬¼è¤ì¤Þ¤»¤ó¡ª"); -#else - quit("setuid(): cannot set permissions correctly!"); -#endif - + quit(_("setuid(): 正しく許可が取れません!", "setuid(): cannot set permissions correctly!")); } if (setgid(player_egid) != 0) { -#ifdef JP -quit("setgid(): Àµ¤·¤¯µö²Ä¤¬¼è¤ì¤Þ¤»¤ó¡ª"); -#else - quit("setgid(): cannot set permissions correctly!"); -#endif - + quit(_("setgid(): 正しく許可が取れません!", "setgid(): cannot set permissions correctly!")); } # else if (setreuid(geteuid(), getuid()) != 0) { -#ifdef JP -quit("setreuid(): Àµ¤·¤¯µö²Ä¤¬¼è¤ì¤Þ¤»¤ó¡ª"); -#else - quit("setreuid(): cannot set permissions correctly!"); -#endif - + quit(_("setreuid(): 正しく許可が取れません!", "setreuid(): cannot set permissions correctly!")); } if (setregid(getegid(), getgid()) != 0) { -#ifdef JP -quit("setregid(): Àµ¤·¤¯µö²Ä¤¬¼è¤ì¤Þ¤»¤ó¡ª"); -#else - quit("setregid(): cannot set permissions correctly!"); -#endif - + quit(_("setregid(): 正しく許可が取れません!", "setregid(): cannot set permissions correctly!")); } # endif /* SAFE_SETUID_POSIX */ @@ -141,25 +104,27 @@ quit("setregid(): } -/* - * Extract the first few "tokens" from a buffer - * +/*! + * @brief 各種データテキストをトークン単位に分解する / Extract the first few "tokens" from a buffer + * @param buf データテキストの参照ポインタ + * @param num トークンの数 + * @param tokens トークンを保管する文字列参照ポインタ配列 + * @param mode オプション + * @return 解釈した文字列数 + * @details + *
  * This function uses "colon" and "slash" as the delimeter characters.
- *
  * We never extract more than "num" tokens.  The "last" token may include
  * "delimeter" characters, allowing the buffer to include a "string" token.
- *
  * We save pointers to the tokens in "tokens", and return the number found.
- *
  * Hack -- Attempt to handle the 'c' character formalism
- *
  * Hack -- An empty buffer, or a final delimeter, yields an "empty" token.
- *
  * Hack -- We will always extract at least one token
+ * 
*/ -s16b tokenize(char *buf, s16b num, char **tokens, int mode) +s16b tokenize(char *buf, s16b num, char **tokens, BIT_FLAGS mode) { - int i = 0; + s16b i = 0; char *s = buf; @@ -250,7 +215,7 @@ static named_num gf_desc[] = {"GF_SOUND", GF_SOUND }, {"GF_CONFUSION", GF_CONFUSION }, {"GF_FORCE", GF_FORCE }, - {"GF_INERTIA", GF_INERTIA }, + {"GF_INERTIA", GF_INERTIAL }, {"GF_MANA", GF_MANA }, {"GF_METEOR", GF_METEOR }, {"GF_ICE", GF_ICE }, @@ -274,7 +239,7 @@ static named_num gf_desc[] = {"GF_OLD_SLOW", GF_OLD_SLOW }, {"GF_OLD_CONF", GF_OLD_CONF }, {"GF_OLD_SLEEP", GF_OLD_SLEEP }, - {"GF_OLD_DRAIN", GF_OLD_DRAIN }, + {"GF_HYPODYNAMIA", GF_HYPODYNAMIA }, {"GF_AWAY_UNDEAD", GF_AWAY_UNDEAD }, {"GF_AWAY_EVIL", GF_AWAY_EVIL }, {"GF_AWAY_ALL", GF_AWAY_ALL }, @@ -335,78 +300,65 @@ static named_num gf_desc[] = }; -/* +/*! + * @brief 設定ファイルの各行から各種テキスト情報を取得する / * Parse a sub-file of the "extra info" (format shown below) - * + * @param buf データテキストの参照ポインタ + * @return エラーコード + * @details + *
  * Each "action" line has an "action symbol" in the first column,
  * followed by a colon, followed by some command specific info,
  * usually in the form of "tokens" separated by colons or slashes.
- *
  * Blank lines, lines starting with white space, and lines starting
  * with pound signs ("#") are ignored (as comments).
- *
  * Note the use of "tokenize()" to allow the use of both colons and
  * slashes as delimeters, while still allowing final tokens which
  * may contain any characters including "delimiters".
- *
  * Note the use of "strtol()" to allow all "integers" to be encoded
  * in decimal, hexidecimal, or octal form.
- *
  * Note that "monster zero" is used for the "player" attr/char, "object
  * zero" will be used for the "stack" attr/char, and "feature zero" is
  * used for the "nothing" attr/char.
- *
  * Parse another file recursively, see below for details
- *   %:
- *
+ *   %:\
  * Specify the attr/char values for "monsters" by race index
- *   R:::
- *
+ *   R:\:\:\
  * Specify the attr/char values for "objects" by kind index
- *   K:::
- *
+ *   K:\:\:\
  * Specify the attr/char values for "features" by feature index
- *   F:::
- *
+ *   F:\:\:\
  * Specify the attr/char values for unaware "objects" by kind tval
- *   U:::
- *
+ *   U:\:\:\
  * Specify the attr/char values for inventory "objects" by kind tval
- *   E:::
- *
+ *   E:\:\:\
  * Define a macro action, given an encoded macro action
- *   A:
- *
+ *   A:\
  * Create a normal macro, given an encoded macro trigger
- *   P:
- *
+ *   P:\
  * Create a command macro, given an encoded macro trigger
- *   C:
- *
+ *   C:\
  * Create a keyset mapping
- *   S:::
- *
+ *   S:\:\:\
  * Turn an option off, given its name
- *   X:
- *
+ *   X:\
  * Turn an option on, given its name
- *   Y:
- *
+ *   Y:\
  * Specify visual information, given an index, and some data
- *   V:::::
- *
+ *   V:\:\:\:\:\
  * Specify the set of colors to use when drawing a zapped spell
- *   Z::
- *
+ *   Z:\:\
  * Specify a macro trigger template and macro trigger names.
- *   T: