Listing 5

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "c_calls.h"

/* Allocate enough stack space to support recursion. */
#ifdef __TURBOC__
extern unsigned_stklen = 32000;
#endif

void main(int argc, char *argv[])
{
LIST fcn_list = NULL;

if (argc ! = 2)
    error("c_calls: usage: c_calls <.asm filename>");

build_graph(&fcn_list, argv[1]); /* Determine calling relationships. */

if (fcn_list != NULL)
    print_all_calls(fcn_list); /* Print the fcn call tree. */
}

void error(const char *message)

/* Exit after giving an error message. */

{
printf("Error: %s\n", message);
exit(-1);
}

int namecmp(const char *name1, const char *name2)

/*
Identical to stricmp, except that "main" is considered
less than any other string.
*/

{
if (stricmp(name1, "main") == 0)
    return -1;
else
    if (stricmp(name2, "main') == 0)
        return 1;
    else return stricmp(name1, name2);
}
/* End of File */