ccx-utils

Miscellaneous utilities written in C
git clone https://ccx.te2000.cz/git/ccx-utils
Log | Files | Refs

argv0exec.c (332B)


      1 #include <skalibs/exec.h>
      2 
      3 int main (int argc, const char const **argv)
      4 {
      5   const char *new_argv[argc + 1];
      6   for(size_t i = 0; i < argc; i++) {
      7     new_argv[i] = argv[i];
      8   }
      9   new_argv[argc] = 0;
     10 
     11   for(size_t i = 0; argv[0][i]; i++) {
     12     if(argv[0][i] == '/') {
     13       new_argv[0] = &argv[0][i+1];
     14     }
     15   }
     16   xexec(new_argv);
     17 }