{"id":18347362,"url":"https://github.com/dcavalei/exam-rank-04-microshell","last_synced_at":"2026-02-04T12:36:23.146Z","repository":{"id":49788223,"uuid":"450544901","full_name":"dcavalei/exam-rank-04-microshell","owner":"dcavalei","description":"My code for microshell exam","archived":false,"fork":false,"pushed_at":"2022-01-21T15:47:39.000Z","size":2,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-07-13T23:35:18.213Z","etag":null,"topics":["42","42born2code","42lisboa","c","microshell"],"latest_commit_sha":null,"homepage":"","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dcavalei.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-01-21T15:34:25.000Z","updated_at":"2024-08-17T07:34:24.000Z","dependencies_parsed_at":"2022-09-02T14:01:55.241Z","dependency_job_id":null,"html_url":"https://github.com/dcavalei/exam-rank-04-microshell","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/dcavalei/exam-rank-04-microshell","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dcavalei%2Fexam-rank-04-microshell","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dcavalei%2Fexam-rank-04-microshell/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dcavalei%2Fexam-rank-04-microshell/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dcavalei%2Fexam-rank-04-microshell/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dcavalei","download_url":"https://codeload.github.com/dcavalei/exam-rank-04-microshell/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dcavalei%2Fexam-rank-04-microshell/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29084400,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-04T03:31:03.593Z","status":"ssl_error","status_checked_at":"2026-02-04T03:29:50.742Z","response_time":62,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["42","42born2code","42lisboa","c","microshell"],"created_at":"2024-11-05T21:13:50.653Z","updated_at":"2026-02-04T12:36:23.131Z","avatar_url":"https://github.com/dcavalei.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# exam-rank-04-microshell\n\n**Assignment name**  : microshell\n\n**Expected files**   : *.c *.h\n\n**Allowed functions**:\n* malloc, free, write, close, fork,\n* waitpid, signal, kill, exit, chdir,\n* execve, dup, dup2, pipe, strcmp, strncmp\n--------------------------------------------------------------------------------------\n\n## Write a program that will behave like executing a shell command\n- The command line to execute will be the arguments of this program\n- Executable's path will be absolute or relative but your program must not build a path (from the PATH variable for example)\n- You must implement \"|\" and \";\" like in bash\n\t- we will never try a \"|\" immediately followed or preceded by nothing or \"|\" or \";\"\n- Your program must implement the built-in command cd only with a path as argument (no '-' or without parameters)\n\t- if cd has the wrong number of argument your program should print in STDERR \"error: cd: bad arguments\" followed by a '\\n'\n\t- if cd failed your program should print in STDERR \"error: cd: cannot change directory to path_to_change\" followed by a '\\n' with path_to_change replaced by the argument to cd\n\t- a cd command will never be immediately followed or preceded by a \"|\"\n- You don't need to manage any type of wildcards (*, ~ etc...)\n- You don't need to manage environment variables ($BLA ...)\n- If a system call, except execve and chdir, returns an error your program should immediatly print \"error: fatal\" in STDERR followed by a '\\n' and the program should exit\n- If execve failed you should print \"error: cannot execute executable_that_failed\" in STDERR followed by a '\\n' with executable_that_failed replaced with the path of the failed executable (It should be the first argument of execve)\n- Your program should be able to manage more than hundreds of \"|\" even if we limit the number of \"open files\" to less than 30.\n--------------------------------------------------------------------------------------\n## for example this should work:\n```bash\n$ ./microshell /bin/ls \"|\" /usr/bin/grep microshell \";\" /bin/echo i love my microshell\nmicroshell\ni love my microshell\n$\n```\nHints:\n\nDon't forget to pass the environment variable to execve\n\nHints:\n\nDo not leak file descriptors!\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdcavalei%2Fexam-rank-04-microshell","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdcavalei%2Fexam-rank-04-microshell","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdcavalei%2Fexam-rank-04-microshell/lists"}