parse.c revision 2
2N/A/* -*- mode: c; c-basic-offset: 4; indent-tabs-mode: nil -*- */ 2N/A * Copyright 1987, 1988 by MIT Student Information Processing Board 2N/A * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved. 2N/A * ss_parse has been modified slightly from the original in two ways. 2N/A * 1) A new parameter "quiet" has been added which is used to silence 2N/A * error or warning messages. 2N/A * 2) ss_parse now returns an error status instead of argv - this is to 2N/A * allow an error to be distinguished from no tokens when parsing an empty 2N/A * Both of these changes allow ss_parse to be used during tab-completion. 2N/A * parse(line_ptr, argc_ptr) 2N/A * Parses line, dividing at whitespace, into tokens, returns 2N/A * the "argc" and "argv" values. 2N/A * Pointer to text string to be parsed. 2N/A * Where to put the "argc" (number of tokens) value. 2N/A * argv_ptr (char ***) 2N/A * Where to put the series of pointers to parsed tokens. 2N/A * error (0 - success, non-zero on failure) 2N/A (
unsigned)(n+
2)*
sizeof(
char*))
2N/A /* go to quoted-string mode */ 2N/A /* random-token mode */ 2N/A "Unbalanced quotes in command line");