Usual BS: large parts of this code come from GNU tar-1.12, some other
parts -- from Debian's busybox (part of boot-floppies package), and 
are GPL'ed by their respective authors.  The rest is written by me
and is copylefted: do what you like with it.  
Send bug reports, suggestions, comments etc. to emaziuk@curtin.edu.au 
and linux-router list: linux-router@psychosis.com

23.01.1999  
ctar-14, released by Tomasz Motylewski motyl@ipl.net
Y2K support in README :-)
Significant fixes in hardlink treatment, "/",".","./" work now, 
more robust exclude lists due to "canonifying" paths before comparison
paradigm shift - create(dnameBuf) instead of create(fname)
WARNING gnu tar: "./" -> "", "./dir" -> "./dir"
ctar-14: "./" -> "", "./dir" -> "dir"

Support for reading file list from stdin ("-") by Stuart Lynne <sl@fireplug.net>

05.09.98
Hardlink support was broken but noone noticed for 6 months. :)
I also added sockets; ctar should be [almost] useable now.

01.02.98
Added hardlink support. 

25.01.98
Another gotcha.  "ctar * > A.tar" when A.tar already exists
produces A.tar that has another A.tar of zero length inside it.
IOW shell expands * to A.tar first, ctar creates archive header 
for it, and then the shell opens A.tar for writing (truncating 
original A.tar) and ctar dumps the header.  Contents of original
A.tar aren't there by now so we end up with A.tar of length 0
inside the archive.  I can't see what ctar can do to prevent this
so make sure you redirect output to a new file.  Piping output
to gzip is OK.  Also, see notes below wrt shell expansion. 

Fixed tar bug when '/' was archived as directory with empty string
for name.  Removed most malloc()/free()'s.


07.01.98
4th beta.  "-X" switch now behaves more like that of GNU tar: all
filenames following "-X" are excluded from the archive (in GNU tar
the switch is used as "-X filelist"; in ctar you have to do
"-X `cat filelist`" -- saves a couple of K on open()/read()/close()).
"-x" switch still excludes single filename folowing it, and "--exclude"
is a synonym for "-x".

Debug version is now built with libdmalloc due to malloc() problems.
Edit the Makefile and main.c if you want to compile debug version of ctar 
and remove reference to libdmalloc in Makefile and <dmalloc.h> in main.c.

Untar code is now included, for those who might want to have a look.
Type "make untar" to roll a ~4.7K executable.

17.12.97 
3rd beta of ctar.  Added command-line parser.  Now ctar recognizes 
"-X filename" option ("--exclude" and "-x" also) and excludes "filename" 
from the archive.  You can use wildcards in "filename" IFF they expand 
to ONE filename.  Any parameter following the "filename" is considered 
a file TO BE ADDED, unless it's another "-X".

You can have multiple "-X" options anywhere on the command line.

11.97
Ctar implements a [very] minimal functionality of "tar -c".  It expects
a list of files on stdin, resulting archive goes to stdout.  Use:
    ctar * > archive.tar
or 
    ctar `cat filelist.txt` > archive.tar

"ctar somedir" will tar all the files in somedir, "ctar somedir/somefile" will 
tar only somefile (and its parent dir).  Putting somedir or somedir/somefile in 
filelist.txt (example 2 above) will give you the same result.  

NOTE: putting 
somedir 
somedir/somefile
in filelist.txt will give you a tar archive of somedir with somefile stored 
ttwwiiccee.

NOTE: "ctar somedir/*" may not expand to dotfiles, depending on your shell. Also,
if you do something like 'ctar * > blah.tar' blah.tar may be already created by
the time shell gets to it, so ctar will try to add blah.tar to archive -- bummer.
Piping is safe, so is putting the resulting archive to some other dir.  Things
like 'ctar * > 0000.tar' usually work, too, because 0000.tar comes before first
existing dir entry.  IOW, if first dir entry is, say, bar.c, "ctar * > aar.tar" 
will work: shell expands *, finds bar.c first and after that aar.tar is created.

[Some of the] other known gotchas in ctar:

* Can't store paths longer than 99 characters (thank POSIX for this one)

* Can't store symlinks that point to paths longer than 99 characters (GNU
tar can, using a special non-POSIX format)

* If ctar can't get a group name for file's gid, it doesn't store a group name
(GNU tar stores gname of the owner)

* ctar archives are only 99.9% compatible with GNU tar, in particular, GNU
tar puts more 512KB blocks of 0's in the end of archive.  It shouldn't matter
as long as you're using a random access device (i.e. not tapes), but...

* ctar goes into subdirs recursively.  It can fail on deep directory trees:
run out of stack space or open files (although paths will probably get longer 
than 99 chars before that happens and it will fail anyway)

* lots of other bugs, I'm sure
 

Dima <emaziuk@curtin.edu.au>
