{"action":"created","comment":{"url":"https://api.github.com/repos/jjaniec/21sh/pulls/comments/228708717","pull_request_review_id":169051155,"id":228708717,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIyODcwODcxNw==","diff_hunk":"@@ -94,12 +95,58 @@ static void\t\tloop_body(t_shell_vars *vars, t_option *opt_list, t_option **char_o\n \t{\n \t\tif (!(input = get_valid_input(&lex, 0)))\n \t\t\tcontinue ;\n+\t\telse\n+\t\t\tfree_lexemes(lex);\n \t\tif (input != NULL && input[0] != '\\0' && input[0] != '\\n')\n \t\t\tadd_history(input, access_le_main_datas());\n \t\tforty_two_sh(input, vars, opt_list, char_opt_index);\n \t}\n }\n \n+static int\topen_error_print_msg(char *file)\n+{\n+\tft_putstr_fd(SH_NAME\": \", 2);\n+\tft_putstr_fd(file, 2);\n+\tft_putendl_fd(\": No such file or directory\", 2);\n+\treturn (1);\n+}\n+\n+static char\t*read_file(int fd)\n+{\n+\tchar\t*line;\n+\tchar\t*final;\n+\tint\t\tret;\n+\n+\tfinal = ft_strnew(0);\n+\twhile((ret = get_next_line(fd, &line)))\n+\t{\n+\t\tif (ret == -1)\n+\t\t\texit(EXIT_FAILURE);\n+\t\tfinal = ft_strjoin_free(final, line);\n+\t\tfinal = ft_strjoin_free(final, ft_strdup(\"\\n\"));\n+\t}\n+\treturn (final);\n+}\n+\n+static int\tinterpret_file(char **argv, t_option **char_opt_index)\n+{\n+\tint\t\tfd;","path":"srcs/main.c","position":56,"original_position":56,"commit_id":"c6d1269e55019c1ece2df86ceae15b6dedfda319","original_commit_id":"c6d1269e55019c1ece2df86ceae15b6dedfda319","user":{"login":"codacy-bot","id":19940114,"node_id":"MDQ6VXNlcjE5OTQwMTE0","avatar_url":"https://avatars1.githubusercontent.com/u/19940114?v=4","gravatar_id":"","url":"https://api.github.com/users/codacy-bot","html_url":"https://github.com/codacy-bot","followers_url":"https://api.github.com/users/codacy-bot/followers","following_url":"https://api.github.com/users/codacy-bot/following{/other_user}","gists_url":"https://api.github.com/users/codacy-bot/gists{/gist_id}","starred_url":"https://api.github.com/users/codacy-bot/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/codacy-bot/subscriptions","organizations_url":"https://api.github.com/users/codacy-bot/orgs","repos_url":"https://api.github.com/users/codacy-bot/repos","events_url":"https://api.github.com/users/codacy-bot/events{/privacy}","received_events_url":"https://api.github.com/users/codacy-bot/received_events","type":"User","site_admin":false},"body":"![Codacy](https://app.codacy.com/assets/images/favicon.png) Issue found: [The scope of the variable 'fd' can be reduced.](https://app.codacy.com/app/jjaniec/21sh/pullRequest?prid=2352386)","created_at":"2018-10-27T10:38:00Z","updated_at":"2018-10-27T10:38:00Z","html_url":"https://github.com/jjaniec/21sh/pull/43#discussion_r228708717","pull_request_url":"https://api.github.com/repos/jjaniec/21sh/pulls/43","author_association":"NONE","_links":{"self":{"href":"https://api.github.com/repos/jjaniec/21sh/pulls/comments/228708717"},"html":{"href":"https://github.com/jjaniec/21sh/pull/43#discussion_r228708717"},"pull_request":{"href":"https://api.github.com/repos/jjaniec/21sh/pulls/43"}}},"pull_request":{"url":"https://api.github.com/repos/jjaniec/21sh/pulls/43","id":222472774,"node_id":"MDExOlB1bGxSZXF1ZXN0MjIyNDcyNzc0","html_url":"https://github.com/jjaniec/21sh/pull/43","diff_url":"https://github.com/jjaniec/21sh/pull/43.diff","patch_url":"https://github.com/jjaniec/21sh/pull/43.patch","issue_url":"https://api.github.com/repos/jjaniec/21sh/issues/43","number":43,"state":"open","locked":false,"title":"Leaks, fix, break, continue, command not found","user":{"login":"SebastienBruckert","id":25817270,"node_id":"MDQ6VXNlcjI1ODE3Mjcw","avatar_url":"https://avatars2.githubusercontent.com/u/25817270?v=4","gravatar_id":"","url":"https://api.github.com/users/SebastienBruckert","html_url":"https://github.com/SebastienBruckert","followers_url":"https://api.github.com/users/SebastienBruckert/followers","following_url":"https://api.github.com/users/SebastienBruckert/following{/other_user}","gists_url":"https://api.github.com/users/SebastienBruckert/gists{/gist_id}","starred_url":"https://api.github.com/users/SebastienBruckert/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SebastienBruckert/subscriptions","organizations_url":"https://api.github.com/users/SebastienBruckert/orgs","repos_url":"https://api.github.com/users/SebastienBruckert/repos","events_url":"https://api.github.com/users/SebastienBruckert/events{/privacy}","received_events_url":"https://api.github.com/users/SebastienBruckert/received_events","type":"User","site_admin":false},"body":"Remove a lot of leaks.\r\nChange leaking get_next_line from cyfermie by sbrucker's one, which doesn't leak 8).\r\nAdd comments with the `#`.\r\nAdd the possibility to load and execute a file, if it is as an argument and if the flac `-c` is not activated. No interactive mode when executing from a file. Only works with one file.\r\nAdd shebang support.\r\nAdd `break` and `continue` statement. If not in a loop, they do nothing.\r\nWhen a command is not found, set the return value on `-1`.\r\nAdd the shell script support with subprompt newline","created_at":"2018-10-12T13:48:30Z","updated_at":"2018-10-27T10:38:00Z","closed_at":null,"merged_at":null,"merge_commit_sha":"df774747a9bca6f7e103101c205048c004285a5c","assignee":{"login":"SebastienBruckert","id":25817270,"node_id":"MDQ6VXNlcjI1ODE3Mjcw","avatar_url":"https://avatars2.githubusercontent.com/u/25817270?v=4","gravatar_id":"","url":"https://api.github.com/users/SebastienBruckert","html_url":"https://github.com/SebastienBruckert","followers_url":"https://api.github.com/users/SebastienBruckert/followers","following_url":"https://api.github.com/users/SebastienBruckert/following{/other_user}","gists_url":"https://api.github.com/users/SebastienBruckert/gists{/gist_id}","starred_url":"https://api.github.com/users/SebastienBruckert/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SebastienBruckert/subscriptions","organizations_url":"https://api.github.com/users/SebastienBruckert/orgs","repos_url":"https://api.github.com/users/SebastienBruckert/repos","events_url":"https://api.github.com/users/SebastienBruckert/events{/privacy}","received_events_url":"https://api.github.com/users/SebastienBruckert/received_events","type":"User","site_admin":false},"assignees":[{"login":"SebastienBruckert","id":25817270,"node_id":"MDQ6VXNlcjI1ODE3Mjcw","avatar_url":"https://avatars2.githubusercontent.com/u/25817270?v=4","gravatar_id":"","url":"https://api.github.com/users/SebastienBruckert","html_url":"https://github.com/SebastienBruckert","followers_url":"https://api.github.com/users/SebastienBruckert/followers","following_url":"https://api.github.com/users/SebastienBruckert/following{/other_user}","gists_url":"https://api.github.com/users/SebastienBruckert/gists{/gist_id}","starred_url":"https://api.github.com/users/SebastienBruckert/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SebastienBruckert/subscriptions","organizations_url":"https://api.github.com/users/SebastienBruckert/orgs","repos_url":"https://api.github.com/users/SebastienBruckert/repos","events_url":"https://api.github.com/users/SebastienBruckert/events{/privacy}","received_events_url":"https://api.github.com/users/SebastienBruckert/received_events","type":"User","site_admin":false}],"requested_reviewers":[{"login":"cgaspart","id":33488209,"node_id":"MDQ6VXNlcjMzNDg4MjA5","avatar_url":"https://avatars2.githubusercontent.com/u/33488209?v=4","gravatar_id":"","url":"https://api.github.com/users/cgaspart","html_url":"https://github.com/cgaspart","followers_url":"https://api.github.com/users/cgaspart/followers","following_url":"https://api.github.com/users/cgaspart/following{/other_user}","gists_url":"https://api.github.com/users/cgaspart/gists{/gist_id}","starred_url":"https://api.github.com/users/cgaspart/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cgaspart/subscriptions","organizations_url":"https://api.github.com/users/cgaspart/orgs","repos_url":"https://api.github.com/users/cgaspart/repos","events_url":"https://api.github.com/users/cgaspart/events{/privacy}","received_events_url":"https://api.github.com/users/cgaspart/received_events","type":"User","site_admin":false}],"requested_teams":[],"labels":[{"id":1031952932,"node_id":"MDU6TGFiZWwxMDMxOTUyOTMy","url":"https://api.github.com/repos/jjaniec/21sh/labels/Bug%20Fix","name":"Bug Fix","color":"c2e0c6","default":false},{"id":934078151,"node_id":"MDU6TGFiZWw5MzQwNzgxNTE=","url":"https://api.github.com/repos/jjaniec/21sh/labels/enhancement","name":"enhancement","color":"a2eeef","default":true}],"milestone":null,"commits_url":"https://api.github.com/repos/jjaniec/21sh/pulls/43/commits","review_comments_url":"https://api.github.com/repos/jjaniec/21sh/pulls/43/comments","review_comment_url":"https://api.github.com/repos/jjaniec/21sh/pulls/comments{/number}","comments_url":"https://api.github.com/repos/jjaniec/21sh/issues/43/comments","statuses_url":"https://api.github.com/repos/jjaniec/21sh/statuses/c6d1269e55019c1ece2df86ceae15b6dedfda319","head":{"label":"jjaniec:break_continue","ref":"break_continue","sha":"c6d1269e55019c1ece2df86ceae15b6dedfda319","user":{"login":"jjaniec","id":16088893,"node_id":"MDQ6VXNlcjE2MDg4ODkz","avatar_url":"https://avatars2.githubusercontent.com/u/16088893?v=4","gravatar_id":"","url":"https://api.github.com/users/jjaniec","html_url":"https://github.com/jjaniec","followers_url":"https://api.github.com/users/jjaniec/followers","following_url":"https://api.github.com/users/jjaniec/following{/other_user}","gists_url":"https://api.github.com/users/jjaniec/gists{/gist_id}","starred_url":"https://api.github.com/users/jjaniec/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jjaniec/subscriptions","organizations_url":"https://api.github.com/users/jjaniec/orgs","repos_url":"https://api.github.com/users/jjaniec/repos","events_url":"https://api.github.com/users/jjaniec/events{/privacy}","received_events_url":"https://api.github.com/users/jjaniec/received_events","type":"User","site_admin":false},"repo":{"id":133548605,"node_id":"MDEwOlJlcG9zaXRvcnkxMzM1NDg2MDU=","name":"21sh","full_name":"jjaniec/21sh","private":false,"owner":{"login":"jjaniec","id":16088893,"node_id":"MDQ6VXNlcjE2MDg4ODkz","avatar_url":"https://avatars2.githubusercontent.com/u/16088893?v=4","gravatar_id":"","url":"https://api.github.com/users/jjaniec","html_url":"https://github.com/jjaniec","followers_url":"https://api.github.com/users/jjaniec/followers","following_url":"https://api.github.com/users/jjaniec/following{/other_user}","gists_url":"https://api.github.com/users/jjaniec/gists{/gist_id}","starred_url":"https://api.github.com/users/jjaniec/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jjaniec/subscriptions","organizations_url":"https://api.github.com/users/jjaniec/orgs","repos_url":"https://api.github.com/users/jjaniec/repos","events_url":"https://api.github.com/users/jjaniec/events{/privacy}","received_events_url":"https://api.github.com/users/jjaniec/received_events","type":"User","site_admin":false},"html_url":"https://github.com/jjaniec/21sh","description":"Our own shell - wip","fork":false,"url":"https://api.github.com/repos/jjaniec/21sh","forks_url":"https://api.github.com/repos/jjaniec/21sh/forks","keys_url":"https://api.github.com/repos/jjaniec/21sh/keys{/key_id}","collaborators_url":"https://api.github.com/repos/jjaniec/21sh/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/jjaniec/21sh/teams","hooks_url":"https://api.github.com/repos/jjaniec/21sh/hooks","issue_events_url":"https://api.github.com/repos/jjaniec/21sh/issues/events{/number}","events_url":"https://api.github.com/repos/jjaniec/21sh/events","assignees_url":"https://api.github.com/repos/jjaniec/21sh/assignees{/user}","branches_url":"https://api.github.com/repos/jjaniec/21sh/branches{/branch}","tags_url":"https://api.github.com/repos/jjaniec/21sh/tags","blobs_url":"https://api.github.com/repos/jjaniec/21sh/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/jjaniec/21sh/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/jjaniec/21sh/git/refs{/sha}","trees_url":"https://api.github.com/repos/jjaniec/21sh/git/trees{/sha}","statuses_url":"https://api.github.com/repos/jjaniec/21sh/statuses/{sha}","languages_url":"https://api.github.com/repos/jjaniec/21sh/languages","stargazers_url":"https://api.github.com/repos/jjaniec/21sh/stargazers","contributors_url":"https://api.github.com/repos/jjaniec/21sh/contributors","subscribers_url":"https://api.github.com/repos/jjaniec/21sh/subscribers","subscription_url":"https://api.github.com/repos/jjaniec/21sh/subscription","commits_url":"https://api.github.com/repos/jjaniec/21sh/commits{/sha}","git_commits_url":"https://api.github.com/repos/jjaniec/21sh/git/commits{/sha}","comments_url":"https://api.github.com/repos/jjaniec/21sh/comments{/number}","issue_comment_url":"https://api.github.com/repos/jjaniec/21sh/issues/comments{/number}","contents_url":"https://api.github.com/repos/jjaniec/21sh/contents/{+path}","compare_url":"https://api.github.com/repos/jjaniec/21sh/compare/{base}...{head}","merges_url":"https://api.github.com/repos/jjaniec/21sh/merges","archive_url":"https://api.github.com/repos/jjaniec/21sh/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/jjaniec/21sh/downloads","issues_url":"https://api.github.com/repos/jjaniec/21sh/issues{/number}","pulls_url":"https://api.github.com/repos/jjaniec/21sh/pulls{/number}","milestones_url":"https://api.github.com/repos/jjaniec/21sh/milestones{/number}","notifications_url":"https://api.github.com/repos/jjaniec/21sh/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/jjaniec/21sh/labels{/name}","releases_url":"https://api.github.com/repos/jjaniec/21sh/releases{/id}","deployments_url":"https://api.github.com/repos/jjaniec/21sh/deployments","created_at":"2018-05-15T17:10:47Z","updated_at":"2018-10-24T18:24:28Z","pushed_at":"2018-10-27T10:35:06Z","git_url":"git://github.com/jjaniec/21sh.git","ssh_url":"git@github.com:jjaniec/21sh.git","clone_url":"https://github.com/jjaniec/21sh.git","svn_url":"https://github.com/jjaniec/21sh","homepage":"","size":2909,"stargazers_count":3,"watchers_count":3,"language":"C","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"archived":false,"open_issues_count":2,"license":null,"forks":1,"open_issues":2,"watchers":3,"default_branch":"develop"}},"base":{"label":"jjaniec:develop","ref":"develop","sha":"434259574e2b54f3c3cd329544778ffd64414a40","user":{"login":"jjaniec","id":16088893,"node_id":"MDQ6VXNlcjE2MDg4ODkz","avatar_url":"https://avatars2.githubusercontent.com/u/16088893?v=4","gravatar_id":"","url":"https://api.github.com/users/jjaniec","html_url":"https://github.com/jjaniec","followers_url":"https://api.github.com/users/jjaniec/followers","following_url":"https://api.github.com/users/jjaniec/following{/other_user}","gists_url":"https://api.github.com/users/jjaniec/gists{/gist_id}","starred_url":"https://api.github.com/users/jjaniec/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jjaniec/subscriptions","organizations_url":"https://api.github.com/users/jjaniec/orgs","repos_url":"https://api.github.com/users/jjaniec/repos","events_url":"https://api.github.com/users/jjaniec/events{/privacy}","received_events_url":"https://api.github.com/users/jjaniec/received_events","type":"User","site_admin":false},"repo":{"id":133548605,"node_id":"MDEwOlJlcG9zaXRvcnkxMzM1NDg2MDU=","name":"21sh","full_name":"jjaniec/21sh","private":false,"owner":{"login":"jjaniec","id":16088893,"node_id":"MDQ6VXNlcjE2MDg4ODkz","avatar_url":"https://avatars2.githubusercontent.com/u/16088893?v=4","gravatar_id":"","url":"https://api.github.com/users/jjaniec","html_url":"https://github.com/jjaniec","followers_url":"https://api.github.com/users/jjaniec/followers","following_url":"https://api.github.com/users/jjaniec/following{/other_user}","gists_url":"https://api.github.com/users/jjaniec/gists{/gist_id}","starred_url":"https://api.github.com/users/jjaniec/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jjaniec/subscriptions","organizations_url":"https://api.github.com/users/jjaniec/orgs","repos_url":"https://api.github.com/users/jjaniec/repos","events_url":"https://api.github.com/users/jjaniec/events{/privacy}","received_events_url":"https://api.github.com/users/jjaniec/received_events","type":"User","site_admin":false},"html_url":"https://github.com/jjaniec/21sh","description":"Our own shell - wip","fork":false,"url":"https://api.github.com/repos/jjaniec/21sh","forks_url":"https://api.github.com/repos/jjaniec/21sh/forks","keys_url":"https://api.github.com/repos/jjaniec/21sh/keys{/key_id}","collaborators_url":"https://api.github.com/repos/jjaniec/21sh/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/jjaniec/21sh/teams","hooks_url":"https://api.github.com/repos/jjaniec/21sh/hooks","issue_events_url":"https://api.github.com/repos/jjaniec/21sh/issues/events{/number}","events_url":"https://api.github.com/repos/jjaniec/21sh/events","assignees_url":"https://api.github.com/repos/jjaniec/21sh/assignees{/user}","branches_url":"https://api.github.com/repos/jjaniec/21sh/branches{/branch}","tags_url":"https://api.github.com/repos/jjaniec/21sh/tags","blobs_url":"https://api.github.com/repos/jjaniec/21sh/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/jjaniec/21sh/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/jjaniec/21sh/git/refs{/sha}","trees_url":"https://api.github.com/repos/jjaniec/21sh/git/trees{/sha}","statuses_url":"https://api.github.com/repos/jjaniec/21sh/statuses/{sha}","languages_url":"https://api.github.com/repos/jjaniec/21sh/languages","stargazers_url":"https://api.github.com/repos/jjaniec/21sh/stargazers","contributors_url":"https://api.github.com/repos/jjaniec/21sh/contributors","subscribers_url":"https://api.github.com/repos/jjaniec/21sh/subscribers","subscription_url":"https://api.github.com/repos/jjaniec/21sh/subscription","commits_url":"https://api.github.com/repos/jjaniec/21sh/commits{/sha}","git_commits_url":"https://api.github.com/repos/jjaniec/21sh/git/commits{/sha}","comments_url":"https://api.github.com/repos/jjaniec/21sh/comments{/number}","issue_comment_url":"https://api.github.com/repos/jjaniec/21sh/issues/comments{/number}","contents_url":"https://api.github.com/repos/jjaniec/21sh/contents/{+path}","compare_url":"https://api.github.com/repos/jjaniec/21sh/compare/{base}...{head}","merges_url":"https://api.github.com/repos/jjaniec/21sh/merges","archive_url":"https://api.github.com/repos/jjaniec/21sh/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/jjaniec/21sh/downloads","issues_url":"https://api.github.com/repos/jjaniec/21sh/issues{/number}","pulls_url":"https://api.github.com/repos/jjaniec/21sh/pulls{/number}","milestones_url":"https://api.github.com/repos/jjaniec/21sh/milestones{/number}","notifications_url":"https://api.github.com/repos/jjaniec/21sh/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/jjaniec/21sh/labels{/name}","releases_url":"https://api.github.com/repos/jjaniec/21sh/releases{/id}","deployments_url":"https://api.github.com/repos/jjaniec/21sh/deployments","created_at":"2018-05-15T17:10:47Z","updated_at":"2018-10-24T18:24:28Z","pushed_at":"2018-10-27T10:35:06Z","git_url":"git://github.com/jjaniec/21sh.git","ssh_url":"git@github.com:jjaniec/21sh.git","clone_url":"https://github.com/jjaniec/21sh.git","svn_url":"https://github.com/jjaniec/21sh","homepage":"","size":2909,"stargazers_count":3,"watchers_count":3,"language":"C","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"archived":false,"open_issues_count":2,"license":null,"forks":1,"open_issues":2,"watchers":3,"default_branch":"develop"}},"_links":{"self":{"href":"https://api.github.com/repos/jjaniec/21sh/pulls/43"},"html":{"href":"https://github.com/jjaniec/21sh/pull/43"},"issue":{"href":"https://api.github.com/repos/jjaniec/21sh/issues/43"},"comments":{"href":"https://api.github.com/repos/jjaniec/21sh/issues/43/comments"},"review_comments":{"href":"https://api.github.com/repos/jjaniec/21sh/pulls/43/comments"},"review_comment":{"href":"https://api.github.com/repos/jjaniec/21sh/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/jjaniec/21sh/pulls/43/commits"},"statuses":{"href":"https://api.github.com/repos/jjaniec/21sh/statuses/c6d1269e55019c1ece2df86ceae15b6dedfda319"}},"author_association":"COLLABORATOR"}}
{"actor":{"display_login":"codacy-bot"}}