]> git.saurik.com Git - wxWidgets.git/blame - distrib/msw/splitwise.cpp
mention wxAUI
[wxWidgets.git] / distrib / msw / splitwise.cpp
CommitLineData
07e63290
JS
1///////////////////////////////////////////////////////////////////////////////
2// Name: splitwise.cpp
3// Purpose: Use this to split wxwin2.wse in the distrib/msw directory
4// into wisetop.txt, wisebott.txt. This allows you to do the
5// following:
6//
7// 1) Edit the existing wxwin2.wse in WISE Install.
8// 2) Call splitwise.exe to split off the non-file bits (i.e.
9// preserve everything except the "item: Install File" lines).
10// 3) Call makewise.bat to generate a new wxwin2.wse from
11// wisetop.txt, wisebott.txt and the file list generated
12// from the files in deliver\wx (which themselves have been
13// put there by zipdist.bat).
14//
15// If you don't wish to change the WISE settings, then there's no
16// need to use splitwise, but it's very likely that settings will
17// be altered, e.g. to change the version number, what's installed,
18// etc.
19//
20// Author: Julian Smart
21// Modified by:
22// Created: 13/10/99
23// RCS-ID: $Id$
24// Copyright: (c) Julian Smart
77ffb593 25// Licence: wxWidgets licence
07e63290
JS
26///////////////////////////////////////////////////////////////////////////////
27
28
29#include <stdio.h>
30#include <stdlib.h>
31#include <string.h>
32
33char g_Line[1024];
34
35int ReadLine(FILE* fd, char* buf)
36{
37 int ch;
38 int i = 0;
39 while (((ch = getc(fd)) != EOF) && (ch != '\n'))
40 {
41 buf[i] = ch;
42 i ++;
43 }
44 buf[i] = 0;
45
46 if (ch == EOF && (i == 0))
47 return 0;
48 else
49 return 1;
50}
51
52void WriteLine(FILE* fd, char* buf)
53{
54 int len = strlen(buf);
55 int i;
56 for (i = 0; i < len; i++)
57 putc(buf[i], fd);
58 putc('\n', fd);
59}
60
61int main(int argc, char* argv[])
62{
63 FILE* wiseTop = fopen("wisetop.txt", "w");
64 if (!wiseTop)
65 return 1;
66
67 FILE* wiseBottom = fopen("wisebott.txt", "w");
68 if (!wiseBottom)
69 return 1;
70
71 FILE* wiseWhole = fopen("wxwin2.wse", "r");
72 if (!wiseWhole)
73 return 1;
74
75 // Write out the top of the file
76 g_Line[0] = 0;
77 while (ReadLine(wiseWhole, g_Line))
78 {
79 if (strcmp(g_Line, "item: Install File") == 0)
80 break;
81 else
82 WriteLine(wiseTop, g_Line);
83 }
84 // Skip to the end of the file items
85 while (ReadLine(wiseWhole, g_Line))
86 {
87 if ((strncmp(g_Line, "item:", 5) == 0) && (strcmp(g_Line, "item: Install File") != 0))
88 {
89 WriteLine(wiseBottom, g_Line);
90 break;
91 }
92 }
93 // Write the rest of the bottom
94 while (ReadLine(wiseWhole, g_Line))
95 {
96 WriteLine(wiseBottom, g_Line);
97 }
98
99 fclose(wiseTop);
100 fclose(wiseBottom);
101 fclose(wiseWhole);
102
103 return 0;
104}
105
106