BarryServer : Git

All the code for all my projects
// BarryServer : Git / OrionUserland / commit / f8ba6df5ab36d7554d045837b3f053ab6db75e5d

// Related

OrionUserland

Barry Removing binaries f8ba6df (2 years, 5 months ago)
diff --git a/cat/cat b/cat/cat
deleted file mode 100755
index 7b4fdb6..0000000
Binary files a/cat/cat and /dev/null differ
diff --git a/cat/main.c b/cat/main.c
index f1570bc..17b7761 100644
--- a/cat/main.c
+++ b/cat/main.c
@@ -6,13 +6,14 @@
 #include <sys/stat.h>
 #include <dirent.h>
 
+#define BUF_SIZE (4096 * 4)
+
 /* Main function */
 int
 main(int argc, char *argv[])
 {
 	int fd, sz, i;
-	char *buf;
-	struct stat statbuf;
+	char buf[BUF_SIZE];
 
 	if (argc < 2) {
 		printf("Usage: %s <file> [<file>...]\n");
@@ -27,14 +28,15 @@ main(int argc, char *argv[])
 			continue;
 		}
 
-		stat(argv[i], &statbuf);
-		if (S_ISREG(statbuf.mode)) {
-			sz = lseek(fd, 0, SEEK_END);
-			buf = malloc(sz + 1);
-			lseek(fd, 0, SEEK_SET);
-			read(fd, buf, sz);
-			printf("%s", buf);
-			free(buf);
+		while ((sz = read(fd, buf, sizeof(buf))) > 0) {
+			if (write(STDOUT_FILENO, buf, sz) < 0) {
+				printf("%s: write: ", argv[0]);
+				perror(NULL);
+			}
+		}
+		if (sz < 0) {
+			printf("%s: read: ", argv[0]);
+			perror(NULL);
 		}
 
 		close(fd);
diff --git a/clear/clear b/clear/clear
deleted file mode 100755
index 59b13f6..0000000
Binary files a/clear/clear and /dev/null differ
diff --git a/date/date b/date/date
deleted file mode 100755
index 0e0bee7..0000000
Binary files a/date/date and /dev/null differ
diff --git a/init/init b/init/init
deleted file mode 100755
index 5b641ac..0000000
Binary files a/init/init and /dev/null differ
diff --git a/login/login b/login/login
deleted file mode 100755
index b45884b..0000000
Binary files a/login/login and /dev/null differ
diff --git a/ls/ls b/ls/ls
deleted file mode 100755
index 0921d86..0000000
Binary files a/ls/ls and /dev/null differ
diff --git a/pwd/pwd b/pwd/pwd
deleted file mode 100755
index 4cc5f35..0000000
Binary files a/pwd/pwd and /dev/null differ
diff --git a/sh/sh b/sh/sh
deleted file mode 100755
index 6326a89..0000000
Binary files a/sh/sh and /dev/null differ
diff --git a/time/time b/time/time
deleted file mode 100755
index cf03725..0000000
Binary files a/time/time and /dev/null differ