[Toybox] uuen/decode

Erich Plondke erich at wreck.org
Thu Mar 14 19:04:18 PDT 2013


Looks like I might be a bit late on this browsing the archives... but
uuencode and uudecode implementations are attached.


Both passed basic tests.  Support both base64 and traditional format.

Also, I needed to put parens around min/max, but I think a better
option was presented that didn't have the duplication problem for
operands with side effects (like x++)


diff -r 3a7defbc671e lib/lib.h
--- a/lib/lib.h	Wed Mar 13 00:39:51 2013 -0500
+++ b/lib/lib.h	Thu Mar 14 20:54:54 2013 -0500
@@ -177,8 +177,8 @@
 char* make_human_readable(unsigned long long size, unsigned long unit);

 // useful tools
-#define min(a,b) (a)<(b) ? (a) : (b)
-#define max(a,b) (a)>(b) ? (a) : (b)
+#define min(a,b) ((a)<(b) ? (a) : (b))
+#define max(a,b) ((a)>(b) ? (a) : (b))

 // cut helper functions
 unsigned long get_int_value(const char *numstr, unsigned lowrange,
unsigned highrange);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: uuencode.c
Type: text/x-csrc
Size: 2723 bytes
Desc: not available
URL: <http://lists.landley.net/pipermail/toybox-landley.net/attachments/20130314/ab23f45d/attachment-0012.c>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: uudecode.c
Type: text/x-csrc
Size: 4477 bytes
Desc: not available
URL: <http://lists.landley.net/pipermail/toybox-landley.net/attachments/20130314/ab23f45d/attachment-0013.c>


More information about the Toybox mailing list