| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394 |
- /* vcc/plugins.c
- *
- * This file is part of vcc.
- *
- * vcc is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * vcc is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with vcc. If not, see <https://www.gnu.org/licenses/>
- */
- #include <stdio.h>
- #include <stdlib.h>
- #include <unistd.h>
- #include <fcntl.h>
- #include <errno.h>
- #include <string.h>
- #include <ctype.h>
- #include <sys/stat.h>
- #include <sys/types.h>
- #include <sys/socket.h>
- #include <netinet/in.h>
- #include <arpa/inet.h>
- #include <poll.h>
- #include <signal.h>
- #include <klist.h>
- #include <vcc/vcc.h>
- #include <vcc/plugin.h>
- #include <vcc/version.h>
- #include <vcc/pretty.h>
- extern struct plugin plg_hello;
- struct plugin *plugins[] = {
- &plg_hello,
- (struct plugin *) NULL
- };
- int do_cmd_pls(char *s) {
- int i;
- struct plugin *p;
- (void) s;
- for (i = 0; (p = plugins[i]); i++)
- pretty_cmd_help(p->name, p->descr);
-
- return 0;
- }
- struct plugin *find_plg(char *s) {
- int i;
- struct plugin *p;
- for (i = 0; (p = plugins[i]); i++)
- if (!strcmp(s, p->name))
- return p;
- return NULL;
- }
- int do_cmd_pins(char *s) {
- struct plugin *p;
- char name[MSG_SIZE];
- (void) s;
- fprintf(stderr, "plugin: ");
- scanf("%s", name);
- if (!(p = find_plg(name))) {
- fprintf(stderr, "*** plugin not found. \n");
- return 1;
- }
-
- p->state = PLG_INSERTED;
- return 0;
- }
|