X-Git-Url: http://git.osdn.net/view?a=blobdiff_plain;f=src%2Ffiles.c;h=8e571dd5284f229a8bc175f61d034f5ecc7038db;hb=d628d768f42efb44f1c7b02baae6b2574b44a298;hp=ca16af963ad48dee51f0150b043661dc75074911;hpb=54297b4292fe1d35ca59ac7d648a721d5f77f9bc;p=hengband%2Fhengband.git diff --git a/src/files.c b/src/files.c index ca16af963..8e571dd52 100644 --- a/src/files.c +++ b/src/files.c @@ -1,6 +1,6 @@ -/*! +/*! * @file files.c - * @brief ¥Õ¥¡¥¤¥ëÆþ½ÐÎÏ´ÉÍý / Purpose: code dealing with files (and death) + * @brief ファイル入出力管理 / Purpose: code dealing with files (and death) * @date 2014/01/28 * @author *
@@ -10,7 +10,7 @@
  * are included in all such copies.  Other copyrights may also apply.
  * 2014 Deskull rearranged comment for Doxygen.\n
  * 
- * + */ #include "angband.h" @@ -23,7 +23,7 @@ /*! - * @brief ¥Õ¥¡¥¤¥ë¤Î¥É¥í¥Ã¥×¥Ñ¡¼¥ß¥Ã¥·¥ç¥ó¥Á¥§¥Ã¥¯ / Hack -- drop permissions + * @brief ファイルのドロップパーミッションチェック / Hack -- drop permissions */ void safe_setuid_drop(void) { @@ -36,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 @@ -84,7 +64,7 @@ quit("setregid(): /*! - * @brief ¥Õ¥¡¥¤¥ë¤Î¥°¥é¥Ö¥Ñ¡¼¥ß¥Ã¥·¥ç¥ó¥Á¥§¥Ã¥¯ / Hack -- grab permissions + * @brief ファイルのグラブパーミッションチェック / Hack -- grab permissions */ void safe_setuid_grab(void) { @@ -97,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 */ @@ -145,12 +105,12 @@ quit("setregid(): /*! - * @brief ³Æ¼ï¥Ç¡¼¥¿¥Æ¥­¥¹¥È¤ò¥È¡¼¥¯¥óñ°Ì¤Ëʬ²ò¤¹¤ë / Extract the first few "tokens" from a buffer - * @param buf ¥Ç¡¼¥¿¥Æ¥­¥¹¥È¤Î»²¾È¥Ý¥¤¥ó¥¿ - * @param num ¥È¡¼¥¯¥ó¤Î¿ô - * @param tokens ¥È¡¼¥¯¥ó¤òÊݴɤ¹¤ëʸ»úÎ󻲾ȥݥ¤¥ó¥¿ÇÛÎó - * @param mode ¥ª¥×¥·¥ç¥ó - * @return ²ò¼á¤·¤¿Ê¸»úÎó¿ô + * @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.
@@ -162,9 +122,9 @@ quit("setregid(): 
  * 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; @@ -242,27 +202,27 @@ static named_num gf_desc[] = {"GF_ACID", GF_ACID }, {"GF_COLD", GF_COLD }, {"GF_FIRE", GF_FIRE }, - {"GF_PSY_SPEAR", GF_PSY_SPEAR }, + {"GF_PSY_SPEAR", GF_PSY_SPEAR }, {"GF_MISSILE", GF_MISSILE }, - {"GF_ARROW", GF_ARROW }, + {"GF_ARROW", GF_ARROW }, {"GF_PLASMA", GF_PLASMA }, - {"GF_WATER", GF_WATER }, + {"GF_WATER", GF_WATER }, {"GF_LITE", GF_LITE }, {"GF_DARK", GF_DARK }, {"GF_LITE_WEAK", GF_LITE_WEAK }, {"GF_DARK_WEAK", GF_DARK_WEAK }, {"GF_SHARDS", GF_SHARDS }, - {"GF_SOUND", GF_SOUND }, + {"GF_SOUND", GF_SOUND }, {"GF_CONFUSION", GF_CONFUSION }, - {"GF_FORCE", GF_FORCE }, - {"GF_INERTIA", GF_INERTIA }, + {"GF_FORCE", GF_FORCE }, + {"GF_INERTIA", GF_INERTIAL }, {"GF_MANA", GF_MANA }, {"GF_METEOR", GF_METEOR }, {"GF_ICE", GF_ICE }, - {"GF_CHAOS", GF_CHAOS }, + {"GF_CHAOS", GF_CHAOS }, {"GF_NETHER", GF_NETHER }, {"GF_DISENCHANT", GF_DISENCHANT }, - {"GF_NEXUS", GF_NEXUS }, + {"GF_NEXUS", GF_NEXUS }, {"GF_TIME", GF_TIME }, {"GF_GRAVITY", GF_GRAVITY }, {"GF_KILL_WALL", GF_KILL_WALL }, @@ -273,24 +233,24 @@ static named_num gf_desc[] = {"GF_MAKE_TRAP", GF_MAKE_TRAP }, {"GF_MAKE_TREE", GF_MAKE_TREE }, {"GF_OLD_CLONE", GF_OLD_CLONE }, - {"GF_OLD_POLY", GF_OLD_POLY }, - {"GF_OLD_HEAL", GF_OLD_HEAL }, + {"GF_OLD_POLY", GF_OLD_POLY }, + {"GF_OLD_HEAL", GF_OLD_HEAL }, {"GF_OLD_SPEED", GF_OLD_SPEED }, - {"GF_OLD_SLOW", GF_OLD_SLOW }, - {"GF_OLD_CONF", GF_OLD_CONF }, + {"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_AWAY_UNDEAD", GF_AWAY_UNDEAD }, + {"GF_HYPODYNAMIA", GF_HYPODYNAMIA }, + {"GF_AWAY_UNDEAD", GF_AWAY_UNDEAD }, {"GF_AWAY_EVIL", GF_AWAY_EVIL }, - {"GF_AWAY_ALL", GF_AWAY_ALL }, - {"GF_TURN_UNDEAD", GF_TURN_UNDEAD }, + {"GF_AWAY_ALL", GF_AWAY_ALL }, + {"GF_TURN_UNDEAD", GF_TURN_UNDEAD }, {"GF_TURN_EVIL", GF_TURN_EVIL }, - {"GF_TURN_ALL", GF_TURN_ALL }, - {"GF_DISP_UNDEAD", GF_DISP_UNDEAD }, + {"GF_TURN_ALL", GF_TURN_ALL }, + {"GF_DISP_UNDEAD", GF_DISP_UNDEAD }, {"GF_DISP_EVIL", GF_DISP_EVIL }, - {"GF_DISP_ALL", GF_DISP_ALL }, + {"GF_DISP_ALL", GF_DISP_ALL }, {"GF_DISP_DEMON", GF_DISP_DEMON }, - {"GF_DISP_LIVING", GF_DISP_LIVING }, + {"GF_DISP_LIVING", GF_DISP_LIVING }, {"GF_ROCKET", GF_ROCKET }, {"GF_NUKE", GF_NUKE }, {"GF_MAKE_GLYPH", GF_MAKE_GLYPH }, @@ -300,51 +260,51 @@ static named_num gf_desc[] = {"GF_STUN", GF_STUN }, {"GF_HOLY_FIRE", GF_HOLY_FIRE }, {"GF_HELL_FIRE", GF_HELL_FIRE }, - {"GF_DISINTEGRATE", GF_DISINTEGRATE }, - {"GF_CHARM", GF_CHARM }, - {"GF_CONTROL_UNDEAD", GF_CONTROL_UNDEAD }, - {"GF_CONTROL_ANIMAL", GF_CONTROL_ANIMAL }, + {"GF_DISINTEGRATE", GF_DISINTEGRATE }, + {"GF_CHARM", GF_CHARM }, + {"GF_CONTROL_UNDEAD", GF_CONTROL_UNDEAD }, + {"GF_CONTROL_ANIMAL", GF_CONTROL_ANIMAL }, {"GF_PSI", GF_PSI }, {"GF_PSI_DRAIN", GF_PSI_DRAIN }, - {"GF_TELEKINESIS", GF_TELEKINESIS }, - {"GF_JAM_DOOR", GF_JAM_DOOR }, + {"GF_TELEKINESIS", GF_TELEKINESIS }, + {"GF_JAM_DOOR", GF_JAM_DOOR }, {"GF_DOMINATION", GF_DOMINATION }, {"GF_DISP_GOOD", GF_DISP_GOOD }, {"GF_DRAIN_MANA", GF_DRAIN_MANA }, {"GF_MIND_BLAST", GF_MIND_BLAST }, {"GF_BRAIN_SMASH", GF_BRAIN_SMASH }, - {"GF_CAUSE_1", GF_CAUSE_1 }, - {"GF_CAUSE_2", GF_CAUSE_2 }, - {"GF_CAUSE_3", GF_CAUSE_3 }, - {"GF_CAUSE_4", GF_CAUSE_4 }, + {"GF_CAUSE_1", GF_CAUSE_1 }, + {"GF_CAUSE_2", GF_CAUSE_2 }, + {"GF_CAUSE_3", GF_CAUSE_3 }, + {"GF_CAUSE_4", GF_CAUSE_4 }, {"GF_HAND_DOOM", GF_HAND_DOOM }, - {"GF_CAPTURE", GF_CAPTURE }, + {"GF_CAPTURE", GF_CAPTURE }, {"GF_ANIM_DEAD", GF_ANIM_DEAD }, - {"GF_CONTROL_LIVING", GF_CONTROL_LIVING }, - {"GF_IDENTIFY", GF_IDENTIFY }, - {"GF_ATTACK", GF_ATTACK }, - {"GF_ENGETSU", GF_ENGETSU }, - {"GF_GENOCIDE", GF_GENOCIDE }, - {"GF_PHOTO", GF_PHOTO }, - {"GF_CONTROL_DEMON", GF_CONTROL_DEMON }, - {"GF_LAVA_FLOW", GF_LAVA_FLOW }, - {"GF_BLOOD_CURSE", GF_BLOOD_CURSE }, - {"GF_SEEKER", GF_SEEKER }, - {"GF_SUPER_RAY", GF_SUPER_RAY }, - {"GF_STAR_HEAL", GF_STAR_HEAL }, - {"GF_WATER_FLOW", GF_WATER_FLOW }, - {"GF_CRUSADE", GF_CRUSADE }, + {"GF_CHARM_LIVING", GF_CHARM_LIVING }, + {"GF_IDENTIFY", GF_IDENTIFY }, + {"GF_ATTACK", GF_ATTACK }, + {"GF_ENGETSU", GF_ENGETSU }, + {"GF_GENOCIDE", GF_GENOCIDE }, + {"GF_PHOTO", GF_PHOTO }, + {"GF_CONTROL_DEMON", GF_CONTROL_DEMON }, + {"GF_LAVA_FLOW", GF_LAVA_FLOW }, + {"GF_BLOOD_CURSE", GF_BLOOD_CURSE }, + {"GF_SEEKER", GF_SEEKER }, + {"GF_SUPER_RAY", GF_SUPER_RAY }, + {"GF_STAR_HEAL", GF_STAR_HEAL }, + {"GF_WATER_FLOW", GF_WATER_FLOW }, + {"GF_CRUSADE", GF_CRUSADE }, {"GF_STASIS_EVIL", GF_STASIS_EVIL }, - {"GF_WOUNDS", GF_WOUNDS }, - {NULL, 0 } + {"GF_WOUNDS", GF_WOUNDS }, + {NULL, 0 } }; /*! - * @brief ÀßÄê¥Õ¥¡¥¤¥ë¤Î³Æ¹Ô¤«¤é³Æ¼ï¥Æ¥­¥¹¥È¾ðÊó¤ò¼èÆÀ¤¹¤ë / + * @brief 設定ファイルの各行から各種テキスト情報を取得する / * Parse a sub-file of the "extra info" (format shown below) - * @param buf ¥Ç¡¼¥¿¥Æ¥­¥¹¥È¤Î»²¾È¥Ý¥¤¥ó¥¿ - * @return ¥¨¥é¡¼¥³¡¼¥É + * @param buf データテキストの参照ポインタ + * @return エラーコード * @details *
  * Each "action" line has an "action symbol" in the first column,
@@ -361,41 +321,44 @@ static named_num gf_desc[] =
  * 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: