Skip to content

Commit

Permalink
Generate tabs in generate_mime_type_map.php
Browse files Browse the repository at this point in the history
The PHP file is space indented, but we need the C file to be tab
indented.
  • Loading branch information
nikic committed Jun 24, 2020
1 parent ff19ec2 commit 5889c41
Showing 1 changed file with 15 additions and 7 deletions.
22 changes: 15 additions & 7 deletions sapi/cli/generate_mime_type_map.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
}
}

?>
echo <<<HEADER
/*
+----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
Expand All @@ -64,15 +64,23 @@
#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;

0 comments on commit 5889c41

Please sign in to comment.