]>
git.saurik.com Git - wxWidgets.git/blob - distrib/msw/splitwise.cpp
1 ///////////////////////////////////////////////////////////////////////////////
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
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).
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,
20 // Author: Julian Smart
24 // Copyright: (c) Julian Smart
25 // Licence: wxWindows licence
26 ///////////////////////////////////////////////////////////////////////////////
35 int ReadLine(FILE* fd
, char* buf
)
39 while (((ch
= getc(fd
)) != EOF
) && (ch
!= '\n'))
46 if (ch
== EOF
&& (i
== 0))
52 void WriteLine(FILE* fd
, char* buf
)
54 int len
= strlen(buf
);
56 for (i
= 0; i
< len
; i
++)
61 int main(int argc
, char* argv
[])
63 FILE* wiseTop
= fopen("wisetop.txt", "w");
67 FILE* wiseBottom
= fopen("wisebott.txt", "w");
71 FILE* wiseWhole
= fopen("wxwin2.wse", "r");
75 // Write out the top of the file
77 while (ReadLine(wiseWhole
, g_Line
))
79 if (strcmp(g_Line
, "item: Install File") == 0)
82 WriteLine(wiseTop
, g_Line
);
84 // Skip to the end of the file items
85 while (ReadLine(wiseWhole
, g_Line
))
87 if ((strncmp(g_Line
, "item:", 5) == 0) && (strcmp(g_Line
, "item: Install File") != 0))
89 WriteLine(wiseBottom
, g_Line
);
93 // Write the rest of the bottom
94 while (ReadLine(wiseWhole
, g_Line
))
96 WriteLine(wiseBottom
, g_Line
);