home *** CD-ROM | disk | FTP | other *** search
/ Current Shareware 1994 January / SHAR194.ISO / compress / arjit.zip / ARJIT.CPP next >
C/C++ Source or Header  |  1993-07-13  |  3KB  |  86 lines

  1. /*
  2.  
  3.     ARJIT - a tool to work with the ARJ utility.
  4.     --------------------------------------------
  5.                                    Garry J. Vass
  6.                                   Gundhof Str 18
  7.                                 Frankfurt  60528
  8.                                          Germany
  9.  
  10.  
  11.     The purpose of this little hack is to compress all
  12.     the files in the current directory into an ARJ file.
  13.     The ARJ file will be given the same name as the directory.
  14.  
  15.     Why?  Because I frequently need to free up some disk space
  16.     for something, but I don't want to erase anything.  Sure,
  17.     I can simply type the ARJ command line, but 1.  I use this
  18.     tool in conjunction with "GO" and "SWEEP" (tools that
  19.     operate on an entire tree); and 2. I am VERY lazy.
  20.  
  21.     To use this tool, go to a directory and type "ARJIT".
  22.     Note that you must have ARJ.EXE installed in your path.
  23.  
  24.     To use this tool with "GO", type GO ARJIT. (etc).
  25.  
  26.     ARJ is a compression utility written by Robert Jung,
  27.     and the word, "ARJ", is a registered trademark belonging
  28.     to him.
  29.  
  30.     What lies below is the "C" language source code.  You are
  31.     invited to hack away.
  32.  
  33. */    
  34. /***************************************************************/
  35. /*                                                             */
  36. /*                                                             */
  37. /*                                                             */
  38. /*                                                             */
  39. /***************************************************************/
  40. #include  <stdio.h>
  41. #include <stdlib.h>
  42. #include <string.h>
  43. #include    <dir.h>
  44. /***************************************************************/
  45. /*                                                             */
  46. /*                                                             */
  47. /*                                                             */
  48. /*                                                             */
  49. /***************************************************************/
  50. char      Cmd[ 261 ];
  51. char  Basecwd[ 128 ];
  52. char   Target[ 128 ];
  53. /***************************************************************/
  54. /*                                                             */
  55. /*                                                             */
  56. /*                                                             */
  57. /*                                                             */
  58. /***************************************************************/
  59. int main( int argc, char *argv[] )
  60. {
  61.     char *arj = searchpath( "ARJ.EXE" );
  62.     if( !arj ) {
  63.         printf( "ARJ not found!\n" );
  64.         exit( 0 );
  65.     }
  66.     getcwd( Basecwd, 128 );
  67.     printf( "Current directory is %s\n", Basecwd );
  68.     strcpy( Target, Basecwd );
  69.     strrev( Target );
  70.     char *p = strchr( Target, '\\' );
  71.     if( p ) {
  72.         *p = 0;
  73.     }
  74.     strrev( Target );
  75.     sprintf( Cmd, "%s m %s *.*", arj, Target );
  76.     system( Cmd );
  77.     system( "DIR" );
  78.     return( 0 );
  79. }
  80. /***************************************************************/
  81. /*                                                             */
  82. /*                                                             */
  83. /*                                                             */
  84. /*                                                             */
  85. /***************************************************************/
  86.