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 <stdlib.h>
 3#include <stdio.h>
 4#include <string.h>
 5
 6/*
 7output:
 8testing
 9done
10end:
11*/
12
13int
14main(void)
15{
16	char buff[40], *s;
17	FILE *fp;
18
19	puts("testing");
20	fp = fopen("__NOT_A_FILE", "w");
21	assert(fp);
22	fputs("Hello\n", fp);
23	fflush(fp);
24	assert(ferror(fp) == 0);
25	fclose(fp);
26	assert(rename("__NOT_A_FILE", "__NOT_OTHER_FILE") == 0);
27
28	fp = fopen("__NOT_OTHER_FILE", "r");
29	assert(fp);
30	s = fgets(buff, sizeof(buff), fp);
31	assert(s != NULL);
32	assert(strcmp(s, "Hello\n") == 0);
33	fclose(fp);
34
35	assert(remove("__NOT_OTHER_FILE") == 0);
36	puts("done");
37
38	return 0;
39}