Browse Source

Added license command

The command-line interface now shows license information if you type the
"license" command.  Now users can be easily made aware of their
freedoms.
Clara Hobbs 5 years ago
parent
commit
8d8b601426
1 changed files with 28 additions and 0 deletions
  1. 28
    0
      src/shell.c

+ 28
- 0
src/shell.c View File

@@ -51,6 +51,33 @@ static struct pdb_config tmpcfg = {
51 51
     .status = PDB_CONFIG_STATUS_EMPTY
52 52
 };
53 53
 
54
+static void cmd_license(BaseSequentialStream *chp, int argc, char *argv[])
55
+{
56
+    (void) argv;
57
+    if (argc > 0) {
58
+        chprintf(chp, "Usage: license\r\n");
59
+        return;
60
+    }
61
+
62
+    chprintf(chp,
63
+        "PD Buddy - USB Power Delivery for everyone\r\n"
64
+        "Copyright (C) 2017 Clayton G. Hobbs <clay@lakeserv.net>\r\n"
65
+        "\r\n"
66
+        "This program is free software: you can redistribute it and/or modify\r\n"
67
+        "it under the terms of the GNU General Public License as published by\r\n"
68
+        "the Free Software Foundation, either version 3 of the License, or\r\n"
69
+        "(at your option) any later version.\r\n"
70
+        "\r\n"
71
+        "This program is distributed in the hope that it will be useful,\r\n"
72
+        "but WITHOUT ANY WARRANTY; without even the implied warranty of\r\n"
73
+        "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r\n"
74
+        "GNU General Public License for more details.\r\n"
75
+        "\r\n"
76
+        "You should have received a copy of the GNU General Public License\r\n"
77
+        "along with this program.  If not, see <http://www.gnu.org/licenses/>.\r\n"
78
+    );
79
+}
80
+
54 81
 static void cmd_erase(BaseSequentialStream *chp, int argc, char *argv[])
55 82
 {
56 83
     (void) argv;
@@ -192,6 +219,7 @@ static void cmd_identify(BaseSequentialStream *chp, int argc, char *argv[])
192 219
 }
193 220
 
194 221
 static const struct pdb_shell_cmd commands[] = {
222
+    {"license", cmd_license, "Show copyright and license information"},
195 223
     {"erase", cmd_erase, "Erase all stored configuration"},
196 224
     {"write", cmd_write, "Write the changes to flash"},
197 225
     {"load", cmd_load, "Load the stored configuration into RAM"},

Loading…
Cancel
Save