00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 
00009 
00010 
00011 #include <sys/types.h>
00012 #include "count.h"
00013 #include "strdup.h"
00014 
00015 Count::Count(const char* n) :
00016   name(strDup(n)),
00017   count(1)
00018 { }
00019 
00020 void count(Counters& c, const char* instr)
00021 {
00022   Counters::iterator i;
00023   for (i = c.begin(); i != c.end(); i++)
00024   {
00025     if (strcmp(instr, (*i).name) == 0)
00026     {
00027       (*i).count++;
00028       return;
00029     }
00030   }
00031   c.push_back(instr);
00032 }
00033