[Search for users] [Overall Top Noters] [List of all Conferences] [Download this site]

Conference 7.286::digital

Title:The Digital way of working
Moderator:QUARK::LIONELON
Created:Fri Feb 14 1986
Last Modified:Fri Jun 06 1997
Last Successful Update:Fri Jun 06 1997
Number of topics:5321
Total number of notes:139771

4380.0. "Need help with UUDECODE files !!!" by ODIXIE::HART (Thomas Hart DTN 369-6123 odixie::hart) Wed Jan 24 1996 20:15

    My turn, I have a question.
    
    While reading note 4349, some folks were talking about recieving
    internet mail and what needs to be done to read it if it is encoded.
    I thought why would anyone send/receive encoeded mail. Guess what, I
    got a document I need and it was encoded. The first line in the
    document said please use UUDECODE to retrieve it.
    
    Joan in reply .41 said to add 2 lines to your login.com then you would
    be able to decode the files when you receive them. My problem is that I
    receive all my mail into ALL-IN-ONE in a captive account. 
    
    I tried Joan's solution, but it did not help me.
    
    What do I need to do in order to be able to view this document ???
    
    Thanks in advance for your help/replys.
    
    Thomas Hart
    
T.RTitleUserPersonal
Name
DateLines
4380.1perhaps uudecode on a UNIX systemUNXA::ZASLAWWed Jan 24 1996 20:205
uuencode/uudecode is used on UNIX and perhaps other systems to convert binary
files to/from ASCII so they can be mailed. One solution would be to extract
just the encoded part of the message, stripping off any headers and trailers,
and uudecoding it on a UNIX system. Hope that's some help.
-- Steve
4380.2CUSTOM::ALLBERYJimWed Jan 24 1996 20:308
    Do you have an non-captive account that you can forward the
    message too?
    
    Also, UUENCODE/DECODE are provided with UCX on an OpenVMS 
    system, so you don't necessarily need a UNIX system.
    
    Jim
    
4380.3uudecodeAWECIM::MCMAHONDEC: ReClaim TheName!Wed Jan 24 1996 20:3515
    Well, I use uudecode on my VAX/VMS system all the time. I have put the
    files into CIMMOM::USER1$:[TEMP]UUDECODE*.* if you want to copy them to
    your node. There is an executable there that may work on your system.
    Otherwise, use UUDECODE-BLD.COM to compile/link on your node.
    
    Once you do this, add this line to your login.com(assumes you put the
    files in your SYS$LOGIN directory): 
    $ SET COMMAND SYS$LOGIN:UUDECODE.CLD
    
    Extract the file from mail and get rid of the header. 
    
    Then, either @login or the next time you login, all you need to do is
    $ uudecode <filename>
    
    Hope this helps.
4380.4EPS::VANDENHEUVELThings that make you think, Hmmm...Thu Jan 25 1996 04:0316
 >   be able to decode the files when you receive them. My problem is that I
 >   receive all my mail into ALL-IN-ONE in a captive account. 
    
    Your IS department should be there to help you to get this job done.
    Your first step should be to request them to both convert the message
    in question here and now, and also to integrate UUDECODE in ALL-IN-ONE
    or otherwise make a procedure available to get converts done. If they
    can not offer both in say 5 working days, tell them to get out of your
    way and allow you to exit to DCL in order to be able to do your job.
    If they do not get out of the way in 5 days... raise *&^&%3 hell!
    
    hth,
    	Hein.
    
    
    
4380.5Since Vickers isn't her anymore...TNKSYS::DBROWNWith magic, you have some controlThu Jan 25 1996 10:477
    Hein,
    
    That should be ALL-IN-1.
    
    Dwight
    
    
4380.6ODIXIE::HARTThomas Hart DTN 369-6123 odixie::hartThu Jan 25 1996 11:308
    Hein,
    
    I logged a hotline call toady. Hopefully I will get the problem
    resolved before 5 days. 
    
    Thanks,
    
    Thomas Hart
4380.7How to get to DCL from an ALL-IN-1 accountTPLAB::VANDYCKSymbolic stack dump fellowThu Jan 25 1996 14:1629
	Well my ALL-IN-1 account is captive too but
anyway :

From the Electronic mail menu type the command UD :
that will bring you into the "User defined process
maintenance" menu. In there, type C for create,
enter a name (like "DCL"). You are now in the editor.
Enter EXACTLY the following text :

.FX GET OA$DCL="@SYS$COMMAND"
.FX CLEAR

then exit from the editor. You are back in the UDP
maintenance menu. Press KeyPad 0 to get back to
electronic mail.

Now, each time you need DCL, press the DO key. If the
name that appears at the bottom of your screen is DCL,
then just hit Return. If not, use the up and down
arrows until you get to it, and then hit Return.

You have now a $ prompt on your screen which you can
use to execute any DCL command you want. Type the
command EXIT to get back to ALL-IN-1. I said well
EXIT, not EOJ or LOGOUT.

It works for me since eight years. There are lots of
other ways to achieve the same goal but this one is
the easiest.
4380.8How to UUDECODE a file from ALL-IN-1TPLAB::VANDYCKSymbolic stack dump fellowThu Jan 25 1996 14:4724
This requires that TCP/IP services for VMS (aka UCX)
is installed on your system.

1) Go to the Electronic Mail menu of ALL-IN-1. Select
   the document to decode. Type DT to get into the
   document transfer menu. Enter SVC for "send to VMS
   without conversion", fill in a file name as
   requested, like SYS$LOGIN:ENCODED.TXT

2) Using the trick in .-1, go to DCL. Edit the file
   you just created above, take all the extra lines
   off, keeping only the encoded part. Your file should
   begin with a line like "begin 676 filename.ext"
   and finish with a line "end". Save and exit.

3) Still at the DCL prompt, define a foreign command :
   $ uudec := $SYS$SYSTEM:UCX$UUDECODE

4) $ SET DEFAULT SYS$LOGIN
   $ UUDEC ENCODED.TXT DECODED.TXT

   The file decoded.txt contains your decoded message.

	HtH, Marc.
4380.9Not sure if I would share it in public!MIMS::BEKELE_DWhen indoubt THINK!Thu Jan 25 1996 15:178
    Re: .7
    
    That security whole has been plugged as of ALL-IN-1 V3.1.  If the 
    author of .0 is under this version he needs the ALL-IN-1 priv UDPDCL
    to do what you suggested.
    
    Dan
    
4380.10I got it, Thanks all.ODIXIE::HARTThomas Hart DTN 369-6123 odixie::hartThu Jan 25 1996 15:3914
    I got the file decoded. It was a Word for Windows V 6.0 file.
    
    What had to be done was to do a document transfer to V.
    Then strip off headers, then mail it to a pc via pathworks in binary
    form. Use a shareware decoder. Then FTP it via pathworks to a PC in our
    office. Then view it under Word for Windows.
    
    Anyway others are now working to come up with a better procedure since
    I logged a hotline call. I guess they will let us all know when that
    happens. Until then I'll use the procedure I now have.
    
    Thanks for all the replys.
    
    Thomas Hart
4380.11Wincode 2.61 works COPS01::kiji.cop.dec.com::skinnerThu Jan 25 1996 17:225
I use Wincode 2.61 to decode files.  No need to strip headers, etc.  I use 
Teamlinks to save the message to my pc's hard drive as "filename.uue" which 
Wincode recognizes and decodes as "filename.doc".

Wincode is shareware, a Windows application to encode/decode files.
4380.12Security hole ?TPLAB::VANDYCKSymbolic stack dump fellowThu Jan 25 1996 17:4123
>
>                        -< The Digital way of working >-
>================================================================================
>Note 4380.9             Need help with UUDECODE files !!!                9 of 11
>MIMS::BEKELE_D "When indoubt THINK!"                  8 lines  25-JAN-1996 12:17
>                  -< Not sure if I would share it in public! >-
>--------------------------------------------------------------------------------
>    Re: .7
>    
>    That security whole has been plugged as of ALL-IN-1 V3.1.  If the 
>    author of .0 is under this version he needs the ALL-IN-1 priv UDPDCL
>    to do what you suggested.
>    
>    Dan

Why is it a security hole ? When I looked at the documentation (where it
is all explained, if I remember well after 7 years) it was not presented
like a secret but like a very ordinary feature ....
And how (as an unprivileged user) do I know if I hold the UDPDCL
privilege ? It looks like I'm indeed under V3.1, as analyze/image says...

Puzzled,
	Marc.
4380.13LJSRV2::INTERNET_TOOLS notesfileSTAR::jacobi.zko.dec.com::JACOBIPaul A. Jacobi - OpenVMS Alpha DevelopmentThu Jan 25 1996 20:125
See  LJSRV2::INTERNET_TOOLS for more information on UUENCODE/UUDECODE.


						-Paul

4380.14NWD002::BAYLEY::Randall_doThu Jan 25 1996 20:576
If you use Teamlinks, add in the Internet stuff from the 
SDK, add the button to your button bar.

Then, instead of lots of steps with lots of syntax,
click on a button and read or use.  Aren't our products
great?
4380.15I could tell you what one college kid did!MIMS::BEKELE_DWhen indoubt THINK!Thu Jan 25 1996 21:1414
    
    Re: .9
        
    ALL-IN-1 V3.1 will let you know as soon as you try to execute
    a script via a udp if you do not have the necessary priv.  As 
    for why it was considered to be a security hole, think of why 
    they made your account to be captive in the first place and 
    then think of your ability to spawn out to dcl using a udp and 
    stay there (we be hav'en fun depending how lax the nature of 
    file security on the system is!)...what if your resource usage 
    is metered (an ALL-IN-1 facility) and you do your work in a dcl 
    window...ect.

    dan
4380.16EPS::VANDENHEUVELThings that make you think, Hmmm...Fri Jan 26 1996 11:1128
.15> As for why it was considered to be a security hole, think of why 
.15>    they made your account to be captive in the first place and 
.15>    then think of your ability to spawn out to dcl using a udp and 
.15>    stay there (we be hav'en fun depending how lax the nature of 
.15>    file security on the system is!)...what if your resource usage 
.15>    is metered (an ALL-IN-1 facility) and you do your work in a dcl 
.15>    window...ect.                                             
    
    And that's precisely why I reacted in the first place, triggered
    by the 'captive' bit. I can NOT think of a security hole requiring
    digital equipments trusted employees to barred from DCL. 
    File protection should not be an issue for a properly set up system.
    I can only imagine it is done for JOB security in the IS department.
    I am (naively?) assuming that folks want to get to DCL to help
    getting their work done. To get to a tool that is not properly
    integrated in ALL-IN-1 yet. Yes they could write a program/procedure
    that sits in a loop eating precious CPU cycles, but I fail to see
    that as a compelling reason to stop OS access. It would show in
    system performance reports or accounting reports soon enough.
    They could write a silly editor macro or decalc monstrosity 
    anyway to keep the system busy if they had just that annoyance in mind.
    I guess this is also how 'non-noters' are born. Another concept I fail
    to grasp! (... writing this note on behalve of a non-noting member..:-(.
    
    Oops, work calls, Hein.
    
    
    
4380.17Another perspectiveALFSS1::WOLFEJohn Wolfe - (770)-924-6463Fri Jan 26 1996 11:5019
    
>    And that's precisely why I reacted in the first place, triggered
>    by the 'captive' bit. I can NOT think of a security hole requiring
>    digital equipments trusted employees to barred from DCL. 

	I USED to agree with these sentiments, until I started supporting
our internal users.  You would be amazed at how many times we have found that
users have destroyed their ALL-IN-1 file cabinets by deleting critical files
or munging them w say EDT or TPU.  When they find that they can no longer read
their mail, the immediate reaction is an often irate hot line call demanding
an immediate fix.  In these days of off site storage of backup tapes and
operations staffs that have been cut till they bleed, anything approaching an
immediate fix is just not possible if files need to be restored from backups.

	FWIW, in most areas of the US, users either have DCL access or can get
it by asking for it.  In the case of .0, I am told all thats required is a
phone call to the IS hotline. 

John
4380.18ROWLET::AINSLEYLess than 150 kts. is TOO slow!Fri Jan 26 1996 12:315
    re: .17
    
    Seems to me that a little training would cure most of those problems.
    
    Bob
4380.19If it happens _that_ often, there is a message thereBBPBV1::WALLACEUNIX is digital. Use Digital UNIX.Fri Jan 26 1996 13:177
    If "they" (a non-privileged, untrained) user `regularly' destroy an
    important application's data by ill-advised or inadvertent use of
    unprivileged commands, then my book says the application is broken.
    Preventing DCL access is a band-aid; it doesn't fix the real problem.
    (I've been a system manager too, and because of the company's failure
    to move the infrastructure into the late 80's, I'm doing more of that
    now than I should. But that's another topic).
4380.20AXEL::FOLEYRebel without a ClueFri Jan 26 1996 13:509
RE: .18

	Doesn't always work. Anytime you try to idiot proof the
	system, someone comes up with a better idiot.

	Really, it amazes me how many computer illiterate people there
	are in the industry.

							mike
4380.21FUNYET::ANDERSONOne month of winter is NOT ENOUGH!Fri Jan 26 1996 15:135
I have never understood how an OpenVMS user could do their job without having
access to the DCL prompt.  User Interfaces are nice, but even with Windows NT ya
gotta get to the DOS prompt sometimes.

Paul
4380.22many different worlds HNDYMN::MCCARTHYA Quinn Martin ProductionFri Jan 26 1996 22:1613
>>I have never understood how an OpenVMS user could do their job without having
>>access to the DCL prompt.  User Interfaces are nice, but even with Windows 
>>NT ya gotta get to the DOS prompt sometimes.

Its the people that don't even know they are using an OpenVMS system that you
don't want to have access to DCL.  
The are the same ones that say: "I use an ALL-IN-ONE (excuse me if that isn't 
the correct trademark) system" or "No I don't use VMS, I use LOTUS" etc...

They get their jobs done fine - if the application doesn't do it, then it is
most likly not there job!

bjm
4380.23REGENT::POWERSMon Jan 29 1996 11:4422
>           <<< Note 4380.20 by AXEL::FOLEY "Rebel without a Clue" >>>
>
>	Really, it amazes me how many computer illiterate people there
>	are in the industry.

Why, what's so special about the computer industry?

How many people on the manufacturing line at Caterpillar know how to operate
a bulldozer?  How many people in the marketing department?  The CEO?

How many people at Fender, Gretsch, or Martin actually know how to play
the guitar?

Computer illiteracy is pretty widespread, in the computer industry and beyond.
The obvious connection of computer usage and the computer industry
is that we are an industry that both uses and makes computers.
But relatively few of us are in positions where we need to understand the
technical complexities of our product.  Our bookkeepers are not substantially
differently trained or equipped than the ones at Ford Motor.
Why would you expect them to be any more "computer literate?"

- tom]
4380.24AXEL::FOLEYRebel without a ClueMon Jan 29 1996 13:0314
RE: .23

	Because it's in all our best interests to become at least 
	somewhat computer litterate. There's no excuse in ANY modern
	industry to let this pass you by. That goes from the person on
	the assembly line to the CEO.

	The reason it amazes me in our industry is that people have 
	ready access and don't take advantage of it. There's plenty of
	people out there that are not in our line of work and they are
	trying. I'm amazed that with such easy access, people in the
	computer industry STILL don't take advantage and learn.

						mike
4380.25litterate?PMRV70::CROSBYMon Jan 29 1996 13:3512
    re:.24
    What amazes me is that, given the ready access we all have to a
    dictionary, some people still don't understand how to use it and learn
    how to spell.
    
    Lighten up, most of the world does not revolve around these little
    beige boxes.
    
    $0.02
    
    gc
    
4380.26REGENT::POWERSMon Jan 29 1996 14:1619
>           <<< Note 4380.24 by AXEL::FOLEY "Rebel without a Clue" >>>
>...
>	I'm amazed that with such easy access, people in the
>	computer industry STILL don't take advantage and learn.

Because most of the people in the computer industry quite rightfully 
don't need to consider themselves "in" the computer industry!

Our bookkeepers, our stock handlers, our staff administrators, our secretaries,
our buyers, our assemblers, even (to a degree) our marketing people,
our product managers, and our upper management all have vastly more 
transportable skills across industries than our technical people do.
Their computers are means to their jobs, not ends.
When computers are made obsolete, most of them will still have (or be able 
to get) jobs based on non-computer skills.
Why should they focus on the arcanities of the DCL command line
when they have a reall job to do?

- tom]
4380.27TLE::REAGANAll of this chaos makes perfect senseMon Jan 29 1996 14:2410
    RE: .25
    
    > -< litterate? >-
    
    It's spelled literate with one "T" not two (actually two, not three).
    
    				-John :-)
    
    
    
4380.28Why should we have to get to the DOS prompt?COPS01::kiji.cop.dec.com::skinnerMon Jan 29 1996 14:346
The cashiers/checkers at the grocery I go to use computers (and scanners) all 
day long and never have to get to a DOS prompt or command line.  If the tools 
I'm provided to do my job were properly designed and implemented, I wouldn't 
have to get to one, either.

The computer should be a means to an end, as noted in earlier replies.
4380.29Carefully avoiding use of words like "good" and "bad"EVMS::HALLYBFish have no concept of fireMon Jan 29 1996 15:0715
> The cashiers/checkers at the grocery I go to use computers (and scanners) all 
> day long and never have to get to a DOS prompt or command line.
    
    Thus taking the skills out of the job, making the universe of potential
    cashiers/checkers much larger, thereby reducing the salary the store
    needs to pay in order to attract new employees.
    
>								If the tools 
>I'm provided to do my job were properly designed and implemented, I wouldn't 
>have to get to one, either.
    
    But you may find yourself without a job, replaced by an illitterate :-)
    high-school dropout who is as competent as you at using "the tools".
    
      John
4380.30COPS01::kiji.cop.dec.com::skinnerMon Jan 29 1996 16:5715
My only point, then I'll jump out of this rathole, is that well designed 
applications should result in the user never ever seeing a command line.  
Period.  

I use QUICKEN to manage my finances, not for the joy of using QUICKEN.  It 
makes the job of managing my finances easier.  When the next better tool 
comes along, that allows me to spend less time managing my finances, 
providing me with more time for other activities, I'll use it.

As a Proposal Manager in Digital's U.S. Federal Government region, I make my 
livelihood managing the preparation of cost-effective, compliant proposals 
which must be submitted on very strict Government deadlines.  Digital does 
not pay me to use a computer or learn about DOS or command line interfaces, 
etc.  but provides me with tools TO MANAGE AND PREPARE PROPOSALS for our 
Government CUSTOMERS. 
4380.31AXEL::FOLEYRebel without a ClueMon Jan 29 1996 17:3720
RE: .25

	Yea, pardon the typo.. DECspell isn't installed on my old VMS
	system. My spelling is usually well above typical engineer
	quality and far above manager quality. So you lighten up a 
	little. The word does not revolve around perfect spelling.

RE: the rest

	Hey, I'm not saying everyone should know how to set the DMA and
	IRQ settings for a telephony board, or debug a Unix system with
	string and duct tape, I'm JUST saying that maybe taking a little
	time to become somewhat more familiar with ones tools would go
	a long way. Obviously, many of you have not tried to debug a 
	user problem over a phone with some yo-yo who doesn't know
	where the on/off switch is.

	Back to our regularly scheduled rathole.

							mike
4380.32Revolving Words?PMRV70::CROSBYMon Jan 29 1996 17:5822
    If you don't have DECspell,
    1. CUT your text from your note screen,
    2. PASTE it into a new MS Word document,
    3. Under Tools, SELECT Spell check,
    4. APPLY spell check to Entire Document,
    5. Make necessary changes,
    6. Select text on screen
    7. CUT text from screen,
    8. OPEN Notes Window,
    9. PASTE text into window,
    10.Complete writing note.
    
    Simple, isn't it?  You just haven't learned how to use the tool, and I
    think your missing the point.
    
    Time is the ONLY thing you've got.  The vast majority of people havem't
    the luxury to spend it learning how to use tools that are poorly
    designed.
    
    $0.02
    
    gc
4380.33People who complain about spelling are _______ATLANT::SCHMIDTSee http://atlant2.zko.dec.com/Mon Jan 29 1996 18:427
> I think your missing the point.

  Of course, not all spelling errors are detect[ia]ble by modern-
  day spell checkers. But I do assume the previous reply had an
  implied smiley, so no hit points will be assessed. :-)

                                   Atlant
4380.34AXEL::FOLEYRebel without a ClueMon Jan 29 1996 19:116
RE: .33

	I was going to point out the "error" of .32's ways but I see
	I don't have to say a thing.

							mike
4380.358^)PMRV70::CROSBYMon Jan 29 1996 20:169
    Touche!  
    
    I'm humbled....no implied smiley, just lack of attention.
    
    $0.02 8^)
    
    gc
    
    
4380.36ROWLET::AINSLEYLess than 150 kts. is TOO slow!Tue Jan 30 1996 11:045
    re: .32
    
    And how do I run MS Word on my VT320?
    
    Bob
4380.37New Notes personal name?EVMS::HALLYBFish have no concept of fireTue Jan 30 1996 11:343
.31>	      The word does not revolve around perfect spelling.
    
    Good one, Mike!<
4380.38Typografical mispelings.REFINE::MCDONALDshh!Tue Jan 30 1996 18:4413
    
>>   The word does not revolve around perfect spelling.

    What DOES the "word" revolve around?   :-)
    
    I think we've stumbled on a new maxim:
    
       "The probability of making a typo or misspelling increases
        dramatically when you happen to be complaining about a typo 
        or misspelling."
    
     
                                              
4380.39AXEL::FOLEYRebel without a ClueTue Jan 30 1996 20:315
RE: .38

	Bingo. :)

							mike
4380.40GANTRY::ALLBERYJimWed Jan 31 1996 12:428
    >I think we've stumbled on a new maxim:
    >
    >   "The probability of making a typo or misspelling increases
    >    dramatically when you happen to be complaining about a typo 
    >    or misspelling."
    
    I think we've rediscovered a rather old maxim.
    
4380.41HDLITE::SCHAFERMark Schafer, Alpha Developer's supportWed Jan 31 1996 13:388
    I can't understand why we continue to correct people and rat-hole about
    it in this conference.  The noise level reduces the good that's
    accomplished here, and I'm concerned that people will not contribute
    because they are afraid of criticism.
    
    "Can't we all just be friends?"
    
    Mark
4380.42Why?EEMELI::SYVANENMon Feb 05 1996 05:079

	Hello folks,


	Just out of curiosity. Why are you not allowed to access DCL?


	Tero
4380.43no answers here!JULIET::CLABAUGHWed Feb 07 1996 06:0711
    
    	i saw the base note.  
    
    	i thought that with 42 replies, i'm bound to leard something
    	about MIME and UUENCODING.
    
    	boy, was i ever wrong.
    
    	where do all you people find the time?  maybe if i had properly
    	designed tools to help me do my job i'd have the extra time too.
    
4380.44FUNYET::ANDERSONWhere's the nearest White Castle?Wed Feb 07 1996 13:457
Try the LJSRV2::INTERNET_TOOLS conference for information about MIME and
UUENCODE.

Since I have *all* the right tools to do *my* job, I have lots of time to answer
questions like yours.

Paul
4380.45Just locate a C compiler and stir;-)SCASS1::WISNIEWSKIADEPT of the Virtual Space.Fri Feb 09 1996 16:16684
    This program will automagically decode uuencoded files for 
    dos, OpenVMS and Unix systems.   (haven't tried it on Win95 yet 
    but it should work)...  compile with a C compiler and have at it;-)
    
    be seeing you,
    
    John Wisniewski
    
    
    
/*
 * uuexplode-1.5.c (based on kiss 1.0)
 * Author kiss 1.0: Kevin Yang
 * Code cleanup and v1.5: Michael Bergman  (euambn@eua.ericsson.se)
 * Released to the Public Domain, no warranty whatsoever implied.
 *
 * (DOS) VMS/Archimedes port : Martin Glanvill (mcg@waikato.ac.nz) 
 *
 * This C program takes an unlimited number of uuencoded files
 * and removes garbage lines. The uuencoded lines are decoded and written 
 * to specific output files. It is quite verbose as opposed to e.g.
 * uuconvert and tells you when things go well and when they don't.
 * It can also handle garbage between the `/SPC line and the end line and
 * warns if it suspects there is garbage between the last short data line
 * and the SPC-line.
 *
 * New in v 1.3:
 * Better format of warning messages, e.g. line numbers provided.
 * Bogus space lines in data and at end of a uucode block is handled.
 * See details below in ExplodeFile() if you're interested in exactly how
 * this is done.
 * New is v 1.4:
 * Secure option implemented.
 * New in v 1.5:
 * Changed string and I/O buffer size. 128 char string buffers
 * is not enough for long path names in news headers. This made
 * the line numbers in warning messages be wrong.
 *
 * WARNING:
 * If there is garbage between the short data line (if any) and the
 * SPC-line, the output file *might* be corrupted, but most likely not!
 *
 * The format of the uucode is assumed to be more or less as described
 * in uuencode(5) in the online UNIX manual with some exceptions:
 * An M-line can be longer than necessary. Some coders put an extra
 * checksum (character) after each line, this is ignored by uuexplode.
 * It is assumed though that all lines have the same number of checksum
 * chars after them.
 * The last data line before end-line can be either SPC\n or `\n
 * since SPC is equivalent to ` when decoding (both give 0).
 *
 * Any char in the range [a-~] is illegal uucode to this program
 * until someone has shown that there are COMMONLY used uuencode 
 * programs that produce correct uucode with small letters in it.
 * There are such uuencode, e.g. for the Macintosh(?), which use the
 * the range [>-}] by adding 96 to [0-29] and 32 to [30-63].
 * Note that this code is transparent to the standard uudecode.
 *
 * It is assumed that the end line of a uucode-block is in the
 * same input file as the corresponding begin and that the parts
 * are in correct order (of course).
 * 
 * Some diagnostics mean that the current output file is removed.
 * Others leave the output file, but check the input to be sure!
 *
 * To speed up the file handling, the file I/O buffers are re-set.
 * I chose 16 KB because it is 4 whole pages in a SunOS 4.x system.
 * The file I/O is by default buffered. If it is not in your system,
 * change to setvbuf() instead. This is also the appropriate action
 * to take if you don't have setbuffer().
 *
 * To compile: "cc -O -o uuexplode uuexplode-1.x.c".
 * --------------------------------------------------------
 *--------------------------------------------------------
 * Modifications: MCG  - increase buffer to 256k
 * VMS: cc/opt=inline uuexplode.c
 *      link uuexplode
 *
 * DOS: You're on your own... it may pay to chop the buffers down 
 *       to 16k on AT machines.
 *
 *-------------| LOGIN.COM insert |------------------
 *----------------| Installation |-------------------   
 * 1) Extract the uucoded binary in the directory of your choice.  
 * 2) Insert the following line in your LOGIN.COM file (substituting 
 *   <path> for the directory path to the executable): 
 *       $ assign/nolog <path> exe$  
 *       $ ext*ract :== "$exe$:uuexplode"
 * 3) type @login to re-initialise your system and type : ext -h   
 *----------------------------------------------------------------
 */
 

#include <stdio.h>
#include <ctype.h>
#include <stdlib.h>

/* Some garbage lines such as paths are very long, almost 200 chars */
#define LEN 256
#define BUFFER_SIZE 262144

#define D(x)
#define DISPLAY  if (verbose) printf
/* #define DISPLAY(X) if (verbose) printf(X) */

/* Most variables are declared globally, in order to
 * speed up function calls.
 */

static char input_buf[LEN],
            b[LEN] = " ";   /* Empty marker. If b is decoded when it is empty,
                               nothing will happen since length is 0 */
static char out_buf[LEN], dest[LEN], dummy[LEN];

static char *ibuf = input_buf, *bp = b, *obuf = out_buf, *tmp, *p;
static char *filebuf1 = NULL,
            *filebuf2 = NULL;   /* Used for I/O buffering */
static int line, len, mlen, dlen, count,
       mode, newdata, hasdata, bquote, bquoteline, end,
       verbose=1, secure=0, ambiguous, truncation=0,
       t, i, x, y, z;
static int siz = LEN;
static FILE *ofp;

/* Forward declaratons, defined after main() */
int ExplodeFile();
int ExplodeLine();
int ExplodeLineCheck();


/* This function returns 1 if the string s only has
 * chars which are valid in uuencoded data, 0 otherwise.
 * The string is assumed not to have any ASCII < 32.
 */
int uuchk(char *s)
{
  int i, top;
 
  top = len-(mlen-62); 
  for(i=1; i<top; i++)           /* Check only those chars that are data */
    if (*s++ >= 'a') return 0;   /* This string is normally not valid uucode */
  return 1;
}


main(int argc, char *argv[])
{
  FILE *ifp;
  char *pname;

  pname = argv[0];
  while (argc > 1 && *argv[1] == '-')   /* There is an option */
    {
      if (*(argv[1]+1) == 'q')          /* Quiet option */
        {
          verbose = 0;
          argc--;
          argv++;
        }
      else if (*(argv[1]+1) == 'h')   /* Help option, print usage and quit */
        {
          printf("Usage: %s [-q | -h | -s] [file1 [file2...]]\n", argv[0]);
          printf("-q  quiet\n-h  usage\n-s  secure, check all data lines\n");
          printf("When you get warnings check the input.\n");
          return;
        }
      else if (*(argv[1]+1) == 's')   /* Secure option  */
        {
          secure = 1;
          argc--;
          argv++;
       }
    }
  D(printf("verbose=%d, secure=%d\n", verbose, secure));
  if (argc < 2)
    {
      line = 0;   /* Not that one has much use of linenumbers in stdin... */
      ExplodeFile(stdin, "stdin");      /* Standard input, probably a pipe */
    }
  else 
    {
      if ((filebuf1 = malloc(BUFFER_SIZE)) == NULL
          || (filebuf2 = malloc(BUFFER_SIZE)) == NULL)
        fprintf(stderr, "%s: buffer allocation failed.\n", pname);
      
      for (; --argc && ++argv; )
        {
          if ((ifp = fopen(*argv,"r")) == NULL)
            {
              perror(*argv);
              continue;
            }
          if (filebuf1 != NULL)
            setbuf(ifp, filebuf1);
          line = 0;                 /* reset line number */
          ExplodeFile(ifp, *argv);  /* uudecodes the data in this input file*/
          
          /* Uncomment the next line when you want to save  */
          /* disk space, it simply deletes the input file   */
          /*    unlink(*argv);  */
          fclose(ifp);
        }
    }
return;
}


/* This function scans the input file until all parts are decoded. */

int ExplodeFile(FILE *ifp, char *fname)
{
  hasdata = mlen = 0;

  /* On EOF, fgets returns NULL, not its first argument */
  while (fgets(ibuf, siz, ifp) != NULL)
    {
      while (1)
        {
          line++;
          if (! strncmp(ibuf, "begin ", 6)
              && isdigit(ibuf[6])
              && isdigit(ibuf[7])
              && isdigit(ibuf[8]))
            {
              break;   /* Found a begin line */
            }
          if (fgets(ibuf, siz, ifp) == NULL)   /* EOF was reached */
            {
              if (! hasdata) printf("%s: no begin line\n", fname);
              return;
            }
        }

      /* Extract filename and file mode */    
      if ((sscanf(ibuf, "begin %o%[ ]%s", &mode, dummy, dest)) != 3)
        {
          len = strlen(ibuf);
          ibuf[len-1] = 0;      /* Replace the \n with a 0 */
          printf("%s: %s: Invalid mode or filename\n", fname, ibuf);
          continue;     /* Search for next begin line */
        }
      hasdata = 1;      /* Found first valid begin line */
      if (verbose) 
        {
          printf("Extracting <%s>\n", dest);
          /* By default stdout is line buffered so I must flush */
          fflush(stdout);
        }

      /* prepare output file */
      if ((ofp = fopen(dest, "w")) == NULL)
        {
          perror(dest);
          continue;
        }
  /*    if (chmod(dest, mode) == -1)      Set file-mode 
        perror(dest); */
      if (filebuf2 != NULL)
        setbuf(ofp, filebuf2);
      
      /* The line after the begin is assumed to be a valid data line.
       * If it is an M-line, the length is saved, unless it is < 62, which
       * is considered a fatal error.
       * If it begins with [!-L], it is decoded as the short data line,
       * if the next line is not SPC/`, a warning is issued.
       * If it is a SPC or `, the outputfile is simply closed.
       * (The code below was added to handle very small uuencoded files.)
       */
      if (fgets(ibuf, siz, ifp) == NULL)  /* EOF encountered */
        {
          DISPLAY("\nEOF after begin\n");
          fclose(ofp);
          /* unlink(dest);     Remove the output file and */
          return;          /* proceed with next input file */
        }
      line++;
      len = strlen(ibuf);
      if (*ibuf == 'M')
        {
          if ((mlen = len) < 62)
            {
              DISPLAY("\ninvalid first data line %d\n", line);
              fclose(ofp);
              /* unlink(dest); */
              continue;     /* Search for next begin line */
            }
          if (! secure)
            ExplodeLine(ibuf);
          else if (! ExplodeLineCheck(ibuf))
            {
              DISPLAY("\nillegal chars in first data line %d\n", line);
              fclose(ofp);
              /* unlink(dest); */
              continue;     /* Search for next begin line */
            }
        }
      else if (*ibuf <= 'L' && *ibuf > ' ')   /* No special checks here! */
        {
          if (! secure)
            ExplodeLine(ibuf);
          else if (! ExplodeLineCheck(ibuf))
            {
              DISPLAY("\nillegal chars in short data line %d\n", line);
              fclose(ofp);
              continue;     /* Search for next begin line */
            }

          /* Now read in line after short data line */
          if (fgets(ibuf, siz, ifp) == NULL)
            {
              DISPLAY("\nwarning: EOF after short data line\n");
              fclose(ofp);
              return;         /* Proceed with next input file */
            }
          len = strlen(ibuf);
          /* This next line depends on lazy evaluation */
          if (len != 2 && len != 3 || *ibuf != ' ' && *ibuf != '`')
            {
              DISPLAY("\nwarning: garbage at end %d\n", line+1);
              /* Back up, it may have been a new begin line */
              fseek(ifp, (long)-strlen(ibuf), 1);
              fclose(ofp);
            }
          else
            {
              line++;
              DISPLAY("-- done\n");
              fclose(ofp);
            }
          continue;       /* Search for next begin line */
        }
      else if ((*ibuf == ' ' || *ibuf == '`') && (len == 2 || len == 3))
        /* uuencoded empty file */
        {
          DISPLAY("-- done\n");
          fclose(ofp);
          continue;       /* Search for next begin line */
        }
      else
        {
          DISPLAY("\ngarbage at first line %d\n", line);
          fclose(ofp);
          /* unlink(dest); */
          continue;       /* Search for next begin line */
        }
      
      /* When a [!-L] line is found, a length and char check is made to
       * validate it as the short data line. If the next valid uucode line
       * is SPC, the line is decoded. If it is not, a warning is printed,
       * but the line is still decoded (most likely correctly). Check the
       * input file to be sure.
       *
       * Whenever a valid M-line is found, it is assumed that any previously
       * seen potentially valid short lines were in fact garbage, this is
       * done by setting ambiguous=0.
       *
       * When a SPC is found, one of two strategies are used:
       * 1. If a short line has been seen, this SPC is assumed valid and I
       *    never bother about the end line.
       * 2. If not, look for the end-line. If next valid uucode line is
       *    end         -- finish output file, no warnings
       *    M-line      -- SPC was bogus, continue & issue warning.
       *    SPC         -- continue & issue warning
       *    EOF or begin -- finish output file with "end line not found"
       *    short data line -- SPC was bogus, continue & issue warning
       *
       * The reason for the last behaviour is that P(no short data line) ~= 2%
       * (see below) and P(bogus short line) is very small. So if a valid
       * short line is seen after a SPC, it is more likely that it is valid
       * and the SPC was bogus.
       * A problem here is how to know if the file has ` or SPC as last
       * 0 length data line. It is one or the other and if it is SPC, I can
       * always just ignore spurious '-lines and vice versa. I decided not
       * to distinguish between them. This is a bit vaulnerable, but saves
       * overhead.
       *
       * The above SPC-line checking is new in v 1.3 and was added to handle
       * cases like this (which do occur sometimes):
       * M-lines
       * [garbage]
       * bogus SPC
       * [garbage]
       * M-lines   (belonging to the same file)
       *
       * As a bonus, it now also handles (I've never seen this happen):
       * M-lines
       * [garbage]
       * bogus SPC
       * [garbage]
       * short data line
       * SPC
       * 
       * Of course things like this cannot be correctly decoded:
       * M-line
       * bogus SPC
       * [garbage]
       * bogus short line
       * [garbage]
       * M-line    (belonging to the same file)
       * but the prob. that this would happen is rather small!
       * 
       * There is still only *one* pathological case where this function
       * would issue no warning at all and still produce corrupted output:
       * M-lines
       * bogus short-line (exactly one, falling through the checks)
       * space/`
       * [garbage]
       * M-lines   (belonging to the same file)
       * This case is obviously theoretically undetectable, so in this case I
       * don't gain anything by looking for the end-line.
       *
       * X = original filesize % 45
       * Assumption: X is uniform(0..44)  (This seems reasonable)
       * P(no short-line) = P(X=0) = 1/45 ~= 2%
       * Even if no short line is found in a block, no warning about this
       * is printed. This was changed because in this case I always look for
       * the end line. If it is found, the output is very likely correct.
       * If not, a warning "no end line" is given, so the previuos warning
       * is now obsolete.
       * 
       * If there is a garbage line beginning with M and of correct length,
       * the output will be corrupted. A check for this is turned on with
       * -s which looks for any chars that cannot belong to a valid M-line.
       * This check is done in ExplodeLineCheck() writing to an array
       * instead of directly to the file. If all goes well, the array is
       * written to the file.
       * This solution costs less if the M-line is valid (which is probable)
       * than checking the line first and then uudecoding it.
       */

      /* Reset the buffer for short data lines to empty */
      *bp = ' ';
      /* Reset a couple of indicators */
      count = ambiguous = truncation = 0;
      bquote = bquoteline = 0;
      end = 0;
      while (fgets(ibuf, siz, ifp) != NULL)
        { 

          if ((newdata = ! strncmp(ibuf, "begin ", 6)
               && isdigit(ibuf[6])
               && isdigit(ibuf[7])
               && isdigit(ibuf[8])) )     /* No SPC line in this block, or
                                             no end line */
            {        /* Return the begin line to input stream */
              fseek(ifp, (long)-strlen(ibuf), 1);
              ExplodeLine(bp);
              break;     /* get out of inner while loop */
            }
          line++;
         
          len = strlen(ibuf);
          if (*ibuf <= 'L' && *ibuf > ' ')   /* It may be a short data line */
            {
              dlen = *ibuf-32;   /* Actual data length, bytes */
              t = dlen/3;
              if (dlen%3) t++;
              t = t << 2;
              if (len == t+2+(mlen-62))  /* Allows for extra chars checksum? */
                if (uuchk(ibuf))     /* All chars are valid */
                  {
                    tmp = bp;    /* Keep this line in b[] */
                    bp = ibuf;
                    ibuf = tmp;
                    if (bquote)  /* There is a bogus SPC line above */
                      {
                        DISPLAY("\nwarning: bogus SPC-line %d  ", bquoteline);
                        bquote = bquoteline = 0;
                        /* I must also reset the truncation flag in
                         * case "truncated" message has been displayed.
                         */
                        truncation = 0;
                      }
                    ambiguous++; /* No of seen valid short-lines between */
                                 /* last M-line and first SPC-line       */
                    continue;    /* Get next input line */
                  }
              if (*bp != ' ') count++;
              /*
               * This was a garbage line after a potential short line,
               *  get next input line
               */
              continue;
            }
          else if ((*ibuf == ' ' || *ibuf == '`' ) && (len == 2 || len == 3))
            {
              bquote = 1;         /* Mark that a SPC line has been seen */
              if (bquoteline)     /* There was a previous SPC line */
                {
                  DISPLAY("\nwarning: bogus SPC-line %d  ", bquoteline);
                  truncation = 0;
                }
              bquoteline = line;  /* Save the line number */
              if (ambiguous)      /* At least one short line has been seen */
                {
                  if (count > 0)
                     DISPLAY("\nwarning: garbage at end %d  ", line);
                  if (ambiguous > 1)
                     DISPLAY("\nambiguous data at end %d  ", line);
                  ExplodeLine(bp);
                  break;            /* Finished, ignore the end line */
                }
            }
          else if ((end = !strncmp(ibuf, "end\n", 4)) && ! ambiguous && bquote)
            {
              /* Mark that the end line has been seen, end==1 */
              break;      /* Finished, get out */
            }
          else if (*ibuf == 'M')     /* This is probably a valid data line */
            {
              if (len != mlen)
                {
                  if (verbose && uuchk(ibuf))   /* All chars are valid */
                    {
                      if (! truncation)
                        {
                          printf("\nwarning: truncated data line %d ", line);
                          fflush(stdout);
                          truncation = 1;
                        }
                      else
                        {
                          printf("%d ", line);
                          fflush(stdout);
                        }
                    }
                }
              else
                {
                  mode = 1;     /* Used temporary as a flag */
                  if (! secure)
                    ExplodeLine(ibuf);
                  else
                  {
                     mode = ExplodeLineCheck(ibuf);
                     D(if (! mode) printf("\nIllegal char %d", line));
                  }
                  if (mode)
                  {
                    /* Reset the garbage indicators */
                    count = ambiguous = 0;
                    if (bquote)       /* There is a bogus SPC line above */
                    {
                       DISPLAY("\nwarning: bogus SPC-line %d  ", bquoteline);
                       bquoteline = bquote = 0;
                       /* I must also reset the truncation flag in case
                        * the "truncated" message has been displayed. It
                        * would otherwise be "broken off" by this message.
                        */
                       truncation = 0;
                    }
                  }
               }
            }
        } /*while*/
      fclose(ofp);
      
      if (! ambiguous && ! end) DISPLAY("\nwarning: no end line  ");
      if (! bquote)
        {DISPLAY("\nend of uucode not found\n");}
      else
        {DISPLAY("-- done\n");}
    } /*while*/
}


/* This function decodes one line of information, written by Kevin Yang.
 * The code is slightly different from that of uuconvert.c
 * or uudecode.c. I use pointers instead of array indices
 * to avoid time consuming address multiplications.  The 
 * condition tests are modified and eliminates 2 tests
 * for every 4 bytes. Characters are decoded only when
 * one of the three conditions matches, in which complicated
 * mathematical computation are eliminated for the last few
 * bytes.
 * I hope this can speed up the decoding!
 */
#define DECODE(C) (((C) - ' ') & 077)

ExplodeLine(char *str)
{
  i = DECODE(*str);    /* Always 0 for a line beginning with SPC or ` */
  p = ++str;
  
  while (i > 0)
    {
      if (i >= 3)
        {
          x  = (DECODE(*p) << 2); p++;
          x |= (DECODE(*p) >> 4);
          y  = (DECODE(*p) << 4); p++;
          y |= (DECODE(*p) >> 2);
          z  = (DECODE(*p) << 6); p++;
          z |= (DECODE(*p));
          putc(x, ofp);
          putc(y, ofp);
          putc(z, ofp);
        }
      else if (i >= 2)
        {
          x  = (DECODE(*p) << 2); p++;
          x |= (DECODE(*p) >> 4);
          y  = (DECODE(*p) << 4); p++;
          y |= (DECODE(*p) >> 2);
          putc(x, ofp);
          putc(y, ofp);
        }
      else if (i >= 1)
        {
          x  = (DECODE(*p) << 2); p++;
          x |= (DECODE(*p) >> 4);
          putc(x, ofp);
        }
      
      str += 4;
      p = str;
      i -= 3;
    }  /*while*/
}


/* This array is used to hold decoded data. The entire buffer is
 * written to the output file when the line is decoded.
 * It is assumed that a full data line is 45 bytes.
 */
unsigned char data[50];

/*
 * Returns:
 *      1 -- OK, wrote to file
 *      0 -- this is no data line, illegal chars found
 */
int ExplodeLineCheck(char *str)
{
  unsigned char *d;

  i = DECODE(*str);    /* Always 0 for a line beginning with SPC or ` */
  p = ++str;
  d = data;
  while (i > 0)
    {
      if (i >= 3)
        {
          x  = (DECODE(*p) << 2); p++;
          x |= (DECODE(*p) >> 4);
          y  = (DECODE(*p) << 4); p++;
          y |= (DECODE(*p) >> 2);
          z  = (DECODE(*p) << 6); p++;
          z |= (DECODE(*p));
          *d++ = x; *d++ = y; *d++ = z;
          /* Check if these chars were valid uucode */
          if (*p >= 'a' || *(p-1) >= 'a' || *(p-2) >= 'a' || *(p-3) >= 'a')
            return(0);
        }
      else if (i >= 2)
        {
          x  = (DECODE(*p) << 2); p++;
          x |= (DECODE(*p) >> 4);
          y  = (DECODE(*p) << 4); p++;
          y |= (DECODE(*p) >> 2);
          *d++ = x; *d++ = y;
          /* Check if these chars were valid uucode */
          if (*p >= 'a' || *(p-1) >= 'a' || *(p-2) >= 'a')
            return(0);
        }
      else if (i >= 1)
        {
          x  = (DECODE(*p) << 2); p++;
          x |= (DECODE(*p) >> 4);
          *d++ = x;
          if (*p >= 'a' || *(p-1) >= 'a')
            return(0);
        }
      str += 4;
      p = str;
      i -= 3;
    }  /*while*/
    *d = 0;   /* End the string */
    fwrite(data, 1, d-data, ofp);
    return(1);
}


    
4380.46Truetype, screwed-riteGVA05::DORRELLWed Mar 13 1996 14:5116
    What an interesting thread. 
    
    Can you help? I'm fairly adept with
    uuencoders. I'm running WinCode 2.61 to decode some truetype fonts
    mailed to me by my marketing agency, sent as uuencoded text as the bocy
    of a message. They decode fine - I get the file name "foo.ttf" or
    whatever. And they're about the right size.
    
    BUT!! I can't get the control panel to see them! Something must be
    screwing up the files so the headers don't work.
    
    Could it be some dreaded Win95 side-effect?
    
    Adam Dorrell @GEO 
    
    PS. What a top maxim.