[comp.sys.ibm.pc.misc] UUEncode question

lodzins@pilot.njin.net (Dean Lodzinski) (10/25/90)

I have a quick question.  At the beginning of a UUencoded file there
is a line that says
begin <mode> <filename>
What is the function of the mode number?  Is it used for a checksum of
some type?  I have looked at the source of a version of uuencode and
it makes calls to a function called umask and fstat.  I know fstat
returns information about a file, like file size, type, etc.  It also
returns mode.  The struct stat is defined in stat.h.  On the Prime
system I am trying to modify the code on, the struct stat in stat.h 
doesn't return mode (or at least I can't find it in the struct stat.
So, if someone could explain what uuencode does with the <mode> number
and how uudecode uses it etc, it might help me in the conversion.
-- 

Dean Lodzinski         DEAN_L@TURBO.Kean.edu, lodzins@pilot.njin.net
47 Mercury Circle      csra19@TURBO.Kean.edu or D.LODZINSKI on GEnie
South Amboy, NJ  08879 Dean Lodzinski on Hologram Inc., FNET Node 133, 
USA                    at 201/727-1914 (1200/2400/9600)

subbarao@phoenix.Princeton.EDU (Kartik Subbarao) (10/25/90)

In article <Oct.24.13.26.49.1990.4850@pilot.njin.net> lodzins@pilot.njin.net (Dean Lodzinski) writes:
>
>I have a quick question.  At the beginning of a UUencoded file there
>is a line that says
>begin <mode> <filename>
>What is the function of the mode number?  Is it used for a checksum of
>some type?  I have looked at the source of a version of uuencode and
>it makes calls to a function called umask and fstat.  I know fstat
>returns information about a file, like file size, type, etc.  It also
>returns mode.  The struct stat is defined in stat.h.  On the Prime
>system I am trying to modify the code on, the struct stat in stat.h 
>doesn't return mode (or at least I can't find it in the struct stat.
>So, if someone could explain what uuencode does with the <mode> number
>and how uudecode uses it etc, it might help me in the conversion.

On a UN*X type system, the mode number denotes the permission in octal,
where 1 = execute, 2 = write, 4 = read. And the three numbers are for
user, group and other. So a permission of 644 means read & write (4 + 2)
for the user, and write (2) for both the group and everybody else. Of course
this means absolutely nothing in a single user MS-DOS system, where there are
no "group" and "other".

				
				-Kartik



>-- 
>
>Dean Lodzinski         DEAN_L@TURBO.Kean.edu, lodzins@pilot.njin.net
>47 Mercury Circle      csra19@TURBO.Kean.edu or D.LODZINSKI on GEnie
>South Amboy, NJ  08879 Dean Lodzinski on Hologram Inc., FNET Node 133, 
>USA                    at 201/727-1914 (1200/2400/9600)



(I need a new .signature -- any suggestions?)
subbarao@{phoenix or gauguin}.Princeton.EDU -|Internet
kartik@silvertone.Princeton.EDU (NeXT mail)       -|	
SUBBARAO@PUCC.BITNET			          - Bitnet

darcy@druid.uucp (D'Arcy J.M. Cain) (10/26/90)

In article <Oct.24.13.26.49.1990.4850@pilot.njin.net> lodzins@pilot.njin.net (Dean Lodzinski) writes:
>
>I have a quick question.  At the beginning of a UUencoded file there
>is a line that says
>begin <mode> <filename>
>What is the function of the mode number?  Is it used for a checksum of
>some type?  I have looked at the source of a version of uuencode and
>it makes calls to a function called umask and fstat.  I know fstat
>returns information about a file, like file size, type, etc.  It also
>returns mode.  The struct stat is defined in stat.h.  On the Prime
>system I am trying to modify the code on, the struct stat in stat.h 
>doesn't return mode (or at least I can't find it in the struct stat.
>So, if someone could explain what uuencode does with the <mode> number
>and how uudecode uses it etc, it might help me in the conversion.

Just hack the code to ignore the mode information.  This number applies
to Unix systems and defines who has what permissions.  When uuencoding
just put something like 0640 in that field and anyone creating the file
on a Unix box should be happy.  (That gives the owner of the file the
right to read and write it, others in his/her group read priviledges
and prevents anyone else on the system from accessing the file.)

-- 
D'Arcy J.M. Cain (darcy@druid)     |
D'Arcy Cain Consulting             |   I support gun control.
West Hill, Ontario, Canada         |   Let's start with the government!
+ 416 281 6094                     |