This is patch09 to PennMUSH 1.8.1. After applying this patch, you will have version 1.8.1p9 To apply this patch, save it to a file in your top-level MUSH directory, and do the following: patch -p1 < 1.8.1-patch09 make clean make install If you use GNU patch 2.2, you probably want the above to be 'patch -b -p1', not just 'patch -p1'. Unix (or cygwin) users need not worry about failed hunks in src/switchinc.c, hdrs/switches.h, hdrs/cmds.h, or hdrs/funs.h. These files are automatically rebuilt on compile. On the off chance they appear not to be, simply rm them and re-run make. Then @shutdown and restart your MUSH. - Alan/Javelin In this patch: Fixes: * Fixes from 1.8.0p13. Prereq: 1.8.1p8 *** 1_8_1.337/Patchlevel Sun, 11 Jun 2006 07:27:46 -0500 dunemush (pennmush/5_Patchlevel 1.17.1.11.1.52 600) --- 1_8_1.342(w)/Patchlevel Wed, 05 Jul 2006 15:09:21 -0500 dunemush (pennmush/5_Patchlevel 1.17.1.11.1.53 600) *************** *** 1,2 **** Do not edit this file. It is maintained by the official PennMUSH patches. ! This is PennMUSH 1.8.1p8 --- 1,2 ---- Do not edit this file. It is maintained by the official PennMUSH patches. ! This is PennMUSH 1.8.1p9 *** 1_8_1.337/src/funlist.c Fri, 23 Jun 2006 11:15:23 -0500 dunemush (pennmush/c/16_funlist.c 1.3.1.1.1.5.1.2.1.1.1.1.1.4.1.2.1.2.1.19.1.2.1.1.1.2.1.5.1.1.1.1.1.1.1.1.1.1.2.1.1.3.1.2.1.1.1.1.1.1.1.1.1.1.1.12.1.14.1.7.1.20.1.1.1.1.1.14 660) --- 1_8_1.342(w)/src/funlist.c Wed, 05 Jul 2006 23:17:34 -0500 dunemush (pennmush/c/16_funlist.c 1.3.1.1.1.5.1.2.1.1.1.1.1.4.1.2.1.2.1.19.1.2.1.1.1.2.1.5.1.1.1.1.1.1.1.1.1.1.2.1.1.3.1.2.1.1.1.1.1.1.1.1.1.1.1.12.1.14.1.7.1.20.1.1.1.1.1.1.1.1.1.2 660) *************** *** 1263,1334 **** } /* ARGSUSED */ - FUNCTION(fun_setunion) - { - char sep; - char **a1, **a2; - char *tempbuff; - int n1, i, a; - char *sort_type = ALPHANUM_LIST; - char *osep = NULL, osepd[2] = { '\0', '\0' }; - - /* if no lists, then no work */ - if (!*args[0] && !*args[1]) - return; - - if (!delim_check(buff, bp, nargs, args, 3, &sep)) - return; - - tempbuff = (char *) mush_malloc((BUFFER_LEN * 2) + 4, "string"); - a1 = (char **) mush_malloc(MAX_SORTSIZE * sizeof(char *), "ptrarray"); - a2 = (char **) mush_malloc(MAX_SORTSIZE * sizeof(char *), "ptrarray"); - if (!tempbuff || !a1 || !a2) - mush_panic("Unable to allocate memory in fun_setunion"); - /* Concat both lists, make array, sort */ - if (!*args[0]) - memcpy(tempbuff, args[1], arglens[1] + 1); - else if (!*args[1]) - memcpy(tempbuff, args[0], arglens[0] + 1); - else - sprintf(tempbuff, "%s%c%s", args[0], sep, args[1]); - n1 = list2arr(a1, MAX_SORTSIZE, tempbuff, sep); - - if (nargs < 4) { - osepd[0] = sep; - osep = osepd; - } else if (nargs == 4) { - sort_type = get_list_type_noauto(args, nargs, 4); - if (sort_type == UNKNOWN_LIST) { - sort_type = ALPHANUM_LIST; - osep = args[3]; - } else { - osepd[0] = sep; - osep = osepd; - } - } else if (nargs == 5) { - sort_type = get_list_type(args, nargs, 4, a1, n1); - osep = args[4]; - } - - do_gensort(executor, a1, NULL, n1, sort_type); - - /* Strip the duplicates and make a2 contain the list */ - a = 0; - for (i = 0; i < n1; i++) { - if (((a == 0) || (gencomp(executor, a1[i], a2[a - 1], sort_type) != 0))) { - a2[a] = a1[i]; - a++; - } - } - - /* Return our sorted result */ - arr2list(a2, a, buff, bp, osep); - mush_free((Malloc_t) tempbuff, "string"); - mush_free((Malloc_t) a1, "ptrarray"); - mush_free((Malloc_t) a2, "ptrarray"); - } - - /* ARGSUSED */ FUNCTION(fun_setinter) { char sep; --- 1263,1268 ---- *************** *** 1348,1354 **** a1 = (char **) mush_malloc(MAX_SORTSIZE * sizeof(char *), "ptrarray"); a2 = (char **) mush_malloc(MAX_SORTSIZE * sizeof(char *), "ptrarray"); if (!a1 || !a2) ! mush_panic("Unable to allocate memory in fun_setunion"); /* make arrays out of the lists */ n1 = list2arr(a1, MAX_SORTSIZE, args[0], sep); --- 1282,1288 ---- a1 = (char **) mush_malloc(MAX_SORTSIZE * sizeof(char *), "ptrarray"); a2 = (char **) mush_malloc(MAX_SORTSIZE * sizeof(char *), "ptrarray"); if (!a1 || !a2) ! mush_panic("Unable to allocate memory in fun_inter"); /* make arrays out of the lists */ n1 = list2arr(a1, MAX_SORTSIZE, args[0], sep); *************** *** 1444,1454 **** } /* ARGSUSED */ ! FUNCTION(fun_setdiff) { char sep; char **a1, **a2; int n1, n2, x1, x2, val; char *sort_type = ALPHANUM_LIST; int osepl = 0; char *osep = NULL, osepd[2] = { '\0', '\0' }; --- 1378,1389 ---- } /* ARGSUSED */ ! FUNCTION(fun_setunion) { char sep; char **a1, **a2; int n1, n2, x1, x2, val; + int lastx1, lastx2, found; char *sort_type = ALPHANUM_LIST; int osepl = 0; char *osep = NULL, osepd[2] = { '\0', '\0' }; *************** *** 1491,1496 **** --- 1426,1567 ---- osep = args[4]; osepl = arglens[4]; } + /* sort each array */ + do_gensort(executor, a1, NULL, n1, sort_type); + do_gensort(executor, a2, NULL, n2, sort_type); + + /* get values for the union, in order, skipping duplicates */ + lastx1 = lastx2 = -1; + found = x1 = x2 = 0; + if (n1 == 1 && !*a1[0]) + n1 = 0; + if (n2 == 1 && !*a2[0]) + n2 = 0; + while ((x1 < n1) || (x2 < n2)) { + /* If we've already copied off something from a1, and our current + * look at a1 is the same element, or we've copied from a2 and + * our current look at a1 is the same element, skip forward in a1. + */ + if (x1 < n1 && lastx1 >= 0) { + val = gencomp(executor, a1[lastx1], a1[x1], sort_type); + if (val == 0) { + x1++; + continue; + } + } + if (x1 < n1 && lastx2 >= 0) { + val = gencomp(executor, a2[lastx2], a1[x1], sort_type); + if (val == 0) { + x1++; + continue; + } + } + if (x2 < n2 && lastx1 >= 0) { + val = gencomp(executor, a1[lastx1], a2[x2], sort_type); + if (val == 0) { + x2++; + continue; + } + } + if (x2 < n2 && lastx2 >= 0) { + val = gencomp(executor, a2[lastx2], a2[x2], sort_type); + if (val == 0) { + x2++; + continue; + } + } + if (x1 >= n1) { + /* Just copy off the rest of a2 */ + if (x2 < n2) { + if (found) + safe_strl(osep, osepl, buff, bp); + safe_str(a2[x2], buff, bp); + lastx2 = x2; + x2++; + found = 1; + } + } else if (x2 >= n2) { + /* Just copy off the rest of a1 */ + if (x1 < n1) { + if (found) + safe_strl(osep, osepl, buff, bp); + safe_str(a1[x1], buff, bp); + lastx1 = x1; + x1++; + found = 1; + } + } else { + /* At this point, we're merging. Take the lower of the two. */ + val = gencomp(executor, a1[x1], a2[x2], sort_type); + if (val <= 0) { + if (found) + safe_strl(osep, osepl, buff, bp); + safe_str(a1[x1], buff, bp); + lastx1 = x1; + x1++; + found = 1; + } else { + if (found) + safe_strl(osep, osepl, buff, bp); + safe_str(a2[x2], buff, bp); + lastx2 = x2; + x2++; + found = 1; + } + } + } + mush_free((Malloc_t) a1, "ptrarray"); + mush_free((Malloc_t) a2, "ptrarray"); + } + + /* ARGSUSED */ + FUNCTION(fun_setdiff) + { + char sep; + char **a1, **a2; + int n1, n2, x1, x2, val; + char *sort_type = ALPHANUM_LIST; + int osepl = 0; + char *osep = NULL, osepd[2] = { '\0', '\0' }; + + /* if no lists, then no work */ + if (!*args[0] && !*args[1]) + return; + + if (!delim_check(buff, bp, nargs, args, 3, &sep)) + return; + + a1 = (char **) mush_malloc(MAX_SORTSIZE * sizeof(char *), "ptrarray"); + a2 = (char **) mush_malloc(MAX_SORTSIZE * sizeof(char *), "ptrarray"); + if (!a1 || !a2) + mush_panic("Unable to allocate memory in fun_diff"); + + /* make arrays out of the lists */ + n1 = list2arr(a1, MAX_SORTSIZE, args[0], sep); + n2 = list2arr(a2, MAX_SORTSIZE, args[1], sep); + + if (nargs < 4) { + osepd[0] = sep; + osep = osepd; + if (sep) + osepl = 1; + } else if (nargs == 4) { + sort_type = get_list_type_noauto(args, nargs, 4); + if (sort_type == UNKNOWN_LIST) { + sort_type = ALPHANUM_LIST; + osep = args[3]; + osepl = arglens[3]; + } else { + osepd[0] = sep; + osep = osepd; + if (sep) + osepl = 1; + } + } else if (nargs == 5) { + sort_type = get_list_type(args, nargs, 4, a1, n1); + osep = args[4]; + osepl = arglens[4]; + } /* sort each array */ do_gensort(executor, a1, NULL, n1, sort_type); *** 1_8_1.337/src/function.c Sat, 03 Jun 2006 17:14:18 -0500 dunemush (pennmush/c/18_function.c 1.29.1.14.1.3.1.6.1.1.1.1.1.14.1.2.1.1.1.7.1.22.1.11.1.3.1.24.1.4.1.2.2.1.1.1.1.18.1.3.1.13 660) --- 1_8_1.342(w)/src/function.c Wed, 05 Jul 2006 23:17:34 -0500 dunemush (pennmush/c/18_function.c 1.29.1.14.1.3.1.6.1.1.1.1.1.14.1.2.1.1.1.7.1.22.1.11.1.3.1.24.1.4.1.2.2.1.1.1.1.1.1.2 660) *************** *** 540,546 **** {"ORPOWERS", fun_orflags, 2, 2, FN_REG}, {"OWNER", fun_owner, 1, 1, FN_REG}, {"PARENT", fun_parent, 1, 2, FN_REG}, ! {"PCREATE", fun_pcreate, 1, 2, FN_REG}, {"PEMIT", fun_pemit, 2, -2, FN_REG}, {"PLAYERMEM", fun_playermem, 1, 1, FN_REG}, {"PMATCH", fun_pmatch, 1, 1, FN_REG}, --- 540,546 ---- {"ORPOWERS", fun_orflags, 2, 2, FN_REG}, {"OWNER", fun_owner, 1, 1, FN_REG}, {"PARENT", fun_parent, 1, 2, FN_REG}, ! {"PCREATE", fun_pcreate, 2, 2, FN_REG}, {"PEMIT", fun_pemit, 2, -2, FN_REG}, {"PLAYERMEM", fun_playermem, 1, 1, FN_REG}, {"PMATCH", fun_pmatch, 1, 1, FN_REG}, *** 1_8_1.337/hdrs/version.h Sun, 11 Jun 2006 07:27:46 -0500 dunemush (pennmush/c/47_version.h 1.32.1.2.1.7.1.9.1.1.1.17.1.58 660) --- 1_8_1.342(w)/hdrs/version.h Wed, 05 Jul 2006 23:17:38 -0500 dunemush (pennmush/c/47_version.h 1.32.1.2.1.7.1.9.1.1.1.17.1.59 660) *************** *** 1,4 **** #define VERSION "1.8.1" ! #define PATCHLEVEL "8" ! #define PATCHDATE "[06/03/2006]" ! #define NUMVERSION 1008001008 --- 1,4 ---- #define VERSION "1.8.1" ! #define PATCHLEVEL "9" ! #define PATCHDATE "[07/05/2006]" ! #define NUMVERSION 1008001009 *** 1_8_1.337/MANIFEST Sat, 25 Feb 2006 15:01:31 -0600 dunemush (pennmush/d/34_MANIFEST 1.21.1.2.1.7.1.3.1.31.1.1.1.3 600) --- 1_8_1.342(w)/MANIFEST Wed, 05 Jul 2006 16:14:24 -0500 dunemush (pennmush/d/34_MANIFEST 1.21.1.2.1.7.1.3.1.31.1.1.1.1.1.2 600) *************** *** 240,245 **** --- 240,246 ---- test/testrand.pl test/testreswitch.pl test/testtr.pl + test/testsetfuns.pl utils/clwrapper.sh utils/customize.pl utils/fixdepend.pl *** 1_8_1.337/game/txt/hlp/pennvOLD.hlp Thu, 20 Apr 2006 22:47:19 -0500 dunemush (pennmush/g/30_pennvOLD.h 1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.9.1.2.1.5.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.4 660) --- 1_8_1.342(w)/game/txt/hlp/pennvOLD.hlp Wed, 05 Jul 2006 23:17:38 -0500 dunemush (pennmush/g/30_pennvOLD.h 1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.9.1.2.1.5.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.2 660) *************** *** 4417,4424 **** For information on a specific patchlevel of one of the versions listed, type 'help p'. For example, 'help 1.7.2p3' ! 1.8.1: 0, 1, 2, 3, 4, 5, 6, 7, 8 ! 1.8.0: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12 1.7.7: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40 --- 4417,4424 ---- For information on a specific patchlevel of one of the versions listed, type 'help p'. For example, 'help 1.7.2p3' ! 1.8.1: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 ! 1.8.0: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13 1.7.7: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40 *** 1_8_1.337/CHANGES.180 Sat, 25 Mar 2006 15:42:06 -0600 dunemush (pennmush/h/21_CHANGES.18 1.67 600) --- 1_8_1.342(w)/CHANGES.180 Wed, 05 Jul 2006 15:08:09 -0500 dunemush (pennmush/h/21_CHANGES.18 1.68 600) *************** *** 13,18 **** --- 13,25 ---- ========================================================================== + Version 1.8.0 patchlevel 13 July 5, 2006 + + Fixes: + * Crash bug in pcreate() fixed. Report by Phreq@M*U*S*H. + * Crash bug in setunion() fixed. Report by Gurenk@ST:Legacy. + + Version 1.8.0 patchlevel 12 March 25, 2006 Minor changes: *** 1_8_1.337/game/txt/hlp/pennv180.hlp Mon, 10 Apr 2006 12:15:53 -0500 dunemush (pennmush/h/28_pennv180.h 1.1.1.2.1.1.1.2.1.1.1.1.1.2.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.4.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.2.1.1.1.1.1.1.1.2.1.2.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.2.1.2 660) --- 1_8_1.342(w)/game/txt/hlp/pennv180.hlp Wed, 05 Jul 2006 23:17:38 -0500 dunemush (pennmush/h/28_pennv180.h 1.1.1.2.1.1.1.2.1.1.1.1.1.2.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.4.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.2.1.1.1.1.1.1.1.2.1.2.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.2.1.1.1.2 660) *************** *** 1,3 **** --- 1,11 ---- + & 1.8.0p13 + Version 1.8.0 patchlevel 13 July 5, 2006 + + Fixes: + * Crash bug in pcreate() fixed. Report by Phreq@M*U*S*H. + * Crash bug in setunion() fixed. Report by Gurenk@ST:Legacy. + + & 1.8.0p12 Version 1.8.0 patchlevel 12 March 25, 2006 *** 1_8_1.337/game/txt/hlp/pennv181.hlp Fri, 23 Jun 2006 11:15:23 -0500 dunemush (pennmush/h/29_pennv181.h 1.139 660) --- 1_8_1.342(w)/game/txt/hlp/pennv181.hlp Wed, 05 Jul 2006 23:17:38 -0500 dunemush (pennmush/h/29_pennv181.h 1.140 660) *************** *** 1,4 **** ! & 1.8.1p8 & changes This is a list of changes in this patchlevel which are probably of interest to players. More information about new commands and functions --- 1,4 ---- ! & 1.8.1p9 & changes This is a list of changes in this patchlevel which are probably of interest to players. More information about new commands and functions *************** *** 11,16 **** --- 11,23 ---- A list of the patchlevels associated with each release can be read in 'help patchlevels'. + Version 1.8.1 patchlevel 9 July 9, 2006 + + Fixes: + * Fixes from 1.8.0p13. + + + & 1.8.1p8 Version 1.8.1 patchlevel 8 June 3, 2006 Attributes: *** 1_8_1.337/CHANGES.181 Fri, 23 Jun 2006 11:15:23 -0500 dunemush (pennmush/h/30_CHANGES.18 1.135 600) --- 1_8_1.342(w)/CHANGES.181 Wed, 05 Jul 2006 15:09:15 -0500 dunemush (pennmush/h/30_CHANGES.18 1.136 600) *************** *** 14,19 **** --- 14,25 ---- ========================================================================== + Version 1.8.1 patchlevel 9 July 9, 2006 + + Fixes: + * Fixes from 1.8.0p13. + + Version 1.8.1 patchlevel 8 June 3, 2006 Attributes: *** 1_8_1.337/test/testsetfuns.pl Wed, 05 Jul 2006 23:17:40 -0500 dunemush () --- 1_8_1.342(w)/test/testsetfuns.pl Wed, 05 Jul 2006 15:47:44 -0500 dunemush (pennmush/h/51_testsetfun 1.2 600) *************** *** 0 **** --- 1,12 ---- + use PennMUSH; + use MUSHConnection; + use TestHarness; + + $mush = PennMUSH->new(); + $god = $mush->loginGod(); + + test('setunion.1', $god, 'think setunion(,)', '^$'); + test('setunion.2', $god, 'think setunion( a,a)', '^a\r$'); + test('setunion.3', $god, 'think setunion(c a b a,a b c c)', '^a b c\r$'); + test('setunion.4', $god, 'think setunion(a a a,)', '^a\r$'); + test('setunion.5', $god, 'think setunion(,a a a)', '^a\r$');