Changeset 2f01162 for util.c


Ignore:
Timestamp:
Mar 29, 2009, 3:08:14 PM (16 years ago)
Author:
James M. Kretchmar <kretch@mit.edu>
Branches:
owl
Children:
a0bde15
Parents:
2ace81e
Message:
new classinstfilt that uses ^(un)*%s(\\.d) style matching
File:
1 edited

Legend:

Unmodified
Added
Removed
  • util.c

    rfa00c5c r2f01162  
    765765}
    766766
     767/* Return the base class or instance from a zephyr class, by removing
     768   leading `un' or trailing `.d'.
     769   The caller is responsible for freeing the allocated string.
     770*/
     771char * owl_util_baseclass(char * class)
     772{
     773  char *start, *end;
     774
     775  start = class;
     776  while(!strncmp(start, "un", 2)) {
     777    start += 2;
     778  }
     779
     780  start = owl_strdup(start);
     781  end = start + strlen(start) - 1;
     782  while(end > start && *end == 'd' && *(end-1) == '.') {
     783    end -= 2;
     784  }
     785  *(end + 1) = 0;
     786
     787  return start;
     788}
     789
    767790/**************************************************************************/
    768791/************************* REGRESSION TESTS *******************************/
Note: See TracChangeset for help on using the changeset viewer.