Blame view
cmd/license.c
787 Bytes
83d290c56 SPDX: Convert all... |
1 |
// SPDX-License-Identifier: GPL-2.0+ |
0a823aa2a Add 'license' com... |
2 3 4 |
/* * (C) Copyright 2007 by OpenMoko, Inc. * Author: Harald Welte <laforge@openmoko.org> |
0a823aa2a Add 'license' com... |
5 6 7 |
*/ #include <common.h> |
0a823aa2a Add 'license' com... |
8 9 |
#include <command.h> #include <malloc.h> |
0a823aa2a Add 'license' com... |
10 |
|
d726f225f cmd: rework "lice... |
11 12 13 14 |
#include "license_data_gz.h" #include "license_data_size.h" static int do_license(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) |
0a823aa2a Add 'license' com... |
15 |
{ |
d726f225f cmd: rework "lice... |
16 17 18 |
char *dst; unsigned long len = data_size; int ret = CMD_RET_SUCCESS; |
0a823aa2a Add 'license' com... |
19 |
|
d726f225f cmd: rework "lice... |
20 |
dst = malloc(data_size + 1); |
0a823aa2a Add 'license' com... |
21 |
if (!dst) |
d726f225f cmd: rework "lice... |
22 |
return CMD_RET_FAILURE; |
0a823aa2a Add 'license' com... |
23 |
|
d726f225f cmd: rework "lice... |
24 25 |
ret = gunzip(dst, data_size, (unsigned char *)data_gz, &len); if (ret) { |
0a823aa2a Add 'license' com... |
26 27 |
printf("Error uncompressing license text "); |
d726f225f cmd: rework "lice... |
28 29 |
ret = CMD_RET_FAILURE; goto free; |
0a823aa2a Add 'license' com... |
30 |
} |
d726f225f cmd: rework "lice... |
31 32 |
dst[data_size] = 0; |
0a823aa2a Add 'license' com... |
33 |
puts(dst); |
d726f225f cmd: rework "lice... |
34 35 |
free: |
0a823aa2a Add 'license' com... |
36 |
free(dst); |
d726f225f cmd: rework "lice... |
37 |
return ret; |
0a823aa2a Add 'license' com... |
38 |
} |
388a29d02 various cmd_* fil... |
39 40 |
U_BOOT_CMD( license, 1, 1, do_license, |
a89c33db9 General help mess... |
41 42 43 |
"print GPL license text", "" ); |