aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--pass.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/pass.c b/pass.c
index e68a262..b66e2ac 100644
--- a/pass.c
+++ b/pass.c
@@ -1,4 +1,5 @@
#include <stdio.h>
+#include <unistd.h>
#include <string.h>
#include <stdlib.h>
#include <errno.h>
@@ -36,10 +37,15 @@ int cat(const char *path)
const char *s = NULL;
s = pass_cat(path);
- if (s)
+ if (!s)
+ return -1;
+
+ if(isatty(STDOUT_FILENO))
+ puts(s);
+ else
fputs(s, stdout);
- return (s == NULL);
+ return 0;
}
int add(const char *path)