%{ /******************************************************************************* * Copyright (c) 2007, Perforce Software, Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL PERFORCE * SOFTWARE, INC. BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH * DAMAGE. *******************************************************************************/ /******************************************************************************* * Config file parser for p4dctl ******************************************************************************/ #include <stdio.h> #include <string.h> #include "parsesupp.h" #include "config.h" #define YYDEBUG 1 %} %union { int ival; char * sval; void * pval; } %type <sval> var %type <sval> value %type <sval> word %type <pval> varspec %type <pval> varlist %type <pval> serverlist %type <pval> serverspec %type <pval> config %token <sval> WORD STRING NUMBER PATH %% config: varlist serverlist { AddEnviron( $1 ); } | serverlist { $$ = $1; } | { } ; varlist: varspec { $$ = $1; } | varlist varspec { $$ = AddVar( $1, $2 ); } ; varspec: var '=' value { $$ = MakeVar( $1, $3 ); } ; var: word { $$ = $1; } ; value: word { $$ = $1; } | STRING { $$ = yylval.sval; } | PATH { $$ = yylval.sval; } | NUMBER { $$ = yylval.sval; } ; word: WORD { $$ = yylval.sval; } serverlist: serverspec { $$ = $1; } | serverlist serverspec ; serverspec: word word '{' varlist '}' { $$ = MakeServer( $2, $1, $4);} ;
# | Change | User | Description | Committed | |
---|---|---|---|---|---|
#1 | 7584 | Mark Allender | Initial checkin of p4dctl code in order to cleanly make other modifications (better support for compressed checkpoints, prefixes for checkpoints, etc) | ||
//guest/tony_smith/perforce/p4dctl/src/configparse.y | |||||
#4 | 7581 | Tony Smith |
Clean up use of yytext, which was incorrect and causes problems with some breeds of yacc. yytext is for the lexer, yylval for the parser, and the twain shall only meet in the lexer code. Thus configlex.l ensures that yytext is strdup'd into yylval.sval before we hand it over to the parser. Fix for bug reported by Mark Allender |
||
#3 | 7179 | Tony Smith |
Fix bug introduced in previous change. In my attempt to sort out the declaration of yytext, I declared it as an array rather than a pointer, and that could cause crashes. I also added support for debugging the parser in the course of fixing this and that's a useful thing to have anyway. Updated linux26x86 binary |
||
#2 | 7177 | Tony Smith |
Update p4dctl to build with 2008.2 API. No major changes needed, mostly jam stuff. The big change is to include all the rules from the sample Jamrules included in the Perforce API since that's the Jamrules used to build the API. This ensures that we're using the right compiler/linker flags on every platform. I also made sure that when lex & yacc are installed, and the grammar is compiled as part of the build, that the source tree is updated with the pre-compiled grammar. Makes it easy to maintain. Lastly, I updated the binary while I was there. |
||
#1 | 5945 | Tony Smith |
Release p4dctl, a program for starting/stopping Perforce services on Unix operating systems. Similar to, and developed in concert with, Sven Erik Knop's p4dcfg. For example: p4dctl start -a Can start multiple P4D, P4P, P4Web, or P4FTP servers in one easy command line. It can be executed by root, or by the 'owners' of the configured services and it maintains pidfiles no matter who uses it (so they remain accurate). An init script using p4dctl will typically just use: p4dctl start -a p4dctl stop -a p4dctl restart -a And check the exit status. |