mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2024-12-26 09:58:20 +01:00
add optional --rack-header and --rack-footer params that take strings
and use them to bracket output.
This commit is contained in:
parent
f0411f4a63
commit
513073a32c
3 changed files with 23 additions and 1 deletions
|
@ -278,6 +278,8 @@ typedef enum {
|
|||
,CMD_RACKPIPE
|
||||
,CMD_RACKSTRING
|
||||
,CMD_RACKLIMIT
|
||||
,CMD_RACKHEADER
|
||||
,CMD_RACKFOOTER
|
||||
,CMD_HIDEVALUES
|
||||
,CMD_SKIPCONFIRM
|
||||
,CMD_VERTICALSCORE
|
||||
|
@ -354,6 +356,8 @@ static CmdInfoRec CmdInfoRecs[] = {
|
|||
,{ CMD_RACKPIPE, true, "rack-pipe", "pipe to listen on for new racks" }
|
||||
,{ CMD_RACKSTRING, true, "rack", "single rack to generate moves for" }
|
||||
,{ CMD_RACKLIMIT, true, "max-words", "max # of moves to print per rack" }
|
||||
,{ CMD_RACKHEADER, true, "rack-header", "printed before each set of rack results" }
|
||||
,{ CMD_RACKFOOTER, true, "rack-footer", "printed after each set of rack result" }
|
||||
,{ CMD_HIDEVALUES, false, "hide-values", "show letters, not nums, on tiles" }
|
||||
,{ CMD_SKIPCONFIRM, false, "skip-confirm", "don't confirm before commit" }
|
||||
,{ CMD_VERTICALSCORE, false, "vertical", "scoreboard is vertical" }
|
||||
|
@ -1161,6 +1165,12 @@ main( int argc, char** argv )
|
|||
case CMD_RACKLIMIT:
|
||||
mainParams.rackLimit = atoi(optarg);
|
||||
break;
|
||||
case CMD_RACKHEADER:
|
||||
mainParams.rackHeader = optarg;
|
||||
break;
|
||||
case CMD_RACKFOOTER:
|
||||
mainParams.rackFooter = optarg;
|
||||
break;
|
||||
|
||||
#ifdef XWFEATURE_BLUETOOTH
|
||||
case CMD_BTADDR:
|
||||
|
|
|
@ -85,6 +85,8 @@ typedef struct LaunchParams {
|
|||
char* rackPipe;
|
||||
char* rackString;
|
||||
XP_U32 rackLimit;
|
||||
char* rackHeader;
|
||||
char* rackFooter;
|
||||
#endif
|
||||
|
||||
DeviceRole serverRole;
|
||||
|
|
|
@ -103,11 +103,16 @@ static void
|
|||
printSaved( MvCntGlobals* globals )
|
||||
{
|
||||
int ii;
|
||||
XP_U32 limit = globals->cGlobals.params->rackLimit;
|
||||
const LaunchParams* params = globals->cGlobals.params;
|
||||
XP_U32 limit = params->rackLimit;
|
||||
if ( limit == 0 || limit > PREPROD_LIMIT ) {
|
||||
limit = PREPROD_LIMIT;
|
||||
}
|
||||
|
||||
if ( !!params->rackHeader ) {
|
||||
fprintf( stdout, "%s\n", params->rackHeader );
|
||||
}
|
||||
|
||||
GArray* move_array = globals->move_array;
|
||||
for ( ii = 0; ii < move_array->len; ++ii ) {
|
||||
gchar* str = g_array_index( move_array, gchar*, ii );
|
||||
|
@ -119,6 +124,11 @@ printSaved( MvCntGlobals* globals )
|
|||
}
|
||||
g_free( str );
|
||||
}
|
||||
|
||||
if ( !!params->rackFooter ) {
|
||||
fprintf( stdout, "%s\n", params->rackFooter );
|
||||
}
|
||||
|
||||
(void)g_array_free( move_array, TRUE );
|
||||
globals->move_array = NULL;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue