Update version info for release v4.6.1 (#2122)
[WRF.git] / external / io_grib1 / MEL_grib1 / hdr_print.c
blob06d3d983b39d3c201ddbbad5a13504f08651ba0c
1 /* FILENAME: hdr_print.c */
2 #include <stdio.h>
3 #include <stdlib.h>
4 #include "dprints.h" /* for dprints */
5 #include "gribfuncs.h" /* prototypes */
7 /*
8 *
9 ********************************************************************
10 * A. FUNCTION: hdr_print
11 * print specified number of bytes from the block provided.
12 * does not require Debug flag to be set;
14 * INTERFACE:
15 * void hdr_print (title, block, bytestoprint)
17 * ARGUMENTS (I=input, O=output, I&O=input and output):
18 * (I) char *title; Title string to print
19 * (I) unsigned char *block; Block whose content to print
20 * (I) int bytestoprint; Number of bytes to print
22 * RETURN CODE: none;
23 ********************************************************************
25 #if PROTOTYPE_NEEDED
26 void hdr_print (char *title, unsigned char *block, int bytestoprint)
27 #else
28 void hdr_print (title, block, bytestoprint)
29 char *title; unsigned char *block; int bytestoprint;
30 #endif
32 int i=0;
35 * A.1 PRINT title string
37 fprintf(stdout,"hdr_print %d bytes of '%s'=", bytestoprint, title);
41 * A.2 WHILE (more bytes to print) DO
42 * PRINT byte value
43 * ENDDO
45 while (i < bytestoprint)
47 if (i % 8 == 0) {
48 if (i+7>= bytestoprint-1)
49 fprintf(stdout,"\n[%2d-%2d]: ",i+1, bytestoprint);
50 else fprintf(stdout,"\n[%2d-%2d]: ",i+1, i+8);
52 fprintf(stdout,"%03u ", block[i++]);
53 if (i % 4 == 0) fprintf(stdout, "| ");
55 fprintf(stdout,"\n");
58 * A.3 RETURN w/nothing
60 fprintf(stdout,"Exiting hdr_print, no return code\n");
63 * END OF FUNCTION
65 */