Commit Graph

27 Commits

Author SHA1 Message Date
Juli Mallett
6fa4125491 Use fwrite(3) to write out the decoded information, as the b64 decoding stuff
won't NUL terminate the string for us, and so we're liable to pick up trailing
garbage, possibly tons of it.

Pointed out by:	obrien
MFC after:	3 days
2002-04-20 03:33:40 +00:00
Juli Mallett
c8268a9fbc base64_decode() was feeding \r and \n to the decoding function, and that
was causing output to be corrupted.

Pointed out by:	obrien
MFC after:	3 days
2002-04-20 02:33:30 +00:00
Juli Mallett
3cd5f68282 Bump WARNS to 4. 2002-04-20 00:20:54 +00:00
Warner Losh
3f330d7d1a remove __P 2002-03-22 01:42:45 +00:00
Juli Mallett
0e3c27aef0 Fix handling of filenames with spaces in them in the input file to
uudecode(1), as this behaviour was explicitly added in revision 1.12 as
the result of PR 2882.  Remove space (' ') from the delimiter characters
handed to strtok(3).

Reviewed by:	mike
Approved by:	mike
Pointy hat to:	me
2002-03-19 02:05:27 +00:00
Juli Mallett
9873dd6133 Make uudecode(1) use setmode(3) and getmode(3) instead of just blindly
chmodding using an octal mode, as uudecode needs to handle symbolic modes
as chmod and such do.

Suggested by:	Tim J. Robbins <tim@robbins.id.au>

Also move meta-character (~ in this case) globbing to only if we are reading
the filename from the encoded file, as otherwise it is the shell's job.

Reviewed by:	mike
Approved by:	mike
2002-03-19 00:44:07 +00:00
Juli Mallett
0e01f18b86 Add base64 support to uuencode(1) and uudecode(1), as specified by SUSv3.
Add `-o' option to uuencode(1) to pipe the uuencoded output to an
arbitrary file, instead of just stdout.

Reviewed by:	-standards, mike
Approved by:	mike
2002-03-05 03:27:47 +00:00
Mike Barcroft
aa7b0c75c5 Un-deprecate the -p option. We now have two ways to output to stdout:
`-o /dev/stdout' or `-p'.

Requested by:	grog, nectar
2002-02-16 09:18:33 +00:00
Mike Barcroft
c3751af262 Add -o option (POSIX.1-2001) to uudecode(1). Deprecate the -p option
(which allows one to redirect output to stdout); `-o /dev/stdout' is
recommended instead.

Submitted by:	Joseph Mallett <jmallett@xMach.org>
MFC after:	2 weeks
2002-01-27 18:21:23 +00:00
Mark Murray
49601c4327 WARNS=2 is to become the default, so remove it from here. 2001-12-11 23:14:43 +00:00
David Malone
9f5b04e925 Style improvements recommended by Bruce as a follow up to some
of the recent WARNS commits. The idea is:

1) FreeBSD id tags should follow vendor tags.
2) Vendor tags should not be compiled (though copyrights probably should).
3) There should be no blank line between including cdefs and __FBSDIF.
2001-12-10 21:13:08 +00:00
David Malone
57a4972d78 Warns cleanup. Add FreeBSD ID to Makefile. 2001-12-03 21:39:04 +00:00
Sheldon Hearn
209e048477 While I'm in here, remove an unused variable.
Submitted by:	Nathan Ahlstrom <nrahlstr@winternet.com>
2000-03-30 09:23:28 +00:00
Sheldon Hearn
a6eb0df247 Do not overwrite files when the -i option is specified!
PR:		17476
Reported by:	Jonathan Chen <jon@spock.org>
2000-03-27 11:49:36 +00:00
Peter Wemm
c3aac50f28 $Id$ -> $FreeBSD$ 1999-08-28 01:08:13 +00:00
Steve Price
c2fd2f2c1b Allow spaces in the filename to be decoded to.
PR:		4882
Submitted by:	Slaven Rezic <eserte@cs.tu-berlin.de>
1998-05-25 06:27:09 +00:00
Wolfram Schneider
dfe64147d2 Add two new options:
-i     Do not overwrite files.

     -s     Do not strip output pathname to base filename. By default uuencode
	    deletes any prefix ending with the last slash '/' for security
	    purpose.
1998-01-25 19:26:05 +00:00
Poul-Henning Kamp
d030d2d2ae Many places in the code NULL is used in integer context, where
plain 0 should be used.  This happens to work because we #define
NULL to 0, but is stylistically wrong and can cause problems
for people trying to port bits of code to other environments.

PR:		2752
Submitted by:	Arne Henrik Juul <arnej@imf.unit.no>
1997-09-18 14:08:40 +00:00
Philippe Charnier
f296f8ebb4 Use err(3). 1997-08-22 06:53:00 +00:00
Warner Losh
1c8af87873 compare return value from getopt against -1 rather than EOF, per the final
posix standard on the topic.
1997-03-29 04:34:07 +00:00
Wolfram Schneider
d05c3da950 Be tolerant to old uuencode programs which encode the ASCII NUL
character as character 32 (space) instead character 64 (`).

See also  'The UNIX-HATERS Handbook', page 82-83.
1997-03-25 14:31:31 +00:00
Wolfram Schneider
3e4c0ae52d Treat 'end\0', 'end\n', 'end\r\n' as trailer line, see rev 1.2 1997-02-18 20:19:04 +00:00
Wolfram Schneider
325bd2382c Better check for detecting header line. A header line must match
"begin [0-7]* *". Now `begin with, ' is not a header line.

Do a boundary check for body characters. Characters less than 33 or
greater than 96 are out of range. If characters are out of range
uudecode print a error message and die.
1997-02-18 17:49:43 +00:00
Wolfram Schneider
2d6a6bc9a8 New options for uudecode
-p Decode file and write output to standard output.
	-c Decode more than one uuencode'd file from file if possible.
1996-10-21 22:02:30 +00:00
Andrey A. Chernov
9137242c2c Oops, restore missing piece of previous commit. 1996-04-25 18:14:11 +00:00
Andrey A. Chernov
cc8c038449 Treat ^end<EOF> as valid terminator (like ^end\n), some encoders (f.e. Eudora)
produce such things.
1996-04-25 14:49:40 +00:00
Rodney W. Grimes
9b50d90275 BSD 4.4 Lite Usr.bin Sources 1994-05-27 12:33:43 +00:00