From f36fb45c3f7356a8ecf98b2e3fc3002dfed99dec Mon Sep 17 00:00:00 2001 From: default Date: Sun, 5 Feb 2023 19:54:41 +0100 Subject: [PATCH] The 'note' command now accepts -e and -. --- main.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/main.c b/main.c index e9f9939..fbb16b4 100644 --- a/main.c +++ b/main.c @@ -261,10 +261,11 @@ int main(int argc, char *argv[]) xs *c_msg = NULL; char *in_reply_to = GET_ARGV(); - if (strcmp(url, "-") == 0) { + if (strcmp(url, "-e") == 0) { /* get the content from an editor */ FILE *f; + unlink("/tmp/snac-edit.txt"); system("$EDITOR /tmp/snac-edit.txt"); if ((f = fopen("/tmp/snac-edit.txt", "r")) != NULL) { @@ -278,6 +279,11 @@ int main(int argc, char *argv[]) return 1; } } + else + if (strcmp(url, "-") == 0) { + /* get the content from stdin */ + content = xs_readall(stdin); + } else content = xs_dup(url);