history.c
int hist_search_index_prefix(char *prefix)
{
    // TODO: Retrieves the most recent command starting with 'prefix', or NULL
    // if no match found.
  struct fork_list_struct* curr_fork = nexth_fork;
  while (curr_fork != NULL) {
    if(strncmp(curr_fork->cmd, prefix, strlen(prefix)-1) == 0) {
      //cmd = realloc(cmd, strlen(curr_fork->cmd)*sizeof(char));
      int match_index = curr_fork->index;
      return match_index;
    }
    curr_fork = curr_fork->next_fork;
    //LOG("next: %d\n", curr_fork->index);
    //LOG("next: %s\n", curr_fork->cmd);
  }
  return -1;
}
/** hist_search_index_prefix
* to search and find the specific commannd
* @ param command
* @ return void
 */
hist_search_index_prefix
to search and find the specific commannd
hist_search_index_prefix to search and find the specific commannd
int hist_search_index_prefix(char *prefix)
{
  struct fork_list_struct* curr_fork = nexth_fork;
  while (curr_fork != NULL) {
    if(strncmp(curr_fork->cmd, prefix, strlen(prefix)-1) == 0) {
      int match_index = curr_fork->index;
      return match_index;
    }
    curr_fork = curr_fork->next_fork;
  }
  return -1;
}
int hist_search_index_prefix ( char * prefix ) { struct fork_list_struct * curr_fork = nexth_fork ; while ( curr_fork != NULL ) { if ( strncmp ( curr_fork -> cmd , prefix , strlen ( prefix ) - 1 ) == 0 ) { int match_index = curr_fork -> index ; return match_index ; } curr_fork = curr_fork -> next_fork ; } return -1 ; }
hist_search_index_prefix
to search and find the specific commannd
hist_search_index_prefix to search and find the specific commannd
// TODO: Retrieves the most recent command starting with 'prefix', or NULL // if no match found. //cmd = realloc(cmd, strlen(curr_fork->cmd)*sizeof(char)); //LOG("next: %d\n", curr_fork->index); //LOG("next: %s\n", curr_fork->cmd);