File: split.c

package info (click to toggle)
gnome-libs 1.4.2-34
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 22,596 kB
  • ctags: 11,411
  • sloc: ansic: 133,185; sh: 9,324; makefile: 1,983; perl: 667; yacc: 318; awk: 285; lisp: 177
file content (31 lines) | stat: -rw-r--r-- 798 bytes parent folder | download | duplicates (5)
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
#include <gnome.h>
#include <glib.h>
#include <stdio.h>

/* Do whatever you need to do... You should put the "expected" output of
   the program in ../expected/testname.out, which will be compared against
   the actual output of the test when it is run.

   A non-zero exit code also indicates failure.
*/

/* This should probably be moved to glib/testglib.c.  */
int main(int argc, char *argv[])
{
	char **output;
	int i;
	gnomelib_init("split", "0.0");
	output = g_strsplit("foo:bar:baz:qaz", ":", -1);
	for(i = 0; output[i]; i++) {
		g_print("%s ", output[i]);
		g_free(output[i]);
	}
	g_print("\n"); g_free(output);
	output = g_strsplit("foo:bar:baz:qaz", ":", 2);
	for(i = 0; output[i]; i++) {
		g_print("%s ", output[i]);
		g_free(output[i]);
	}
	g_print("\n"); g_free(output);	
	return 0;
}