sbsv2/raptor/util/talon/chomp.c
author timothy.murphy@nokia.com
Mon, 15 Mar 2010 15:52:03 +0000
branchfix
changeset 359 6173843d1ce4
parent 256 ac7e607c7d30
permissions -rw-r--r--
Merge
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
252
6846d05399b6 SF Bug 2000 - test code for commandline parsing.
raptorbot <raptorbot@systemstesthead.symbian.intra>
parents:
diff changeset
     1
/*
6846d05399b6 SF Bug 2000 - test code for commandline parsing.
raptorbot <raptorbot@systemstesthead.symbian.intra>
parents:
diff changeset
     2
* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
6846d05399b6 SF Bug 2000 - test code for commandline parsing.
raptorbot <raptorbot@systemstesthead.symbian.intra>
parents:
diff changeset
     3
* All rights reserved.
6846d05399b6 SF Bug 2000 - test code for commandline parsing.
raptorbot <raptorbot@systemstesthead.symbian.intra>
parents:
diff changeset
     4
* This component and the accompanying materials are made available
6846d05399b6 SF Bug 2000 - test code for commandline parsing.
raptorbot <raptorbot@systemstesthead.symbian.intra>
parents:
diff changeset
     5
* under the terms of the License "Eclipse Public License v1.0"
6846d05399b6 SF Bug 2000 - test code for commandline parsing.
raptorbot <raptorbot@systemstesthead.symbian.intra>
parents:
diff changeset
     6
* which accompanies this distribution, and is available
6846d05399b6 SF Bug 2000 - test code for commandline parsing.
raptorbot <raptorbot@systemstesthead.symbian.intra>
parents:
diff changeset
     7
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
6846d05399b6 SF Bug 2000 - test code for commandline parsing.
raptorbot <raptorbot@systemstesthead.symbian.intra>
parents:
diff changeset
     8
*
6846d05399b6 SF Bug 2000 - test code for commandline parsing.
raptorbot <raptorbot@systemstesthead.symbian.intra>
parents:
diff changeset
     9
* Initial Contributors:
6846d05399b6 SF Bug 2000 - test code for commandline parsing.
raptorbot <raptorbot@systemstesthead.symbian.intra>
parents:
diff changeset
    10
* Nokia Corporation - initial contribution.
6846d05399b6 SF Bug 2000 - test code for commandline parsing.
raptorbot <raptorbot@systemstesthead.symbian.intra>
parents:
diff changeset
    11
*
6846d05399b6 SF Bug 2000 - test code for commandline parsing.
raptorbot <raptorbot@systemstesthead.symbian.intra>
parents:
diff changeset
    12
* Contributors:
6846d05399b6 SF Bug 2000 - test code for commandline parsing.
raptorbot <raptorbot@systemstesthead.symbian.intra>
parents:
diff changeset
    13
*
6846d05399b6 SF Bug 2000 - test code for commandline parsing.
raptorbot <raptorbot@systemstesthead.symbian.intra>
parents:
diff changeset
    14
* Description: 
6846d05399b6 SF Bug 2000 - test code for commandline parsing.
raptorbot <raptorbot@systemstesthead.symbian.intra>
parents:
diff changeset
    15
*
6846d05399b6 SF Bug 2000 - test code for commandline parsing.
raptorbot <raptorbot@systemstesthead.symbian.intra>
parents:
diff changeset
    16
*/
6846d05399b6 SF Bug 2000 - test code for commandline parsing.
raptorbot <raptorbot@systemstesthead.symbian.intra>
parents:
diff changeset
    17
6846d05399b6 SF Bug 2000 - test code for commandline parsing.
raptorbot <raptorbot@systemstesthead.symbian.intra>
parents:
diff changeset
    18
/*
6846d05399b6 SF Bug 2000 - test code for commandline parsing.
raptorbot <raptorbot@systemstesthead.symbian.intra>
parents:
diff changeset
    19
   Get rid of the path to talon from a commandline string on windows find the 
6846d05399b6 SF Bug 2000 - test code for commandline parsing.
raptorbot <raptorbot@systemstesthead.symbian.intra>
parents:
diff changeset
    20
   -c (if it's there) and step past it to after the quote on the first command:
6846d05399b6 SF Bug 2000 - test code for commandline parsing.
raptorbot <raptorbot@systemstesthead.symbian.intra>
parents:
diff changeset
    21
6846d05399b6 SF Bug 2000 - test code for commandline parsing.
raptorbot <raptorbot@systemstesthead.symbian.intra>
parents:
diff changeset
    22
   "g:\program files\talon\talon.exe" -c "gcc -c . . ."
6846d05399b6 SF Bug 2000 - test code for commandline parsing.
raptorbot <raptorbot@systemstesthead.symbian.intra>
parents:
diff changeset
    23
                                          ^------ Returns a pointer to here
6846d05399b6 SF Bug 2000 - test code for commandline parsing.
raptorbot <raptorbot@systemstesthead.symbian.intra>
parents:
diff changeset
    24
6846d05399b6 SF Bug 2000 - test code for commandline parsing.
raptorbot <raptorbot@systemstesthead.symbian.intra>
parents:
diff changeset
    25
   Take care of the possibilty that there might be spaces in the command
6846d05399b6 SF Bug 2000 - test code for commandline parsing.
raptorbot <raptorbot@systemstesthead.symbian.intra>
parents:
diff changeset
    26
   if it is quoted.
6846d05399b6 SF Bug 2000 - test code for commandline parsing.
raptorbot <raptorbot@systemstesthead.symbian.intra>
parents:
diff changeset
    27
6846d05399b6 SF Bug 2000 - test code for commandline parsing.
raptorbot <raptorbot@systemstesthead.symbian.intra>
parents:
diff changeset
    28
   A state-machine is flexible but not all that easy to write.  Should investigate
6846d05399b6 SF Bug 2000 - test code for commandline parsing.
raptorbot <raptorbot@systemstesthead.symbian.intra>
parents:
diff changeset
    29
   the possiblity of using the Ragel state machine generator perhaps.
6846d05399b6 SF Bug 2000 - test code for commandline parsing.
raptorbot <raptorbot@systemstesthead.symbian.intra>
parents:
diff changeset
    30
6846d05399b6 SF Bug 2000 - test code for commandline parsing.
raptorbot <raptorbot@systemstesthead.symbian.intra>
parents:
diff changeset
    31
*/
256
ac7e607c7d30 SF Bug 2000 - tidy up copyright dates
timothy.murphy@nokia.com
parents: 252
diff changeset
    32
#define CH_START 0 	/* start state */
ac7e607c7d30 SF Bug 2000 - tidy up copyright dates
timothy.murphy@nokia.com
parents: 252
diff changeset
    33
#define CH_PRE 1	/* spaces before executable name */
ac7e607c7d30 SF Bug 2000 - tidy up copyright dates
timothy.murphy@nokia.com
parents: 252
diff changeset
    34
#define CH_EXQUOTE 2    /* part of the executable name, outside quotes */
ac7e607c7d30 SF Bug 2000 - tidy up copyright dates
timothy.murphy@nokia.com
parents: 252
diff changeset
    35
#define CH_INQUOTE 3	/* part of the executable name, in a quoted region */
ac7e607c7d30 SF Bug 2000 - tidy up copyright dates
timothy.murphy@nokia.com
parents: 252
diff changeset
    36
#define CH_POST 4	/* spaces after executable name */
ac7e607c7d30 SF Bug 2000 - tidy up copyright dates
timothy.murphy@nokia.com
parents: 252
diff changeset
    37
#define CH_MINUS 5	/* start of -c option */
ac7e607c7d30 SF Bug 2000 - tidy up copyright dates
timothy.murphy@nokia.com
parents: 252
diff changeset
    38
#define CH_C 6		/* end of -c option */
ac7e607c7d30 SF Bug 2000 - tidy up copyright dates
timothy.murphy@nokia.com
parents: 252
diff changeset
    39
#define CH_PRECOMMAND 7 /* spaces before shell commands */
ac7e607c7d30 SF Bug 2000 - tidy up copyright dates
timothy.murphy@nokia.com
parents: 252
diff changeset
    40
#define CH_COMMAND 8	/* first character of shell command */
ac7e607c7d30 SF Bug 2000 - tidy up copyright dates
timothy.murphy@nokia.com
parents: 252
diff changeset
    41
#define CH_ERR 9	/* Error! */
252
6846d05399b6 SF Bug 2000 - test code for commandline parsing.
raptorbot <raptorbot@systemstesthead.symbian.intra>
parents:
diff changeset
    42
6846d05399b6 SF Bug 2000 - test code for commandline parsing.
raptorbot <raptorbot@systemstesthead.symbian.intra>
parents:
diff changeset
    43
#include "log.h"
6846d05399b6 SF Bug 2000 - test code for commandline parsing.
raptorbot <raptorbot@systemstesthead.symbian.intra>
parents:
diff changeset
    44
#include "chomp.h"
6846d05399b6 SF Bug 2000 - test code for commandline parsing.
raptorbot <raptorbot@systemstesthead.symbian.intra>
parents:
diff changeset
    45
6846d05399b6 SF Bug 2000 - test code for commandline parsing.
raptorbot <raptorbot@systemstesthead.symbian.intra>
parents:
diff changeset
    46
char * chompCommand(char command[])
6846d05399b6 SF Bug 2000 - test code for commandline parsing.
raptorbot <raptorbot@systemstesthead.symbian.intra>
parents:
diff changeset
    47
{
6846d05399b6 SF Bug 2000 - test code for commandline parsing.
raptorbot <raptorbot@systemstesthead.symbian.intra>
parents:
diff changeset
    48
	char *result = command;
6846d05399b6 SF Bug 2000 - test code for commandline parsing.
raptorbot <raptorbot@systemstesthead.symbian.intra>
parents:
diff changeset
    49
	int state = CH_START;
6846d05399b6 SF Bug 2000 - test code for commandline parsing.
raptorbot <raptorbot@systemstesthead.symbian.intra>
parents:
diff changeset
    50
6846d05399b6 SF Bug 2000 - test code for commandline parsing.
raptorbot <raptorbot@systemstesthead.symbian.intra>
parents:
diff changeset
    51
	while (state != CH_COMMAND && state != CH_ERR)
6846d05399b6 SF Bug 2000 - test code for commandline parsing.
raptorbot <raptorbot@systemstesthead.symbian.intra>
parents:
diff changeset
    52
	{
6846d05399b6 SF Bug 2000 - test code for commandline parsing.
raptorbot <raptorbot@systemstesthead.symbian.intra>
parents:
diff changeset
    53
		DEBUG(("startstate: %d, char %c ",state, *result));
6846d05399b6 SF Bug 2000 - test code for commandline parsing.
raptorbot <raptorbot@systemstesthead.symbian.intra>
parents:
diff changeset
    54
		switch (*result)
6846d05399b6 SF Bug 2000 - test code for commandline parsing.
raptorbot <raptorbot@systemstesthead.symbian.intra>
parents:
diff changeset
    55
		{
6846d05399b6 SF Bug 2000 - test code for commandline parsing.
raptorbot <raptorbot@systemstesthead.symbian.intra>
parents:
diff changeset
    56
			case ' ':
6846d05399b6 SF Bug 2000 - test code for commandline parsing.
raptorbot <raptorbot@systemstesthead.symbian.intra>
parents:
diff changeset
    57
				switch (state)
6846d05399b6 SF Bug 2000 - test code for commandline parsing.
raptorbot <raptorbot@systemstesthead.symbian.intra>
parents:
diff changeset
    58
				{
6846d05399b6 SF Bug 2000 - test code for commandline parsing.
raptorbot <raptorbot@systemstesthead.symbian.intra>
parents:
diff changeset
    59
					case CH_START:
6846d05399b6 SF Bug 2000 - test code for commandline parsing.
raptorbot <raptorbot@systemstesthead.symbian.intra>
parents:
diff changeset
    60
					case CH_PRE:
6846d05399b6 SF Bug 2000 - test code for commandline parsing.
raptorbot <raptorbot@systemstesthead.symbian.intra>
parents:
diff changeset
    61
						state = CH_PRE;
6846d05399b6 SF Bug 2000 - test code for commandline parsing.
raptorbot <raptorbot@systemstesthead.symbian.intra>
parents:
diff changeset
    62
						break;
6846d05399b6 SF Bug 2000 - test code for commandline parsing.
raptorbot <raptorbot@systemstesthead.symbian.intra>
parents:
diff changeset
    63
					case CH_EXQUOTE:
6846d05399b6 SF Bug 2000 - test code for commandline parsing.
raptorbot <raptorbot@systemstesthead.symbian.intra>
parents:
diff changeset
    64
						state = CH_POST;
6846d05399b6 SF Bug 2000 - test code for commandline parsing.
raptorbot <raptorbot@systemstesthead.symbian.intra>
parents:
diff changeset
    65
						break;
6846d05399b6 SF Bug 2000 - test code for commandline parsing.
raptorbot <raptorbot@systemstesthead.symbian.intra>
parents:
diff changeset
    66
					case CH_INQUOTE:
6846d05399b6 SF Bug 2000 - test code for commandline parsing.
raptorbot <raptorbot@systemstesthead.symbian.intra>
parents:
diff changeset
    67
						break;
6846d05399b6 SF Bug 2000 - test code for commandline parsing.
raptorbot <raptorbot@systemstesthead.symbian.intra>
parents:
diff changeset
    68
					case CH_POST:
6846d05399b6 SF Bug 2000 - test code for commandline parsing.
raptorbot <raptorbot@systemstesthead.symbian.intra>
parents:
diff changeset
    69
						break;
6846d05399b6 SF Bug 2000 - test code for commandline parsing.
raptorbot <raptorbot@systemstesthead.symbian.intra>
parents:
diff changeset
    70
					case CH_MINUS:
6846d05399b6 SF Bug 2000 - test code for commandline parsing.
raptorbot <raptorbot@systemstesthead.symbian.intra>
parents:
diff changeset
    71
						state = CH_C;
6846d05399b6 SF Bug 2000 - test code for commandline parsing.
raptorbot <raptorbot@systemstesthead.symbian.intra>
parents:
diff changeset
    72
						break;
6846d05399b6 SF Bug 2000 - test code for commandline parsing.
raptorbot <raptorbot@systemstesthead.symbian.intra>
parents:
diff changeset
    73
					case CH_C:
6846d05399b6 SF Bug 2000 - test code for commandline parsing.
raptorbot <raptorbot@systemstesthead.symbian.intra>
parents:
diff changeset
    74
						state = CH_PRECOMMAND;
6846d05399b6 SF Bug 2000 - test code for commandline parsing.
raptorbot <raptorbot@systemstesthead.symbian.intra>
parents:
diff changeset
    75
						break;
6846d05399b6 SF Bug 2000 - test code for commandline parsing.
raptorbot <raptorbot@systemstesthead.symbian.intra>
parents:
diff changeset
    76
					case CH_PRECOMMAND:
6846d05399b6 SF Bug 2000 - test code for commandline parsing.
raptorbot <raptorbot@systemstesthead.symbian.intra>
parents:
diff changeset
    77
						break;
6846d05399b6 SF Bug 2000 - test code for commandline parsing.
raptorbot <raptorbot@systemstesthead.symbian.intra>
parents:
diff changeset
    78
					default:
6846d05399b6 SF Bug 2000 - test code for commandline parsing.
raptorbot <raptorbot@systemstesthead.symbian.intra>
parents:
diff changeset
    79
						state = CH_ERR;
6846d05399b6 SF Bug 2000 - test code for commandline parsing.
raptorbot <raptorbot@systemstesthead.symbian.intra>
parents:
diff changeset
    80
						break;
6846d05399b6 SF Bug 2000 - test code for commandline parsing.
raptorbot <raptorbot@systemstesthead.symbian.intra>
parents:
diff changeset
    81
				}
6846d05399b6 SF Bug 2000 - test code for commandline parsing.
raptorbot <raptorbot@systemstesthead.symbian.intra>
parents:
diff changeset
    82
			break;
6846d05399b6 SF Bug 2000 - test code for commandline parsing.
raptorbot <raptorbot@systemstesthead.symbian.intra>
parents:
diff changeset
    83
			case 'c':
6846d05399b6 SF Bug 2000 - test code for commandline parsing.
raptorbot <raptorbot@systemstesthead.symbian.intra>
parents:
diff changeset
    84
				switch (state)
6846d05399b6 SF Bug 2000 - test code for commandline parsing.
raptorbot <raptorbot@systemstesthead.symbian.intra>
parents:
diff changeset
    85
				{
6846d05399b6 SF Bug 2000 - test code for commandline parsing.
raptorbot <raptorbot@systemstesthead.symbian.intra>
parents:
diff changeset
    86
					case CH_START:
6846d05399b6 SF Bug 2000 - test code for commandline parsing.
raptorbot <raptorbot@systemstesthead.symbian.intra>
parents:
diff changeset
    87
					case CH_PRE:
6846d05399b6 SF Bug 2000 - test code for commandline parsing.
raptorbot <raptorbot@systemstesthead.symbian.intra>
parents:
diff changeset
    88
						state = CH_EXQUOTE;
6846d05399b6 SF Bug 2000 - test code for commandline parsing.
raptorbot <raptorbot@systemstesthead.symbian.intra>
parents:
diff changeset
    89
						break;
6846d05399b6 SF Bug 2000 - test code for commandline parsing.
raptorbot <raptorbot@systemstesthead.symbian.intra>
parents:
diff changeset
    90
					case CH_EXQUOTE:
6846d05399b6 SF Bug 2000 - test code for commandline parsing.
raptorbot <raptorbot@systemstesthead.symbian.intra>
parents:
diff changeset
    91
					case CH_INQUOTE:
6846d05399b6 SF Bug 2000 - test code for commandline parsing.
raptorbot <raptorbot@systemstesthead.symbian.intra>
parents:
diff changeset
    92
						break;
6846d05399b6 SF Bug 2000 - test code for commandline parsing.
raptorbot <raptorbot@systemstesthead.symbian.intra>
parents:
diff changeset
    93
					case CH_POST:
6846d05399b6 SF Bug 2000 - test code for commandline parsing.
raptorbot <raptorbot@systemstesthead.symbian.intra>
parents:
diff changeset
    94
						state = CH_ERR;
6846d05399b6 SF Bug 2000 - test code for commandline parsing.
raptorbot <raptorbot@systemstesthead.symbian.intra>
parents:
diff changeset
    95
						break;
6846d05399b6 SF Bug 2000 - test code for commandline parsing.
raptorbot <raptorbot@systemstesthead.symbian.intra>
parents:
diff changeset
    96
					case CH_MINUS:
6846d05399b6 SF Bug 2000 - test code for commandline parsing.
raptorbot <raptorbot@systemstesthead.symbian.intra>
parents:
diff changeset
    97
						state = CH_C;
6846d05399b6 SF Bug 2000 - test code for commandline parsing.
raptorbot <raptorbot@systemstesthead.symbian.intra>
parents:
diff changeset
    98
						break;
6846d05399b6 SF Bug 2000 - test code for commandline parsing.
raptorbot <raptorbot@systemstesthead.symbian.intra>
parents:
diff changeset
    99
					case CH_C:
6846d05399b6 SF Bug 2000 - test code for commandline parsing.
raptorbot <raptorbot@systemstesthead.symbian.intra>
parents:
diff changeset
   100
					case CH_PRECOMMAND:
6846d05399b6 SF Bug 2000 - test code for commandline parsing.
raptorbot <raptorbot@systemstesthead.symbian.intra>
parents:
diff changeset
   101
					default:
6846d05399b6 SF Bug 2000 - test code for commandline parsing.
raptorbot <raptorbot@systemstesthead.symbian.intra>
parents:
diff changeset
   102
						state = CH_ERR;
6846d05399b6 SF Bug 2000 - test code for commandline parsing.
raptorbot <raptorbot@systemstesthead.symbian.intra>
parents:
diff changeset
   103
						break;
6846d05399b6 SF Bug 2000 - test code for commandline parsing.
raptorbot <raptorbot@systemstesthead.symbian.intra>
parents:
diff changeset
   104
				}
6846d05399b6 SF Bug 2000 - test code for commandline parsing.
raptorbot <raptorbot@systemstesthead.symbian.intra>
parents:
diff changeset
   105
			break;
6846d05399b6 SF Bug 2000 - test code for commandline parsing.
raptorbot <raptorbot@systemstesthead.symbian.intra>
parents:
diff changeset
   106
			case '-':
6846d05399b6 SF Bug 2000 - test code for commandline parsing.
raptorbot <raptorbot@systemstesthead.symbian.intra>
parents:
diff changeset
   107
				switch (state)
6846d05399b6 SF Bug 2000 - test code for commandline parsing.
raptorbot <raptorbot@systemstesthead.symbian.intra>
parents:
diff changeset
   108
				{
6846d05399b6 SF Bug 2000 - test code for commandline parsing.
raptorbot <raptorbot@systemstesthead.symbian.intra>
parents:
diff changeset
   109
					case CH_START:
6846d05399b6 SF Bug 2000 - test code for commandline parsing.
raptorbot <raptorbot@systemstesthead.symbian.intra>
parents:
diff changeset
   110
					case CH_PRE:
6846d05399b6 SF Bug 2000 - test code for commandline parsing.
raptorbot <raptorbot@systemstesthead.symbian.intra>
parents:
diff changeset
   111
						state = CH_EXQUOTE;
6846d05399b6 SF Bug 2000 - test code for commandline parsing.
raptorbot <raptorbot@systemstesthead.symbian.intra>
parents:
diff changeset
   112
						break;
6846d05399b6 SF Bug 2000 - test code for commandline parsing.
raptorbot <raptorbot@systemstesthead.symbian.intra>
parents:
diff changeset
   113
					case CH_EXQUOTE:
6846d05399b6 SF Bug 2000 - test code for commandline parsing.
raptorbot <raptorbot@systemstesthead.symbian.intra>
parents:
diff changeset
   114
					case CH_INQUOTE:
6846d05399b6 SF Bug 2000 - test code for commandline parsing.
raptorbot <raptorbot@systemstesthead.symbian.intra>
parents:
diff changeset
   115
						break;
6846d05399b6 SF Bug 2000 - test code for commandline parsing.
raptorbot <raptorbot@systemstesthead.symbian.intra>
parents:
diff changeset
   116
					case CH_POST:
6846d05399b6 SF Bug 2000 - test code for commandline parsing.
raptorbot <raptorbot@systemstesthead.symbian.intra>
parents:
diff changeset
   117
						state = CH_MINUS;
6846d05399b6 SF Bug 2000 - test code for commandline parsing.
raptorbot <raptorbot@systemstesthead.symbian.intra>
parents:
diff changeset
   118
						break;
6846d05399b6 SF Bug 2000 - test code for commandline parsing.
raptorbot <raptorbot@systemstesthead.symbian.intra>
parents:
diff changeset
   119
					case CH_MINUS:
6846d05399b6 SF Bug 2000 - test code for commandline parsing.
raptorbot <raptorbot@systemstesthead.symbian.intra>
parents:
diff changeset
   120
					case CH_C:
6846d05399b6 SF Bug 2000 - test code for commandline parsing.
raptorbot <raptorbot@systemstesthead.symbian.intra>
parents:
diff changeset
   121
					case CH_PRECOMMAND:
6846d05399b6 SF Bug 2000 - test code for commandline parsing.
raptorbot <raptorbot@systemstesthead.symbian.intra>
parents:
diff changeset
   122
					default:
6846d05399b6 SF Bug 2000 - test code for commandline parsing.
raptorbot <raptorbot@systemstesthead.symbian.intra>
parents:
diff changeset
   123
						state = CH_ERR;
6846d05399b6 SF Bug 2000 - test code for commandline parsing.
raptorbot <raptorbot@systemstesthead.symbian.intra>
parents:
diff changeset
   124
						break;
6846d05399b6 SF Bug 2000 - test code for commandline parsing.
raptorbot <raptorbot@systemstesthead.symbian.intra>
parents:
diff changeset
   125
				}
6846d05399b6 SF Bug 2000 - test code for commandline parsing.
raptorbot <raptorbot@systemstesthead.symbian.intra>
parents:
diff changeset
   126
			break;
6846d05399b6 SF Bug 2000 - test code for commandline parsing.
raptorbot <raptorbot@systemstesthead.symbian.intra>
parents:
diff changeset
   127
			case '"':
6846d05399b6 SF Bug 2000 - test code for commandline parsing.
raptorbot <raptorbot@systemstesthead.symbian.intra>
parents:
diff changeset
   128
				switch (state)
6846d05399b6 SF Bug 2000 - test code for commandline parsing.
raptorbot <raptorbot@systemstesthead.symbian.intra>
parents:
diff changeset
   129
				{
6846d05399b6 SF Bug 2000 - test code for commandline parsing.
raptorbot <raptorbot@systemstesthead.symbian.intra>
parents:
diff changeset
   130
					case CH_START:
6846d05399b6 SF Bug 2000 - test code for commandline parsing.
raptorbot <raptorbot@systemstesthead.symbian.intra>
parents:
diff changeset
   131
					case CH_PRE:
6846d05399b6 SF Bug 2000 - test code for commandline parsing.
raptorbot <raptorbot@systemstesthead.symbian.intra>
parents:
diff changeset
   132
					case CH_EXQUOTE:
6846d05399b6 SF Bug 2000 - test code for commandline parsing.
raptorbot <raptorbot@systemstesthead.symbian.intra>
parents:
diff changeset
   133
						state = CH_INQUOTE;
6846d05399b6 SF Bug 2000 - test code for commandline parsing.
raptorbot <raptorbot@systemstesthead.symbian.intra>
parents:
diff changeset
   134
						break;
6846d05399b6 SF Bug 2000 - test code for commandline parsing.
raptorbot <raptorbot@systemstesthead.symbian.intra>
parents:
diff changeset
   135
					case CH_INQUOTE:
6846d05399b6 SF Bug 2000 - test code for commandline parsing.
raptorbot <raptorbot@systemstesthead.symbian.intra>
parents:
diff changeset
   136
						state = CH_EXQUOTE;
6846d05399b6 SF Bug 2000 - test code for commandline parsing.
raptorbot <raptorbot@systemstesthead.symbian.intra>
parents:
diff changeset
   137
						break;
6846d05399b6 SF Bug 2000 - test code for commandline parsing.
raptorbot <raptorbot@systemstesthead.symbian.intra>
parents:
diff changeset
   138
					case CH_POST:
6846d05399b6 SF Bug 2000 - test code for commandline parsing.
raptorbot <raptorbot@systemstesthead.symbian.intra>
parents:
diff changeset
   139
					case CH_MINUS:
6846d05399b6 SF Bug 2000 - test code for commandline parsing.
raptorbot <raptorbot@systemstesthead.symbian.intra>
parents:
diff changeset
   140
					case CH_C:
6846d05399b6 SF Bug 2000 - test code for commandline parsing.
raptorbot <raptorbot@systemstesthead.symbian.intra>
parents:
diff changeset
   141
						state = CH_ERR;
6846d05399b6 SF Bug 2000 - test code for commandline parsing.
raptorbot <raptorbot@systemstesthead.symbian.intra>
parents:
diff changeset
   142
						break;
6846d05399b6 SF Bug 2000 - test code for commandline parsing.
raptorbot <raptorbot@systemstesthead.symbian.intra>
parents:
diff changeset
   143
					case CH_PRECOMMAND:
6846d05399b6 SF Bug 2000 - test code for commandline parsing.
raptorbot <raptorbot@systemstesthead.symbian.intra>
parents:
diff changeset
   144
						state = CH_COMMAND;
6846d05399b6 SF Bug 2000 - test code for commandline parsing.
raptorbot <raptorbot@systemstesthead.symbian.intra>
parents:
diff changeset
   145
						break;
6846d05399b6 SF Bug 2000 - test code for commandline parsing.
raptorbot <raptorbot@systemstesthead.symbian.intra>
parents:
diff changeset
   146
					default:
6846d05399b6 SF Bug 2000 - test code for commandline parsing.
raptorbot <raptorbot@systemstesthead.symbian.intra>
parents:
diff changeset
   147
						state = CH_ERR;
6846d05399b6 SF Bug 2000 - test code for commandline parsing.
raptorbot <raptorbot@systemstesthead.symbian.intra>
parents:
diff changeset
   148
						break;
6846d05399b6 SF Bug 2000 - test code for commandline parsing.
raptorbot <raptorbot@systemstesthead.symbian.intra>
parents:
diff changeset
   149
				}
6846d05399b6 SF Bug 2000 - test code for commandline parsing.
raptorbot <raptorbot@systemstesthead.symbian.intra>
parents:
diff changeset
   150
6846d05399b6 SF Bug 2000 - test code for commandline parsing.
raptorbot <raptorbot@systemstesthead.symbian.intra>
parents:
diff changeset
   151
			break;
6846d05399b6 SF Bug 2000 - test code for commandline parsing.
raptorbot <raptorbot@systemstesthead.symbian.intra>
parents:
diff changeset
   152
			default:
6846d05399b6 SF Bug 2000 - test code for commandline parsing.
raptorbot <raptorbot@systemstesthead.symbian.intra>
parents:
diff changeset
   153
				switch (state)
6846d05399b6 SF Bug 2000 - test code for commandline parsing.
raptorbot <raptorbot@systemstesthead.symbian.intra>
parents:
diff changeset
   154
				{
6846d05399b6 SF Bug 2000 - test code for commandline parsing.
raptorbot <raptorbot@systemstesthead.symbian.intra>
parents:
diff changeset
   155
					case CH_START:
6846d05399b6 SF Bug 2000 - test code for commandline parsing.
raptorbot <raptorbot@systemstesthead.symbian.intra>
parents:
diff changeset
   156
					case CH_PRE:
6846d05399b6 SF Bug 2000 - test code for commandline parsing.
raptorbot <raptorbot@systemstesthead.symbian.intra>
parents:
diff changeset
   157
						state = CH_EXQUOTE;
6846d05399b6 SF Bug 2000 - test code for commandline parsing.
raptorbot <raptorbot@systemstesthead.symbian.intra>
parents:
diff changeset
   158
						break;
6846d05399b6 SF Bug 2000 - test code for commandline parsing.
raptorbot <raptorbot@systemstesthead.symbian.intra>
parents:
diff changeset
   159
					case CH_INQUOTE:
6846d05399b6 SF Bug 2000 - test code for commandline parsing.
raptorbot <raptorbot@systemstesthead.symbian.intra>
parents:
diff changeset
   160
					case CH_EXQUOTE:
6846d05399b6 SF Bug 2000 - test code for commandline parsing.
raptorbot <raptorbot@systemstesthead.symbian.intra>
parents:
diff changeset
   161
						break;
6846d05399b6 SF Bug 2000 - test code for commandline parsing.
raptorbot <raptorbot@systemstesthead.symbian.intra>
parents:
diff changeset
   162
					default:
6846d05399b6 SF Bug 2000 - test code for commandline parsing.
raptorbot <raptorbot@systemstesthead.symbian.intra>
parents:
diff changeset
   163
						state = CH_ERR;
6846d05399b6 SF Bug 2000 - test code for commandline parsing.
raptorbot <raptorbot@systemstesthead.symbian.intra>
parents:
diff changeset
   164
						break;
6846d05399b6 SF Bug 2000 - test code for commandline parsing.
raptorbot <raptorbot@systemstesthead.symbian.intra>
parents:
diff changeset
   165
				}
6846d05399b6 SF Bug 2000 - test code for commandline parsing.
raptorbot <raptorbot@systemstesthead.symbian.intra>
parents:
diff changeset
   166
			break;
6846d05399b6 SF Bug 2000 - test code for commandline parsing.
raptorbot <raptorbot@systemstesthead.symbian.intra>
parents:
diff changeset
   167
		}
6846d05399b6 SF Bug 2000 - test code for commandline parsing.
raptorbot <raptorbot@systemstesthead.symbian.intra>
parents:
diff changeset
   168
		DEBUG(("endstate: %d\n",state));
6846d05399b6 SF Bug 2000 - test code for commandline parsing.
raptorbot <raptorbot@systemstesthead.symbian.intra>
parents:
diff changeset
   169
		result ++;
6846d05399b6 SF Bug 2000 - test code for commandline parsing.
raptorbot <raptorbot@systemstesthead.symbian.intra>
parents:
diff changeset
   170
		
6846d05399b6 SF Bug 2000 - test code for commandline parsing.
raptorbot <raptorbot@systemstesthead.symbian.intra>
parents:
diff changeset
   171
	}
6846d05399b6 SF Bug 2000 - test code for commandline parsing.
raptorbot <raptorbot@systemstesthead.symbian.intra>
parents:
diff changeset
   172
6846d05399b6 SF Bug 2000 - test code for commandline parsing.
raptorbot <raptorbot@systemstesthead.symbian.intra>
parents:
diff changeset
   173
	if (state == CH_ERR)
6846d05399b6 SF Bug 2000 - test code for commandline parsing.
raptorbot <raptorbot@systemstesthead.symbian.intra>
parents:
diff changeset
   174
		return (char *)0;
6846d05399b6 SF Bug 2000 - test code for commandline parsing.
raptorbot <raptorbot@systemstesthead.symbian.intra>
parents:
diff changeset
   175
6846d05399b6 SF Bug 2000 - test code for commandline parsing.
raptorbot <raptorbot@systemstesthead.symbian.intra>
parents:
diff changeset
   176
	return result;
6846d05399b6 SF Bug 2000 - test code for commandline parsing.
raptorbot <raptorbot@systemstesthead.symbian.intra>
parents:
diff changeset
   177
}