home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD1.mdf / icon / dos / src / icont / lnklist.c < prev    next >
C/C++ Source or Header  |  1992-02-10  |  2KB  |  71 lines

  1. /*
  2.  * lnklist.c -- functions for handling file linking.
  3.  */
  4.  
  5. #include "../h/gsupport.h"
  6. #include "tproto.h"
  7. #include "trans.h"
  8. #include "lfile.h"
  9.  
  10. /*
  11.  * Prototype.
  12.  */
  13. hidden    struct lfile *alclfile    Params((char *name));
  14.  
  15. struct lfile *lfiles;
  16.  
  17. /*
  18.  * Dummy function to satify restriction on the length of the name of
  19.  *  the first function in a file ... on a certain system.  Needs to
  20.  *  be handled in a better fashion.
  21.  */
  22.  
  23. /*
  24.  * One of the developers of ... a certain system ... urges everyone to
  25.  *  lighten up, and not take warning messages so seriously (and to
  26.  *  look into the SName compilation option).
  27.  */
  28.  
  29. novalue dummyda()
  30.    {
  31.    }
  32.  
  33. /*
  34.  * alclfile allocates an lfile structure for the named file, fills
  35.  *  in the name and returns a pointer to it.
  36.  */
  37. static struct lfile *alclfile(name)
  38. char *name;
  39.    {
  40.    struct lfile *p;
  41.    
  42.    p = (struct lfile *) alloc(sizeof(struct lfile));
  43.    if (!p)
  44.       tsyserr("not enough memory for file list");
  45.    p->lf_link = NULL;
  46.    p->lf_name = salloc(name);
  47.    return p;
  48.    }
  49.  
  50. /*
  51.  * addlfile creates an lfile structure for the named file and add it to the
  52.  *  end of the list of files (lfiles) to generate link instructions for.
  53.  */
  54. novalue addlfile(name)
  55. char *name;
  56. {
  57.    struct lfile *nlf, *p;
  58.    
  59.    nlf = alclfile(name);
  60.    if (lfiles == NULL) {
  61.       lfiles = nlf;
  62.       }
  63.    else {
  64.       p = lfiles;
  65.       while (p->lf_link != NULL) {
  66.          p = p->lf_link;
  67.          }
  68.       p->lf_link = nlf;
  69.       }
  70. }
  71.