I wish to write a 'virtual tapedrive' for use on my Linux system (gcc 3.2.2). The code will be your basic I/O filter (with enhancements of course). If I call it 'vtape', here is how I imagine using it:
Backup:
tar -c /home | vtape
Restore:
vtape | tar -x
Within vtape.c, can I tell which mode the program has been called? In the first case, vtape will slurp in the data stream from stdin (nothing to stdout). In the second case, there is no stdin so it will spew out a data stream to stdout.
Get it?
-with thanks.
Backup:
tar -c /home | vtape
Restore:
vtape | tar -x
Within vtape.c, can I tell which mode the program has been called? In the first case, vtape will slurp in the data stream from stdin (nothing to stdout). In the second case, there is no stdin so it will spew out a data stream to stdout.
Get it?
-with thanks.