history.c
unsigned int hist_search_downkey(unsigned int match_index, char *prefix)
{
  //char *cmd;
  struct fork_list_struct* curr_fork = nexth_fork;
  //LOG("prefix: %s\n", prefix);
  //LOG("match_index before calculation: %d\n", match_index);
  while (curr_fork != NULL) {
    if(strncmp(curr_fork->cmd, prefix, strlen(prefix)-1) == 0){// && curr_fork->index >= (int)match_index) {
      //cmd = realloc(cmd, strlen(curr_fork->cmd)*sizeof(char));

      match_index = (unsigned int)curr_fork->index;
      //LOG("match_index after calculation: %d\n", match_index);
      //LOG("cmd after calculation: %s\n", curr_fork->cmd);
      return match_index;
    }
    curr_fork = curr_fork->next_fork;
    //LOG("next: %d\n", curr_fork->index);
    //LOG("next: %s\n", curr_fork->cmd);
  }
  return 0;
}
/** hist_search_downkey
* to search and find the specific commannd index
* @ param match_index
* @ param prefix
* @ return void
 */
hist_search_downkey
to search and find the specific commannd index
hist_search_downkey to search and find the specific commannd index
unsigned int hist_search_downkey(unsigned int match_index, char *prefix)
{
  struct fork_list_struct* curr_fork = nexth_fork;
  while (curr_fork != NULL) {
    if(strncmp(curr_fork->cmd, prefix, strlen(prefix)-1) == 0){
      match_index = (unsigned int)curr_fork->index;
      return match_index;
    }
    curr_fork = curr_fork->next_fork;
  }
  return 0;
}
unsigned int hist_search_downkey ( unsigned int match_index , char * prefix ) { struct fork_list_struct * curr_fork = nexth_fork ; while ( curr_fork != NULL ) { if ( strncmp ( curr_fork -> cmd , prefix , strlen ( prefix ) - 1 ) == 0 ) { match_index = ( unsigned int ) curr_fork -> index ; return match_index ; } curr_fork = curr_fork -> next_fork ; } return 0 ; }
hist_search_downkey
to search and find the specific commannd index
hist_search_downkey to search and find the specific commannd index
//char *cmd; //LOG("prefix: %s\n", prefix); //LOG("match_index before calculation: %d\n", match_index); // && curr_fork->index >= (int)match_index) { //cmd = realloc(cmd, strlen(curr_fork->cmd)*sizeof(char)); //LOG("match_index after calculation: %d\n", match_index); //LOG("cmd after calculation: %s\n", curr_fork->cmd); //LOG("next: %d\n", curr_fork->index); //LOG("next: %s\n", curr_fork->cmd);