Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions inc/main.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
/* By: ttsubo <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2025/04/03 12:50:38 by ttsubo #+# #+# */
/* Updated: 2025/04/25 18:16:36 by ttsubo ### ########.fr */
/* Updated: 2025/04/27 16:28:37 by ttsubo ### ########.fr */
/* */
/* ************************************************************************** */

Expand Down Expand Up @@ -36,6 +36,4 @@
# include <stdlib.h>
# include <unistd.h>

t_cmd *parse_command_line(char *line);

#endif
25 changes: 0 additions & 25 deletions src/debug.c

This file was deleted.

34 changes: 3 additions & 31 deletions src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,38 +6,12 @@
/* By: ttsubo <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2025/04/03 12:50:11 by ttsubo #+# #+# */
/* Updated: 2025/04/25 18:19:42 by ttsubo ### ########.fr */
/* Updated: 2025/04/27 16:33:43 by ttsubo ### ########.fr */
/* */
/* ************************************************************************** */

#include "main.h"

/**
* @brief debug用 cmdを表示します。 後で削除予定。
*
* @param tokens
*/
static void _dbg_show_cmd(t_cmd **cmds)
{
size_t cmd_i;
size_t arg_i;

cmd_i = 0;
printf("DEBUG: show cmds\n");
while (cmds[cmd_i])
{
arg_i = 0;
printf("cmd[%zu]\n", cmd_i);
printf("\tcmd->type=%d\n", cmds[cmd_i]->type);
printf("\tcmd->argc=%d\n", cmds[cmd_i]->argc);
printf("\tcmd->argv=[");
while (cmds[cmd_i]->argv[arg_i])
printf("%s,", cmds[cmd_i]->argv[arg_i++]);
printf("NULL]\n");
cmd_i++;
}
}

static void _free_tokens(char **tokens)
{
int i;
Expand All @@ -59,9 +33,8 @@ static void destroy_minish(t_minish *minish)
}

/**
* @brief bool型が利用できるみたいなので、使用してみました。
* @brief parse_command_lineのプロトタイプを勝手に作成しているので、好きなように改変していただいて大丈夫です
* @param program_nam
* @brief I used bool type since it seems to be available.
* @param program_name
* @param minish
* @return true
* @return false
Expand All @@ -88,7 +61,6 @@ static bool prompt(char *program_name, t_minish *minish, int *status)
}
if (cmds[0]->argc > 0)
*status = invoke_commands(cmds[0], minish);
_dbg_show_cmd(cmds);
_free_tokens(tokens);
free_cmds(cmds, cmds_len(cmds));
free(line);
Expand Down