Review your favorite Linux distribution.
Go Back > Blogs > rainbowsally
User Name


Rate this Entry

new runc version

Posted 09-27-2013 at 03:53 PM by rainbowsally

Here's where runc can be d/loaded.
Run C/C++ Code As Script

Here's another usage example for runc.

When you want to pack up a bunch of folders by name that live in a windows partition, there's a great likelihoold that spaces in the paths could cause a normal shell program to mis-parse the file names.

Runc uses C/C++ and the built-in slist functions (readng and writing to/from files and pipes) don't parse lines of text as args.

file: packall.runc
purpose: utility (executable)

#include <runc.h>

#include <stdlib.h>
#include <stdio.h>

int main(int argc, char** argv)
  char cmd[256];
  char** list = slist_new();
  slist_pipeRead(&list, "find * -mindepth 0 -maxdepth 0 -type d");
  for(int i = 0; i < slist_count(&list); i++)
    char* line = slist_get(&list, i);
    sprintf(cmd, "tar -caf \"%s.tar.gz\" \"%s\"", line, line);
If on a windows partition run this as
runc packall.runc
in lieu of being able to make it executable.

The Computer Mad Science Team
Posted in Uncategorized
Views 1138 Comments 0
« Prev     Main     Next »
Total Comments 0




All times are GMT -5. The time now is 07:32 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration