Go to the documentation of this file.
7 #define isdigit(c) (c >= '0' && c <= '9')
8 #define isalpha(c) ((c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z'))
9 #define isspace(c) (c == ' ' || c == '\t' || c == '\n')
11 int zs_strparts(
char str[],
char delim[],
int maxparts,
char *strvec[]);
13 char *
zs_substr(
char *longstr,
char *smlstr);
24 char str1[FILENAME_MAX], str2[FILENAME_MAX], envvar[128];
25 char *dollar, *ptr, *trans, *
parts[128];
26 int32_t numparts,
i, index1, index2;
32 ptr = (
char*) &inpath[0];
36 while ((dollar = strchr(ptr,
'$'))) {
37 strncat(str1, ptr, (dollar - ptr));
38 index1 += (dollar - ptr);
44 envvar[index2++] = *ptr;
47 envvar[index2] =
'\0';
51 if ((trans = getenv(envvar)) ==
NULL) {
54 index1 += (strlen(envvar) + 1);
57 index1 += strlen(trans);
67 for (
i = 0;
i < numparts;
i++)
72 if (strlen(
parts[0]) == 0) {
73 for (
i = 0;
i < numparts;
i++) {
74 if ((strlen(
parts[
i]) == 0) || (strcmp(
parts[
i],
".") == 0))
79 if ((
i == numparts) && (numparts != 1))
81 else if ((
i < numparts) && (strcmp(
parts[
i],
"..") == 0))
83 }
else if (*
parts[0] ==
'~') {
84 printf(
"\nInterpretation of ~ is no longer supported.\n");
87 else if ((strcmp(
parts[0],
".") == 0) || (strcmp(
parts[0],
"..") == 0)) {
89 if (strcmp(
parts[0],
".") == 0)
93 for (
i = index1;
i < numparts;
i++) {
94 if (strcmp(
parts[
i],
"..") == 0) {
95 if ((ptr = strrchr(str2,
'/')) ==
NULL)
103 }
else if (strlen(
parts[
i]) && (strcmp(
parts[
i],
".") != 0)) {
104 if ((
i != 0) && (strcmp(str2,
"/") != 0))
111 for (
i = 0;
i < numparts;
i++)
129 for (
i = 0;
i < maxparts;
i++) {
130 if (*sptr1 ==
'\0' || sptr1 ==
zs_substr(sptr1, delim))
140 strvec[
i] = (
char *) malloc(len + 1);
142 *(strvec[
i] + len) =
'\0';
146 if (sptr2 ==
NULL || *sptr2 ==
'\0')
165 for (
k =
i;
k <= l;
k++)
180 char *longstr, *smlstr;
186 slen = strlen(smlstr);
187 llen = strlen(longstr);
188 for (
pos = longstr; *
pos !=
'\0';
pos++) {
191 if (!strncmp(
pos, smlstr, slen))
char * zs_substr(char *longstr, char *smlstr)
void parse_file_name(const char *inpath, char *outpath)
int zs_strparts(char str[], char delim[], int maxparts, char *strvec[])
PARAM_TYPE_NONE Default value No parameter is buried in the product name name_prefix is case insensitive string compared to the product name PARAM_TYPE_VIS_WAVE The visible wavelength bands from the sensor are buried in the product name The product name is compared by appending and name_suffix ie aph_412_giop where prod_ix will be set to PARAM_TYPE_IR_WAVE same search method as PARAM_TYPE_VIS_WAVE except only wavelength above are looped through but prod_ix is still based ie aph_2_giop for the second and prod_ix set to PARAM_TYPE_INT name_prefix is compared with the beginning of the product name If name_suffix is not empty the it must match the end of the product name The characters right after the prefix are read as an integer and prod_ix is set to that number strncpy(l2prod->name_prefix, "myprod", UNITLEN)
How many dimensions is the output array Default is Not sure if anything above will work correctly strcpy(l2prod->title, "no title yet")