home *** CD-ROM | disk | FTP | other *** search
/ Unix System Administration Handbook 1997 October / usah_oct97.iso / news / nn.tar / nn-6.5.1 / chset.c < prev    next >
C/C++ Source or Header  |  1995-04-29  |  764b  |  44 lines

  1. /*
  2.  *    (c) Copyright 1992, Luc Rooijakkers.  All rights reserved.
  3.  *
  4.  *    Character set support (rudimentary)
  5.  */
  6.  
  7. #include "config.h"
  8. #include "chset.h"
  9.  
  10. static struct chset chsets[]= {
  11.     "us-ascii",        7,
  12.     "iso-8859-1",    8,
  13.     "iso-8859-2",    8,
  14.     "iso-8859-3",    8,
  15.     "iso-8859-4",    8,
  16.     "iso-8859-5",    8,
  17.     "iso-8859-6",    8,
  18.     "iso-8859-7",    8,
  19.     "iso-8859-8",    8,
  20.     "iso-8859-9",    8,
  21.     "unknown",        0,
  22.     NULL,        0,
  23. };
  24.  
  25. export struct chset *curchset = chsets;
  26.  
  27. struct chset *getchset(name)
  28. char *name;
  29. {
  30.     struct chset *csp;
  31.     char *sp;
  32.  
  33.     for (sp = name; *sp; sp++)
  34.     if (isupper(*sp))
  35.         *sp = tolower(*sp);
  36.  
  37.     for (csp = chsets; csp->cs_name != NULL; csp++) {
  38.     if (strcmp (csp->cs_name, name) == 0)
  39.         return csp;
  40.     }
  41.  
  42.     return NULL;
  43. }
  44.