File: split.h

package info (click to toggle)
libsdl-console 2.1-6
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye, buster, sid
  • size: 1,284 kB
  • sloc: sh: 7,371; ansic: 1,482; makefile: 49
file content (56 lines) | stat: -rw-r--r-- 1,975 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
/***************************************************************************
                          split.h  -  description
                             -------------------
    begin                : Mon May 27 2002
    copyright            : (C) 2002 by Clemens Wacha
    email                : wacha@gmx.ch
 ***************************************************************************/

/***************************************************************************
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 ***************************************************************************/


/*! file
    Simple String Tokenizer
	
	example:
	
	input: "hello this is a "very cool" test.     "
	-> splitline(argv, max_tokens_to_return, string);
	
	output: return value of splitline = 6
			argv[0] = "hello"
			argv[1] = "this"
			argv[2] = "is"
			argv[3] = "a"
			argv[4] = "very cool"
			argv[5] = "test."  <-- remark the missing spaces
 
    @author Clemens Wacha
*/

#ifndef _SPLIT_H
#define _SPLIT_H

/*! internal function that is used by splitline() */
char *splitnext(char **pos);

/*!
	splitline is a destructive argument parser, much like a very primitive
	form of a shell parser. it supports quotes for embedded spaces and
	literal quotes with the backslash escape.
 
	splitline converts a string into 'tokens'. A 'token' is a string of characters
	not containing the space ' ' character.

	*** Remark the the original string gets cut apart! You cannot use it anymore! ***
*/
int splitline(char **argv, int max, char *line);

#endif  /* _SPLIT_H */