{"id":25393871,"url":"https://github.com/5cover/argc","last_synced_at":"2026-04-30T15:31:14.367Z","repository":{"id":264068422,"uuid":"892266604","full_name":"5cover/argc","owner":"5cover","description":"CLI utility that prints the number of arguments it was passed.","archived":false,"fork":false,"pushed_at":"2025-04-09T16:45:55.000Z","size":12,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-05-19T13:03:20.660Z","etag":null,"topics":["argc","cli"],"latest_commit_sha":null,"homepage":"","language":"Perl","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"unlicense","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/5cover.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,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-11-21T19:50:27.000Z","updated_at":"2025-04-09T16:45:59.000Z","dependencies_parsed_at":"2025-02-15T18:54:05.068Z","dependency_job_id":"aa8491b6-193d-4f37-868e-0cc3454d0311","html_url":"https://github.com/5cover/argc","commit_stats":null,"previous_names":["5cover/argc"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/5cover/argc","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/5cover%2Fargc","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/5cover%2Fargc/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/5cover%2Fargc/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/5cover%2Fargc/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/5cover","download_url":"https://codeload.github.com/5cover/argc/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/5cover%2Fargc/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32469344,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-30T13:12:12.517Z","status":"ssl_error","status_checked_at":"2026-04-30T13:12:06.837Z","response_time":57,"last_error":"SSL_read: 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":["argc","cli"],"created_at":"2025-02-15T18:53:59.090Z","updated_at":"2026-04-30T15:31:14.345Z","avatar_url":"https://github.com/5cover.png","language":"Perl","funding_links":[],"categories":[],"sub_categories":[],"readme":"# argc\n\nargc - print the number of arguments passed. That's it. ~~Seriously, why doesn't this already exist?~~\n\n## Synopsis\n\n`argc ARGUMENT...`\n\n## Description\n\nPrints the number of command-line arguments passed to the program in base 10, followed by a newline.\n\nThe traditional `--help` and `--version` arguments aren't supported, in order to ensure seamless argument counting.\n\n## To ignore the program name\n\nBy definition, `argc` includes the program name as the first argument (`argv[0]`).\n\nIf you prefer to count only the user-supplied arguments (excluding the program itself), you can easily adjust:\n\nUsing Bash arithmetic:\n\n```sh\necho $(($(argc \"$@\") - 1))\n```\n\nOr with `bc`:\n\n```sh\nbc \u003c\u003c\u003c \"$(argc \"$@\")-1\"\n```\n\n## Installation\n\nTo build and install `argc` manually:\n\n### Prerequisites\n\nYou'll need:\n\n- A C compiler (e.g. `gcc`, `clang`)\n- `make`\n- Basic POSIX tools (`install`, `rm`, etc.)\n\n### Build and install\n\nClone the repository, then run:\n\n```sh\nmake\nsudo make install\n```\n\nThis will:\n\n- Compile the `argc` binary with optimization flags\n- Install it to `/usr/local/bin/argc`\n- Install the manpage to `/usr/local/share/man/man1/argc.1`\n\nTo remove it later:\n\n```sh\nsudo make uninstall\n```\n\nTo clean up build artifacts:\n\n```sh\nmake clean\n```\n\n## Running Tests\n\nBefore running the tests, make sure the `argc` binary exists by compiling it:\n\n```sh\nmake\n```\n\nThen, run the tests with:\n\n```sh\nprove -v t/argc.t\nprove -v t/zero.t\n```\n\nOr run them all at once:\n\n```sh\nprove -v t/\n```\n\n### Test scripts\n\n#### `t/argc.t`\n\nThis is the main test suite. It checks:\n\n- That `argc` is executable\n- That it returns the correct number of arguments for:\n  - No extra args\n  - A few args\n  - A lot of args (up to 100)\n\nThis test uses normal shell-style execution and reflects how `argc` behaves in the real world.\n\n#### `t/zero.t`\n\nThis one’s\u0026hellip; special.\n\nIt uses **low-level syscall magic** to launch `argc` with **literally zero arguments**\u0026mdash;not even `argv[0]`. This is only possible by bypassing the shell and calling the `execve()` system call directly.\n\nIt's separated from the main suite because:\n\n- It’s a rare, weird edge case\n- Behavior is not guaranteed or portable\n- It tells us something about how `argc` (and your OS) handles broken expectations\n\n### Cleaning Up\n\nAfter running tests, you can clean up the compiled binary like so:\n\n```sh\nmake clean\n```\n\nThese tests aren’t here because they’re strictly necessary.  \nThey’re here because **you deserve to know your 3-line program works with 100 arguments and 0 expectations.**\n\n## Copyright\n\nThis is free and unencumbered software released into the public domain.\n\n## Philosophy\n\n- Even the smallest tool deserves to be well-made.  \n- Even the most basic function can be shared with pride.  \n- Even three lines of C can teach someone *how real software is built*.\n\n## Contributing\n\nNo need.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F5cover%2Fargc","html_url":"https://awesome.ecosyste.ms/projects/github.com%2F5cover%2Fargc","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F5cover%2Fargc/lists"}