src/console/conio.c
static void add_smap(char *str, int func)
{
   stab_t *tstab;
   int len;

   if (!str) {
      return;
   }
   len = strlen(str);
   if (len == 0) {
/*    errmsg("String for func %d is zero length\n", func); */
      return;
   }
   tstab = (stab_t *)malloc(sizeof(stab_t));
   memset(tstab, 0, sizeof(stab_t));
   tstab->len = len;
   tstab->str = (char *)malloc(tstab->len + 1);
   bstrncpy(tstab->str, str, tstab->len + 1);
   tstab->func = func;
   if (tstab->len > num_stab) {
      printf("stab string too long %d. Max is %d\n", tstab->len, num_stab);
      exit(1);
   }
   tstab->next = stab[tstab->len-1];
   stab[tstab->len-1] = tstab;
/* printf("Add_smap tstab=%x len=%d func=%d tstab->next=%x\n\r", tstab, len,
          func, tstab->next); */

}
/*
 * New routine. Add string to string->func mapping table.
 */
New routine. Add string to string->func mapping table.
New routine . Add string to string - > func mapping table .
static void add_smap(char *str, int func)
{
   stab_t *tstab;
   int len;
   if (!str) {
      return;
   }
   len = strlen(str);
   if (len == 0) {
      return;
   }
   tstab = (stab_t *)malloc(sizeof(stab_t));
   memset(tstab, 0, sizeof(stab_t));
   tstab->len = len;
   tstab->str = (char *)malloc(tstab->len + 1);
   bstrncpy(tstab->str, str, tstab->len + 1);
   tstab->func = func;
   if (tstab->len > num_stab) {
      printf("stab string too long %d. Max is %d\n", tstab->len, num_stab);
      exit(1);
   }
   tstab->next = stab[tstab->len-1];
   stab[tstab->len-1] = tstab;
}
static void add_smap ( char * str , int func ) { stab_t * tstab ; int len ; if ( ! str ) { return ; } len = strlen ( str ) ; if ( len == 0 ) { return ; } tstab = ( stab_t * ) malloc ( sizeof ( stab_t ) ) ; memset ( tstab , 0 , sizeof ( stab_t ) ) ; tstab -> len = len ; tstab -> str = ( char * ) malloc ( tstab -> len + 1 ) ; bstrncpy ( tstab -> str , str , tstab -> len + 1 ) ; tstab -> func = func ; if ( tstab -> len > num_stab ) { printf ( " \n " , tstab -> len , num_stab ) ; exit ( 1 ) ; } tstab -> next = stab [ tstab -> len - 1 ] ; stab [ tstab -> len - 1 ] = tstab ; }
New routine.
New routine .
/*    errmsg("String for func %d is zero length\n", func); */ /* printf("Add_smap tstab=%x len=%d func=%d tstab->next=%x\n\r", tstab, len,
          func, tstab->next); */