1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62
|
#include "libtest.h"
#include <string.h>
EXTERN const char *
get_string_from_array(const char **array, int index)
{
static char buffer[512];
if(array[index] == NULL)
return NULL;
strcpy(buffer, array[index]);
return buffer;
}
EXTERN const char **
onetwothree3()
{
static char *buffer[4] = {
"one",
"two",
"three"
};
return (const char **) buffer;
}
EXTERN const char **
onetwothree4()
{
static char *buffer[4] = {
"one",
"two",
"three",
NULL
};
return (const char **) buffer;
}
EXTERN const char **
onenullthree3()
{
static char *buffer[3] = {
"one",
NULL,
"three"
};
return (const char **) buffer;
}
EXTERN const char **
ptrnull()
{
static char *buffer[1] = {
NULL
};
return (const char **) buffer;
}
EXTERN void
string_array_arg_update(char **arg)
{
arg[0] = "one";
arg[1] = "two";
}
|