X-Git-Url: https://git.gag.com/?a=blobdiff_plain;ds=sidebyside;f=recover-src%2Fuparse.y;h=35d6d3e43162221058007dcfc3fd8f7a8b617248;hb=12179dea039515c06168c0037d048566a3f623de;hp=872d0b65adda6793766a626ca878eb1d3aa4235b;hpb=1194fb66aa28d9929c3f2bef3cc6c1c3f40a60a4;p=debian%2Famanda diff --git a/recover-src/uparse.y b/recover-src/uparse.y index 872d0b6..35d6d3e 100644 --- a/recover-src/uparse.y +++ b/recover-src/uparse.y @@ -24,7 +24,7 @@ * file named AUTHORS, in the root directory of this distribution. */ /* - * $Id: uparse.y,v 1.11 2003/01/01 23:28:17 martinea Exp $ + * $Id: uparse.y,v 1.13 2006/05/25 01:47:14 johnfranks Exp $ * * parser for amrecover interactive language */ @@ -32,21 +32,23 @@ #include "amanda.h" #include "amrecover.h" -void yyerror P((char *s)); -extern int yylex P((void)); +void yyerror(char *s); +extern int yylex(void); +extern char * yytext; + %} /* DECLARATIONS */ %union { - int intval; - double floatval; - char *strval; - int subtok; + int intval; + double floatval; + char * strval; + int subtok; } /* literal keyword tokens */ -%token LISTDISK SETHOST SETDISK SETDATE SETTAPE SETMODE +%token LISTHOST LISTDISK SETHOST SETDISK SETDATE SETTAPE SETMODE %token CD CDX QUIT DHIST LS ADD ADDX EXTRACT %token LIST DELETE DELETEX PWD CLEAR HELP LCD LPWD MODE SMB TAR @@ -70,10 +72,17 @@ ucommand: | local_command | help_command | extract_command + | { + char * errstr = vstralloc("Invalid command: ", yytext, NULL); + yyerror(errstr); + amfree(errstr); + YYERROR; + } /* Quiets compiler warnings about unused label */ ; set_command: - LISTDISK PATH { list_disk($2); amfree($2); } + LISTHOST { list_host(); } + | LISTDISK PATH { list_disk($2); amfree($2); } | LISTDISK { list_disk(NULL); } | SETDATE DATE { set_date($2); amfree($2); } | SETHOST PATH { set_host($2); amfree($2); } @@ -166,10 +175,9 @@ extract_command: /* ADDITIONAL C CODE */ %% -void yyerror(s) -char *s; +void +yyerror( + char * s) { - printf("Invalid command - %s\n", s); + printf("%s\n", s); } - -