Changeset 136
- Timestamp:
- 05/14/07 03:31:20 (1 year ago)
- Files:
-
- trunk/src/autoconf.h.in (modified) (4 diffs)
- trunk/src/birth.c (modified) (5 diffs)
- trunk/src/cmd2.c (modified) (1 diff)
- trunk/src/cmd3.c (modified) (2 diffs)
- trunk/src/cmd5.c (modified) (4 diffs)
- trunk/src/cmds.h (modified) (1 diff)
- trunk/src/dungeon.c (modified) (3 diffs)
- trunk/src/externs.h (modified) (3 diffs)
- trunk/src/files.c (modified) (20 diffs)
- trunk/src/init1.c (modified) (5 diffs)
- trunk/src/init2.c (modified) (3 diffs)
- trunk/src/load.c (modified) (1 diff)
- trunk/src/maid-x11.c (modified) (1 diff)
- trunk/src/main-crb.c (modified) (3 diffs)
- trunk/src/main-ros.c (modified) (14 diffs)
- trunk/src/main-win.c (modified) (1 diff)
- trunk/src/main-x11.c (modified) (1 diff)
- trunk/src/main-xxx.c (modified) (1 diff)
- trunk/src/object1.c (modified) (16 diffs)
- trunk/src/randart.c (modified) (2 diffs)
- trunk/src/script.h (modified) (1 diff)
- trunk/src/squelch.c (modified) (1 diff)
- trunk/src/util.c (modified) (2 diffs)
- trunk/src/variable.c (modified) (1 diff)
- trunk/src/wizard1.c (modified) (11 diffs)
- trunk/src/wizard2.c (modified) (10 diffs)
- trunk/src/x-spell.c (modified) (3 diffs)
- trunk/src/xtra1.c (modified) (19 diffs)
- trunk/src/xtra2.c (modified) (3 diffs)
- trunk/src/z-file.c (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/src/autoconf.h.in
r127 r136 34 34 #undef HAVE_MKSTEMP 35 35 36 /* Define to 1 if you have the <SDL/SDL_ttf.h> header file. */ 37 #undef HAVE_SDL_SDL_TTF_H 38 36 39 /* Define to 1 if you have the `setegid' function. */ 37 40 #undef HAVE_SETEGID … … 43 46 /* Define to 1 if you have the <stdint.h> header file. */ 44 47 #undef HAVE_STDINT_H 45 46 /* Define to 1 if you have the <stdbool.h> header file. */47 #undef HAVE_STDBOOL_H48 48 49 49 /* Define to 1 if you have the <stdlib.h> header file. */ … … 82 82 /* Define to 1 if you have the <unistd.h> header file. */ 83 83 #undef HAVE_UNISTD_H 84 85 /* Define to 1 if you have the `usleep' function. */86 #undef HAVE_USLEEP87 84 88 85 /* Define to 1 if `lstat' dereferences a symlink specified with a trailing … … 153 150 first (like Motorola and SPARC, unlike Intel and VAX). */ 154 151 #undef WORDS_BIGENDIAN 155 156 /* Define for Solaris 2.5.1 so the uint32_t typedef from <sys/synch.h>,157 <pthread.h>, or <semaphore.h> is not used. If the typedef was allowed, the158 #define below would cause a syntax error. */159 #undef _UINT32_T160 161 /* Define to the type of a signed integer type of width exactly 16 bits if162 such a type exists and the standard includes do not define it. */163 #undef int16_t164 165 /* Define to the type of a signed integer type of width exactly 32 bits if166 such a type exists and the standard includes do not define it. */167 #undef int32_t168 169 /* Define to the type of an unsigned integer type of width exactly 16 bits if170 such a type exists and the standard includes do not define it. */171 #undef uint16_t172 173 /* Define to the type of an unsigned integer type of width exactly 32 bits if174 such a type exists and the standard includes do not define it. */175 #undef uint32_ttrunk/src/birth.c
r135 r136 775 775 else if (oid == 1) 776 776 str = "Autoroller"; 777 else if (oid == 2)777 else 778 778 str = "Standard roller"; 779 779 … … 1229 1229 1230 1230 /* Extract a textual format */ 1231 /* cnv_stat(m, inp ); */1231 /* cnv_stat(m, inp, sizeof(buf); */ 1232 1232 1233 1233 /* Above 18 */ … … 1262 1262 1263 1263 /* Default */ 1264 strcpy(inp, "");1264 inp[0] = '\0'; 1265 1265 1266 1266 /* Get a response (or escape) */ … … 1324 1324 1325 1325 /* Put the stat */ 1326 cnv_stat(stat_limit[i], buf );1326 cnv_stat(stat_limit[i], buf, sizeof(buf)); 1327 1327 c_put_str(TERM_L_BLUE, buf, 3+i, col+5); 1328 1328 } … … 1380 1380 { 1381 1381 /* Put the stat */ 1382 cnv_stat(stat_use[i], buf );1382 cnv_stat(stat_use[i], buf, sizeof(buf)); 1383 1383 c_put_str(TERM_L_GREEN, buf, 3+i, col+24); 1384 1384 trunk/src/cmd2.c
r119 r136 2275 2275 cptr p = "Rest (0-9999, '*' for HP/SP, '&' as needed): "; 2276 2276 2277 char out_val[5]; 2278 2279 /* Default */ 2280 strcpy(out_val, "&"); 2277 char out_val[5] = "& "; 2281 2278 2282 2279 /* Ask for duration */ trunk/src/cmd3.c
r117 r136 747 747 748 748 /* Start with nothing */ 749 strcpy(tmp, "");749 tmp[0] = '\0'; 750 750 751 751 /* Use old inscription */ … … 1424 1424 { 1425 1425 all = TRUE; 1426 strcpy(buf, "Full monster list.");1426 my_strcpy(buf, "Full monster list.", sizeof(buf)); 1427 1427 } 1428 1428 else if (sym == KTRL('U')) 1429 1429 { 1430 1430 all = uniq = TRUE; 1431 strcpy(buf, "Unique monster list.");1431 my_strcpy(buf, "Unique monster list.", sizeof(buf)); 1432 1432 } 1433 1433 else if (sym == KTRL('N')) 1434 1434 { 1435 1435 all = norm = TRUE; 1436 strcpy(buf, "Non-unique monster list.");1436 my_strcpy(buf, "Non-unique monster list.", sizeof(buf)); 1437 1437 } 1438 1438 else if (ident_info[i]) trunk/src/cmd5.c
r24 r136 123 123 const magic_type *s_ptr; 124 124 125 cptr comment; 126 125 char help[20]; 127 126 char out_val[160]; 127 128 const char *comment = help; 128 129 129 130 byte line_attr; … … 152 153 153 154 /* Get extra info */ 154 comment = get_spell_info(cp_ptr->spell_book, spell);155 get_spell_info(cp_ptr->spell_book, spell, help, sizeof(help)); 155 156 156 157 /* Assume spell is known and tried */ … … 479 480 const magic_type *s_ptr; 480 481 481 cptr comment;482 483 482 char out_val[160]; 483 char help[20]; 484 485 const char *comment = help; 484 486 485 487 byte line_attr; … … 496 498 497 499 /* Get extra info */ 498 comment = get_spell_info(cp_ptr->spell_book, spell);500 get_spell_info(cp_ptr->spell_book, spell, help, sizeof(help)); 499 501 500 502 /* Assume spell is known and tried */ trunk/src/cmds.h
r134 r136 4 4 /* cmd.c */ 5 5 extern void cmd_init(void); 6 extern void process_command s(bool no_request);6 extern void process_command(bool no_request); 7 7 8 8 /* cmd2.c */ trunk/src/dungeon.c
r135 r136 12 12 #include "angband.h" 13 13 #include "z-file.h" 14 14 #include "cmds.h" 15 15 #include "script.h" 16 16 … … 1887 1887 if (!op_ptr->base_name[0]) 1888 1888 { 1889 strcpy(op_ptr->base_name, "PLAYER");1889 my_strcpy(op_ptr->base_name, "PLAYER", sizeof(op_ptr->base_name)); 1890 1890 } 1891 1891 … … 2136 2136 2137 2137 /* Note cause of death XXX XXX XXX */ 2138 strcpy(p_ptr->died_from, "Cheating death");2138 my_strcpy(p_ptr->died_from, "Cheating death", sizeof(p_ptr->died_from)); 2139 2139 2140 2140 /* New depth */ trunk/src/externs.h
r135 r136 235 235 extern cptr ANGBAND_DIR_USER; 236 236 extern cptr ANGBAND_DIR_XTRA; 237 extern cptr ANGBAND_DIR_SCRIPT;238 237 extern bool item_tester_full; 239 238 extern byte item_tester_tval; … … 345 344 346 345 /* init2.c */ 347 extern void init_file_paths(c har *path);346 extern void init_file_paths(const char *path); 348 347 extern void create_user_dirs(void); 349 348 extern void init_angband(void); … … 673 672 674 673 /* xtra1.c */ 675 extern void cnv_stat(int val, char *out_val );674 extern void cnv_stat(int val, char *out_val, size_t len); 676 675 extern s16b modify_stat_value(int value, int amount); 677 676 extern void notice_stuff(void); trunk/src/files.c
r120 r136 1362 1362 1363 1363 /* Internal "natural" maximum value */ 1364 cnv_stat(p_ptr->stat_max[i], buf );1364 cnv_stat(p_ptr->stat_max[i], buf, sizeof(buf)); 1365 1365 c_put_str(TERM_L_GREEN, buf, row+i, col+5); 1366 1366 … … 1378 1378 1379 1379 /* Resulting "modified" maximum value */ 1380 cnv_stat(p_ptr->stat_top[i], buf );1380 cnv_stat(p_ptr->stat_top[i], buf, sizeof(buf)); 1381 1381 c_put_str(TERM_L_GREEN, buf, row+i, col+24); 1382 1382 … … 1384 1384 if (p_ptr->stat_use[i] < p_ptr->stat_top[i]) 1385 1385 { 1386 cnv_stat(p_ptr->stat_use[i], buf );1386 cnv_stat(p_ptr->stat_use[i], buf, sizeof(buf)); 1387 1387 c_put_str(TERM_YELLOW, buf, row+i, col+31); 1388 1388 } … … 2089 2089 2090 2090 /* Hold a string to find */ 2091 char finder[80] ;2091 char finder[80] = ""; 2092 2092 2093 2093 /* Hold a string to show */ 2094 char shower[80] ;2094 char shower[80] = ""; 2095 2095 2096 2096 /* Filename */ … … 2098 2098 2099 2099 /* Describe this thing */ 2100 char caption[128] ;2100 char caption[128] = ""; 2101 2101 2102 2102 /* Path buffer */ … … 2115 2115 2116 2116 2117 /* Wipe finder */2118 strcpy(finder, "");2119 2120 /* Wipe shower */2121 strcpy(shower, "");2122 2123 /* Wipe caption */2124 strcpy(caption, "");2125 2117 2126 2118 /* Wipe the hooks */ … … 2433 2425 if (ch == '#') 2434 2426 { 2435 char tmp[80]; 2427 char tmp[80] = "0"; 2428 2436 2429 prt("Goto Line: ", hgt - 1, 0); 2437 strcpy(tmp, "0");2438 2430 if (askfor_aux(tmp, sizeof(tmp), NULL)) 2439 {2440 2431 line = atoi(tmp); 2441 }2442 2432 } 2443 2433 … … 2445 2435 if (ch == '%') 2446 2436 { 2447 char ftmp[80]; 2437 char ftmp[80] = "help.hlp"; 2438 2448 2439 prt("Goto File: ", hgt - 1, 0); 2449 strcpy(ftmp, "help.hlp");2450 2440 if (askfor_aux(ftmp, sizeof(ftmp), NULL)) 2451 2441 { 2452 if (!show_file(ftmp, NULL, 0, mode)) ch = ESCAPE; 2442 if (!show_file(ftmp, NULL, 0, mode)) 2443 ch = ESCAPE; 2453 2444 } 2454 2445 } … … 2591 2582 if (!op_ptr->base_name[0]) 2592 2583 { 2593 strcpy(op_ptr->base_name, "PLAYER");2584 my_strcpy(op_ptr->base_name, "PLAYER", sizeof(op_ptr->base_name)); 2594 2585 } 2595 2586 … … 2655 2646 2656 2647 /* Cause of death */ 2657 strcpy(p_ptr->died_from, "Quitting");2648 my_strcpy(p_ptr->died_from, "Quitting", sizeof(p_ptr->died_from)); 2658 2649 } 2659 2650 … … 2681 2672 2682 2673 /* The player is not dead */ 2683 strcpy(p_ptr->died_from, "(saved)");2674 my_strcpy(p_ptr->died_from, "(saved)", sizeof(p_ptr->died_from)); 2684 2675 2685 2676 /* Forbid suspend */ … … 2705 2696 2706 2697 /* Note that the player is not dead */ 2707 strcpy(p_ptr->died_from, "(alive and well)");2698 my_strcpy(p_ptr->died_from, "(alive and well)", sizeof(p_ptr->died_from)); 2708 2699 } 2709 2700 … … 2753 2744 FILE *fp; 2754 2745 2755 char str[1024];2746 char str[1024]; 2756 2747 2757 2748 … … 2765 2756 2766 2757 /* XXX XXX XXX "Bones" name */ 2767 s printf(tmp, "bone.%03d", p_ptr->depth);2758 strnfmt(tmp, sizeof(tmp), "bone.%03d", p_ptr->depth); 2768 2759 2769 2760 /* Build the filename */ … … 3627 3618 3628 3619 /* Calculate and save the points */ 3629 s printf(the_score.pts, "%9lu", (long)total_points());3620 strnfmt(the_score.pts, sizeof(the_score.pts), "%9lu", (long)total_points()); 3630 3621 3631 3622 /* Save the current gold */ 3632 s printf(the_score.gold, "%9lu", (long)p_ptr->au);3623 strnfmt(the_score.gold, sizeof(the_score.gold), "%9lu", (long)p_ptr->au); 3633 3624 3634 3625 /* Save the current turn */ 3635 s printf(the_score.turns, "%9lu", (long)turn);3626 strnfmt(the_score.turns, sizeof(the_score.turns), "%9lu", (long)turn); 3636 3627 3637 3628 /* Hack -- no time needed */ 3638 strcpy(the_score.day, "TODAY");3629 my_strcpy(the_score.day, "TODAY", sizeof(the_score.day)); 3639 3630 3640 3631 /* Save the player name (15 chars) */ 3641 s printf(the_score.who, "%-.15s", op_ptr->full_name);3632 strnfmt(the_score.who, sizeof(the_score.who), "%-.15s", op_ptr->full_name); 3642 3633 3643 3634 /* Save the player info XXX XXX XXX */ 3644 s printf(the_score.uid, "%7u", player_uid);3645 s printf(the_score.sex, "%c", (p_ptr->psex ? 'm' : 'f'));3646 s printf(the_score.p_r, "%2d", p_ptr->prace);3647 s printf(the_score.p_c, "%2d", p_ptr->pclass);3635 strnfmt(the_score.uid, sizeof(the_score.uid), "%7u", player_uid); 3636 strnfmt(the_score.sex, sizeof(the_score.sex), "%c", (p_ptr->psex ? 'm' : 'f')); 3637 strnfmt(the_score.p_r, sizeof(the_score.p_r), "%2d", p_ptr->prace); 3638 strnfmt(the_score.p_c, sizeof(the_score.p_c), "%2d", p_ptr->pclass); 3648 3639 3649 3640 /* Save the level and such */ 3650 s printf(the_score.cur_lev, "%3d", p_ptr->lev);3651 s printf(the_score.cur_dun, "%3d", p_ptr->depth);3652 s printf(the_score.max_lev, "%3d", p_ptr->max_lev);3653 s printf(the_score.max_dun, "%3d", p_ptr->max_depth);3654 3655 /* Hack -- no cause of death */3656 strcpy(the_score.how, "nobody (yet!)");3641 strnfmt(the_score.cur_lev, sizeof(the_score.cur_lev), "%3d", p_ptr->lev); 3642 strnfmt(the_score.cur_dun, sizeof(the_score.cur_dun), "%3d", p_ptr->depth); 3643 strnfmt(the_score.max_lev, sizeof(the_score.max_lev), "%3d", p_ptr->max_lev); 3644 strnfmt(the_score.max_dun, sizeof(the_score.max_dun), "%3d", p_ptr->max_depth); 3645 3646 /* No cause of death */ 3647 my_strcpy(the_score.how, "nobody (yet!)", sizeof(the_score.how)); 3657 3648 3658 3649 … … 3736 3727 3737 3728 /* Fake death */ 3738 strcpy(p_ptr->died_from, "Ripe Old Age");3729 my_strcpy(p_ptr->died_from, "Ripe Old Age", sizeof(p_ptr->died_from)); 3739 3730 3740 3731 /* Restore the experience */ … … 4067 4058 4068 4059 /* Indicate panic save */ 4069 strcpy(p_ptr->died_from, "(panic save)");4060 my_strcpy(p_ptr->died_from, "(panic save)", sizeof(p_ptr->died_from)); 4070 4061 4071 4062 /* Panic save, or get worried */ … … 4177 4168 { 4178 4169 /* Mark the savefile */ 4179 strcpy(p_ptr->died_from, "Abortion");4170 my_strcpy(p_ptr->died_from, "Abortion", sizeof(p_ptr->died_from)); 4180 4171 4181 4172 /* HACK - Skip the tombscreen if it is already displayed */ … … 4194 4185 { 4195 4186 /* Cause of "death" */ 4196 strcpy(p_ptr->died_from, "Interrupting");4187 my_strcpy(p_ptr->died_from, "Interrupting", sizeof(p_ptr->died_from)); 4197 4188 4198 4189 /* Commit suicide */ … … 4273 4264 4274 4265 /* Panic save */ 4275 strcpy(p_ptr->died_from, "(panic save)");4266 my_strcpy(p_ptr->died_from, "(panic save)", sizeof(p_ptr->died_from)); 4276 4267 4277 4268 /* Forbid suspend */ trunk/src/init1.c
r110 r136 664 664 static bool add_text(u32b *offset, header *head, cptr buf) 665 665 { 666 size_t len = strlen(buf); 667 666 668 /* Hack -- Verify space */ 667 if (head->text_size + strlen(buf)+ 8 > z_info->fake_text_size)669 if (head->text_size + len + 8 > z_info->fake_text_size) 668 670 return (FALSE); 669 671 … … 672 674 { 673 675 /* Advance and save the text index */ 674 *offset = ++head->text_size; 676 *offset = ++head->text_size; 675 677 } 676 678 677 679 /* Append chars to the text */ 678 strcpy(head->text_ptr + head->text_size, buf);680 my_strcpy(head->text_ptr + head->text_size, buf, len + 1); 679 681 680 682 /* Advance the index */ 681 head->text_size += strlen(buf);683 head->text_size += len; 682 684 683 685 /* Success */ … … 695 697 { 696 698 u32b index; 699 size_t len = strlen(buf); 697 700 698 701 /* Hack -- Verify space */ 699 if (head->name_size + strlen(buf)+ 8 > z_info->fake_name_size)702 if (head->name_size + len + 8 > z_info->fake_name_size) 700 703 return (0); 701 704 … … 704 707 705 708 /* Append chars to the names */ 706 strcpy(head->name_ptr + head->name_size, buf);709 my_strcpy(head->name_ptr + head->name_size, buf, len + 1); 707 710 708 711 /* Advance the index */ 709 head->name_size += strlen(buf);712 head->name_size += len; 710 713 711 714 /* Return the name index */ … … 2267 2270 2268 2271 /* Mega-Hack -- acquire "ghost" */ 2269 r_ptr = &r_info[z_info->r_max-1]; 2270 2271 /* Get the next index */ 2272 r_ptr->name = head->name_size; 2273 r_ptr->text = head->text_size; 2274 2275 /* Save some space for the ghost info */ 2276 head->name_size += 64; 2277 head->text_size += 64; 2272 r_ptr = &r_info[z_info->r_max - 1]; 2278 2273 2279 2274 /* Hack -- Default name/text for the ghost */ 2280 strcpy(r_name + r_ptr->name, "Nobody, the Undefined Ghost");2281 strcpy(r_text + r_ptr->text, "It seems strangely familiar...");2275 r_ptr->name = add_name(head, "Nobody, the Undefined Ghost"); 2276 add_text(&r_ptr->text, head, "It seems strangely familiar..."); 2282 2277 2283 2278 /* Hack -- set the attr/char info */ trunk/src/init2.c
r134 r136 70 70 * try several base "path" values until a good one is found. 71 71 */ 72 void init_file_paths(char *path) 73 { 74 char *tail; 75 72 void init_file_paths(const char *path) 73 { 76 74 #ifdef PRIVATE_USER_PATH 77 75 char buf[1024]; … … 96 94 string_free(ANGBAND_DIR_USER); 97 95 string_free(ANGBAND_DIR_XTRA); 98 string_free(ANGBAND_DIR_SCRIPT); 99 100 101 /*** Prepare the "path" ***/ 102 103 /* Hack -- save the main directory */ 96 97 98 /*** Prepare the paths ***/ 99 100 /* Save the main directory */ 104 101 ANGBAND_DIR = string_make(path); 105 102 106 /* Prepare to append to the Base Path */ 107 tail = path + strlen(path); 108 109 110 /*** Build the sub-directory names ***/ 111 112 /* Build a path name */ 113 strcpy(tail, "edit"); 114 ANGBAND_DIR_EDIT = string_make(path); 115 116 /* Build a path name */ 117 strcpy(tail, "file"); 118 ANGBAND_DIR_FILE = string_make(path); 119 120 /* Build a path name */ 121 strcpy(tail, "help"); 122 ANGBAND_DIR_HELP = string_make(path); 123 124 /* Build a path name */ 125 strcpy(tail, "info"); 126 ANGBAND_DIR_INFO = string_make(path); 127 128 /* Build a path name */ 129 strcpy(tail, "pref"); 130 ANGBAND_DIR_PREF = string_make(path); 103 /* Build path names */ 104 ANGBAND_DIR_EDIT = string_make(format("%sedit", path)); 105 ANGBAND_DIR_FILE = string_make(format("%sfile", path)); 106 ANGBAND_DIR_HELP = string_make(format("%shelp", path)); 107 ANGBAND_DIR_INFO = string_make(format("%sinfo", path)); 108 ANGBAND_DIR_PREF = string_make(format("%spref", path)); 109 ANGBAND_DIR_XTRA = string_make(format("%sxtra", path)); 110 131 111 132 112 #ifdef PRIVATE_USER_PATH 133 113 134 /* Get an absolute path from the filename */114 /* Get an absolute path from the filename, */ 135 115 path_parse(dirpath, sizeof(dirpath), PRIVATE_USER_PATH); 116 136 117 /* Build the path to the user specific directory */ 137 118 path_build(buf, sizeof(buf), dirpath, VERSION_NAME); 138 139 /* Build a relative path name */140 119 ANGBAND_DIR_USER = string_make(buf); 141 120 142 #else /* PRIVATE_USER_PATH */143 144 /* Build a path name */145 strcpy(tail, "user");146 ANGBAND_DIR_USER = string_make(path);147 148 #endif /* PRIVATE_USER_PATH */149 150 #ifdef USE_PRIVATE_PATHS151 121 152 122 /* Build the path to the user specific sub-directory */ 153 123 path_build(buf, sizeof(buf), ANGBAND_DIR_USER, "scores"); 154 155 /* Build a relative path name */156 124 ANGBAND_DIR_APEX = string_make(buf); 157 125 158 126 /* Build the path to the user specific sub-directory */ 159 127 path_build(buf, sizeof(buf), ANGBAND_DIR_USER, "bone"); 160 161 /* Build a relative path name */162 128 ANGBAND_DIR_BONE = string_make(buf); 163 129 164 130 /* Build the path to the user specific sub-directory */ 165 131 path_build(buf, sizeof(buf), ANGBAND_DIR_USER, "data"); 166 167 /* Build a relative path name */168 132 ANGBAND_DIR_DATA = string_make(buf); 169 133 170 134 /* Build the path to the user specific sub-directory */ 171 135 path_build(buf, sizeof(buf), ANGBAND_DIR_USER, "save"); 172 173 /* Build a relative path name */174 136 ANGBAND_DIR_SAVE = string_make(buf); 175 137 176 138 #else /* USE_PRIVATE_PATHS */ 177 139 178 /* Build a path name */ 179 strcpy(tail, "apex"); 180 ANGBAND_DIR_APEX = string_make(path); 181 182 /* Build a path name */ 183 strcpy(tail, "bone"); 184 ANGBAND_DIR_BONE = string_make(path); 185 186 /* Build a path name */ 187 strcpy(tail, "data"); 188 ANGBAND_DIR_DATA = string_make(path); 189 190 /* Build a path name */ 191 strcpy(tail, "save"); 192 ANGBAND_DIR_SAVE = string_make(path); 140 /* Build pathnames */ 141 ANGBAND_DIR_USER = string_make(format("%suser", path)); 142 ANGBAND_DIR_APEX = string_make(format("%sapex", path)); 143 ANGBAND_DIR_BONE = string_make(format("%sbone", path)); 144 ANGBAND_DIR_DATA = string_make(format("%sdata", path)); 145 ANGBAND_DIR_SAVE = string_make(format("%ssave", path)); 193 146 194 147 #endif /* USE_PRIVATE_PATHS */ 195 196 /* Build a path name */197 strcpy(tail, "xtra");198 ANGBAND_DIR_XTRA = string_make(path);199 200 /* Build a path name */201 strcpy(tail, "script");202 ANGBAND_DIR_SCRIPT = string_make(path);203 148 } 204 149 … … 1967 1912 string_free(ANGBAND_DIR_USER); 1968 1913 string_free(ANGBAND_DIR_XTRA); 1969 string_free(ANGBAND_DIR_SCRIPT); 1970 } 1914 } trunk/src/load.c
r135 r136 2315 2315 { 2316 2316 /* Reset cause of death */ 2317 strcpy(p_ptr->died_from, "(alive and well)");2317 my_strcpy(p_ptr->died_from, "(alive and well)", sizeof(p_ptr->died_from)); 2318 2318 } 2319 2319 trunk/src/maid-x11.c
r1 r136 104 104 105 105 /* Window specific font name */ 106 s printf(buf, "ANGBAND_X11_FONT_%d", term_num);106 strnfmt(buf, sizeof(buf), "ANGBAND_X11_FONT_%d", term_num); 107 107 108 108 /* Check environment for that font */ trunk/src/main-crb.c
r107 r136 807 807 td->font_wid = (info->font_wid +.999); 808 808 td->font_hgt = info->ascent + info->descent; 809 strncpy(td->font_name, info->psname, sizeof(td->font_name));809 my_strcpy(td->font_name, info->psname, sizeof(td->font_name)); 810 810 811 811 /* Set default tile size */ … … 2327 2327 if(fid) td->font_id = fid; 2328 2328 /* Use the default */ 2329 else strncpy(td->font_name, "Monaco", sizeof(td->font_name));2329 else my_strcpy(td->font_name, "Monaco", sizeof(td->font_name)); 2330 2330 } 2331 2331 } … … 2357 2357 /* Default font */ 2358 2358 td->font_id = fid; 2359 strncpy(td->font_name, "Monaco", sizeof(td->font_name));2359 my_strcpy(td->font_name, "Monaco", sizeof(td->font_name)); 2360 2360 2361 2361 /* Default font size - was 12 */ trunk/src/main-ros.c
r109 r136 877 877 va_list ap; 878 878 char buffer[260]; 879 879 880 va_start(ap, fmt); 880 vs printf(buffer, fmt, ap);881 vstrnfmt(buffer, sizeof(buffer), fmt, ap); 881 882 va_end(ap); 883 882 884 plog(buffer); 883 885 } … … 960 962 char buffer[2048]; 961 963 va_start(ap, fmt); 962 vs printf(buffer, fmt, ap);964 vstrnfmt(buffer, sizeof(buffer), fmt, ap); 963 965 va_end(ap); 964 966 … … 994 996 { 995 997 char tmp[512]; 996 strcpy(tmp, scrap_path);998 my_strcpy(tmp, scrap_path, sizeof(tmp)); 997 999 tmp[strlen(tmp) - 1] = 0; /* Remove trailing dot */ 998 1000 … … 1214 1216 { 1215 1217 char new_[260]; 1216 strcpy(new_, riscosify_name(new));1218 my_strcpy(new_, riscosify_name(new), sizeof(new_)); 1217 1219 return rename(riscosify_name(old), new_) ? 1 : 0; 1218 1220 } … … 1660 1662 font_path = getenv(path); 1661 1663 if (!font_path || !*font_path) 1662 strcpy(path, "null:$.");1664 my_strcpy(path, "null:$.", sizeof(path)); 1663 1665 else 1664 1666 { 1665 strcpy(path, font_path);1667 my_strcpy(path, font_path, sizeof(path)); 1666 1668 for (t = path; *t > ' '; t++) 1667 1669 ; … … 2154 2156 2155 2157 /* Preserve the old path, in case something goes wrong... */ 2156 strcpy(old_savefile, savefile);2158 my_strcpy(old_savefile, savefile, sizeof(old_savefile)); 2157 2159 2158 2160 /* Set the new path */ 2159 strcpy(savefile, unixify_name(filename));2161 my_strcpy(savefile, unixify_name(filename), sizeof(savefile)); 2160 2162 2161 2163 /* Try a save (if sensible) */ … … 2167 2169 { 2168 2170 Msgs_Report(0, "err.save", filename); 2169 strcpy(savefile, old_savefile);2171 my_strcpy(savefile, old_savefile, sizeof(savefile)); 2170 2172 return FALSE; /* => failure */ 2171 2173 } … … 2174 2176 { 2175 2177 Msgs_Report(0, "err.nosave"); 2176 strcpy(savefile, old_savefile);2178 my_strcpy(savefile, old_savefile, sizeof(savefile)); 2177 2179 return TRUE; /* Failed really, but not unexpectedly */ 2178 2180 } … … 2769 2771 } 2770 2772 2771 strcpy(buffer, t);2773 my_strcpy(buffer, t, sizeof(buffer)); 2772 2774 2773 2775 /* … … 2850 2852 2851 2853 /* Fudge so that the fontpath can be a path, not just a dir. */ 2852 strcpy(menu_buffer, t);2854 my_strcpy(menu_buffer, t, sizeof(menu_buffer)); 2853 2855 for (t = menu_buffer; *t > ' '; t++) 2854 2856 ; … … 3083 3085 menu_item *mi = (menu_item *) (fm + 1); 3084 3086 3085 strcpy(buffer, prefix); 3087 my_strcpy(buffer, prefix, sizeof(buffer)); 3088 3086 3089 pl = strlen(buffer); 3087 3090 b_leaf = buffer + pl; … … 3101 3104 { 3102 3105 /* Yes - must be a partial match (with a dot on :) */ 3103 strcat(b_leaf, ".");3106 my_strcat(b_leaf, ".", sizeof(buffer) - pl); 3104 3107 mi->menuflags.data.ticked = 3105 3108 !strncmp(buffer, fn, pl + strlen(b_leaf)); … … 7158 7161 7159 7162 va_start(ap, fmt); 7160 vs printf(buffer, fmt, ap);7163 vstrnfmt(buffer, sizeof(buffer), fmt, ap); 7161 7164 Term_putstr(x, y, -1, c, buffer); 7162 7165 va_end(ap); … … 8631 8634 8632 8635 va_start(ap, fmt); 8633 vs printf(buffer, fmt, ap);8636 vstrnfmt(buffer, sizeof(buffer), fmt, ap); 8634 8637 va_end(ap); 8635 8638 trunk/src/main-win.c
r115 r136 3148 3148 3149 3149 /* Extract filename */ 3150 *savefile = '\0'; 3151 strncat(savefile, s, sizeof(savefile) - 1); 3150 my_strcpy(savefile, s, sizeof(savefile)); 3152 3151 3153 3152 /* Validate the file */ trunk/src/main-x11.c
r82 r136 2811 2811 ch->res_name = res_name; 2812 2812 2813 strcpy(res_class, "Angband");2813 my_strcpy(res_class, "Angband", sizeof(res_class)); 2814 2814 ch->res_class = res_class; 2815 2815 trunk/src/main-xxx.c
r82 r136 722 722 /* so that it points at the "lib" directory. Every */ 723 723 /* machine handles this in a different way... */ 724 strcpy(path, "XXX XXX XXX");724 my_strcpy(path, "XXX XXX XXX", sizeof(path)); 725 725 726 726 /* Prepare the filepaths */ trunk/src/object1.c
r123 r136 1952 1952 byte attr; 1953 1953 1954 char tmp_val[ 80];1954 char tmp_val[10]; 1955 1955 1956 1956 char o_name[80]; … … 2010 2010 { 2011 2011 int wgt = o_ptr->weight * o_ptr->number;
