diff options
| author | Sven Eisenhauer <sven@sven-eisenhauer.net> | 2023-11-10 15:11:48 +0100 |
|---|---|---|
| committer | Sven Eisenhauer <sven@sven-eisenhauer.net> | 2023-11-10 15:11:48 +0100 |
| commit | 33613a85afc4b1481367fbe92a17ee59c240250b (patch) | |
| tree | 670b842326116b376b505ec2263878912fca97e2 /Bachelor/Mikroprozessorsysteme2/ARM202U/EXAMPLES/SCATTER/UUE.C | |
| download | Studium-master.tar.gz Studium-master.tar.bz2 | |
Diffstat (limited to 'Bachelor/Mikroprozessorsysteme2/ARM202U/EXAMPLES/SCATTER/UUE.C')
| -rw-r--r-- | Bachelor/Mikroprozessorsysteme2/ARM202U/EXAMPLES/SCATTER/UUE.C | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/Bachelor/Mikroprozessorsysteme2/ARM202U/EXAMPLES/SCATTER/UUE.C b/Bachelor/Mikroprozessorsysteme2/ARM202U/EXAMPLES/SCATTER/UUE.C new file mode 100644 index 0000000..76d60c3 --- /dev/null +++ b/Bachelor/Mikroprozessorsysteme2/ARM202U/EXAMPLES/SCATTER/UUE.C @@ -0,0 +1,26 @@ +/*
+ A simple reoutine to UUENCODE a buffer. It does not split up the
+ uuencoded data into lines and append encode count bytes though.
+ It assumes that the input buffer is an integer multiple of 3 bytes long.
+ The number of bytes written to the output buffer is returned.
+*/
+unsigned int encodedCount=0;
+unsigned int uuencode(unsigned char *in,unsigned char *out,unsigned int count)
+{
+ unsigned char t0;
+ unsigned char t1;
+ unsigned char t2;
+ unsigned int result=0;
+
+ for (;count;count-=3,in+=3,out+=4,result+=4) {
+ t0=in[0];
+ *out=' '+(t0>>2);
+ t1=in[1];
+ out[1]=' '+((t0<<4)&0x30)+(t1>>4);
+ t2=in[2];
+ out[2]=' '+((t1<<2)&0x3C)+ (t2>>6);
+ out[3]=' '+(t2&0x3F);
+ }
+ encodedCount += count;
+ return result;
+}
|
