summaryrefslogtreecommitdiff
path: root/emacs
diff options
context:
space:
mode:
authordefanor <defanor@uberspace.net>2023-10-07 20:29:00 +0300
committerdefanor <defanor@uberspace.net>2023-10-07 20:29:00 +0300
commit430d97ddc6e68e62cc0f2e77319aaa92876f51eb (patch)
treeb566aea000feebaac699b14de39c660e1e3f7e60 /emacs
parentccdb748c81abc9bb30b8989e27d22bbbb219f9a0 (diff)
Use file descriptors instead of streams, update Rust sources
File descriptors tend to be easier to handle with FFI.
Diffstat (limited to 'emacs')
-rw-r--r--emacs/xml_interface.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/emacs/xml_interface.c b/emacs/xml_interface.c
index 66cbe7f..02db77d 100644
--- a/emacs/xml_interface.c
+++ b/emacs/xml_interface.c
@@ -10,7 +10,7 @@ supposed to respond to requests starting with the most recent one.
This program's output is separated with NUL ('\0') characters, to
simplify parsing in Emacs, while the input is separated with newlines,
-to simplify reading with rexmpp_xml_read_fd (getline).
+to simplify reading with rexmpp_xml_read_fd.
*/
@@ -34,7 +34,7 @@ void print_xml (rexmpp_xml_t *node) {
char *request (rexmpp_t *s, rexmpp_xml_t *payload)
{
rexmpp_xml_t *req = rexmpp_xml_new_elem("request", NULL);
- rexmpp_xml_add_id(s, req);
+ rexmpp_xml_add_id(req);
rexmpp_xml_add_child(req, payload);
print_xml(req);
char *id = strdup(rexmpp_xml_find_attr_val(req, "id"));
@@ -46,7 +46,7 @@ void req_process (rexmpp_t *s,
rexmpp_xml_t *elem);
rexmpp_xml_t *read_response (rexmpp_t *s, const char *id) {
- rexmpp_xml_t *elem = rexmpp_xml_read_fd(stdin);
+ rexmpp_xml_t *elem = rexmpp_xml_read_fd(STDIN_FILENO);
if (elem != NULL) {
if (rexmpp_xml_match(elem, NULL, "response")) {
const char *resp_id = rexmpp_xml_find_attr_val(elem, "id");
@@ -327,7 +327,7 @@ int main (int argc, char **argv) {
do {
/* Check if we have some user input. */
if (n > 0 && FD_ISSET(STDIN_FILENO, &read_fds)) {
- rexmpp_xml_t *elem = rexmpp_xml_read_fd(stdin);
+ rexmpp_xml_t *elem = rexmpp_xml_read_fd(STDIN_FILENO);
if (elem != NULL) {
req_process(&s, elem);
rexmpp_xml_free(elem);