Prechádzať zdrojové kódy

The 'note' command now accepts -e and -.

default 2 rokov pred
rodič
commit
f36fb45c3f
1 zmenil súbory, kde vykonal 7 pridanie a 1 odobranie
  1. 7 1
      main.c

+ 7 - 1
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);