The error return paths in tool_function_bash were returning string literals instead of heap-allocated copies via strdup, causing potential null pointer dereference when callers attempt to free the returned pointer. This fix ensures both "Popen failed!" and "Failed to allocate memory!" error messages are properly duplicated on the heap before being returned.
Implement a new `tool_function_bash` that executes shell commands via `popen` and captures their output into a dynamically allocated buffer. Register the corresponding `tool_description_bash` JSON schema and include it in the `tools_descriptions` array alongside the existing HTTP GET tool. Also change the history file path from `~/.calpaca_history` to `.r_history` and remove the redundant `read_history` call before adding new history entries.
Implement tool calling infrastructure including tools.h with http_fetch function description and execution, message_add_tool_call and message_add_tool_result helpers in messages.h, tool descriptions injection into user messages and chat_json, http header parsing utilities in http.h, curl_get function in http_curl.h, and tool call execution loop in openai_chat that recursively processes tool results.
Add `http_curl.h` providing `curl_post` function using libcurl, update `openai.h` to call `curl_post` instead of `https_post` in both `openai_system` and `openai_chat`, add missing `#ifndef`/`#endif` include guard to `auth.h`, increase HTTP buffer size from 4096 to 1MB, add explicit `(char *)` casts to `malloc`/`realloc` calls in `http.h`, and link `-lcurl` in both `build` and `build_free` Makefile targets.
- Stripped stale references to C/Python-only context rules from .rcontext.txt
- Added new instruction for emoticon usage and markdown formatting in responses
- Retained core review and alternative language guidance sections
The review now includes a full text body, a numeric rating field, and a timestamp for when the review was submitted. This enables richer display and sorting by date on the product page.
Add initial project structure including .gitignore for build artifacts,
Makefile with gcc build and run targets, README placeholder, cgi-bin
directory with gpt.py and gpt_template.html, and core C headers for
chat, http, line input, markdown rendering, and messages.