LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Blogs > rainbowsally
User Name
Password

Notices

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
http://www.linuxquestions.org/questi...-script-35691/

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)
Code:
#!/usr/local/bin/runc

#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);
    system(cmd);
  }
}
If on a windows partition run this as
Code:
runc packall.runc
in lieu of being able to make it executable.

The Computer Mad Science Team
:-)
Posted in Uncategorized
Views 214 Comments 0
« Prev     Main     Next »
Total Comments 0

Comments

 

  



All times are GMT -5. The time now is 10:56 AM.

Main Menu

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