{"action":"created","comment":{"url":"https://api.github.com/repos/neovim/neovim/pulls/comments/30477288","id":30477288,"diff_hunk":"@@ -76,6 +76,31 @@ char *os_getenvname_at_index(size_t index)\n   return name;\n }\n \n+/// Check if the environment variable `name` exists and has\n+/// a value of either 1, \"on\", \"yes\", or \"true\".\n+bool os_env_istruthy(const char *name) FUNC_ATTR_NONNULL_ALL\n+{\n+  const char *val = os_getenv(name);\n+  if (val == NULL || *val == NUL) {  // TODO(Pyrohh): Remove the check for\n+    return false;                    // NUL after #2574 is merged.\n+  }\n+\n+  errno = 0;\n+  long n = strtol(val, NULL, 10);","path":"src/nvim/os/env.c","position":14,"original_position":14,"commit_id":"b748d7821457cf2bdf776d21a4e224d858df9b2f","original_commit_id":"9ab22bc9e7a45c5d073c6d484b80d608a9aaa2c2","user":{"login":"equalsraf","id":715238,"avatar_url":"https://avatars.githubusercontent.com/u/715238?v=3","gravatar_id":"","url":"https://api.github.com/users/equalsraf","html_url":"https://github.com/equalsraf","followers_url":"https://api.github.com/users/equalsraf/followers","following_url":"https://api.github.com/users/equalsraf/following{/other_user}","gists_url":"https://api.github.com/users/equalsraf/gists{/gist_id}","starred_url":"https://api.github.com/users/equalsraf/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/equalsraf/subscriptions","organizations_url":"https://api.github.com/users/equalsraf/orgs","repos_url":"https://api.github.com/users/equalsraf/repos","events_url":"https://api.github.com/users/equalsraf/events{/privacy}","received_events_url":"https://api.github.com/users/equalsraf/received_events","type":"User","site_admin":false},"body":"In Windows as in Unix os_getenv() is just getenv(), so I am not expecting any update there.\r\n\r\n> I assume it is not possible for os_getenv to return a non-NUL-terminated string\r\n\r\nNot normal, but it doesn't seem impossible, even in Unix. putenv() might allow it, or failing that, if a program really wants to place binary data in an environment variable, it might even write directly to **environ. A quick search shows one such case in [SO](http://stackoverflow.com/questions/15767114/binary-enviornment-variables-and-setenv).\r\n\r\nIs \"1\" the only number considered \"truthly\"? If so can't we just compare against \"1\\0\"?","created_at":"2015-05-18T01:05:06Z","updated_at":"2015-05-18T01:05:06Z","html_url":"https://github.com/neovim/neovim/pull/2569#discussion_r30477288","pull_request_url":"https://api.github.com/repos/neovim/neovim/pulls/2569","_links":{"self":{"href":"https://api.github.com/repos/neovim/neovim/pulls/comments/30477288"},"html":{"href":"https://github.com/neovim/neovim/pull/2569#discussion_r30477288"},"pull_request":{"href":"https://api.github.com/repos/neovim/neovim/pulls/2569"}}},"pull_request":{"url":"https://api.github.com/repos/neovim/neovim/pulls/2569","id":34590982,"html_url":"https://github.com/neovim/neovim/pull/2569","diff_url":"https://github.com/neovim/neovim/pull/2569.diff","patch_url":"https://github.com/neovim/neovim/pull/2569.patch","issue_url":"https://api.github.com/repos/neovim/neovim/issues/2569","number":2569,"state":"open","locked":false,"title":"[WIP] Introduce os_getenv_istruthy() and use to check the values of NVIM_TUI_*","user":{"login":"Pyrohh","id":4174345,"avatar_url":"https://avatars.githubusercontent.com/u/4174345?v=3","gravatar_id":"","url":"https://api.github.com/users/Pyrohh","html_url":"https://github.com/Pyrohh","followers_url":"https://api.github.com/users/Pyrohh/followers","following_url":"https://api.github.com/users/Pyrohh/following{/other_user}","gists_url":"https://api.github.com/users/Pyrohh/gists{/gist_id}","starred_url":"https://api.github.com/users/Pyrohh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Pyrohh/subscriptions","organizations_url":"https://api.github.com/users/Pyrohh/orgs","repos_url":"https://api.github.com/users/Pyrohh/repos","events_url":"https://api.github.com/users/Pyrohh/events{/privacy}","received_events_url":"https://api.github.com/users/Pyrohh/received_events","type":"User","site_admin":false},"body":"IMO, it doesn't make much sense that the following works for setting cursor shape:\r\n- `NVIM_TUI_ENABLE_CURSOR_SHAPE=\"\" nvim`\r\n- `NVIM_TUI_ENABLE_CURSOR_SHAPE=0 nvim`\r\n\r\nGiven the change in behavior, I renamed the `NVIM_TUI_*` variables as well. I'm skeptical about providing backwards compatibility for the old names as we can just mention the change in [Troubleshooting](https://github.com/neovim/neovim/wiki/Troubleshooting).\r\n\r\nIf people like this idea then I'll add some documentation for the NVIM_TUI options and set to RFC.","created_at":"2015-05-02T20:11:41Z","updated_at":"2015-05-18T01:05:06Z","closed_at":null,"merged_at":null,"merge_commit_sha":"0cb365d8cb91451368547b59599a4764f8787e42","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/neovim/neovim/pulls/2569/commits","review_comments_url":"https://api.github.com/repos/neovim/neovim/pulls/2569/comments","review_comment_url":"https://api.github.com/repos/neovim/neovim/pulls/comments{/number}","comments_url":"https://api.github.com/repos/neovim/neovim/issues/2569/comments","statuses_url":"https://api.github.com/repos/neovim/neovim/statuses/b748d7821457cf2bdf776d21a4e224d858df9b2f","head":{"label":"Pyrohh:os_getenv_istrue","ref":"os_getenv_istrue","sha":"b748d7821457cf2bdf776d21a4e224d858df9b2f","user":{"login":"Pyrohh","id":4174345,"avatar_url":"https://avatars.githubusercontent.com/u/4174345?v=3","gravatar_id":"","url":"https://api.github.com/users/Pyrohh","html_url":"https://github.com/Pyrohh","followers_url":"https://api.github.com/users/Pyrohh/followers","following_url":"https://api.github.com/users/Pyrohh/following{/other_user}","gists_url":"https://api.github.com/users/Pyrohh/gists{/gist_id}","starred_url":"https://api.github.com/users/Pyrohh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Pyrohh/subscriptions","organizations_url":"https://api.github.com/users/Pyrohh/orgs","repos_url":"https://api.github.com/users/Pyrohh/repos","events_url":"https://api.github.com/users/Pyrohh/events{/privacy}","received_events_url":"https://api.github.com/users/Pyrohh/received_events","type":"User","site_admin":false},"repo":{"id":26184050,"name":"neovim","full_name":"Pyrohh/neovim","owner":{"login":"Pyrohh","id":4174345,"avatar_url":"https://avatars.githubusercontent.com/u/4174345?v=3","gravatar_id":"","url":"https://api.github.com/users/Pyrohh","html_url":"https://github.com/Pyrohh","followers_url":"https://api.github.com/users/Pyrohh/followers","following_url":"https://api.github.com/users/Pyrohh/following{/other_user}","gists_url":"https://api.github.com/users/Pyrohh/gists{/gist_id}","starred_url":"https://api.github.com/users/Pyrohh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Pyrohh/subscriptions","organizations_url":"https://api.github.com/users/Pyrohh/orgs","repos_url":"https://api.github.com/users/Pyrohh/repos","events_url":"https://api.github.com/users/Pyrohh/events{/privacy}","received_events_url":"https://api.github.com/users/Pyrohh/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/Pyrohh/neovim","description":"vim out of the box","fork":true,"url":"https://api.github.com/repos/Pyrohh/neovim","forks_url":"https://api.github.com/repos/Pyrohh/neovim/forks","keys_url":"https://api.github.com/repos/Pyrohh/neovim/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Pyrohh/neovim/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Pyrohh/neovim/teams","hooks_url":"https://api.github.com/repos/Pyrohh/neovim/hooks","issue_events_url":"https://api.github.com/repos/Pyrohh/neovim/issues/events{/number}","events_url":"https://api.github.com/repos/Pyrohh/neovim/events","assignees_url":"https://api.github.com/repos/Pyrohh/neovim/assignees{/user}","branches_url":"https://api.github.com/repos/Pyrohh/neovim/branches{/branch}","tags_url":"https://api.github.com/repos/Pyrohh/neovim/tags","blobs_url":"https://api.github.com/repos/Pyrohh/neovim/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Pyrohh/neovim/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Pyrohh/neovim/git/refs{/sha}","trees_url":"https://api.github.com/repos/Pyrohh/neovim/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Pyrohh/neovim/statuses/{sha}","languages_url":"https://api.github.com/repos/Pyrohh/neovim/languages","stargazers_url":"https://api.github.com/repos/Pyrohh/neovim/stargazers","contributors_url":"https://api.github.com/repos/Pyrohh/neovim/contributors","subscribers_url":"https://api.github.com/repos/Pyrohh/neovim/subscribers","subscription_url":"https://api.github.com/repos/Pyrohh/neovim/subscription","commits_url":"https://api.github.com/repos/Pyrohh/neovim/commits{/sha}","git_commits_url":"https://api.github.com/repos/Pyrohh/neovim/git/commits{/sha}","comments_url":"https://api.github.com/repos/Pyrohh/neovim/comments{/number}","issue_comment_url":"https://api.github.com/repos/Pyrohh/neovim/issues/comments{/number}","contents_url":"https://api.github.com/repos/Pyrohh/neovim/contents/{+path}","compare_url":"https://api.github.com/repos/Pyrohh/neovim/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Pyrohh/neovim/merges","archive_url":"https://api.github.com/repos/Pyrohh/neovim/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Pyrohh/neovim/downloads","issues_url":"https://api.github.com/repos/Pyrohh/neovim/issues{/number}","pulls_url":"https://api.github.com/repos/Pyrohh/neovim/pulls{/number}","milestones_url":"https://api.github.com/repos/Pyrohh/neovim/milestones{/number}","notifications_url":"https://api.github.com/repos/Pyrohh/neovim/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Pyrohh/neovim/labels{/name}","releases_url":"https://api.github.com/repos/Pyrohh/neovim/releases{/id}","created_at":"2014-11-04T19:04:22Z","updated_at":"2015-05-01T21:07:17Z","pushed_at":"2015-05-18T00:41:11Z","git_url":"git://github.com/Pyrohh/neovim.git","ssh_url":"git@github.com:Pyrohh/neovim.git","clone_url":"https://github.com/Pyrohh/neovim.git","svn_url":"https://github.com/Pyrohh/neovim","homepage":"http://neovim.org/","size":33029,"stargazers_count":0,"watchers_count":0,"language":"VimL","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"neovim:master","ref":"master","sha":"4140d23cc0d63bea88c634966dbf337a1ca01ba5","user":{"login":"neovim","id":6471485,"avatar_url":"https://avatars.githubusercontent.com/u/6471485?v=3","gravatar_id":"","url":"https://api.github.com/users/neovim","html_url":"https://github.com/neovim","followers_url":"https://api.github.com/users/neovim/followers","following_url":"https://api.github.com/users/neovim/following{/other_user}","gists_url":"https://api.github.com/users/neovim/gists{/gist_id}","starred_url":"https://api.github.com/users/neovim/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/neovim/subscriptions","organizations_url":"https://api.github.com/users/neovim/orgs","repos_url":"https://api.github.com/users/neovim/repos","events_url":"https://api.github.com/users/neovim/events{/privacy}","received_events_url":"https://api.github.com/users/neovim/received_events","type":"Organization","site_admin":false},"repo":{"id":16408992,"name":"neovim","full_name":"neovim/neovim","owner":{"login":"neovim","id":6471485,"avatar_url":"https://avatars.githubusercontent.com/u/6471485?v=3","gravatar_id":"","url":"https://api.github.com/users/neovim","html_url":"https://github.com/neovim","followers_url":"https://api.github.com/users/neovim/followers","following_url":"https://api.github.com/users/neovim/following{/other_user}","gists_url":"https://api.github.com/users/neovim/gists{/gist_id}","starred_url":"https://api.github.com/users/neovim/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/neovim/subscriptions","organizations_url":"https://api.github.com/users/neovim/orgs","repos_url":"https://api.github.com/users/neovim/repos","events_url":"https://api.github.com/users/neovim/events{/privacy}","received_events_url":"https://api.github.com/users/neovim/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/neovim/neovim","description":"ambitious Vim-fork focused on extensibility and agility. Please consider helping sustain Neovim development! https://salt.bountysource.com/teams/neovim","fork":false,"url":"https://api.github.com/repos/neovim/neovim","forks_url":"https://api.github.com/repos/neovim/neovim/forks","keys_url":"https://api.github.com/repos/neovim/neovim/keys{/key_id}","collaborators_url":"https://api.github.com/repos/neovim/neovim/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/neovim/neovim/teams","hooks_url":"https://api.github.com/repos/neovim/neovim/hooks","issue_events_url":"https://api.github.com/repos/neovim/neovim/issues/events{/number}","events_url":"https://api.github.com/repos/neovim/neovim/events","assignees_url":"https://api.github.com/repos/neovim/neovim/assignees{/user}","branches_url":"https://api.github.com/repos/neovim/neovim/branches{/branch}","tags_url":"https://api.github.com/repos/neovim/neovim/tags","blobs_url":"https://api.github.com/repos/neovim/neovim/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/neovim/neovim/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/neovim/neovim/git/refs{/sha}","trees_url":"https://api.github.com/repos/neovim/neovim/git/trees{/sha}","statuses_url":"https://api.github.com/repos/neovim/neovim/statuses/{sha}","languages_url":"https://api.github.com/repos/neovim/neovim/languages","stargazers_url":"https://api.github.com/repos/neovim/neovim/stargazers","contributors_url":"https://api.github.com/repos/neovim/neovim/contributors","subscribers_url":"https://api.github.com/repos/neovim/neovim/subscribers","subscription_url":"https://api.github.com/repos/neovim/neovim/subscription","commits_url":"https://api.github.com/repos/neovim/neovim/commits{/sha}","git_commits_url":"https://api.github.com/repos/neovim/neovim/git/commits{/sha}","comments_url":"https://api.github.com/repos/neovim/neovim/comments{/number}","issue_comment_url":"https://api.github.com/repos/neovim/neovim/issues/comments{/number}","contents_url":"https://api.github.com/repos/neovim/neovim/contents/{+path}","compare_url":"https://api.github.com/repos/neovim/neovim/compare/{base}...{head}","merges_url":"https://api.github.com/repos/neovim/neovim/merges","archive_url":"https://api.github.com/repos/neovim/neovim/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/neovim/neovim/downloads","issues_url":"https://api.github.com/repos/neovim/neovim/issues{/number}","pulls_url":"https://api.github.com/repos/neovim/neovim/pulls{/number}","milestones_url":"https://api.github.com/repos/neovim/neovim/milestones{/number}","notifications_url":"https://api.github.com/repos/neovim/neovim/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/neovim/neovim/labels{/name}","releases_url":"https://api.github.com/repos/neovim/neovim/releases{/id}","created_at":"2014-01-31T13:39:22Z","updated_at":"2015-05-18T01:03:55Z","pushed_at":"2015-05-18T00:41:11Z","git_url":"git://github.com/neovim/neovim.git","ssh_url":"git@github.com:neovim/neovim.git","clone_url":"https://github.com/neovim/neovim.git","svn_url":"https://github.com/neovim/neovim","homepage":"http://neovim.io","size":78121,"stargazers_count":13355,"watchers_count":13355,"language":"VimL","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":912,"mirror_url":null,"open_issues_count":486,"forks":912,"open_issues":486,"watchers":13355,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/neovim/neovim/pulls/2569"},"html":{"href":"https://github.com/neovim/neovim/pull/2569"},"issue":{"href":"https://api.github.com/repos/neovim/neovim/issues/2569"},"comments":{"href":"https://api.github.com/repos/neovim/neovim/issues/2569/comments"},"review_comments":{"href":"https://api.github.com/repos/neovim/neovim/pulls/2569/comments"},"review_comment":{"href":"https://api.github.com/repos/neovim/neovim/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/neovim/neovim/pulls/2569/commits"},"statuses":{"href":"https://api.github.com/repos/neovim/neovim/statuses/b748d7821457cf2bdf776d21a4e224d858df9b2f"}}}}