xref: /PHP-7.4/ext/fileinfo/create_data_file.php (revision 58b17906)
1#!/usr/bin/env php
2/* This is a generated file, do not modify */
3/* Usage: php create_data_file.php /path/to/magic.mgc > data_file.c */
4<?php
5    $dta = file_get_contents( $argv[1] );
6    $dta_l = strlen($dta);
7    $j = 0;
8
9    echo "const unsigned char php_magic_database[$dta_l] = {\n";
10    for ($i = 0; $i < $dta_l; $i++) {
11        printf("0x%02X, ", ord($dta[$i]));
12        if ($j % 16 == 15) {
13            echo "\n";
14        }
15        $j++;
16    }
17    echo "};\n";
18?>
19