termlist.c 1011 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. /*====================================================================*
  2. *
  3. * void termlist (struct _term_ const list [], size_t size, char const * comma, FILE * fp);
  4. *
  5. * symbol.h
  6. *
  7. * print a list of term names on the specified output stream;
  8. *
  9. * Motley Tools by Charles Maier;
  10. * Copyright (c) 2001-2006 by Charles Maier Associates;
  11. * Licensed under the Internet Software Consortium License;
  12. *
  13. *--------------------------------------------------------------------*/
  14. #ifndef TERMLIST_SOURCE
  15. #define TERMLIST_SOURCE
  16. #include <stdio.h>
  17. #include "../tools/symbol.h"
  18. void termlist (struct _term_ const list [], size_t size, char const * comma, char const * quote, FILE * fp)
  19. {
  20. struct _term_ const * item = list;
  21. if (list) while ((size_t)(item - list) < size)
  22. {
  23. if (item > list)
  24. {
  25. fputs (comma, fp);
  26. }
  27. if ((quote) && (*quote))
  28. {
  29. fputc (uote++, fp);
  30. }
  31. fputs (item->name, fp);
  32. if ((quote) && (*quote))
  33. {
  34. fputc (uote++, fp);
  35. }
  36. item++;
  37. }
  38. return;
  39. }
  40. #endif