135 {
137 char **inputfile, *outputfile;
138 long inputfiles, i, i_arg, retval = 0, first_page;
139 long iFile, first_data, sparse, setPageNumber;
140 int32_t sparse_statistics = 0;
141 long merge, nMerge, overwrite, collapse, page, append;
142 int64_t allocated_rows;
143 int32_t columns;
144 SCANNED_ARG *s_arg;
145 long buffer[16];
146 char *param, *last_param, *this_param, *text, *contents, **column;
147 long param_index, param_type, param_size, output_pending;
148 unsigned long pipeFlags, majorOrderFlag;
149
150 char **retain_column, **delete_column;
151 long retain_columns, delete_columns;
152 char **retain_parameter, **delete_parameter;
153 long retain_parameters, delete_parameters;
154 char **retain_array, **delete_array;
155 long retain_arrays, delete_arrays;
156 long nColumns, recover, recovered;
157 short columnMajorOrder = -1;
158
160 argc =
scanargs(&s_arg, argc, argv);
161 if (argc < 3)
163
164 setPageNumber = allocated_rows = param_type = param_size = 0;
165 last_param = this_param = NULL;
166 column = NULL;
167 inputfile = NULL;
168 outputfile = param = NULL;
169 inputfiles = merge = overwrite = collapse = append = nMerge = 0;
170 pipeFlags = 0;
171 sparse = 1;
172 recover = 0;
173
174 retain_column = delete_column = NULL;
175 retain_columns = delete_columns = 0;
176 retain_parameter = delete_parameter = NULL;
177 retain_parameters = delete_parameters = 0;
178 retain_array = delete_array = NULL;
179 retain_arrays = delete_arrays = 0;
180
182 argc =
scanargs(&s_arg, argc, argv);
183 if (argc < 3)
185
186 for (i_arg = 1; i_arg < argc; i_arg++) {
187 if (s_arg[i_arg].arg_type == OPTION) {
188 switch (
match_string(s_arg[i_arg].list[0], option, N_OPTIONS, 0)) {
189 case SET_MAJOR_ORDER:
190 majorOrderFlag = 0;
191 s_arg[i_arg].n_items -= 1;
192 if (s_arg[i_arg].n_items > 0 &&
193 (!
scanItemList(&majorOrderFlag, s_arg[i_arg].list + 1, &s_arg[i_arg].n_items, 0,
194 "row", -1, NULL, 0, SDDS_ROW_MAJOR_ORDER,
195 "column", -1, NULL, 0, SDDS_COLUMN_MAJOR_ORDER, NULL)))
196 SDDS_Bomb(
"invalid -majorOrder syntax/values");
197 if (majorOrderFlag & SDDS_COLUMN_MAJOR_ORDER)
198 columnMajorOrder = 1;
199 else if (majorOrderFlag & SDDS_ROW_MAJOR_ORDER)
200 columnMajorOrder = 0;
201 break;
202 case SET_MERGE:
203 if (s_arg[i_arg].n_items > 2)
204 bomb(
"invalid -merge syntax", USAGE);
205 merge = 1;
206 param = NULL;
207 nMerge = -1;
208 if (s_arg[i_arg].n_items == 2) {
209 if (isdigit(s_arg[i_arg].list[1][0])) {
210 if (!sscanf(s_arg[i_arg].list[1], "%ld", &nMerge))
211 bomb(
"invalid -merge syntax (could not scan number of pages)", USAGE);
212 } else
213 param = s_arg[i_arg].list[1];
214 }
215 break;
216 case SET_APPEND:
217 if (s_arg[i_arg].n_items > 1)
218 bomb(
"invalid -append syntax", USAGE);
219 append = 1;
220 if (collapse) {
221 SDDS_Bomb(
"-collapse and -append options cannot be used together");
222 break;
223 }
224 break;
225 case SET_OVERWRITE:
226 overwrite = 1;
227 break;
228 case SET_PIPE:
229 if (!
processPipeOption(s_arg[i_arg].list + 1, s_arg[i_arg].n_items - 1, &pipeFlags))
231 break;
232 case SET_RECOVER:
233 recover = 1;
234 if (s_arg[i_arg].n_items != 1) {
235 recover = 2;
236 if (s_arg[i_arg].n_items > 2 || strncmp(s_arg[i_arg].list[1], "clip", strlen(s_arg[i_arg].list[1])) != 0)
238 }
239 break;
240 case SET_DELETE:
241 if (s_arg[i_arg].n_items < 3)
243 switch (
match_string(s_arg[i_arg].list[1], mode_name, MODES, 0)) {
244 case COLUMN_MODE:
245 delete_column =
trealloc(delete_column,
sizeof(*delete_column) * (delete_columns + s_arg[i_arg].n_items - 2));
246 for (i = 2; i < s_arg[i_arg].n_items; i++)
247 delete_column[i - 2 + delete_columns] =
expand_ranges(s_arg[i_arg].list[i]);
248 delete_columns += s_arg[i_arg].n_items - 2;
249 break;
250 case PARAMETER_MODE:
251 delete_parameter =
trealloc(delete_parameter,
sizeof(*delete_parameter) * (delete_parameters + s_arg[i_arg].n_items - 2));
252 for (i = 2; i < s_arg[i_arg].n_items; i++)
253 delete_parameter[i - 2 + delete_parameters] =
expand_ranges(s_arg[i_arg].list[i]);
254 delete_parameters += s_arg[i_arg].n_items - 2;
255 break;
256 case ARRAY_MODE:
257 delete_array =
trealloc(delete_array,
sizeof(*delete_array) * (delete_arrays + s_arg[i_arg].n_items - 2));
258 for (i = 2; i < s_arg[i_arg].n_items; i++)
259 delete_array[i - 2 + delete_arrays] =
expand_ranges(s_arg[i_arg].list[i]);
260 delete_arrays += s_arg[i_arg].n_items - 2;
261 break;
262 default:
263 SDDS_Bomb(
"invalid -delete syntax: specify column or parameter keyword");
264 break;
265 }
266 break;
267 case SET_RETAIN:
268 if (s_arg[i_arg].n_items < 3)
270 switch (
match_string(s_arg[i_arg].list[1], mode_name, MODES, 0)) {
271 case COLUMN_MODE:
272 retain_column =
trealloc(retain_column,
sizeof(*retain_column) * (retain_columns + s_arg[i_arg].n_items - 2));
273 for (i = 2; i < s_arg[i_arg].n_items; i++)
274 retain_column[i - 2 + retain_columns] =
expand_ranges(s_arg[i_arg].list[i]);
275 retain_columns += s_arg[i_arg].n_items - 2;
276 break;
277 case PARAMETER_MODE:
278 retain_parameter =
trealloc(retain_parameter,
sizeof(*retain_parameter) * (retain_parameters + s_arg[i_arg].n_items - 2));
279 for (i = 2; i < s_arg[i_arg].n_items; i++)
280 retain_parameter[i - 2 + retain_parameters] =
expand_ranges(s_arg[i_arg].list[i]);
281 retain_parameters += s_arg[i_arg].n_items - 2;
282 break;
283 case ARRAY_MODE:
284 retain_array =
trealloc(retain_array,
sizeof(*retain_array) * (retain_arrays + s_arg[i_arg].n_items - 2));
285 for (i = 2; i < s_arg[i_arg].n_items; i++)
286 retain_array[i - 2 + retain_arrays] =
expand_ranges(s_arg[i_arg].list[i]);
287 retain_arrays += s_arg[i_arg].n_items - 2;
288 break;
289 default:
290 SDDS_Bomb(
"invalid -retain syntax: specify column or parameter keyword");
291 break;
292 }
293 break;
294 case SET_SPARSE:
295 if ((s_arg[i_arg].n_items >= 2) && (s_arg[i_arg].n_items <= 3)) {
296 if (sscanf(s_arg[i_arg].list[1], "%ld", &sparse) != 1) {
297 bomb(
"invalid -sparse syntax", USAGE);
298 }
299 if (sparse <= 0) {
300 bomb(
"invalid -sparse syntax", USAGE);
301 }
302 if (s_arg[i_arg].n_items == 3) {
303 switch (
match_string(s_arg[i_arg].list[2], sparse_mode, SPARSE_MODES, 0)) {
304 case SPARSE_AVERAGE:
305 sparse_statistics = 1;
306 break;
307 case SPARSE_MEDIAN:
308 sparse_statistics = 2;
309 break;
310 case SPARSE_MINIMUM:
311 sparse_statistics = 3;
312 break;
313 case SPARSE_MAXIMUM:
314 sparse_statistics = 4;
315 break;
316 default:
318 break;
319 }
320 }
321 } else {
322 bomb(
"invalid -sparse syntax", USAGE);
323 }
324 break;
325 case SET_COLLAPSE:
326 collapse = 1;
327 if (append) {
328 SDDS_Bomb(
"-collapse and -append options cannot be used together");
329 break;
330 }
331 break;
332 default:
333 bomb(
"unrecognized option", USAGE);
334 break;
335 }
336 } else {
337 inputfile =
trealloc(inputfile,
sizeof(*inputfile) * (inputfiles + 1));
338 inputfile[inputfiles++] = s_arg[i_arg].list[0];
339 }
340 }
341
342 outputfile = NULL;
343 if (inputfiles > 1) {
344 if (pipeFlags & USE_STDIN)
345 SDDS_Bomb(
"too many input files with -pipe option");
346 if (!(pipeFlags & USE_STDOUT)) {
347 if (!append) {
348 outputfile = inputfile[--inputfiles];
349 if (
fexists(outputfile) && !overwrite)
350 SDDS_Bomb(
"output file exists already--give -overWrite option to force replacement");
351 }
352 }
353 } else if (inputfiles == 1) {
354 if (pipeFlags & USE_STDIN) {
355 outputfile = inputfile[0];
356 inputfile[0] = NULL;
357 }
358 if (pipeFlags & USE_STDOUT && outputfile)
359 SDDS_Bomb(
"too many filenames given with -pipe=output");
360 } else {
361 if (!(pipeFlags & USE_STDIN) || !(pipeFlags & USE_STDOUT))
363 inputfiles = 1;
364 inputfile =
tmalloc(
sizeof(*inputfile) * 1);
365 inputfile[0] = outputfile = NULL;
366 }
367
368 for (i = 0; i < inputfiles; i++)
369 if (inputfile[i] && outputfile && strcmp(inputfile[i], outputfile) == 0)
370 SDDS_Bomb(
"Output file is also an input file.");
371
372 if (append) {
373 if (merge) {
374 int64_t rowsPresent;
377 } else {
380 }
381 iFile = 1;
382 } else {
387 if (columnMajorOrder != -1)
388 SDDS_output.layout.data_mode.column_major = columnMajorOrder;
389 else
390 SDDS_output.layout.data_mode.column_major = SDDS_input.layout.data_mode.column_major;
391 iFile = 0;
392 }
393
394 for (; iFile < inputfiles; iFile++) {
395 char **name;
396 int32_t names;
399 if (!collapse) {
402 for (i = 0; i < names; i++) {
403 if (append) {
404
405 if (keep_element(name[i], delete_column, delete_columns, retain_column, retain_columns) &&
407 fprintf(stderr, "Error (sddscombine): Problem appending data. Column %s does not exist in first page.\n", name[i]);
408 exit(EXIT_FAILURE);
409 }
410 } else {
411 if (keep_element(name[i], delete_column, delete_columns, retain_column, retain_columns) &&
415 }
416 free(name[i]);
417 }
418 free(name);
419 }
420
423 for (i = 0; i < names; i++) {
424 if (collapse) {
425 if (keep_element(name[i], delete_parameter, delete_parameters, retain_parameter, retain_parameters) &&
429 } else {
430 if (append) {
431 if (keep_element(name[i], delete_parameter, delete_parameters, retain_parameter, retain_parameters) &&
433 fprintf(stderr, "Error (sddscombine): Problem appending data. Parameter %s does not exist in first page.\n", name[i]);
434 exit(EXIT_FAILURE);
435 }
436 } else {
437 if (keep_element(name[i], delete_parameter, delete_parameters, retain_parameter, retain_parameters) &&
441 }
442 }
443 free(name[i]);
444 }
445 free(name);
446
447 if (!collapse) {
450 for (i = 0; i < names; i++) {
451 if (append) {
452 if (keep_element(name[i], delete_array, delete_arrays, retain_array, retain_arrays) &&
454 fprintf(stderr, "Error (sddscombine): Problem appending data. Array %s does not exist in first page.\n", name[i]);
455 exit(EXIT_FAILURE);
456 }
457 } else {
458 if (keep_element(name[i], delete_array, delete_arrays, retain_array, retain_arrays) &&
462 }
463 free(name[i]);
464 }
465 free(name);
466 }
469 }
470
471 if (collapse) {
474 exit(EXIT_FAILURE);
475 }
476 }
477
478 if (collapse) {
479 if (!merge) {
483 }
485 SDDS_DefineColumn(&SDDS_output,
"NumberCombined", NULL, NULL,
"Number of files combined to make this file", NULL,
SDDS_LONG, 0) < 0)
487 } else {
488 if (!append) {
491 exit(EXIT_FAILURE);
492 }
493 if (!merge) {
497 }
501 }
502 }
503
504 if (collapse) {
508 exit(EXIT_FAILURE);
509 }
510 setPageNumber = 1;
511 } else {
512 setPageNumber = 0;
513 }
514 }
515 if (!append) {
518 exit(EXIT_FAILURE);
519 }
520 }
521 if (collapse) {
522 if (!
SDDS_StartPage(&SDDS_output, allocated_rows = ROW_INCREMENT)) {
524 exit(EXIT_FAILURE);
525 }
526 }
528 if (append) {
529 iFile = 1;
530 first_data = 0;
531 output_pending = 1;
532 } else {
533 iFile = 0;
534 first_data = 1;
535 output_pending = 0;
536 }
537
538 page = 0;
539 for (; iFile < inputfiles; iFile++) {
542 exit(EXIT_FAILURE);
543 }
544 first_page = 1;
545 recovered = 0;
546 while (!recovered && (retval =
SDDS_ReadPageSparse(&SDDS_input, 0, nColumns ? sparse : INT64_MAX - 1, 0, sparse_statistics)) >= 0) {
547 page++;
548 if (retval == 0) {
549 if (!recover)
550 break;
551 recovered = 1;
553
554 break;
555 }
556 if (param) {
557 if (first_page) {
559 SDDS_Bomb(
"-merge parameter not in input file(s)");
560 if (param_type) {
562 SDDS_Bomb(
"-merge parameter changes type in subsequent files");
563 } else {
565 this_param =
tmalloc(param_size);
566 last_param =
tmalloc(param_size);
568 SDDS_Bomb(
"error getting value for -merge parameter");
569 }
570 } else {
571 memcpy(last_param, this_param, param_size);
572 }
574 SDDS_Bomb(
"error getting value for -merge parameter");
575 }
576#ifdef DEBUG
577 if (param) {
578 fprintf(stderr, "parameter %s = ", param);
580 fprintf(stderr, " now (was ");
582 fprintf(stderr, ")\n");
583 }
584#endif
585 if (collapse) {
586 if (merge && param) {
587 if (SDDS_CompareParameterValues(this_param, last_param, param_type) != 0 && output_pending) {
588 output_pending = 0;
589 }
590 }
591 if (!merge || (!param && first_data && first_page) || (param && !output_pending)) {
592 if (page > allocated_rows) {
595 exit(EXIT_FAILURE);
596 }
597 allocated_rows += ROW_INCREMENT;
598 }
599 for (i = 0; i < columns; i++) {
600 if (!SDDS_GetParameterMod(&SDDS_input, &SDDS_output, column[i], buffer)) {
602 exit(EXIT_FAILURE);
603 }
604 if (!
SDDS_SetRowValues(&SDDS_output, SDDS_SET_BY_NAME | SDDS_PASS_BY_REFERENCE, page - 1, column[i], buffer, NULL)) {
606 exit(EXIT_FAILURE);
607 }
608 }
609 if (!merge) {
610 if (!
SDDS_SetRowValues(&SDDS_output, SDDS_SET_BY_NAME | SDDS_PASS_BY_VALUE, page - 1,
"Filename", inputfile[iFile] ? inputfile[iFile] :
"stdin",
"NumberCombined", inputfiles, NULL)) {
612 exit(EXIT_FAILURE);
613 }
614 } else {
615 if (!
SDDS_SetRowValues(&SDDS_output, SDDS_SET_BY_NAME | SDDS_PASS_BY_VALUE, page - 1,
"NumberCombined", inputfiles, NULL)) {
617 exit(EXIT_FAILURE);
618 }
619 }
620 if (setPageNumber && !
SDDS_SetRowValues(&SDDS_output, SDDS_SET_BY_NAME | SDDS_PASS_BY_VALUE, page - 1,
"PageNumber", page, NULL)) {
622 exit(EXIT_FAILURE);
623 }
624 first_data = 0;
625 } else if (merge && param && output_pending) {
626 page--;
627 }
628 } else {
629 if (!merge) {
633 exit(EXIT_FAILURE);
634 }
636 if (!
SDDS_SetParameters(&SDDS_output, SDDS_SET_BY_NAME | SDDS_PASS_BY_VALUE,
"Filename", inputfile[iFile] ? inputfile[iFile] :
"stdin", NULL)) {
638 exit(EXIT_FAILURE);
639 }
640 }
642 if (!
SDDS_SetParameters(&SDDS_output, SDDS_SET_BY_NAME | SDDS_PASS_BY_VALUE,
"NumberCombined", inputfiles, NULL)) {
644 exit(EXIT_FAILURE);
645 }
646 }
649 exit(EXIT_FAILURE);
650 }
651 } else if (merge && !param) {
652 if (nMerge > 0 && (page - 1) % nMerge == 0 && page != 1) {
655 exit(EXIT_FAILURE);
656 }
657 output_pending = 0;
658 }
659 if ((first_data && first_page) || (nMerge > 0 && (page - 1) % nMerge == 0)) {
662 exit(EXIT_FAILURE);
663 }
664 first_data = 0;
665 } else {
668 exit(EXIT_FAILURE);
669 }
670 }
671 } else {
672#ifdef DEBUG
673 if (SDDS_CompareParameterValues(this_param, last_param, param_type) != 0)
674 fprintf(stderr, "Parameter value has changed\n");
675#endif
676 if (SDDS_CompareParameterValues(this_param, last_param, param_type) != 0 && output_pending) {
678 if (!
SDDS_SetParameters(&SDDS_output, SDDS_SET_BY_NAME | SDDS_PASS_BY_VALUE,
"NumberCombined", inputfiles, NULL)) {
680 exit(EXIT_FAILURE);
681 }
682 }
685 exit(EXIT_FAILURE);
686 }
687 output_pending = 0;
688 }
689 if (!output_pending) {
692 exit(EXIT_FAILURE);
693 }
694 } else {
697 exit(EXIT_FAILURE);
698 }
699 }
700 }
701 }
702 if (merge) {
703 output_pending = 1;
704 }
705 first_page = 0;
706 }
709 exit(EXIT_FAILURE);
710 }
711 }
712 if (!collapse && merge && output_pending) {
714 if (!
SDDS_SetParameters(&SDDS_output, SDDS_SET_BY_NAME | SDDS_PASS_BY_VALUE,
"NumberCombined", inputfiles, NULL)) {
716 exit(EXIT_FAILURE);
717 }
718 }
719 if (append) {
722 exit(EXIT_FAILURE);
723 }
724 } else {
727 exit(EXIT_FAILURE);
728 }
729 }
730 }
731 if (collapse) {
734 exit(EXIT_FAILURE);
735 }
736 if (page == 0) {
738 exit(EXIT_FAILURE);
739 }
740 }
743 exit(EXIT_FAILURE);
744 }
745
746 return EXIT_SUCCESS;
747}
int32_t SDDS_ReadRecoveryPossible(SDDS_DATASET *SDDS_dataset)
Checks if any data in an SDDS page was recovered after an error was detected.
int32_t SDDS_CopyAdditionalRows(SDDS_DATASET *SDDS_target, SDDS_DATASET *SDDS_source)
int32_t SDDS_CopyPage(SDDS_DATASET *SDDS_target, SDDS_DATASET *SDDS_source)
int32_t SDDS_LengthenTable(SDDS_DATASET *SDDS_dataset, int64_t n_additional_rows)
int32_t SDDS_SetRowValues(SDDS_DATASET *SDDS_dataset, int32_t mode, int64_t row,...)
int32_t SDDS_StartPage(SDDS_DATASET *SDDS_dataset, int64_t expected_n_rows)
int32_t SDDS_SetParameters(SDDS_DATASET *SDDS_dataset, int32_t mode,...)
int32_t SDDS_ClearPage(SDDS_DATASET *SDDS_dataset)
int32_t SDDS_InitializeAppend(SDDS_DATASET *SDDS_dataset, const char *filename)
Initializes the SDDS dataset for appending data by adding a new page to an existing file.
int32_t SDDS_InitializeOutput(SDDS_DATASET *SDDS_dataset, int32_t data_mode, int32_t lines_per_row, const char *description, const char *contents, const char *filename)
Initializes the SDDS output dataset.
int32_t SDDS_InitializeAppendToPage(SDDS_DATASET *SDDS_dataset, const char *filename, int64_t updateInterval, int64_t *rowsPresentReturn)
Initializes the SDDS dataset for appending data to the last page of an existing file.
int32_t SDDS_UpdatePage(SDDS_DATASET *SDDS_dataset, uint32_t mode)
Updates the current page of the SDDS dataset.
int32_t SDDS_WritePage(SDDS_DATASET *SDDS_dataset)
Writes the current data table to the output file.
int32_t SDDS_DefineColumn(SDDS_DATASET *SDDS_dataset, const char *name, const char *symbol, const char *units, const char *description, const char *format_string, int32_t type, int32_t field_length)
Defines a data column within the SDDS dataset.
int32_t SDDS_WriteLayout(SDDS_DATASET *SDDS_dataset)
Writes the SDDS layout header to the output file.
int32_t SDDS_DefineParameter(SDDS_DATASET *SDDS_dataset, const char *name, const char *symbol, const char *units, const char *description, const char *format_string, int32_t type, char *fixed_value)
Defines a data parameter with a fixed string value.
int32_t SDDS_TransferColumnDefinition(SDDS_DATASET *target, SDDS_DATASET *source, char *name, char *newName)
Transfers a column definition from a source dataset to a target dataset.
int32_t SDDS_TransferArrayDefinition(SDDS_DATASET *target, SDDS_DATASET *source, char *name, char *newName)
Transfers an array definition from a source dataset to a target dataset.
int32_t SDDS_DefineColumnLikeParameter(SDDS_DATASET *target, SDDS_DATASET *source, char *name, char *newName)
Defines a column in the target dataset based on a parameter definition from the source dataset.
int32_t SDDS_TransferParameterDefinition(SDDS_DATASET *target, SDDS_DATASET *source, char *name, char *newName)
Transfers a parameter definition from a source dataset to a target dataset.
int32_t SDDS_GetParameterType(SDDS_DATASET *SDDS_dataset, int32_t index)
Retrieves the data type of a parameter in the SDDS dataset by its index.
int32_t SDDS_GetArrayIndex(SDDS_DATASET *SDDS_dataset, char *name)
Retrieves the index of a named array in the SDDS dataset.
char ** SDDS_GetParameterNames(SDDS_DATASET *SDDS_dataset, int32_t *number)
Retrieves the names of all parameters in the SDDS dataset.
int32_t SDDS_GetParameterIndex(SDDS_DATASET *SDDS_dataset, char *name)
Retrieves the index of a named parameter in the SDDS dataset.
int32_t SDDS_GetColumnIndex(SDDS_DATASET *SDDS_dataset, char *name)
Retrieves the index of a named column in the SDDS dataset.
int32_t SDDS_ColumnCount(SDDS_DATASET *page)
Retrieves the number of columns in the SDDS dataset.
char ** SDDS_GetColumnNames(SDDS_DATASET *SDDS_dataset, int32_t *number)
Retrieves the names of all columns in the SDDS dataset.
void SDDS_PrintErrors(FILE *fp, int32_t mode)
Prints recorded error messages to a specified file stream.
int32_t SDDS_DeleteParameterFixedValues(SDDS_DATASET *SDDS_dataset)
Deletes fixed values from all parameters in the SDDS dataset.
void SDDS_RegisterProgramName(const char *name)
Registers the executable program name for use in error messages.
int32_t SDDS_NumberOfErrors()
Retrieves the number of errors recorded by SDDS library routines.
int32_t SDDS_GetTypeSize(int32_t type)
Retrieves the size in bytes of a specified SDDS data type.
void SDDS_Bomb(char *message)
Terminates the program after printing an error message and recorded errors.
char ** SDDS_GetArrayNames(SDDS_DATASET *SDDS_dataset, int32_t *number)
Retrieves the names of all arrays in the SDDS dataset.
int32_t SDDS_PrintTypedValue(void *data, int64_t index, int32_t type, char *format, FILE *fp, uint32_t mode)
Prints a data value of a specified type using an optional printf format string.
#define SDDS_STRING
Identifier for the string data type.
#define SDDS_LONG
Identifier for the signed 32-bit integer data type.
void * trealloc(void *old_ptr, uint64_t size_of_block)
Reallocates a memory block to a new size.
void * tmalloc(uint64_t size_of_block)
Allocates a memory block of the specified size with zero initialization.
void bomb(char *error, char *usage)
Reports error messages to the terminal and aborts the program.
long fexists(const char *filename)
Checks if a file exists.
long match_string(char *string, char **option, long n_options, long mode)
Matches a given string against an array of option strings based on specified modes.
int scanargs(SCANNED_ARG **scanned, int argc, char **argv)
long processPipeOption(char **item, long items, unsigned long *flags)
long scanItemList(unsigned long *flags, char **item, long *items, unsigned long mode,...)
Scans a list of items and assigns values based on provided keywords and types.
char * expand_ranges(char *template)
Expand range specifiers in a wildcard template into explicit character lists.