libsheepy

C lib for handling text files, strings and json like data structure with an object oriented system
git clone https://spartatek.se/git/libsheepy.git
Log | Files | Refs | README | LICENSE

cpy.c (618B)


      1 //
      2 
      3 #include "../release/libsheepyObject.h"
      4 
      5 #define internal static
      6 
      7 
      8 #ifndef unitTest
      9 #endif
     10 int MAIN(int ARGC, char** ARGV);
     11 
     12 int argc; char **argv;
     13 
     14 #ifndef unitTest
     15 // Remove main when running the unit tests
     16 #define MAIN   main
     17 #endif
     18 int MAIN(int ARGC, char** ARGV) {
     19   int dummy UNUSED;
     20 
     21   argc = ARGC; argv = ARGV;;// cpy path
     22 
     23   if (argc < 2) {
     24     puts(BLD RED "Usage: " RST "cpy path (dest)");
     25     XFAILURE
     26   }
     27 
     28   if (argc < 3) {
     29     // only one parameter
     30     logSystemf("cp -r %s .", argv[1]);
     31   }
     32   else {
     33     rangeFrom(i, 1, argc-1) {
     34       logSystemf("cp -r %s %s", argv[1], argv[argc-1]);
     35     }
     36 }
     37   }
     38