diff options
-rw-r--r-- | pkg.c | 2 | ||||
-rw-r--r-- | utils.c | 15 | ||||
-rw-r--r-- | utils.h | 1 |
3 files changed, 18 insertions, 0 deletions
@@ -8,5 +8,7 @@ int main(int argc, char **argv) { + char* arg = stringedArgument(argc, argv); + free(arg); return 0; } @@ -1,4 +1,6 @@ #include "utils.h" +#include <stdlib.h> +#include <string.h> #include <unistd.h> int checkIfFileExists(char *path) @@ -43,3 +45,16 @@ int detectOsType() } return exists; } + +char* stringedArgument(int argc, char** argv) +{ + int numberOfTotalPackages = argc - 2; + char* arg = (char *) calloc((numberOfTotalPackages * 80), sizeof(char)); + + for( int i = 2; i < argc; i++ ) + { + strcat(arg, argv[i]); + strcat(arg, " "); + } + return arg; +} @@ -15,3 +15,4 @@ enum os int checkIfFileExists(char *path); int detectOsType(); +char* stringedArgument(int argc, char** argv); |