history.c
unsigned int hist_last_cnum(void)
{
    // TODO: Retrieve the most recent command number.
    unsigned int index;
    char* cmd = malloc(sizeof(char));
    char* cmd_copy = cmd;
    if(cmd == NULL){
        free(cmd_copy);
        return 0;
    }
    cmd = realloc(cmd, strlen(nexth_fork->cmd)*sizeof(char));
    char* cmd_copy_2 = cmd;
    if(cmd == NULL){
        free(cmd_copy_2);
        return 0;
    }

    index = nexth_fork->index;
    free(cmd_copy_2);
    return index;
}
/** hist_last_cnum
* to find relevant command number using the command history number
* and return the command number
* @ param void 
* @ return command number
 */
hist_last_cnum
to find relevant command number using the command history number
and return the command number
hist_last_cnum to find relevant command number using the command history number and return the command number
unsigned int hist_last_cnum(void)
{
    unsigned int index;
    char* cmd = malloc(sizeof(char));
    char* cmd_copy = cmd;
    if(cmd == NULL){
        free(cmd_copy);
        return 0;
    }
    cmd = realloc(cmd, strlen(nexth_fork->cmd)*sizeof(char));
    char* cmd_copy_2 = cmd;
    if(cmd == NULL){
        free(cmd_copy_2);
        return 0;
    }
    index = nexth_fork->index;
    free(cmd_copy_2);
    return index;
}
unsigned int hist_last_cnum ( void ) { unsigned int index ; char * cmd = malloc ( sizeof ( char ) ) ; char * cmd_copy = cmd ; if ( cmd == NULL ) { free ( cmd_copy ) ; return 0 ; } cmd = realloc ( cmd , strlen ( nexth_fork -> cmd ) * sizeof ( char ) ) ; char * cmd_copy_2 = cmd ; if ( cmd == NULL ) { free ( cmd_copy_2 ) ; return 0 ; } index = nexth_fork -> index ; free ( cmd_copy_2 ) ; return index ; }
hist_last_cnum
to find relevant command number using the command history number
and return the command number
hist_last_cnum to find relevant command number using the command history number and return the command number
// TODO: Retrieve the most recent command number.