File: mkconf.c

package info (click to toggle)
xfireworks 1.3-6
  • links: PTS
  • area: main
  • in suites: lenny
  • size: 416 kB
  • ctags: 464
  • sloc: ansic: 3,110; makefile: 121; sh: 52
file content (45 lines) | stat: -rw-r--r-- 753 bytes parent folder | download | duplicates (11)
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
#include <stdio.h>
#include <stdlib.h>

#if 1
#define ONE_LINE
#endif

main()
{
  char buffer[1000];
  char * p;

  printf("static char * default_xfireworks_conf =\n");
#ifdef ONE_LINE
  printf("\"");
#endif
  while (fgets(buffer, 1000, stdin) != NULL) {
    if ((buffer[0] != '\0') && (buffer[0] != '#')) {

#ifndef ONE_LINE
      printf("\"");
#endif
      for (p = buffer; *p != '\0'; p++) {
	if      (*p == '\n') break;
	else if (*p == '\t') printf(" ");
	else if (*p == '\"') printf("\\\"");
	else if (*p == '\'') printf("\\\'");
	else printf("%c", *p);
      }
#ifdef ONE_LINE
      printf("\\n");
#else
      printf("\\n\"\n");
#endif
    }
  }
#ifdef ONE_LINE
  printf("\";\n");
#else
  printf(";\n");
#endif
  exit (0);
}

/* End of Program */