Changeset 407
- Timestamp:
- 08/12/06 16:52:53 (2 years ago)
- Files:
-
- 1.7.7/CHANGES (modified) (1 diff)
- 1.7.7/Makefile.SH (modified) (3 diffs)
- 1.7.7/Patchlevel (modified) (1 diff)
- 1.7.7/game/mushcnf.dst (modified) (2 diffs)
- 1.7.7/game/txt/hlp/penncmd.hlp (modified) (3 diffs)
- 1.7.7/game/txt/hlp/pennfunc.hlp (modified) (1 diff)
- 1.7.7/game/txt/hlp/penntop.hlp (modified) (1 diff)
- 1.7.7/game/txt/hlp/pennvers.hlp (modified) (4 diffs)
- 1.7.7/hdrs/conf.h (modified) (2 diffs)
- 1.7.7/hdrs/externs.h (modified) (1 diff)
- 1.7.7/hdrs/function.h (modified) (3 diffs)
- 1.7.7/hdrs/game.h (modified) (1 diff)
- 1.7.7/hdrs/lock.h (modified) (5 diffs)
- 1.7.7/hdrs/version.h (modified) (1 diff)
- 1.7.7/src/Makefile (modified) (1 diff)
- 1.7.7/src/bsd.c (modified) (2 diffs)
- 1.7.7/src/conf.c (modified) (2 diffs)
- 1.7.7/src/db.c (modified) (2 diffs)
- 1.7.7/src/extmail.c (modified) (2 diffs)
- 1.7.7/src/flags.c (modified) (6 diffs)
- 1.7.7/src/function.c (modified) (12 diffs)
- 1.7.7/src/game.c (modified) (4 diffs)
- 1.7.7/src/lock.c (modified) (1 diff)
- 1.7.7/src/log.c (modified) (1 diff)
- 1.7.7/src/look.c (modified) (1 diff)
- 1.7.7/src/match.c (modified) (18 diffs)
- 1.7.7/src/move.c (modified) (36 diffs)
- 1.7.7/src/player.c (modified) (1 diff)
- 1.7.7/src/rob.c (modified) (2 diffs)
- 1.7.7/src/set.c (modified) (1 diff)
- 1.7.7/src/unparse.c (modified) (2 diffs)
- 1.7.7/src/wild.c (modified) (3 diffs)
- 1.7.7/src/wiz.c (modified) (2 diffs)
- 1.7.7/utils/mkcmds.sh.SH (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
1.7.7/CHANGES
r405 r407 18 18 19 19 ========================================================================== 20 21 Version 1.7.7 patchlevel 4 January 2, 2003 22 23 Minor Changes: 24 * When room_connects is on, @aconnect and @adisconnect also 25 functions on things when players (dis)connect inside them. 26 Suggested by Philip Mak. [SW] 27 * Parser-enforced argument counts for user-defined @functions, 28 as an option to @function. 29 Config: 30 * New mush.cnf option max_global_fns allows increasing the number 31 of @functions allowed without editing source code. If you change 32 this, you should reboot the MUSH or bad things can happen. 33 Suggested by hilikiradi@Dardalani. 34 Fixes: 35 * mkcmds.sh doesn't always regenerate every file, only what's 36 needed. Speeds up compiles. Suggested by Philip Mak. [SW] 37 * Fixes from 1.7.6p4. 38 20 39 21 40 Version 1.7.7 patchlevel 3 December 25, 2002 1.7.7/Makefile.SH
r357 r407 61 61 (cd src; make all "CC=$(CC)" "CCFLAGS=$(CCFLAGS)" \ 62 62 "LDFLAGS=$(LDFLAGS)" "CLIBS=$(CLIBS)" "MAKE=$(MAKE)" \ 63 "MAKEFLAGS=$(MAKEFLAGS)" ; rm -f ../hdrs/timestamp)63 "MAKEFLAGS=$(MAKEFLAGS)") 64 64 @echo "If the make was successful, use 'make install' to install links." 65 65 … … 75 75 76 76 hdrs/cmds.h: src/cmds.c src/command.c src/cque.c src/help.c src/set.c 77 (cd utils; sh mkcmds.sh )77 (cd utils; sh mkcmds.sh commands) 78 78 79 79 hdrs/switches.h: src/SWITCHES 80 (cd utils; sh mkcmds.sh )81 82 src/switchinc.c: src/SWITCHES 83 (cd utils; sh mkcmds.sh)84 85 hdrs/funs.h: src/fun*.c 86 (cd utils; sh mkcmds.sh )80 (cd utils; sh mkcmds.sh switches) 81 82 #src/switchinc.c: hdrs/switches.h 83 # (cd utils; sh mkcmds.sh switches) 84 85 hdrs/funs.h: src/fun*.c src/bsd.c src/conf.c src/extmail.c src/help.c src/wiz.c 86 (cd utils; sh mkcmds.sh functions) 87 87 88 88 hdrs/patches.h: patches/* 89 (cd utils; sh mkcmds.sh )89 (cd utils; sh mkcmds.sh patches) 90 90 91 91 install: localized all … … 223 223 224 224 dist.tar: distclean versions 225 -rm -f hdrs/timestamp226 225 (cd utils; sh mkcmds.sh) 227 226 makedist -c pennmush 1.7.7/Patchlevel
r405 r407 1 1 Do not edit this file. It is maintained by the official PennMUSH patches. 2 This is PennMUSH 1.7.7p 32 This is PennMUSH 1.7.7p4 1.7.7/game/mushcnf.dst
r403 r407 189 189 # What's the max chain length of indirect locks allowed? 190 190 max_depth 10 191 192 # How many @functions can we have? If you change this without # doing a 193 # shutdown (or shutdown/reboot) immediately thereafter, you'll very likely 194 # crash your MUSH, so don't do that. 195 max_global_fns 50 191 196 192 197 # How much does it cost a mortal to create a channel? … … 410 415 global_connects yes 411 416 412 # trigger @aconnect/@adisconnect in the room? 417 # trigger @aconnect/@adisconnect in a connecting player's location 418 # if the location is a room or thing? 413 419 room_connects no 414 420 1.7.7/game/txt/hlp/penncmd.hlp
r405 r407 1255 1255 & @function 1256 1256 @function [<function name>] 1257 @function <function name>=<object>,<attribute> 1257 @function <function name>=<object>,<attribute>[,<min args>, <max args>] 1258 1258 or @function <function name>=<object>/<attribute> 1259 1259 @function/<switch> <function name> … … 1286 1286 Functions defined via @function should follow the format used by 1287 1287 UFUN() - %0 is the first argument passed, %1 is the second argument 1288 passed, and so forth. 1288 passed, and so forth. Option third and fourth arguments to @function 1289 can be used to set a parser-enforced number of arguments for the function. 1289 1290 1290 1291 Example: … … 1325 1326 @function/delete ansi 1326 1327 &ansi_fun #1234=%0 1327 @function ansi=#1234, ansi_fun 1328 @function ansi=#1234, ansi_fun, 2, 2 1328 1329 1329 1330 will create a new version of ansi() that doesn't do any 1330 colorization. 1331 colorization, and that requires it to be called with exactly 1332 2 arguments, like the built-in version. 1331 1333 1332 1334 See also: RESTRICT, FUNCTIONS, @startup 1.7.7/game/txt/hlp/pennfunc.hlp
r403 r407 1825 1825 F - Return #-1 if what's found is of a different type than the 1826 1826 preferred one. 1827 X - Never return #-2. Use the last dbref found if the match is 1827 X - Never return #-2. Use the last dbref found if the match is 1828 1828 ambiguous. 1829 1829 If you specify more than one type, the last one will be preferred. Unless 1.7.7/game/txt/hlp/penntop.hlp
r403 r407 1783 1783 * my <obj> - an object you're carrying 1784 1784 * this <obj> - an object in your location (also: this here <obj>) 1785 * toward <exit> - an exit in your location 1785 1786 * 1st, 2nd, etc. <obj> - one of a set of objects with the same names. 1786 1787 Objects are ordered in the order in which they're listed in your 1787 inventory or room contents.1788 You may combine some adjectives (my 1st box, this here 2nd box .1788 inventory, room contents, and exit list (in that order). 1789 You may combine some adjectives (my 1st box, this here 2nd box). 1789 1790 & &HELP 1790 1791 This is the AHELP index. 1.7.7/game/txt/hlp/pennvers.hlp
r405 r407 1 1 & changes 2 & 1.7.7p 32 & 1.7.7p4 3 3 This is a list of changes in this patchlevel which are probably of 4 4 interest to players. More information about new commands and functions … … 12 12 be read in 'help patchlevels'. 13 13 14 Version 1.7.7 patchlevel 4 January 2, 2003 15 16 Minor Changes: 17 * When room_connects is on, @aconnect and @adisconnect also 18 functions on things when players (dis)connect inside them. 19 Suggested by Philip Mak. [SW] 20 * Parser-enforced argument counts for user-defined @functions, 21 as an option to @function. 22 Config: 23 * New mush.cnf option max_global_fns allows increasing the number 24 of @functions allowed without editing source code. If you change 25 this, you should reboot the MUSH or bad things can happen. 26 Suggested by hilikiradi@Dardalani. 27 Fixes: 28 * mkcmds.sh doesn't always regenerate every file, only what's 29 needed. Speeds up compiles. Suggested by Philip Mak. [SW] 30 * Fixes from 1.7.6p4. 31 32 33 & 1.7.7p3 14 34 Version 1.7.7 patchlevel 3 December 25, 2002 15 35 … … 581 601 * Indentation fixes [SW] 582 602 * Fixes up to 1.7.4p12 merged in. 603 604 & 1.7.6p4 605 Version 1.7.6 patchlevel 4 January 2, 2003 606 607 Minor Changes: 608 * English-style matching now applies to exits in the room 609 (so '1st down' can match the first 'down' exit if you're not carrying 610 anything that matches 'down'). New english-style matching adjective 611 'toward' restricts the match to exits (so: 'look toward 1st down'). 612 Fixes: 613 * Code cleanup to fix several potential buffer overflows. 614 * The wildcard matcher had problems with backslash escapes in 615 some cases, making matching a : in a $command very hard. 616 Reported by Wayne@PDX. 617 * @chzone could cause crashes on some systems. Reported by Wayne@PDX. 618 * When two exits match, one is no longer chosen at random. 619 Instead, the ambiguity should be reported as an error. 620 Reported by Intrevis@M*U*S*H. 621 * The dbref returned by locate when given the X parameter is 622 no longer random, but the last one found (as per the help). 623 * Serious bug in reading locks from the db on startup corrected. 624 * The profiling timer is turned off duing dumps, as some systems 625 (FreeBSD?) appear to continue to use it and interrupt dumps 626 due to cpu limiting. Reported by Nathan Schuette. 627 583 628 584 629 & 1.7.6p3 … … 5885 5930 type 'help <version>p<patchlevel>'. For example, 'help 1.7.2p3' 5886 5931 5887 1.7.7: 0, 1, 2, 3 5888 1.7.6: 0, 1, 2, 3 5932 1.7.7: 0, 1, 2, 3, 4 5933 1.7.6: 0, 1, 2, 3, 4 5889 5934 1.7.5: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12 5890 5935 1.7.4: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 1.7.7/hdrs/conf.h
r403 r407 221 221 int queue_entry_cpu_time; 222 222 int ascii_names; 223 int max_global_fns; 223 224 }; 224 225 … … 347 348 #define NEWLINE_ONE_CHAR (options.newline_one_char) 348 349 #define ONLY_ASCII_NAMES (options.ascii_names) 349 350 #define MAX_GLOBAL_FNS (options.max_global_fns) 350 351 351 352 /* Compiler-specific stuff. */ 1.7.7/hdrs/externs.h
r403 r407 179 179 extern void moveto(dbref what, dbref where); 180 180 extern void safe_tel(dbref player, dbref dest, int nomovemsgs); 181 extern dbrefglobal_exit(dbref player, const char *direction);182 extern dbrefremote_exit(dbref loc, const char *direction);181 extern int global_exit(dbref player, const char *direction); 182 extern int remote_exit(dbref loc, const char *direction); 183 183 extern void move_wrapper(dbref player, const char *command); 184 184 extern void do_follow(dbref player, const char *arg); 1.7.7/hdrs/function.h
r399 r407 31 31 32 32 33 /* Number of user @functions */34 #define MAX_GLOBAL_FNS 5035 36 33 #ifndef HAVE_FUN_DEFINED 37 34 typedef struct fun FUN; … … 65 62 }; 66 63 67 extern USERFN_ENTRY userfn_tab[MAX_GLOBAL_FNS];64 extern USERFN_ENTRY *userfn_tab; 68 65 69 66 extern void do_userfn(char *buff, char **bp, … … 86 83 extern void do_function_report(dbref player, char *name); 87 84 extern void do_function_delete(dbref player, char *name); 88 85 extern void function_init_postconfig(void); 89 86 90 87 1.7.7/hdrs/game.h
r401 r407 160 160 /* From timer.c */ 161 161 extern void init_timer(void); 162 extern void signal_cpu_limit(int signo); 162 163 163 164 /* From version.c */ 1.7.7/hdrs/lock.h
r399 r407 55 55 int add_lock(dbref player, dbref thing, lock_type type, struct boolexp *key, 56 56 int flags); 57 int add_lock_raw(dbref player, dbref thing, lock_type type, 58 struct boolexp *key, int flags); 57 59 void free_locks(lock_list *ll); 58 60 int eval_lock(dbref player, dbref thing, lock_type ltype); … … 65 67 const char *lock_flags(lock_list *ll); 66 68 const char *lock_flags_long(lock_list *ll); 67 68 69 #define L_FLAGS(lock) ((lock)->flags) 69 70 #define L_CREATOR(lock) ((lock)->creator) … … 71 72 #define L_KEY(lock) ((lock)->key) 72 73 #define L_NEXT(lock) ((lock)->next) 73 74 74 /* can p read/evaluate lock l on object x? */ 75 75 int lock_visual(dbref, lock_type); … … 77 77 (See_All(p) || controls(p,x) || ((Visual(x) || lock_visual(x, l)) && \ 78 78 eval_lock(p,x,Examine_Lock))) 79 80 79 /* The actual magic cookies. */ 81 80 extern const lock_type Basic_Lock; … … 102 101 extern const lock_type Destroy_Lock; /* Who can @dest me if I'm dest_ok? */ 103 102 /* Declare new lock types here! */ 104 105 103 #include "boolexp.h" 106 107 104 #endif /* __LOCK_H */ 1.7.7/hdrs/version.h
r405 r407 1 #define VERSION "PennMUSH version 1.7.7 patchlevel 3 [12/25/2002]"2 #define SHORTVN "PennMUSH 1.7.7p 3"1 #define VERSION "PennMUSH version 1.7.7 patchlevel 4 [01/02/2003]" 2 #define SHORTVN "PennMUSH 1.7.7p4" 1.7.7/src/Makefile
r399 r407 193 193 ../hdrs/patches.h: 194 194 if [ ! -f ../hdrs/patches.h ]; then \ 195 (cd ../utils; sh mkcmds.sh ); \195 (cd ../utils; sh mkcmds.sh patches); \ 196 196 fi 197 197 1.7.7/src/bsd.c
r403 r407 4559 4559 if (ROOM_CONNECTS) { 4560 4560 /* Do the room the player connected into */ 4561 if (IsRoom(loc) ) {4561 if (IsRoom(loc) || IsThing(loc)) { 4562 4562 (void) queue_attribute(loc, "ACONNECT", player); 4563 4563 } … … 4637 4637 (void) queue_attribute(player, "ADISCONNECT", player); 4638 4638 if (ROOM_CONNECTS) 4639 if (IsRoom(loc) ) {4639 if (IsRoom(loc) || IsThing(loc)) { 4640 4640 (void) queue_attribute(loc, "ADISCONNECT", player); 4641 4641 } 1.7.7/src/conf.c
r401 r407 327 327 {"queue_entry_cpu_time", cf_int, &options.queue_entry_cpu_time, 100000, 0, 328 328 "limits"} 329 , 330 {"max_global_fns", cf_int, &options.max_global_fns, 2000, 0, 0} 329 331 , 330 332 … … 925 927 options.max_depth = 10; 926 928 options.max_parents = 10; 929 options.max_global_fns = 50; 927 930 options.purge_interval = 601; 928 931 options.dbck_interval = 599; 1.7.7/src/db.c
r405 r407 1022 1022 /* boolexp */ 1023 1023 b = getboolexp(f, type); 1024 add_lock (creator, i, type, b, flags);1024 add_lock_raw(creator, i, type, b, flags); 1025 1025 } 1026 1026 } … … 1050 1050 return; 1051 1051 } else { 1052 add_lock (Owner(i), i, buf, b, -1);1052 add_lock_raw(Owner(i), i, buf, b, -1); 1053 1053 } 1054 1054 } 1.7.7/src/extmail.c
r403 r407 416 416 417 417 struct mail *mp; 418 char tbuf1[BUFFER_LEN] ;418 char tbuf1[BUFFER_LEN], *bp; 419 419 char folderheader[BUFFER_LEN]; 420 420 struct mail_selector ms; … … 444 444 strcpy(folderheader, T("Folder:")); 445 445 notify(player, DASH_LINE); 446 bp = tbuf1; 446 447 if (IsPlayer(mp->from)) 447 s printf(tbuf1, "%s", Name(mp->from));448 safe_str(Name(mp->from), tbuf1, &bp); 448 449 else 449 sprintf(tbuf1, "%s (owner: %s)", Name(mp->from), 450 Name(Owner(mp->from))); 450 safe_format(tbuf1, &bp, "%s (owner: %s)", Name(mp->from), 451 Name(Owner(mp->from))); 452 *bp = '\0'; 451 453 notify_format(player, 452 454 T 1.7.7/src/flags.c
r403 r407 691 691 GoodObject(Location(thing)) && (hear || listener) && 692 692 !Hearer(thing) && !Listener(thing)) { 693 sprintf(tbuf1, T("%s is no longer listening."), Name(thing)); 693 tp = tbuf1; 694 safe_format(tbuf1, &tp, T("%s is no longer listening."), Name(thing)); 695 *tp = '\0'; 694 696 notify_except(Contents(Location(thing)), NOTHING, tbuf1); 695 697 notify_except(Contents(thing), NOTHING, tbuf1); … … 697 699 if (IsRoom(thing) && (f->type == TYPE_ROOM) && 698 700 (f->flag == ROOM_LISTEN) && !hear && !Listener(thing)) { 699 sprintf(tbuf1, T("%s is no longer listening."), Name(thing)); 701 tp = tbuf1; 702 safe_format(tbuf1, &tp, T("%s is no longer listening."), Name(thing)); 703 *tp = '\0'; 700 704 notify_except(Contents(thing), NOTHING, tbuf1); 701 705 } … … 704 708 case TYPE_EXIT: 705 709 if (Audible(Source(thing))) { 706 sprintf(tbuf1, T("Exit %s is no longer broadcasting."), Name(thing)); 710 tp = tbuf1; 711 safe_format(tbuf1, &tp, T("Exit %s is no longer broadcasting."), 712 Name(thing)); 713 *tp = '\0'; 707 714 notify_except(Contents(Source(thing)), NOTHING, tbuf1); 708 715 } … … 755 762 ((f->flag == THING_PUPPET) || (f->flag == THING_LISTEN)) && 756 763 !hear && !listener) { 757 sprintf(tbuf1, T("%s is now listening."), Name(thing)); 764 tp = tbuf1; 765 safe_format(tbuf1, &tp, T("%s is now listening."), Name(thing)); 766 *tp = '\0'; 758 767 notify_except(Contents(Location(thing)), NOTHING, tbuf1); 759 768 notify_except(Contents(thing), NOTHING, tbuf1); … … 761 770 if (IsRoom(thing) && (f->type == TYPE_ROOM) && 762 771 (f->flag == ROOM_LISTEN) && !hear && !listener) { 763 sprintf(tbuf1, T("%s is now listening."), Name(thing)); 772 tp = tbuf1; 773 safe_format(tbuf1, &tp, T("%s is now listening."), Name(thing)); 774 *tp = '\0'; 764 775 notify_except(Contents(thing), NOTHING, tbuf1); 765 776 } … … 769 780 case TYPE_EXIT: 770 781 if (Audible(Source(thing))) { 771 sprintf(tbuf1, T("Exit %s is now broadcasting."), Name(thing)); 782 tp = tbuf1; 783 safe_format(tbuf1, &tp, T("Exit %s is now broadcasting."), 784 Name(thing)); 785 *tp = '\0'; 772 786 notify_except(Contents(Source(thing)), NOTHING, tbuf1); 773 787 } 1.7.7/src/function.c
r403 r407 5 5 #include <string.h> 6 6 #include <ctype.h> 7 #include <stdlib.h> 7 8 #include "conf.h" 8 9 #include "attrib.h" … … 27 28 extern void local_functions(void); 28 29 30 USERFN_ENTRY *userfn_tab; 29 31 HASHTAB htab_function; 30 32 HASHTAB htab_user_function; … … 567 569 568 570 void 569 init_func_hashtab( )571 init_func_hashtab(void) 570 572 { 571 573 FUNTAB *ftp; … … 577 579 } 578 580 local_functions(); 581 } 582 583 void 584 function_init_postconfig(void) 585 { 586 userfn_tab = 587 (USERFN_ENTRY *) mush_malloc(MAX_GLOBAL_FNS * sizeof(USERFN_ENTRY), 588 "userfn_tab"); 579 589 } 580 590 … … 681 691 */ 682 692 683 USERFN_ENTRY userfn_tab[MAX_GLOBAL_FNS];684 693 685 694 static Size_t userfn_count = 0; … … 760 769 do_function(dbref player, char *name, char *argv[]) 761 770 { 762 /* Command of format: @function <function name>=<thing>,<attribute> 771 /* Command of format: @function <function name>=<thing>,<attribute>[,<minargs>,<maxargs>] 763 772 * or @function <function name>=<thing>/<attribute> 764 773 * Adds a new user-defined function. … … 844 853 fp = func_hash_lookup(upcasestr(name)); 845 854 if (!fp) { 846 if (userfn_count >= MAX_GLOBAL_FNS) {855 if (userfn_count >= (Size_t) MAX_GLOBAL_FNS) { 847 856 notify(player, T("Function table full.")); 848 857 return; … … 852 861 fp->name = mush_strdup(name, "func_hash.name"); 853 862 fp->where.offset = userfn_count; 854 fp->minargs = 0; 855 fp->maxargs = 10; 863 if (argv[3] && *argv[3]) { 864 fp->minargs = parse_integer(argv[3]); 865 if (fp->minargs < 0) 866 fp->minargs = 0; 867 else if (fp->minargs > 10) 868 fp->minargs = 10; 869 } else 870 fp->minargs = 0; 871 872 if (argv[4] && *argv[4]) { 873 fp->maxargs = parse_integer(argv[4]); 874 if (fp->maxargs < -10) 875 fp->maxargs = -10; 876 else if (fp->maxargs > 10) 877 fp->maxargs = 10; 878 } else 879 fp->maxargs = 10; 856 880 fp->flags = 0; 857 881 hashadd(name, fp, &htab_user_function); … … 874 898 } 875 899 if (fp->flags & FN_BUILTIN) { /* Overriding a built in function */ 876 if (userfn_count >= MAX_GLOBAL_FNS) {900 if (userfn_count >= (Size_t) MAX_GLOBAL_FNS) { 877 901 notify(player, T("Function table full.")); 878 902 return; … … 881 905 fp->name = mush_strdup(name, "func_hash.name"); 882 906 fp->where.offset = userfn_count; 883 fp->minargs = 0;884 fp->maxargs = 10;885 907 fp->flags = 0; 886 908 userfn_count++; … … 893 915 userfn_tab[fp->where.offset].name = 894 916 mush_strdup(upcasestr(argv[2]), "userfn_tab.name"); 917 if (argv[3] && *argv[3]) { 918 fp->minargs = parse_integer(argv[3]); 919 if (fp->minargs < 0) 920 fp->minargs = 0; 921 else if (fp->minargs > 10) 922 fp->minargs = 10; 923 } else 924 fp->minargs = 0; 925 926 if (argv[4] && *argv[4]) { 927 fp->maxargs = parse_integer(argv[4]); 928 if (fp->maxargs < -10) 929 fp->maxargs = -10; 930 else if (fp->maxargs > 10) 931 fp->maxargs = 10; 932 } else 933 fp->maxargs = 10; 895 934 notify(player, T("Function updated.")); 896 935 } … … 1140 1179 } 1141 1180 1142 1143 1144 1145 1146 1147 1181 *tp = '\0'; 1148 1182 notify_format(player, T("Flags : %s"), tbuf); 1149 1183 1150 if (fp->flags & FN_BUILTIN) { 1151 maxargs = fp->maxargs; 1152 if (maxargs < 0) 1153 maxargs = -maxargs; 1154 tp = tbuf; 1155 1156 if (fp->maxargs < 0) { 1157 safe_str(T("(Commas okay in last argument)"), tbuf, &tp); 1158 *tp = '\0'; 1159 } else 1160 tbuf[0] = '\0'; 1161 1162 if (fp->minargs == maxargs) 1163 notify_format(player, T("Arguments : %d %s"), fp->minargs, tbuf); 1164 else if (fp->maxargs == INT_MAX) 1165 notify_format(player, T("Arguments : At least %d %s"), fp->minargs, tbuf); 1166 else 1167 notify_format(player, 1168 T("Arguments : %d to %d %s"), fp->minargs, maxargs, tbuf); 1169 } else { 1170 if (Global_Funcs(player)) 1171 notify_format(player, T("Location : #%d/%s"), 1172 userfn_tab[fp->where.offset].thing, 1173 userfn_tab[fp->where.offset].name); 1174 notify(player, T("Arguments : 0 to 10")); 1175 } 1176 } 1184 if (!(fp->flags & FN_BUILTIN) && Global_Funcs(player)) { 1185 notify_format(player, T("Location : #%d/%s"), 1186 userfn_tab[fp->where.offset].thing, 1187 userfn_tab[fp->where.offset].name); 1188 } 1189 1190 maxargs = abs(fp->maxargs); 1191 1192 tp = tbuf; 1193 1194 if (fp->maxargs < 0) { 1195 safe_str(T("(Commas okay in last argument)"), tbuf, &tp); 1196 *tp = '\0'; 1197 } else 1198 tbuf[0] = '\0'; 1199 1200 if (fp->minargs == maxargs) 1201 notify_format(player, T("Arguments : %d %s"), fp->minargs, tbuf); 1202 else if (fp->maxargs == INT_MAX) 1203 notify_format(player, T("Arguments : At least %d %s"), fp->minargs, tbuf); 1204 else 1205 notify_format(player, 1206 T("Arguments : %d to %d %s"), fp->minargs, maxargs, tbuf); 1207 } 1.7.7/src/game.c
r403 r407 324 324 FILE *f = NULL; 325 325 326 #ifndef WIN32 327 ignore_signal(SIGPROF); 328 #endif 329 #ifdef I_SETJMP 326 330 if (setjmp(db_err)) { 327 331 /* The dump failed. Disk might be full or something went bad with the … … 330 334 flag_broadcast(WIZARD | ROYALTY, 0, 331 335 T("GAME: ERROR! Database save failed!")); 336 #ifdef HAS_ITIMER 337 install_sig_handler(SIGPROF, signal_cpu_limit); 338 #endif 332 339 } else { 333 340 local_dump_database(); … … 402 409 } 403 410 411 #endif 412 #ifdef HAS_ITIMER 413 install_sig_handler(SIGPROF, signal_cpu_limit); 414 #endif 404 415 } 405 416 … … 618 629 config_file_startup(conf); 619 630 command_init_postconfig(); 631 function_init_postconfig(); 620 632 } 621 633 1.7.7/src/lock.c
r401 r407 383 383 } 384 384 385 /* Set the lock type on thing to boolexp. 386 * Used only on db load, when we can't safely test the player's 387 * permissions because they're not loaded yet. 388 */ 389 int 390 add_lock_raw(dbref player, dbref thing, lock_type type, struct boolexp *key, 391 int flags) 392 { 393 lock_list *ll, **t; 394 lock_type real_type = type; 395 396 if (!GoodObject(thing)) { 397 return 0; 398 } 399 400 ll = next_free_lock(); 401 if (!ll) { 402 /* Oh, this sucks */ 403 do_log(LT_ERR, 0, 0, "Unable to malloc memory for lock_list!"); 404 } else { 405 real_type = st_insert(type, &lock_names); 406 ll->type = real_type; 407 ll->key = key; 408 ll->creator = player; 409 if (flags == -1) { 410 const lock_list *l2 = get_lockproto(real_type); 411 if (l2) 412 ll->flags = l2->flags; 413 else 414 ll->flags = 0; 415 } else { 416 ll->flags = flags; 417 } 418 t = &Locks(thing); 419 while (*t && strcmp(L_TYPE(*t), L_TYPE(ll)) < 0) 420 t = &L_NEXT(*t); 421 L_NEXT(ll) = *t; 422 *t = ll; 423 } 424 return 1; 425 } 426 385 427 /* Very primitive. */ 386 428 static void 1.7.7/src/log.c
r399 r407 45 45 dbref object; 46 46 { 47 static char buff[BUFFER_LEN] ;47 static char buff[BUFFER_LEN], *bp; 48 48 49 49 switch (object) { 50 50 case NOTHING: 51 s printf(buff, T("*NOTHING*"));51 strcpy(buff, T("*NOTHING*")); 52 52 break; 53 53 case AMBIGUOUS: 54 s printf(buff, T("*VARIABLE*"));54 strcpy(buff, T("*VARIABLE*")); 55 55 break; 56 56 case HOME: 57 s printf(buff, T("*HOME*"));57 strcpy(buff, T("*HOME*")); 58 58 break; 59 59 default: 60 sprintf(buff, "%s(#%d%s)", 61 Name(object), object, unparse_flags(object, GOD)); 60 bp = buff; 61 safe_format(buff, &bp, "%s(#%d%s)", 62 Name(object), object, unparse_flags(object, GOD)); 63 *bp = '\0'; 62 64 } 63 65 1.7.7/src/look.c
r403 r407 655 655 { 656 656 static char buf[BUFFER_LEN]; 657 char *bp; 657 658 CHANLIST *c; 658 659 659 660 if ((c = Chanlist(player))) { 660 strcpy(buf, T("Channels:")); 661 for (; c; c = c->next) 662 sprintf(buf, "%s %s", buf, ChanName(c->chan)); 661 bp = buf; 662 safe_str(T("Channels:"), buf, &bp); 663 for (; c; c = c->next) { 664 safe_chr(' ', buf, &bp); 665 safe_str(ChanName(c->chan), buf, &bp); 666 } 667 *bp = '\0'; 663 668 } else 664 669 strcpy(buf, T("Channels: *NONE*")); 1.7.7/src/match.c
r399 r407 77 77 dbref *last_match, int *match_count); 78 78 static dbref match_exit(const dbref who, const char *name, 79 const int type, const long int flags );79 const int type, const long int flags, int *match_count); 80 80 static dbref match_exit_internal(const dbref match_who, 81 81 const char *match_name, const int type, … … 93 93 long int flags, dbref thing1, dbref thing2, 94 94 int *match_count); 95 extern int check_alias(const char *command, const char *list); /* game.c */ 95 96 96 97 … … 205 206 match_remote_contents(who, name, type, flags, &last_match, &match_count); 206 207 if (GoodObject(match)) { 207 exact_match_count ++;208 exact_match_count += match_count; 208 209 exact_match = match; 209 210 } … … 212 213 match = match_neighbor(who, name, type, flags, &last_match, &match_count); 213 214 if (GoodObject(match)) { 214 exact_match_count ++;215 exact_match_count += match_count; 215 216 exact_match = match; 216 217 } … … 219 220 match = match_possession(who, name, type, flags, &last_match, &match_count); 220 221 if (GoodObject(match)) { 221 exact_match_count ++;222 exact_match_count += match_count; 222 223 exact_match = match; 223 224 } 224 225 } 225 226 if (flags & MAT_EXIT) { 226 match = match_exit(who, name, type, flags );227 match = match_exit(who, name, type, flags, &match_count); 227 228 if (GoodObject(match)) { 228 exact_match_count ++;229 exact_match_count += match_count; 229 230 exact_match = match; 230 231 } … … 233 234 match = match_container(who, name, type, flags, &last_match, &match_count); 234 235 if (GoodObject(match)) { 235 exact_match_count ++;236 exact_match_count += match_count; 236 237 exact_match = match; 237 238 } … … 240 241 match = match_exit_internal(who, name, type, flags, who, &match_count); 241 242 if (GoodObject(match)) { 242 exact_match_count ++;243 exact_match_count += match_count; 243 244 exact_match = match; 244 245 } 245 246 } 246 if ((flags & MAT_ENGLISH) && !GoodObject( last_match)247 && ! GoodObject(exact_match)) {247 if ((flags & MAT_ENGLISH) && !GoodObject(exact_match) 248 && !((flags & MAT_LAST) && GoodObject(last_match))) { 248 249 match = match_english(who, name, flags); 249 250 if (GoodObject(match)) { … … 360 361 DOLIST(first, first) { 361 362 if (first == absolute) { 363 (*match_count)++; 362 364 return first; 363 365 } else if (!strcasecmp(Name(first), match_name) || … … 367 369 * make sure match_count is high enough that we report ambiguity 368 370 */ 369 *match_count += 2;370 371 *last_match = 371 372 choose_thing(match_who, type, flags, the_match, first, match_count); 372 373 return NOTHING; 373 } else 374 } else { 374 375 the_match = first; 376 (*match_count)++; 377 } 375 378 } else if (string_match(Name(first), match_name)) { 376 379 *last_match = … … 413 416 414 417 static dbref 415 match_exit(who, name, type, flags )418 match_exit(who, name, type, flags, match_count) 416 419 const dbref who; 417 420 const char *name; 418 421 const int type; 419 422 const long flags; 423 int *match_count; 420 424 { 421 425 dbref loc; … … 424 428 if (flags & MAT_REMOTES) { 425 429 if (GoodObject(loc)) 426 return match_exit_internal(who, name, type, flags, Zone(loc), NULL); 430 return match_exit_internal(who, name, type, flags, Zone(loc), 431 match_count); 427 432 else 428 433 return NOTHING; 429 434 } else if (flags & MAT_GLOBAL) 430 return match_exit_internal(who, name, type, flags, MASTER_ROOM, NULL); 431 } 432 return match_exit_internal(who, name, type, flags, loc, NULL); 435 return match_exit_internal(who, name, type, flags, MASTER_ROOM, 436 match_count); 437 } 438 return match_exit_internal(who, name, type, flags, loc, match_count); 433 439 } 434 440 … … 444 450 dbref exit_tmp; 445 451 dbref absolute; 446 const char *match;447 const char *p;448 452 dbref the_match = NOTHING; 449 453 … … 454 458 absolute = match_absolute(match_name); 455 459 DOLIST(exit_tmp, Exits(loc)) { 456 if (exit_tmp == absolute) {460 if (exit_tmp == absolute) 457 461 the_match = exit_tmp; 458 } else { 459 match = Name(exit_tmp); 460 while (*match) { 461 /* check out this one */ 462 for (p = match_name; (*p && DOWNCASE(*p) == DOWNCASE(*match) 463 && *match != EXIT_DELIMITER); p++, match++) ; 464 /* did we get it? */ 465 if (*p == '\0') { 466 /* make sure there's nothing afterwards */ 467 while (isspace((unsigned char) *match)) 468 match++; 469 if (*match == '\0' || *match == EXIT_DELIMITER) { 470 /* we got it */ 471 the_match = 472 choose_thing(match_who, type, flags, the_match, exit_tmp, 473 match_count); 474 goto next_exit; 475 } 476 } 477 /* we didn't get it, find next match */ 478 while (*match && *match++ != EXIT_DELIMITER) ; 479 while (isspace((unsigned char) *match)) 480 match++; 481 } 482 } 483 next_exit: 484 ; 462 else if (check_alias(match_name, Name(exit_tmp))) 463 the_match =
