Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
freebsd
GitHub Repository: freebsd/pkg
Path: blob/main/external/curl/src/mk-file-embed.pl
2649 views
1
#!/usr/bin/env perl
2
#***************************************************************************
3
# _ _ ____ _
4
# Project ___| | | | _ \| |
5
# / __| | | | |_) | |
6
# | (__| |_| | _ <| |___
7
# \___|\___/|_| \_\_____|
8
#
9
# Copyright (C) Daniel Stenberg, <[email protected]>, et al.
10
#
11
# This software is licensed as described in the file COPYING, which
12
# you should have received as part of this distribution. The terms
13
# are also available at https://curl.se/docs/copyright.html.
14
#
15
# You may opt to use, copy, modify, merge, publish, distribute and/or sell
16
# copies of the Software, and permit persons to whom the Software is
17
# furnished to do so, under the terms of the COPYING file.
18
#
19
# This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
20
# KIND, either express or implied.
21
#
22
# SPDX-License-Identifier: curl
23
#
24
###########################################################################
25
26
use strict;
27
use warnings;
28
29
my $varname = "var";
30
if(@ARGV && $ARGV[0] eq "--var") {
31
shift;
32
$varname = shift @ARGV;
33
}
34
35
my $varname_upper = uc($varname);
36
37
print <<HEAD
38
/*
39
* NEVER EVER edit this manually, fix the mk-file-embed.pl script instead!
40
*/
41
/* !checksrc! disable COPYRIGHT all */
42
#ifndef CURL_DECLARED_${varname_upper}
43
#define CURL_DECLARED_${varname_upper}
44
extern const unsigned char ${varname}[];
45
#endif
46
const unsigned char ${varname}[] = {
47
HEAD
48
;
49
50
while(<STDIN>) {
51
my $line = $_;
52
foreach my $n (split //, $line) {
53
my $ord = ord($n);
54
printf("%s,", $ord);
55
if($ord == 10) {
56
printf("\n");
57
}
58
}
59
}
60
61
print <<ENDLINE
62
0
63
};
64
ENDLINE
65
;
66
67