OSDN Git Service

[Refactor] #37353 CHECK_LOADのプリプロを削除 / Removed preprocessor CHECK_LOAD
authorHourier <hourier@users.sourceforge.jp>
Sun, 26 Jan 2020 13:06:39 +0000 (22:06 +0900)
committerHourier <hourier@users.sourceforge.jp>
Sun, 26 Jan 2020 13:06:39 +0000 (22:06 +0900)
src/files.c
src/files.h
src/h-config.h
src/main.c

index 50fb153..95ff9c5 100644 (file)
@@ -1254,134 +1254,6 @@ errr process_pref_file(player_type *creature_ptr, concptr name)
 }
 
 
-#ifdef CHECK_LOAD
-
-#ifndef MAXHOSTNAMELEN
-# define MAXHOSTNAMELEN  64
-#endif
-
-typedef struct statstime statstime;
-
-struct statstime
-{
-       int                 cp_time[4];
-       int                 dk_xfer[4];
-       unsigned int        v_pgpgin;
-       unsigned int        v_pgpgout;
-       unsigned int        v_pswpin;
-       unsigned int        v_pswpout;
-       unsigned int        v_intr;
-       int                 if_ipackets;
-       int                 if_ierrors;
-       int                 if_opackets;
-       int                 if_oerrors;
-       int                 if_collisions;
-       unsigned int        v_swtch;
-       long                avenrun[3];
-       struct timeval      boottime;
-       struct timeval      curtime;
-};
-
-/*
- * Maximal load (if any).
- */
-static int check_load_value = 0;
-
-#endif
-
-
-/*!
- * @brief Angbandプレイ禁止ホストのチェック /
- * Handle CHECK_LOAD
- * @return エラーコード
- */
-errr check_load(void)
-{
-
-#ifdef CHECK_LOAD
-
-       struct statstime    st;
-
-       /* Success if not checking */
-       if (!check_load_value) return 0;
-
-       /* Check the load */
-       if (0 == rstat("localhost", &st))
-       {
-               long val1 = (long)(st.avenrun[2]);
-               long val2 = (long)(check_load_value)* FSCALE;
-
-               /* Check for violation */
-               if (val1 >= val2) return 1;
-       }
-
-#endif
-
-       /* Success */
-       return 0;
-}
-
-
-/*!
- * @brief Angbandプレイ禁止ホストの設定初期化 /
- * Initialize CHECK_LOAD
- * @return エラーコード
- */
-errr check_load_init(void)
-{
-
-#ifdef CHECK_LOAD
-
-       FILE        *fp;
-
-       char    buf[1024];
-
-       char    temphost[MAXHOSTNAMELEN + 1];
-       char    thishost[MAXHOSTNAMELEN + 1];
-
-       path_build(buf, sizeof(buf), ANGBAND_DIR_FILE, "load.txt");
-
-       /* Open the "load" file */
-       fp = my_fopen(buf, "r");
-
-       /* No file, no restrictions */
-       if (!fp) return 0;
-
-       /* Default load */
-       check_load_value = 100;
-
-       /* Get the host name */
-       (void)gethostname(thishost, (sizeof thishost) - 1);
-
-       /* Parse it */
-       while (0 == my_fgets(fp, buf, sizeof(buf)))
-       {
-               int value;
-
-               /* Skip comments and blank lines */
-               if (!buf[0] || (buf[0] == '#')) continue;
-
-               /* Parse, or ignore */
-               if (sscanf(buf, "%s%d", temphost, &value) != 2) continue;
-
-               /* Skip other hosts */
-               if (!streq(temphost, thishost) &&
-                       !streq(temphost, "localhost")) continue;
-
-               /* Use that value */
-               check_load_value = value;
-
-               break;
-       }
-       my_fclose(fp);
-
-#endif
-
-       /* Success */
-       return 0;
-}
-
-
 #define ENTRY_BARE_HAND 0
 #define ENTRY_TWO_HANDS 1
 #define ENTRY_RIGHT_HAND1 2
index a0cb486..4dddc8a 100644 (file)
@@ -34,8 +34,6 @@ extern errr process_pref_file(player_type *creature_ptr, concptr name);
 extern errr process_autopick_file(player_type *creature_ptr, concptr name);
 extern errr process_histpref_file(player_type *creature_ptr, concptr name);
 extern void display_player_equippy(player_type *player_ptr, TERM_LEN y, TERM_LEN x, BIT_FLAGS16 mode);
-extern errr check_load_init(void);
-extern errr check_load(void);
 extern bool show_file(player_type *player_ptr, bool show_version, concptr name, concptr what, int line, BIT_FLAGS mode);
 extern void do_cmd_help(player_type *creature_ptr);
 extern void process_player_name(player_type *creature_ptr, bool sf);
index ceeccef..561d1bd 100644 (file)
 #define PRIVATE_USER_PATH "~/.angband"
 #endif /* SET_UID */
 
-
 /*
  * On multiuser systems, add the "uid" to savefile names
  */
 #endif
 
 /*
- * OPTION: Check the "load" against "lib/file/load.txt"
- * This may require the 'rpcsvs' library
- */
-/* #define CHECK_LOAD */
-
-
-/*
  * OPTION: Capitalize the "user_name" (for "default" player name)
  * This option is only relevant on SET_UID machines.
  */
 #define CAPITALIZE_USER_NAME
 
-
-
 /*
  * OPTION: Person to bother if something goes wrong.
  */
index adc7555..2c5c95b 100644 (file)
@@ -338,12 +338,6 @@ int main(int argc, char *argv[])
 
 #ifdef SET_UID
 
-       /* Initialize the "load" checker */
-       if (check_load_init() || check_load())
-       {
-               quit("The gates to Angband are closed (bad load).");
-       }
-
        /* Acquire the "user name" as a default player name */
        user_name(p_ptr->name, p_ptr->player_uid);