Skip to content

add sasa.c#15

Open
sasai3 wants to merge 2 commits into
sfc-arch:masterfrom
sasai3:master
Open

add sasa.c#15
sasai3 wants to merge 2 commits into
sfc-arch:masterfrom
sasai3:master

Conversation

@sasai3
Copy link
Copy Markdown

@sasai3 sasai3 commented Dec 27, 2018

No description provided.

笹井 雄貴 and others added 2 commits December 27, 2018 20:11
Comment thread cat/sasa.c
int fdescript;
ssize_t readbytes;
ssize_t writebytes;
char buf[1024];
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1024 みたいなマジックナンバーはstatic const#defineにしたいね

Comment thread cat/sasa.c

int main(int argc, char * argv[]){
int fdescript;
ssize_t readbytes;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

どうでもいいけどタブとスペースが混ざっている気がする

Comment thread cat/sasa.c
fdescript = open(argv[i], O_RDONLY);
if (fdescript == -1)
continue;
}
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

インデントが揃っていなくてわかりにくいけど、"引数を複数指定したら最初に開けたファイルを出力する"という仕様になっているっぽい?
オリジナルのcatの仕様(となぜcatという名前がついているか)を確認してみるといいかも

Comment thread cat/sasa.c
writebytes = write(1,buf,readbytes);
} else if (readbytes == 0) {
close(fdescript);
writebytes = write(1,"\n",1);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

writebytesは代入しているけど使っていないのかな?
書き込み失敗した時のエラーハンドリングもしたいところですね

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants