home *** CD-ROM | disk | FTP | other *** search
/ Graphics Plus / Graphics Plus.iso / general / procssng / alv.sun / alv.lha / src / toolmerge.c < prev    next >
Encoding:
C/C++ Source or Header  |  1992-11-08  |  1.0 KB  |  45 lines

  1. /*
  2.  *     Overview:    Tool Merger: The size of the libraries used by tools
  3.  *            is large.  Substantial memory size saving can be
  4.  *            realized by merging together a group of tools.
  5.  *            The text for every instance of each of the merged tools
  6.  *            is shared.  Each merged tool should be a symbolic
  7.  *            link to the shared object file.
  8.  */
  9.  
  10. #include "declarations.h"
  11.  
  12. truct map {
  13.     char cmd[32];
  14.     int  (*routine)();
  15. };
  16. truct map  cmd_routine_map[] = {
  17. #include "tools.h"
  18. };
  19.  
  20. ain(argc, argv, envp)
  21.     int argc;
  22.     char **argv;
  23.         char **envp;
  24. {
  25.     extern    char *rindex();
  26.     char    *filename = rindex(argv[0], '/');
  27.     int i;
  28.     int num_of_cmds;
  29.  
  30.     if (!filename)
  31.         filename = argv[0];
  32.     else
  33.         filename++;
  34.     num_of_cmds = sizeof(cmd_routine_map)/sizeof(struct map);
  35.     for (i = 0; i < sizeof(cmd_routine_map)/sizeof(struct map); i++)  { 
  36.         if (strcmp(filename,cmd_routine_map[i].cmd) == 0)  {
  37.             cmd_routine_map[i].routine(argc,argv,envp);
  38.             exit(0);
  39.         }
  40.     }
  41.     printf("Couldn't run %s in toolmerge.main report to author\n", argv[0]);
  42.     
  43.     exit(0);
  44. }
  45.