1/*********************************************************************
2 *   Copyright 1993, UCAR/Unidata
3 *   See netcdf/COPYRIGHT file for copying and redistribution conditions.
4 *********************************************************************/
5
6#include <config.h>
7#include <stdlib.h>
8#include <stdio.h>
9#include <string.h>
10
11/* BOM Sequences */
12static char* U8   = "\xEF\xBB\xBF";    /* UTF-8 */
13static char* BE32 = "\x00\x00\xFE\xFF"; /* UTF-32; big-endian */
14static char* LE32 = "\xFF\xFE";       /* UTF-32; little-endian */
15static char* BE16 = "\xFE\xFF";       /* UTF-16; big-endian */
16static char* LE16 = "\xFF\xFE";       /* UTF-16; little-endian */
17
18int
19main(int argc, char** argv)
20{
21    char* bom = U8;
22    size_t bomlen = 3;
23    if(argc > 1 && strlen(argv[1]) > 0) {
24 char* which = argv[1];
25 switch (which[0]) {
26 case '1': bom = BE16bomlen = 2; break;
27 case '3': bom = BE32bomlen = 2; break;
28 default: break;
29 }
30    }
31    fwrite(bom,1,bomlen,stdout);
32    exit(0);
33}


HyperKWIC - Version 7.20DA executed at 11:37 on 27 Oct 2017 | Polyhedron Solutions - INTERNAL USE | COMMERCIAL (Any O/S) SN 4AKIed