Giter VIP home page Giter VIP logo

minishell's Introduction

github-user-contribution2

minishell's People

Contributors

risudo avatar ryojiroakiyama avatar

Stargazers

 avatar

Watchers

 avatar

minishell's Issues

コメント書く

ファイルごと、場合によっては関数ごとにコメント書く
コメントの形式は

/*
** 説明
*/

これで統一したいと思ってます
関数ごとに書くのはめんどくさそうなので基本はファイルごとで、説明が必要そうな関数、重要な関数はその上に

/*
** param (int param1)引数の説明
** param (int param2)引数の説明
** return 戻り値の説明
** 関数の説明
*/

みたいな感じで書きたいと思います

in_fdとout_fdの削除

minishell.h内のin_fdとout_fdを削除する

@ryojiroakiyama
自分の方で消しちゃって大丈夫ですか?あきやまさんのファイルの方はもう消したんでしたっけ。

変数展開時の区切り文字の判定を修正する

環境変数の終わりの判定の仕方を修正します。

bool	is_delimiter(char c)
{
	if (c == ' ' || c == '$' || c == '\"' || c == '\'' || c == '\0')
		return (true);
	else
		return (false);
}

この関数をアルファベット、数字、アンバーバー以外ならtrueを返すようにすればよさそう

実行可能ファイルが現れるまで実行ファイルを探します。

今までは、ビルトイン以外コマンドのパス検索(存在する名前なのか、ファイルなのか)に関して
PATHの頭から検索して、先に見つかったファイルを実行させていましたが、さらに実行可能ファイルかまで条件を絞ります。

変更ファイル

  • wrapper3.c
  • command_nonbuiltin.c
  • struct.h
  • Makefile
  • execute.h

ヘッダーとファイル整理

  • minishell.hの型名などの整理
  • コマンド実行関係のファイル名整理やnorm対応
  • echoの空白出力対応
    など変更します。

catバグる

$ cat outfile

の場合、

cmdlist[0] "cat"
cmdlist[1] "outfile"
cmdlist[2] ""

になってる。
原因不明。

子プロセスSEGVなどのエラー出力

セグフォする実行ファイルa.outを実行すると

current

  • execveの終了ステータスを見る
  • シグナルで終わっていることを確認
  • 終了ステータスを設定

ideal

  • execveの終了ステータスを見る
  • シグナルで終わっていることを確認
  • シグナルの種類を判定して, 適切なエラー内容を出力(ただbashはstderr以外で出力してるらしく詳しくは謎)
    WTERMSIG(wstatus)==SEGVなどの条件分岐で実装
  • 終了ステータスを設定

$ ./a.out
minishell: segmentation fault  ./a.out    //<-ここ追加
$ echo $?
139

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.