scc

A fork of https://git.simple-cc.org/scc/ for Qute

git clone https://git.8pit.net/scc.git

 1#include <assert.h>
 2#include <stdio.h>
 3#include <string.h>
 4
 5/*
 6output:
 7testing
 8test1
 9test2
10test3
11test4
12test5
13done
14end:
15*/
16
17int
18main()
19{
20	char *s, buf[40], buf2[40];
21
22	puts("testing");
23
24	puts("test1");
25	strcpy(buf, "01234");
26	s = strncat(buf, "567", 8);
27	assert(s == buf);
28	assert(!strcmp(s, "01234567"));
29
30	puts("test2");
31	strcpy(buf, "01234");
32	s = strncat(buf, "567", 2);
33	assert(s == buf);
34	assert(!strcmp(s, "0123456"));
35
36	puts("test3");
37	strcpy(buf, "01234");
38	memcpy(buf2, "567", 3);
39	s = strncat(buf, buf2, 3);
40	assert(s == buf);
41	assert(!strcmp(s, "01234567"));
42
43	puts("test4");
44	strcpy(buf, "01234");
45	s = strncat(buf, "", 7);
46	assert(s == buf);
47	assert(!strcmp(s, "01234"));
48
49	puts("test5");
50	strcpy(buf, "01234");
51	s = strncat(buf, "", 0);
52	assert(s == buf);
53	assert(!strcmp(s, "01234"));
54
55	puts("done");
56
57	return 0;
58}