cmd_license.c 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. /*
  2. * (C) Copyright 2007 by OpenMoko, Inc.
  3. * Author: Harald Welte <laforge@openmoko.org>
  4. *
  5. * See file CREDITS for list of people who contributed to this
  6. * project.
  7. *
  8. * This program is free software; you can redistribute it and/or
  9. * modify it under the terms of the GNU General Public License as
  10. * published by the Free Software Foundation; either version 2 of
  11. * the License, or (at your option) any later version.
  12. *
  13. * This program is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. * GNU General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU General Public License
  19. * along with this program; if not, write to the Free Software
  20. * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
  21. * MA 02111-1307 USA
  22. */
  23. #include <common.h>
  24. #if defined(CONFIG_CMD_LICENSE)
  25. /* COPYING is currently 15951 bytes in size */
  26. #define LICENSE_MAX 20480
  27. #include <command.h>
  28. #include <malloc.h>
  29. #include <license.h>
  30. int gunzip(void *, int, unsigned char *, unsigned long *);
  31. int do_license(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
  32. {
  33. char *tok, *dst = malloc(LICENSE_MAX);
  34. unsigned long len = LICENSE_MAX;
  35. if (!dst)
  36. return -1;
  37. if (gunzip(dst, LICENSE_MAX, license_gz, &len) != 0) {
  38. printf("Error uncompressing license text\n");
  39. free(dst);
  40. return -1;
  41. }
  42. puts(dst);
  43. free(dst);
  44. return 0;
  45. }
  46. U_BOOT_CMD(license, 1, 1, do_license,
  47. "print GPL license text",
  48. ""
  49. );
  50. #endif /* CONFIG_CMD_LICENSE */