scripts/dnote-add.c

27 lines
438 B
C
Raw Normal View History

2024-02-28 10:04:05 +00:00
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
int main()
{
char note[32];
char cmd[42];
char c;
printf("a -add \n v -view\n");
system("/bin/stty raw");//remove enter
c = getc(stdin);
system("/bin/stty cooked");
if (c == 'a')
{
fgets(note,32,stdin);
printf("you wrote: %s", note);
snprintf(cmd,sizeof(cmd),"dnote add %s",note);
}
if (c == 'v')
{
snprintf(cmd,sizeof(cmd),"dnote view");
}
system(cmd);
return 0;
}