From 3f829bcc56a0dff2ba4ed6e1a1c081b6262fbed9 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Sun, 13 Sep 2009 00:33:03 -0400 Subject: everything that is coded in the wrapper works --- plugins/users/plugin.conf | 2 +- wrapper/plugin-debug.h | 101 ---------------------------------------------- wrapper/plugin-parse.h | 77 ++++++++++++++++++----------------- wrapper/plugins | 1 - wrapper/plugins.h | 7 ---- wrapper/rvs.c | 5 ++- wrapper/rvs.h | 9 ----- 7 files changed, 44 insertions(+), 158 deletions(-) delete mode 100644 wrapper/plugin-debug.h delete mode 120000 wrapper/plugins diff --git a/plugins/users/plugin.conf b/plugins/users/plugin.conf index 4895b44..b0e70b2 100644 --- a/plugins/users/plugin.conf +++ b/plugins/users/plugin.conf @@ -1,5 +1,5 @@ # users-0.7beta plugins.conf -commit:repo/commit +commit:repo-0.7beta/commit login logout mkuser diff --git a/wrapper/plugin-debug.h b/wrapper/plugin-debug.h deleted file mode 100644 index d7c3541..0000000 --- a/wrapper/plugin-debug.h +++ /dev/null @@ -1,101 +0,0 @@ -/* Copyright (C) 2009 Luke Shumaker - - This file is part of rvs. - - rvs 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 2, or (at your - option) any later version. - - rvs 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 rvs; see the file COPYING. - If not, write to the Free Software Foundation, - 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -*/ -#ifndef FILE_plugin_debug_h_SEEN -#define FILE_plugin_debug_h_SEEN - -#include -#include "rvs.h" -#include "plugins.h" - -size_t -xstrlen (const char *s) -{ - printf("xstrlen(%p)\n",s); - size_t size=0; - while (s[size] != '\0') { - printf("%i = %p `%c'\n",size,&s[size],s[size]); - size++; - } - return size; -} - -void plugin_print_ind(int ind) -{ - unsigned int i; - for (i=0; i < ind; i++) printf(" "); -} -void plugin_print_string(char *string) -{ - printf("%p",string); - if (string != NULL) - printf(" \"%s\"\n",string); - else - puts(""); -} - -void -plugin_print_command (struct plugin_command *command, int ind) -{ - plugin_print_ind(ind); - printf("pointer: %p\n",command); - if (command != NULL ) { - ind++; - plugin_print_ind(ind); - printf("name: "); - plugin_print_string(command->name); - plugin_print_ind(ind); - printf("depends: "); - plugin_print_string(command->depends); - plugin_print_ind(ind); - printf("depend: %p - ",command->depend); - if (command->depend!=NULL) - plugin_print_string(command->depend->name); - else - puts(""); - plugin_print_ind(ind); - printf("next: %p - ",command->next); - if (command->next!=NULL) - plugin_print_string(command->next->name); - else - puts(""); - } - -} - -void -plugin_print_plugin (struct plugin *plugin, int ind) -{ - plugin_print_ind(ind); - printf("pointer: %p\n",plugin); - if (plugin != NULL ) { - plugin_print_ind(ind); - if (plugin->name==NULL) - puts("noname"); - else - printf("name: %s\n",plugin->name); - plugin_print_ind(ind); - printf("commands: %p\n",plugin->commands); - plugin_print_ind(ind); - printf("next: %p\n",plugin->next); - } -} - -#endif - diff --git a/wrapper/plugin-parse.h b/wrapper/plugin-parse.h index 4cad0bc..e4bfe2b 100644 --- a/wrapper/plugin-parse.h +++ b/wrapper/plugin-parse.h @@ -23,7 +23,7 @@ #define FILE_plugin_parse_h_SEEN #include -#include /* only used in `plugin_parse_escape' for `error'*/ +#include /* only used in `plugin_parse_escape' for `error' */ #include "rvs.h" #include "plugins.h" @@ -58,6 +58,16 @@ plugin_parse_escape(FILE *file) return c; } +#define _parse_share(string) \ + case '#':\ + plugin_parse_comment(file);\ + break;\ + case '\\':\ + c[0]=plugin_parse_escape(file);\ + default:\ + stradds(&nbytes,string,(char *)&c);\ + break; + char * plugin_parse_depend (FILE *file) { @@ -72,14 +82,7 @@ plugin_parse_depend (FILE *file) ungetc (c[0], file); return string; break; - case '#': - plugin_parse_comment(file); - break; - case '\\': - c[0]=plugin_parse_escape(file); - default: - stradds(&nbytes,&string,(char *)&c); - break; + _parse_share(&string) } } return string; @@ -88,38 +91,38 @@ plugin_parse_depend (FILE *file) struct plugin_command * plugin_parse (FILE *file) { - struct plugin_command *command=plugin_mk_command(); - - size_t nbytes = 10; - command->name = (char *)xmalloc(nbytes); - command->name[0]='\0'; + struct plugin_command *command; char c[2] = " \0"; - c[0]=getc(file); - if (c[0]==EOF) return NULL; - else ungetc (c[0], file); - while ( (c[0]=getc(file)) != EOF ) { - switch (c[0]) { - case '\n': - if (strlen(command->name)==0) { - plugin_free_command(command); - command=plugin_parse(file); - } else - command->next=plugin_parse(file); - break; - case ':': - command->depends=plugin_parse_depend(file); - break; - case '#': - plugin_parse_comment(file); - break; - case '\\': - c[0]=plugin_parse_escape(file); - default: - stradds(&nbytes,&(command->name),(char *)&c); - break; + if (c[0]==EOF) + command=NULL; + else { + ungetc (c[0], file); + command=plugin_mk_command(); + + size_t nbytes = 10; + command->name = (char *)xmalloc(nbytes); + command->name[0]='\0'; + + while ( (c[0]=getc(file)) != EOF ) { + switch (c[0]) { + case '\n': + /*if (strlen(command->name)==0) {*/ + if (c[0]=='\n') { + plugin_free_command(command); + return plugin_parse(file); + } else + command->next=plugin_parse( + file); + break; + case ':': + command->depends=plugin_parse_depend( + file); + break; + _parse_share(&(command->name)) + } } } return command; diff --git a/wrapper/plugins b/wrapper/plugins deleted file mode 120000 index b1f2dbf..0000000 --- a/wrapper/plugins +++ /dev/null @@ -1 +0,0 @@ -../plugins/ \ No newline at end of file diff --git a/wrapper/plugins.h b/wrapper/plugins.h index 1e88279..c5fb53d 100644 --- a/wrapper/plugins.h +++ b/wrapper/plugins.h @@ -58,9 +58,6 @@ plugin_mk_command() { struct plugin_command *command; command=(struct plugin_command *)xmalloc(sizeof(*command)); - #ifdef DEBUG - printf("malloc'd command: %p\n",command); - #endif /* node */ command->name=NULL; @@ -83,10 +80,6 @@ plugin_free_command(struct plugin_command *command) { if (command!=NULL) { plugin_free_command(command->next); - #ifdef DEBUG - printf(" free'd command: %p \"%s\"\n", - command,command->name); - #endif xfree(command->name); xfree(command->depends); xfree(command); diff --git a/wrapper/rvs.c b/wrapper/rvs.c index 50343e4..4f2fa1b 100644 --- a/wrapper/rvs.c +++ b/wrapper/rvs.c @@ -20,7 +20,6 @@ const char *ver="0.8c"; 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -#define DEBUG #include "rvs.h" #include "plugins.h" #include "plugin-load.h" @@ -37,8 +36,10 @@ main ( int argc, char *argv[] ) if (argc > 1) { struct plugin_command_list *list; list=plugin_find_commands(plugins,argv[1]); - plugin_depend_list(list,plugins); + struct plugin_command *root; + root=plugin_depend_list(list,plugins); plugin_free_list(list); + plugin_free_command(root); } plugin_free_plugin(plugins); return 0; diff --git a/wrapper/rvs.h b/wrapper/rvs.h index 008b94a..83cde87 100644 --- a/wrapper/rvs.h +++ b/wrapper/rvs.h @@ -41,9 +41,6 @@ void * xmalloc (size_t size) { void *value = malloc (size); - #ifdef DEBUG_ALLOC - printf("x=%p\n",value); - #endif if (value == NULL) { perror(program_invocation_name); exit(EXIT_FAILURE); @@ -55,9 +52,6 @@ void * xrealloc (void *ptr, size_t size) { void *value = realloc (ptr, size); - #ifdef DEBUG_ALLOC - printf("x/%p -> %p\n",ptr,value); - #endif if (value == NULL) { perror(program_invocation_name); exit(EXIT_FAILURE); @@ -69,9 +63,6 @@ void xfree (void *ptr) { if (ptr!=NULL) - #ifdef DEBUG_ALLOC - printf("x-%p\n",ptr); - #endif free (ptr); } -- cgit v1.2.3-2-g168b