summaryrefslogtreecommitdiff
path: root/cmd_rand_libc.c
diff options
context:
space:
mode:
authorFreeArtMan <dos21h@gmail.com>2017-05-20 13:43:49 +0100
committerFreeArtMan <dos21h@gmail.com>2017-05-20 13:43:49 +0100
commit126fa84b8591c3b285b7f598089451aa22447f10 (patch)
tree29eb78cd41870a1e4211e45b8e551a94b401ffe7 /cmd_rand_libc.c
parentc03a145002445eaaa814e3f133c9a28f991bb860 (diff)
downloadagni-126fa84b8591c3b285b7f598089451aa22447f10.tar.gz
agni-126fa84b8591c3b285b7f598089451aa22447f10.zip
Moved commands to seperate directory, moved external sources to seperate directory, updated Makefile with auto include and auto compile features
Diffstat (limited to 'cmd_rand_libc.c')
-rw-r--r--cmd_rand_libc.c50
1 files changed, 0 insertions, 50 deletions
diff --git a/cmd_rand_libc.c b/cmd_rand_libc.c
deleted file mode 100644
index d72bc45..0000000
--- a/cmd_rand_libc.c
+++ /dev/null
@@ -1,50 +0,0 @@
-#include "cmd_rand_libc.h"
-
-
-void *cmd_rand_libc(void *data)
-{
- char *ret = NULL;
- int fret=-1;
-
- const int buf_size = 128;
- char buf[buf_size+1];
-
- printf("RAND LIBC\n");
-
- int i;
- int count;
- int rand_val;
- sds params;
- sds out_result;
- sds *tokens;
-
- if (data == NULL)
- {
- rand_val = rand();
- snprintf(buf, buf_size, "%d", rand_val);
- } else {
- //cut output to 512
- char str_integer[16];
- int rand_state;
-
- params = sdsnew(data);
- out_result = sdsempty();
- tokens = sdssplitargs(params, &count);
- for (i=0;i<count;i++)
- {
- rand_state = atoi(tokens[i]);
- snprintf(str_integer, 16, "%d ", rand_r(&rand_state));
- out_result = sdscat(out_result, str_integer);
- }
- out_result = sdscat(out_result,"\n");
- snprintf(buf, buf_size, "%s", out_result);
-
- sdsfree(params);
- sdsfree(out_result);
- sdsfreesplitres(tokens, count);
- }
-
- ret = alloc_new_str(buf);
-
- return ret;
-}