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.
 
 
 
 

25 lines
739 B

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