mirror of
https://github.com/Savapitech/42sh.git
synced 2026-01-18 16:57:28 +01:00
26 lines
562 B
C
26 lines
562 B
C
/*
|
|
** EPITECH PROJECT, 2025
|
|
** 42sh
|
|
** File description:
|
|
** history
|
|
*/
|
|
|
|
#include <stdio.h>
|
|
|
|
#include "common.h"
|
|
#include "exec.h"
|
|
|
|
int builtins_history(ef_t *ef, char **args __attribute__((unused)))
|
|
{
|
|
his_command_t *cmd_history = ef->exec_ctx->history_command;
|
|
|
|
for (int i = 0; i < cmd_history->sz; i++){
|
|
if (cmd_history[i].arg) {
|
|
printf("%d %s %s\n", i + 1, cmd_history[i].command,
|
|
cmd_history[i].arg);
|
|
} else
|
|
printf("%d %s\n", i + 1, cmd_history[i].command);
|
|
}
|
|
return RETURN_SUCCESS;
|
|
}
|