[comp.sys.amiga.tech] UUDECODE info. requested...what is first line?

mark@isi.UUCP (Mark Bailey) (10/19/89)

I have finally gotten around to writing UUDECODE on the local UNIX box.

Question:  the amiga shar files I'm getting spit out a line like

begin 644 name

in front of all UUENCODED files.  I can get around this but was
wondering if someone could e-mail me the official explanation and rules
for this line.  Should my UUENCODE generate one?  Should I strip it
before UUDECODING?

Thank you very much.  This may be a re-post (our machine died and I
never got any response the first time!!!)


-- 
Mark Bailey                                 (I didn't really say this.)
via:  ...!uunet!pyrdc!isi!mark              ------Have a  8-|  day!!!!!

tadguy@cs.odu.edu (Tad Guy) (10/20/89)

In article <557@isi.UUCP> mark@isi.UUCP (Mark Bailey) writes:
   I have finally gotten around to writing UUDECODE on the local UNIX box.

Why not use one of the freely distributable ones available from most
archive sites?  (I think the one on the fish disks will compile ok on
UNIX as well).

   Question:  the amiga shar files I'm getting spit out a line like
   begin 644 name
   in front of all UUENCODED files.  I can get around this but was
   wondering if someone could e-mail me the official explanation and rules
   for this line.  Should my UUENCODE generate one?  Should I strip it
   before UUDECODING?

Yes, you had better generate a begin line if you want others to be
able to decode your files.  You should use the begin line when decoding:

``begin'' is a magic token that indicates the start of a uucode file.
All text until this token is ignored.

``644'' is the UNIX mode of the file.  Your uudecode should chmod(2)
your output file to this mode before exiting.

``name'' is the filename the uudecoded output should be placed in.

	...tad

matthew@sunpix.UUCP ( Sun Visualization Products) (10/20/89)

In article <557@isi.UUCP> mark@isi.UUCP (Mark Bailey) writes:
}I have finally gotten around to writing UUDECODE on the local UNIX box.
}
}Question:  the amiga shar files I'm getting spit out a line like
}
}begin 644 name
}
}in front of all UUENCODED files.  I can get around this but was
}wondering if someone could e-mail me the official explanation and rules
}for this line.  Should my UUENCODE generate one?  Should I strip it
}before UUDECODING?
}
}Thank you very much.  This may be a re-post (our machine died and I
}never got any response the first time!!!)
}
}-- 
}Mark Bailey                                 (I didn't really say this.)
}via:  ...!uunet!pyrdc!isi!mark              ------Have a  8-|  day!!!!!

The purpose of the 'begin 644 name' line is to give uudecode a starting point
to work from.   With this line uudecode will know several things. 

1) What line the uuencoded information actually begins. In this way, a uudecode
   program can be written that can do self striping of mail and other headers.
   (ever notice that uudecode can take entire e-mail messages and find what it
    needs. No preprocessing to remove the file header needed.)

   /* here is some off the cuff code to show you how to find the begin line */
   do {
	buf=read();
   }
   until(strncmp(buf,"begin ",6))

2) The number (in your case 644) is the unix read/write/execute permissions
   of the encoded file.  If you are uudecodeing the number can typically be
   ignored.  If you are creating uuencodeing files on a non-unix system, 644
   is a good default to use. The number are octal values with the following 
   conventions:

	The first digit is users permission   (6)  /* the single users */
	The second digit is group permissions (4)  /* a group of users */
	The third digit is world permissions  (4)  /* everybody        */

   The digits themselves are decoded as:

	Most significant bit is read.
	The middle bit is write.
	Least significant bit is execute.

   So the following codes mean:

	7) Read, write and execute permissions.
	6) Read and write permissions.
	5) Read and execute permissions.
	4) Read permission only.
	3) Write and execute permissions.
	2) Write permission only.
	1) Execute permission only.
	0) No permissions.

3) The name, is the filename of the file that was originally uuencoded. This 
   permits the uudecode program to recreate the original file with its original
   filename.


-- 
Matthew Lee Stier                            |
Sun Microsystems ---  RTP, NC  27709-3447    |     "Wisconsin   Escapee"
uucp:  sun!mstier or mcnc!rti!sunpix!matthew |
phone: (919) 469-8300 fax: (919) 460-8355    |