Mirror of :pserver:cvs@cvs.fefe.de:/cvs libowfat https://www.fefe.de/libowfat/
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

24 lines
724 B

  1. #include "textcode.h"
  2. unsigned int scan_uuencoded(const char *src,char *dest,unsigned int *destlen) {
  3. unsigned int len;
  4. unsigned long tmp;
  5. register const unsigned char* s=(const unsigned char*) src;
  6. const char* orig=dest;
  7. if ((len=*s-' ')>64) return 0; len&=63;
  8. ++s;
  9. while (len>0) {
  10. if (s[0]-' '>64 || s[1]-' '>64 || s[2]-' '>64 || s[3]-' '>64) return 0;
  11. tmp=(((s[0]-' ')&077) << (3*6)) +
  12. (((s[1]-' ')&077) << (2*6)) +
  13. (((s[2]-' ')&077) << (1*6)) +
  14. (((s[3]-' ')&077));
  15. s+=4;
  16. if (len) { *dest=tmp>>16; ++dest; --len; }
  17. if (len) { *dest=tmp>>8; ++dest; --len; }
  18. if (len) { *dest=tmp&0xff; ++dest; --len; }
  19. }
  20. *destlen=dest-orig;
  21. return (const char*)s-src;
  22. }