about summary refs log tree commit diff stats
path: root/b64f.c
diff options
context:
space:
mode:
Diffstat (limited to 'b64f.c')
-rw-r--r--b64f.c18
1 files changed, 8 insertions, 10 deletions
diff --git a/b64f.c b/b64f.c
index 95acb6f..aa17963 100644
--- a/b64f.c
+++ b/b64f.c
@@ -1,12 +1,12 @@
+#include <u.h>
+#include <libc.h>
 #include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
 
 #include "base64.h"
 
 int lower(int a);
 
-int main(int argc,char** argv) {
+void main(int argc,char** argv) {
 	
 	char opt = ' ';
 	if (argc > 1)
@@ -23,14 +23,14 @@ int main(int argc,char** argv) {
 		printf("\tUse the following to decode:\n\t%s b(ase64) IN_Base64\n",argv[0]);
 		
 		puts("\nERROR: insufficient or incorrect parameters...");
-		return 1;
+		exits("1");
 	}
 	
 	int bcoded = 0;
 	switch(opt) {
 		case 'd':
 			puts("\nDECODING");
-			bcoded = b64_decodef(argv[2],argv[3]);
+			bcoded = b64_decode(argv[2],argv[3]);
 			break;
 		case 'e':
 			puts("\nENCODING");
@@ -43,7 +43,7 @@ int main(int argc,char** argv) {
 				char *b64 = (char *)malloc(1 + (sizeof(char) * b64e_size(tlen)));
 				if (b64 == NULL) {
 					printf("Error: cannot allocate memory for output\n");
-					exit(1);  /* End program with error status. */
+					exits("1");  /* End program with error status. */
 				}
 			
 			bcoded = b64_encode(argv[2],tlen,b64);
@@ -57,10 +57,10 @@ int main(int argc,char** argv) {
 				char *txt = malloc(1 + (sizeof(char) * b64d_size(blen)));
 				if (txt == NULL) {
 					printf("Error: cannot allocate memory for output\n");
-					exit(1);  /* End program with error status. */
+					exits("1");  /* End program with error status. */
 				}
 			
-			bcoded = b64_decode(argv[2],blen,txt);
+			//bcoded = b64_decode(argv[2],blen,txt);
 			txt[bcoded] = '\0';
 			printf("Decoded text from base64: %s", txt);
 			free(txt);
@@ -71,8 +71,6 @@ int main(int argc,char** argv) {
 	}
 	
 	printf("\nBytes encoded/decoded: %i\n",bcoded);
-	
-	return 0;
 }
 
 int lower(int a) { //https://stackoverflow.com/a/15709023/883015