Remove snc
authorBarret Rhoden <brho@cs.berkeley.edu>
Fri, 13 May 2016 16:51:17 +0000 (12:51 -0400)
committerBarret Rhoden <brho@cs.berkeley.edu>
Thu, 16 Jun 2016 15:48:36 +0000 (11:48 -0400)
Now that we have ssh, we don't need snc.  If we ever do, we can revert this
commit.

Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
Makefile
tools/apps/snc/.gitignore [deleted file]
tools/apps/snc/Makefile [deleted file]
tools/apps/snc/snc.c [deleted file]

index 3e00fd1..6007871 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -670,7 +670,7 @@ realclean: userclean mrproper doxyclean objclean
 # Bundled apps
 # =========================================================================
 
-app-dirs = tools/apps/snc
+app-dirs =
 tagged-app-dirs := $(subst /,__,$(app-dirs))
 app-dirs-install := $(addprefix _install_,$(tagged-app-dirs))
 app-dirs-clean := $(addprefix _clean_,$(tagged-app-dirs))
diff --git a/tools/apps/snc/.gitignore b/tools/apps/snc/.gitignore
deleted file mode 100644 (file)
index 29cf51c..0000000
+++ /dev/null
@@ -1 +0,0 @@
-snc
diff --git a/tools/apps/snc/Makefile b/tools/apps/snc/Makefile
deleted file mode 100644 (file)
index 85eeecd..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-APPNAME = snc
-include ../../../user/Makefrag-user-app
diff --git a/tools/apps/snc/snc.c b/tools/apps/snc/snc.c
deleted file mode 100644 (file)
index afebf91..0000000
+++ /dev/null
@@ -1,105 +0,0 @@
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <errno.h>
-#include <unistd.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <sys/socket.h>
-#include <netinet/in.h>
-#include <arpa/inet.h>
-#include <netdb.h>
-
-#define min(a, b)                               \
-    ({ __typeof__(a) _a = (a);                  \
-               __typeof__(b) _b = (b);                 \
-               _a < _b ? _a : _b; })
-#define max(a, b)                               \
-    ({ __typeof__(a) _a = (a);                  \
-               __typeof__(b) _b = (b);                 \
-               _a > _b ? _a : _b; })
-
-static void usage(const char *prg)
-{
-       fprintf(stderr, "Use: %s -s SERVER_IP -p PORT -i FILE\n", prg);
-       exit(1);
-}
-
-int main(int argc, const char **argv)
-{
-       int i, sfd, ffd, port = -1;
-       off_t written;
-       const char *sip = NULL, *fpath = NULL;
-       struct sockaddr_in address;
-       struct stat stb;
-       char buffer[4096];
-
-       for (i = 1; i < argc; i++) {
-               if (strcmp(argv[i], "-s") == 0) {
-                       if (++i < argc)
-                               sip = argv[i];
-               } else if (strcmp(argv[i], "-p") == 0) {
-                       if (++i < argc)
-                               port = atoi(argv[i]);
-               } else if (strcmp(argv[i], "-i") == 0) {
-                       if (++i < argc)
-                               fpath = argv[i];
-               }
-       }
-       if (port < 0 || !sip || !fpath)
-               usage(argv[0]);
-
-       ffd = open(fpath, O_RDONLY);
-       if (ffd < 0) {
-               fprintf(stderr, "Unable to open input file '%s': %s\n", fpath,
-                               strerror(errno));
-               return 1;
-       }
-       if (fstat(ffd, &stb)) {
-               fprintf(stderr, "Unable to stat input file '%s': %s\n", fpath,
-                               strerror(errno));
-               return 1;
-       }
-
-       memset(&address, 0, sizeof(address));
-       address.sin_family = AF_INET;
-       address.sin_port = htons(port);
-       if (inet_pton(AF_INET, sip, &address.sin_addr) <= 0) {
-               fprintf(stderr, "Invalid server IP '%s': %s\n", sip, strerror(errno));
-               return 1;
-       }
-       sfd = socket(AF_INET, SOCK_STREAM, 0);
-       if (sfd < 0) {
-               fprintf(stderr, "Invalid create stream socket: %s\n", strerror(errno));
-               return 1;
-       }
-       if (connect(sfd, (struct sockaddr *) &address, sizeof(address)) < 0) {
-               fprintf(stderr, "Unable to connect to server IP '%s': %s\n", sip,
-                               strerror(errno));
-               return 1;
-       }
-
-       written = 0;
-       while (written < stb.st_size) {
-               size_t csize = min((off_t) sizeof(buffer), stb.st_size - written);
-
-               if (read(ffd, buffer, csize) != csize) {
-                       fprintf(stderr, "Unable to read input file '%s': %s\n", fpath,
-                                       strerror(errno));
-                       return 1;
-               }
-               if (write(sfd, buffer, csize) != csize) {
-                       fprintf(stderr, "Unable to write to server IP '%s': %s\n", sip,
-                                       strerror(errno));
-                       return 1;
-               }
-
-               written += csize;
-       }
-
-       close(sfd);
-
-       return 0;
-}