commit f36fb45

default  ·  2023-02-05 18:54:41 +0000 UTC
parent 7a2cce4
The 'note' command now accepts -e and -.
1 files changed,  +7, -1
M main.c
M main.c
+7, -1
 1@@ -261,10 +261,11 @@ int main(int argc, char *argv[])
 2         xs *c_msg = NULL;
 3         char *in_reply_to = GET_ARGV();
 4 
 5-        if (strcmp(url, "-") == 0) {
 6+        if (strcmp(url, "-e") == 0) {
 7             /* get the content from an editor */
 8             FILE *f;
 9 
10+            unlink("/tmp/snac-edit.txt");
11             system("$EDITOR /tmp/snac-edit.txt");
12 
13             if ((f = fopen("/tmp/snac-edit.txt", "r")) != NULL) {
14@@ -278,6 +279,11 @@ int main(int argc, char *argv[])
15                 return 1;
16             }
17         }
18+        else
19+        if (strcmp(url, "-") == 0) {
20+            /* get the content from stdin */
21+            content = xs_readall(stdin);
22+        }
23         else
24             content = xs_dup(url);
25