[parser] Forgot to add shuffle.h/.c

This commit is contained in:
Al
2015-12-01 11:25:28 -05:00
parent 116fe857db
commit b94264b745
2 changed files with 33 additions and 0 deletions

24
src/shuffle.c Normal file
View File

@@ -0,0 +1,24 @@
#include "shuffle.h"
#include <config.h>
#include "string_utils.h"
bool shuffle_file(char *filename) {
char *shuffle_command = NULL;
#if defined(HAVE_SHUF)
shuffle_command = "shuf";
#else
return false;
#endif
char_array *command = char_array_new();
char_array_cat_printf(command, "%s -o %s %s", shuffle_command, filename, filename);
int ret = system(char_array_get_string(command));
char_array_destroy(command);
return ret == EXIT_SUCCESS;
}