{"id":13451555,"url":"https://github.com/ryanmjacobs/c","last_synced_at":"2025-10-21T04:56:16.376Z","repository":{"id":28031193,"uuid":"31526549","full_name":"ryanmjacobs/c","owner":"ryanmjacobs","description":"Compile and execute C \"scripts\" in one go!","archived":false,"fork":false,"pushed_at":"2025-10-06T18:34:47.000Z","size":163,"stargazers_count":2146,"open_issues_count":14,"forks_count":187,"subscribers_count":79,"default_branch":"master","last_synced_at":"2025-10-12T07:53:26.541Z","etag":null,"topics":["c","clang","cli","compiler","cpp","gcc","script","tcc"],"latest_commit_sha":null,"homepage":"","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ryanmjacobs.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2015-03-02T06:31:32.000Z","updated_at":"2025-10-06T18:34:52.000Z","dependencies_parsed_at":"2022-09-24T17:57:37.903Z","dependency_job_id":"80590d34-7d0a-4987-ba46-7002d783baa0","html_url":"https://github.com/ryanmjacobs/c","commit_stats":{"total_commits":193,"total_committers":17,"mean_commits":"11.352941176470589","dds":"0.20207253886010368","last_synced_commit":"06772218f1dbe1588bd614145ee9a05a14987b70"},"previous_names":[],"tags_count":16,"template":false,"template_full_name":null,"purl":"pkg:github/ryanmjacobs/c","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ryanmjacobs%2Fc","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ryanmjacobs%2Fc/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ryanmjacobs%2Fc/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ryanmjacobs%2Fc/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ryanmjacobs","download_url":"https://codeload.github.com/ryanmjacobs/c/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ryanmjacobs%2Fc/sbom","scorecard":{"id":792225,"data":{"date":"2025-08-11","repo":{"name":"github.com/ryanmjacobs/c","commit":"7cdc09e69d2f7fc49f70c80c565aa09b19e666db"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3.9,"checks":[{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Code-Review","score":1,"reason":"Found 4/26 approved changesets -- score normalized to 1","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Dangerous-Workflow","score":10,"reason":"no dangerous workflow patterns detected","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Token-Permissions","score":0,"reason":"detected GitHub workflow tokens with excessive permissions","details":["Warn: no topLevel permission defined: .github/workflows/ci.yml:1","Info: no jobLevel write permissions found"],"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Pinned-Dependencies","score":0,"reason":"dependency not pinned by hash detected -- score normalized to 0","details":["Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yml:12: update your workflow using https://app.stepsecurity.io/secureworkflow/ryanmjacobs/c/ci.yml/master?enable=pin","Info:   0 out of   1 GitHub-owned GitHubAction dependencies pinned"],"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":-1,"reason":"internal error: error during branchesHandler.setup: internal error: githubv4.Query: Resource not accessible by integration","details":null,"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 8 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}}]},"last_synced_at":"2025-08-23T07:53:03.349Z","repository_id":28031193,"created_at":"2025-08-23T07:53:03.349Z","updated_at":"2025-08-23T07:53:03.349Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":280207209,"owners_count":26290616,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-21T02:00:06.614Z","response_time":58,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["c","clang","cli","compiler","cpp","gcc","script","tcc"],"created_at":"2024-07-31T07:00:55.781Z","updated_at":"2025-10-21T04:56:16.347Z","avatar_url":"https://github.com/ryanmjacobs.png","language":"Shell","readme":"# c\n\n\u003c!--\n[![Build Status](https://travis-ci.org/ryanmjacobs/c.svg)](https://travis-ci.org/ryanmjacobs/c)\n--\u003e\n\n\u003e \"There isn't much that's special about C. That's one of the reasons why it's\nfast.\"\n\nI love C for its raw speed (although it does have its drawbacks). We should\nall write more C.\n\nWith this shell script, you can compile and execute C \"scripts\" in one go!\n\n(Oh yeah, and it works for C++ too.)\n\n![GIF Demo](http://i.imgur.com/aWnG03r.gif)\n\nHere's a simple example:\n```c\n#include \u003cstdio.h\u003e\n\nint main(void) {\n    printf(\"Hello World!\\n\");\n    return 0;\n}\n```\n\nRun it by typing:\n```bash\n$ c hello.c\nHello World!\n```\n\nOr, call it from the shebang!\n```c\n#!/usr/bin/c\n#include \u003cstdio.h\u003e\n\nint main(void) {\n    printf(\"Hello World!\\n\");\n    return 0;\n}\n```\n```bash\n$ chmod +x hello.c\n$ ./hello.c\nHello World!\n```\n\n## Hooked? Here's how to install it:\nUse a package manager? [Check here](https://github.com/ryanmjacobs/c#packages).\n\nFor the entire system:\n```bash\n$ wget https://raw.githubusercontent.com/ryanmjacobs/c/master/c\n$ sudo install -m 755 c /usr/bin/c\n\n# Or... for systems that prefer /usr/local/bin (e.g. macOS)\n$ sudo install -m 755 c /usr/local/bin/c\n```\n\nFor your local user only:\n```bash\n$ wget https://raw.githubusercontent.com/ryanmjacobs/c/master/c\n$ sudo install -Dm 755 c ~/.bin/c\n$ echo 'PATH=$PATH:$HOME/.bin' \u003e\u003e ~/.bashrc\n```\n\nNote: if you install it somewhere other than `/usr/bin/c`, then your shebang\nwill be different. For example it may be something more similar to\n`#!/home/ryan/.bin/c`.\n\n## Okay, how do I use it?\nc will use whatever `$CC` is set to. You can change this with:\n```bash\n$ export CC=clang\n$ export CC=tcc\n$ # etc...\n```\n## CLI\n### Multiple Files - CLI\nAnything you want passed to the compiler, put in quotes as the first argument.\nWhether they're flags (`-Wall`, `-O2`, etc.) or file names (`file.c`,\n`main.c`, etc.).\n\n```bash\n$ c \"main.c other.c\" arg1 arg2\n$ c \"main.c other.c -O3 -Wall -lncurses\" arg1 arg2\n```\n### Single File - CLI\nWith only one file, omit the quotes:\n```bash\n$ c hello.c\n$ c main.c arg1 arg2\n```\n\n## Shebang!\nAfter adding a shebang, just set the file to executable and it's ready to run.\n```bash\n$ chmod +x file.c\n$ ./file.c\n```\n\n### Single File - Shebang\nAdd this to the top of your C file:\n```c\n#!/usr/bin/c\n```\n\n### Multiple Files - Shebang\nJust tack on any extra flags, options, or files you want passed to the compiler.\nThen be sure to add the terminating `--` characters.\n```c\n#!/usr/bin/c file1.c file2.c -lncurses -lm --\n```\n\n## Caching\nThe default cache size is set to 5 MB. You can change this with:\n```bash\n$ export C_CACHE_SIZE=$((10*1024)) # 10 MB\n```\nThe default cache path is set to `$TMPDIR/c.cache`. You can change this with:\n```bash\n$ export C_CACHE_PATH=\"/tmp/the_cache\"\n```\n\n### Clear cache\nYou can clear the cache with the `--clear-cache` flag:\n```bash\n$ c --clear-cache\n```\n\n# Contributing\nFeel free to submit any ideas, questions, or problems by reporting an issue.\nOr, if you're feeling a bit brave, submit a pull request. :grimacing:\n\nJust hack away and make sure that all the tests pass.\n```bash\n$ cd tests\n$ ./test.sh\n```\n\n## Why?\nFirst of all, I want to clarify why this is **not** the same as `tcc -run`.\nTCC is a compiler. We all know that. TCC will perform its own set of\noptimizations, just as GCC will perform its own and Clang will perform its\nown. The purpose of this script is to give a simple front-end to your favorite\ncompiler.\n\nWhether it's GCC, Clang, or something else entirely, **you** get to choose\nyour compiler.\n\nSecond reason: it's simply satisfying to type `c hello.c` and see it run instantly.\n\nThird reason: I'm a fan of speed, and C definitely offers it. Being able to\nwrite a small, fast, and portable C \"script\" is great. You can pass around a\nC \"script\" just like you would a BASH script.\n\n## zsh\nIf you're using `zsh`, then you can take advantage of `zsh`'s suffix aliases:\n```bash\n$ alias -s c='c'\n$ alias -s cc='c'\n$ alias -s cpp='c'\n```\nThen you can run files with `./file.c` without `chmod +x`.\n\n## Packages\nUse a package manager? You've come to the right place.\n\nAUR: https://aur.archlinux.org/packages/c/\u003cbr\u003e\nbpkg: `bpkg install ryanmjacobs/c`\u003cbr\u003e\nbrew: `brew install c`\n(shebang will be `#!/usr/local/bin/c` for Intel-based Macs or `#!/opt/homebrew/bin/c` for Apple Silicon)\u003cbr\u003e\n\n## Todo\n~~Maybe later we can implement caching.~~ Done!\n\n## License\n[MIT License](https://raw.githubusercontent.com/ryanmjacobs/c/master/LICENSE).\n\nBasically, you can do whatever you want provided that you include\nthe LICENSE notice in any copy of the source. Also, I am not liable\nif the script breaks anything.\n","funding_links":[],"categories":["Compiler","Shell","Tools","Web 后端","工具","排序","C/C++","Tools ##"],"sub_categories":["YAML","编译器","Vim ###"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fryanmjacobs%2Fc","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fryanmjacobs%2Fc","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fryanmjacobs%2Fc/lists"}