Re: [Code] command to display text files

From: Ron Hensley (ron@CROSS.DMV.COM)
Date: 10/15/97


> ACMD(do_map);
> {"map", POSITION_SLEEPING, do_map, 0, 0},
>
> in act.informative.c -
> extern char *map
^^^^^^^^^^^^^^^^^^^

Here you have defined a char pointer, which is, at this point, pointing
nowhere, to utter garbage.

> ACMD(do_map)
> {
>     page_string(ch->desc, map, 0);    /* line 2973 */
                   ^^^^^^^^^^^^
     Here you are trying to send a string, located at what 'map' points
to, to the player. Where in your code, did you actually allocate some
memory for map to pint to, a buffer that is? And where did you read in
your map file and actually store soemthing there?

If you did neither, then this is why you crash. Page_string expects to
find a null terminated string at the location pointed to be the map variable.

> }
>
> in db.h -
> #define MAP_FILE      "text/map"    /* for the 'map' command */

    *******************************************************************
    *   Ron Hensley                     ron@dmv.com                   *
    *   Network Administrator           http://www.dmv.com/~ron       *
    *                                   PGP Key at WWW Page           *
    *   DelMarVa OnLine                 749-7898 Ext. 403             *
    *******************************************************************


     +------------------------------------------------------------+
     | Ensure that you have read the CircleMUD Mailing List FAQ:  |
     | http://democracy.queensu.ca/~fletcher/Circle/list-faq.html |
     +------------------------------------------------------------+



This archive was generated by hypermail 2b30 : 12/08/00 PST