commit 015f021669811eeb7de927197d27c88a2e7ef86a
parent 07c86b10fbbfb4e86a0b87e4ad729639b760aee8
Author: qorg11 <qorg@vxempire.xyz>
Date: Wed, 12 Aug 2020 20:53:47 +0200
added cat the posix -u flag which is useless
Diffstat:
1 file changed, 8 insertions(+), 6 deletions(-)
diff --git a/src/cat.c b/src/cat.c
@@ -1,7 +1,7 @@
#include <stdio.h>
#include <fcntl.h>
#include <unistd.h>
-
+#include <getopt.h>
int
cat(int fd,const char *filename)
{
@@ -25,13 +25,15 @@ cat(int fd,const char *filename)
int
main(int argc, char *argv[])
{
+
if(argc == 1)
cat(0,NULL);
else
- for(int i = 1; i<argc;i++)
- {
- cat(1,argv[i]);
- }
-
+ for(int i = optind; i<argc;i++)
+ {
+ int c = getopt(argc, argv, "c");
+ cat(1,argv[i]);
+ }
+
return 0;
}