Commits

John Floren committed ad5d6a6

cleaned up

Comments (0)

Files changed (1)

 #include <ctype.h>
 #else
 #include <stdio.h>
-//#include <string.h>
-//#include <stdlib.h>
-//#include <sys/types.h>
-//#include <sys/stat.h>
-//#include <fcntl.h>
-//#include <unistd.h>
 #include "linux.h"
 #endif
 
 	if (c->args != nil)
 		for (i = 0; i < c->nargs; i++) {
 			freepstring(c->args[i]);
-//			if (c->args[i] != nil) {
-//				if (c->args[i]->data != nil)
-//					free(c->args[i]->data);
-//				free(c->args[i]);
-//			}
 		}
 	free(c->args); // according to malloc(2), this is safe even if args is nil
 	c->args = nil;
 	if (done) {
-		//print("quitting\n");
 		close(c->fd);
 		exits(0);
 	}
 	//print("new client fd = %d\n", fd);
 
 	c.fd = fd;
-	//c.args = mallocz(sizeof(pstring*)*3, 1); // allocate 3 slots, this should actually be big enough for anything for now
 
 	for (;;) {
 		/* All commands start with '*' followed by the # of arguments */
 		pstringtolower(c.args[0]);
 
 		for (i = 0; i < (sizeof(commands)/sizeof(commands[0])); i++) {
+			// I apologize for this conditional
 			if (!memcmp(c.args[0]->data, commands[i].name, (c.args[0]->length < strlen(commands[i].name) ? c.args[0]->length : strlen(commands[i].name))) && c.nargs - 1 == commands[i].nargs) {
 				foundcommand = 1;
 				(commands[i].proc)(&c);
 		}
 		cleanclient(&c, 0);
 	}
-	//close(fd);
-	//exits(0);
 }
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.