void od(const void *data, size_t data_len, uint8_t width, uint16_t flags) { char address_format[5]; uint8_t date_length = _length(flags); char bytes_format[_log10(date_length) + 7]; if (data_len == 0) { return; } _address_format(address_format, flags); _bytes_format(bytes_format, flags); if (width == 0) { width = OD_WIDTH_DEFAULT; } if (width < date_length) { width = 1; } else { width = (width / date_length); } if (data_len % date_length) { data_len = (data_len / date_length) + 1; } else { data_len = data_len / date_length; } if ((flags & OD_FLAGS_ADDRESS_MASK) != OD_FLAGS_ADDRESS_NONE) { printf(address_format, 0); } for (size_t i = 0; i < data_len; i++) { _print_date(data, i, bytes_format, date_length, flags); if ((((i + 1) % width) == 0) || i == (data_len - 1)) { printf("\n"); if (i != (data_len - 1)) { if ((flags & OD_FLAGS_ADDRESS_MASK) != OD_FLAGS_ADDRESS_NONE) { printf(address_format, date_length * (i + 1)); } } } } }
int main (int argc, char *argv[]) { log_options_t opts = LOG_OPTS_STDERR_ONLY ; int error_code = SLURM_SUCCESS; log_init(xbasename(argv[0]), opts, SYSLOG_FACILITY_USER, NULL); parse_command_line( argc, argv ); if (params.verbose) { opts.stderr_level += params.verbose; log_alter(opts, SYSLOG_FACILITY_USER, NULL); } max_line_size = _get_window_width( ); if (params.clusters) working_cluster_rec = list_peek(params.clusters); while (1) { if ((!params.no_header) && (params.iterate || params.verbose || params.long_list)) _print_date (); if (!params.clusters) { if (_get_info(false)) error_code = 1; } else if (_multi_cluster(params.clusters) != 0) error_code = 1; if ( params.iterate ) { printf( "\n"); sleep( params.iterate ); } else break; } if ( error_code != SLURM_SUCCESS ) exit (error_code); else exit (0); }