]> granicus.if.org Git - php/commitdiff
Generate tabs in generate_mime_type_map.php
authorNikita Popov <nikita.ppv@gmail.com>
Wed, 24 Jun 2020 14:31:46 +0000 (16:31 +0200)
committerNikita Popov <nikita.ppv@gmail.com>
Wed, 24 Jun 2020 14:31:46 +0000 (16:31 +0200)
The PHP file is space indented, but we need the C file to be tab
indented.

sapi/cli/generate_mime_type_map.php

index c4c83679c2cf69a47333b94e29262bd60f72efaa..642d1da124552622a20dfc29eca1c1996ba8a75b 100755 (executable)
@@ -40,7 +40,7 @@ foreach($additional_mime_maps as $ext => $mime) {
     }
 }
 
-?>
+echo <<<HEADER
 /*
    +----------------------------------------------------------------------+
    | Copyright (c) The PHP Group                                          |
@@ -64,15 +64,23 @@ foreach($additional_mime_maps as $ext => $mime) {
 #define PHP_CLI_SERVER_MIME_TYPE_MAP_H
 
 typedef struct php_cli_server_ext_mime_type_pair {
-    const char *ext;
-    const char *mime_type;
+\tconst char *ext;
+\tconst char *mime_type;
 } php_cli_server_ext_mime_type_pair;
 
 static const php_cli_server_ext_mime_type_pair mime_type_map[] = {
-<?php foreach ($extensions as $extension => $mime): ?>
-    { "<?= addcslashes($extension, "\0..\37!@\@\177..\377") ?>", "<?= addcslashes($mime, "\0..\37!@\@\177..\377") ?>" },
-<?php endforeach ?>
-    { NULL, NULL }
+
+HEADER;
+
+foreach ($extensions as $extension => $mime) {
+    echo "\t{ \"" .addcslashes($extension, "\0..\37!@\@\177..\377") . "\", \""
+        . addcslashes($mime, "\0..\37!@\@\177..\377") . "\" },\n";
+}
+
+echo <<<FOOTER
+\t{ NULL, NULL }
 };
 
 #endif /* PHP_CLI_SERVER_MIME_TYPE_MAP_H */
+
+FOOTER;