Ejemplo n.º 1
0
/*
 * jsonwr_arg_prop
 *
 * Outputs an argv array while removing the path from the program name
 */
void jsonwr_args_prop(JSONWR_T* jsonwr, const char* property, int argc, char** argv) {
  char *prog;
  int i;
  jsonwr_property(jsonwr, property);
  jsonwr_start_array_value(jsonwr);
  prog = strdup(argv[0]);
  jsonwr_str_value(jsonwr, basename(prog));
  free(prog);
  for (i = 1; i < argc; i++) {
    jsonwr_str_value(jsonwr, argv[i]);
  }
  jsonwr_end_array_value(jsonwr);
}
Ejemplo n.º 2
0
/*
 * jsonwr_str_prop
 */
void jsonwr_str_prop(JSONWR_T* jsonwr, char* property, char* value) {
  jsonwr_property(jsonwr, property);
  jsonwr_str_value(jsonwr, value);
}
Ejemplo n.º 3
0
/*
 * jsonwr_str_array_value
 * Writes an array of strings.
 */
void jsonwr_str_array_value(JSONWR_T* jsonwr, char** values, int count) {
  int i;
  jsonwr_start_array_value(jsonwr);
  for (i = 0; i < count; i++) jsonwr_str_value(jsonwr, values[i]);
  jsonwr_end_array_value(jsonwr);
}
Ejemplo n.º 4
0
/*
 * jsonwr_nstr_value
 * Write a string or a null value.
 */
void jsonwr_nstr_value(JSONWR_T* jsonwr, char* value) {
  if (value == NULL) jsonwr_null_value(jsonwr);
  else jsonwr_str_value(jsonwr, value);
}