Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
freebsd
GitHub Repository: freebsd/pkg
Path: blob/main/external/curl/src/mk-file-embed.pl
2065 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
my $varname = "var";
27
if($ARGV[0] eq "--var") {
28
shift;
29
$varname = shift @ARGV;
30
}
31
32
my $varname_upper = uc($varname);
33
34
print <<HEAD
35
/*
36
* NEVER EVER edit this manually, fix the mk-file-embed.pl script instead!
37
*/
38
/* !checksrc! disable COPYRIGHT all */
39
#ifndef CURL_DECLARED_${varname_upper}
40
#define CURL_DECLARED_${varname_upper}
41
extern const unsigned char ${varname}[];
42
#endif
43
const unsigned char ${varname}[] = {
44
HEAD
45
;
46
47
while (<STDIN>) {
48
my $line = $_;
49
foreach my $n (split //, $line) {
50
my $ord = ord($n);
51
printf("%s,", $ord);
52
if($ord == 10) {
53
printf("\n");
54
}
55
}
56
}
57
58
print <<ENDLINE
59
0
60
};
61
ENDLINE
62
;
63
64