Merge patch series "led: add function naming option from linux"
[u-boot.git] / cmd / license.c
blob161663ff29c64173d3bb62f52c7aecdabdef80ab
1 // SPDX-License-Identifier: GPL-2.0+
2 /*
3 * (C) Copyright 2007 by OpenMoko, Inc.
4 * Author: Harald Welte <laforge@openmoko.org>
5 */
7 #include <command.h>
8 #include <gzip.h>
9 #include <malloc.h>
11 #include "license_data_gz.h"
12 #include "license_data_size.h"
14 static int do_license(struct cmd_tbl *cmdtp, int flag, int argc,
15 char *const argv[])
17 char *dst;
18 unsigned long len = data_size;
19 int ret = CMD_RET_SUCCESS;
21 dst = malloc(data_size + 1);
22 if (!dst)
23 return CMD_RET_FAILURE;
25 ret = gunzip(dst, data_size, (unsigned char *)data_gz, &len);
26 if (ret) {
27 printf("Error uncompressing license text\n");
28 ret = CMD_RET_FAILURE;
29 goto free;
32 dst[data_size] = 0;
33 puts(dst);
35 free:
36 free(dst);
38 return ret;
41 U_BOOT_CMD(
42 license, 1, 1, do_license,
43 "print GPL license text",