home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Internet Tools 1993 July / Internet Tools.iso / RockRidge / mail / pp / pp-6.0 / Lib / util / lstr2oid.c < prev    next >
Encoding:
C/C++ Source or Header  |  1991-12-18  |  784 b   |  43 lines

  1. /* lstr2oid.c: labelled string -> OID */
  2.  
  3. # ifndef lint
  4. static char Rcsid[] = "@(#)$Header: /xtel/pp/pp-beta/Lib/util/RCS/lstr2oid.c,v 6.0 1991/12/18 20:25:18 jpo Rel $";
  5. # endif
  6.  
  7. /*
  8.  * $Header: /xtel/pp/pp-beta/Lib/util/RCS/lstr2oid.c,v 6.0 1991/12/18 20:25:18 jpo Rel $
  9.  *
  10.  * $Log: lstr2oid.c,v $
  11.  * Revision 6.0  1991/12/18  20:25:18  jpo
  12.  * Release 6.0
  13.  *
  14.  */
  15.  
  16. #include "util.h"
  17. #include <isode/quipu/oid.h>
  18.  
  19. OID    lstr2oid (str)
  20. char    *str;
  21. {
  22.     char    buf[BUFSIZ];
  23.     char    *ix;
  24.     int    iy;
  25.     int    copy = FALSE;
  26.  
  27.     for (ix = str, iy = 0;
  28.          NULLCP != ix && '\0' != *ix;
  29.          ix++) {
  30.         if ('(' == *ix) {
  31.             copy = TRUE;
  32.             if (iy != 0)
  33.                 buf[iy++] = '.';
  34.         } else if (')' == *ix) 
  35.             copy = FALSE;
  36.         else if (TRUE == copy)
  37.             buf[iy++] = *ix;
  38.     }
  39.     buf[iy] = '\0';
  40.     
  41.     return str2oid(buf);
  42. }
  43.