Reformatting.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@8291 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -43,148 +43,148 @@ int include_unpack(char *aname);
|
|||||||
|
|
||||||
void append_file(char *filename)
|
void append_file(char *filename)
|
||||||
{
|
{
|
||||||
FILE *appendfile;
|
FILE *appendfile;
|
||||||
int amnt;
|
int amnt;
|
||||||
char buffer[512];
|
char buffer[512];
|
||||||
|
|
||||||
if((appendfile = fopen(filename, "rb"))==NULL)
|
if((appendfile = fopen(filename, "rb"))==NULL)
|
||||||
{
|
{
|
||||||
printf("Error opening %s for reading!\n", filename);
|
printf("Error opening %s for reading!\n", filename);
|
||||||
exit(3);
|
exit(3);
|
||||||
}
|
}
|
||||||
while(!feof(appendfile))
|
while(!feof(appendfile))
|
||||||
{
|
{
|
||||||
amnt = fread(buffer, 1, 512, appendfile);
|
amnt = fread(buffer, 1, 512, appendfile);
|
||||||
fwrite(buffer, 1, amnt, installfile);
|
fwrite(buffer, 1, amnt, installfile);
|
||||||
}
|
}
|
||||||
fclose(appendfile);
|
fclose(appendfile);
|
||||||
}
|
}
|
||||||
|
|
||||||
void getline(FILE *f, char *entry, char *entrydata)
|
void getline(FILE *f, char *entry, char *entrydata)
|
||||||
{
|
{
|
||||||
char in[4096];
|
char in[4096];
|
||||||
int z;
|
int z;
|
||||||
|
|
||||||
memset(in, 0, 4096);
|
memset(in, 0, 4096);
|
||||||
fgets(in, 4095, f);
|
fgets(in, 4095, f);
|
||||||
|
|
||||||
if(in[strlen(in)-1] == '\n')
|
if(in[strlen(in)-1] == '\n')
|
||||||
in[strlen(in)-1] = 0;
|
in[strlen(in)-1] = 0;
|
||||||
|
|
||||||
if(in[0] != '#')
|
if(in[0] != '#')
|
||||||
{
|
{
|
||||||
for(z=0;z<strlen(in);z++)
|
for(z=0;z<strlen(in);z++)
|
||||||
{
|
{
|
||||||
if(in[z] == '=')
|
if(in[z] == '=')
|
||||||
{
|
{
|
||||||
in[z] = 0;
|
in[z] = 0;
|
||||||
strcpy(entry, in);
|
strcpy(entry, in);
|
||||||
strcpy(entrydata, &in[z+1]);
|
strcpy(entrydata, &in[z+1]);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
strcpy(entry, "");
|
strcpy(entry, "");
|
||||||
strcpy(entrydata, "");
|
strcpy(entrydata, "");
|
||||||
}
|
}
|
||||||
|
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
char entry[8096], entrydata[8096];
|
char entry[8096], entrydata[8096];
|
||||||
int z;
|
int z;
|
||||||
|
|
||||||
printf("Packinst- version 2.0 (c) 1999-2000 DBSoft\n\n");
|
printf("Packinst- version 2.0 (c) 1999-2000 DBSoft\n\n");
|
||||||
if(argc!=2)
|
if(argc!=2)
|
||||||
{
|
{
|
||||||
printf("Usage: Packinst <filename.cfg>\n");
|
printf("Usage: Packinst <filename.cfg>\n");
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
|
||||||
if((cfgfile = fopen(argv[1], "r"))==NULL)
|
|
||||||
{
|
|
||||||
printf("Error opening config file \"%s\"!\n", argv[1]);
|
|
||||||
exit(2);
|
|
||||||
}
|
|
||||||
if((installfile = fopen("install.exe", "wb"))==NULL)
|
|
||||||
{
|
|
||||||
printf("Error opening install.exe for writing!\n");
|
|
||||||
exit(3);
|
|
||||||
}
|
}
|
||||||
|
if((cfgfile = fopen(argv[1], "r"))==NULL)
|
||||||
|
{
|
||||||
|
printf("Error opening config file \"%s\"!\n", argv[1]);
|
||||||
|
exit(2);
|
||||||
|
}
|
||||||
|
if((installfile = fopen("install.exe", "wb"))==NULL)
|
||||||
|
{
|
||||||
|
printf("Error opening install.exe for writing!\n");
|
||||||
|
exit(3);
|
||||||
|
}
|
||||||
#if 0
|
#if 0
|
||||||
printf("Adding resources to sfx.exe...\n");
|
printf("Adding resources to sfx.exe...\n");
|
||||||
system("rc install.rc sfx.exe > NUL");
|
system("rc install.rc sfx.exe > NUL");
|
||||||
#endif
|
#endif
|
||||||
printf("Creating installer...\n");
|
printf("Creating installer...\n");
|
||||||
append_file("sfx.exe");
|
append_file("sfx.exe");
|
||||||
fwrite("DBSOFT-HEADER", 1, 13, installfile);
|
fwrite("DBSOFT-HEADER", 1, 13, installfile);
|
||||||
while(!feof(cfgfile))
|
while(!feof(cfgfile))
|
||||||
{
|
{
|
||||||
getline(cfgfile, entry, entrydata);
|
getline(cfgfile, entry, entrydata);
|
||||||
if(stricmp(entry, "INSTALLER_APPLICATION") == 0)
|
if(stricmp(entry, "INSTALLER_APPLICATION") == 0)
|
||||||
INSTALLER_APPLICATION = (char *)strdup(entrydata);
|
INSTALLER_APPLICATION = (char *)strdup(entrydata);
|
||||||
if(stricmp(entry, "INSTALLER_VERSION") == 0)
|
if(stricmp(entry, "INSTALLER_VERSION") == 0)
|
||||||
INSTALLER_VERSION = (char *)strdup(entrydata);
|
INSTALLER_VERSION = (char *)strdup(entrydata);
|
||||||
if(stricmp(entry, "INSTALLER_TITLE") == 0)
|
if(stricmp(entry, "INSTALLER_TITLE") == 0)
|
||||||
INSTALLER_TITLE = (char *)strdup(entrydata);
|
INSTALLER_TITLE = (char *)strdup(entrydata);
|
||||||
if(stricmp(entry, "INSTALLER_PATH") == 0)
|
if(stricmp(entry, "INSTALLER_PATH") == 0)
|
||||||
INSTALLER_PATH = (char *)strdup(entrydata);
|
INSTALLER_PATH = (char *)strdup(entrydata);
|
||||||
if(stricmp(entry, "INSTALLER_FOLDER") == 0)
|
if(stricmp(entry, "INSTALLER_FOLDER") == 0)
|
||||||
INSTALLER_FOLDER = (char *)strdup(entrydata);
|
INSTALLER_FOLDER = (char *)strdup(entrydata);
|
||||||
if(stricmp(entry, "INSTALLER_PROGRAM") == 0)
|
if(stricmp(entry, "INSTALLER_PROGRAM") == 0)
|
||||||
INSTALLER_PROGRAM = (char *)strdup(entrydata);
|
INSTALLER_PROGRAM = (char *)strdup(entrydata);
|
||||||
if(stricmp(entry, "INSTALLER_SHADOW") == 0)
|
if(stricmp(entry, "INSTALLER_SHADOW") == 0)
|
||||||
INSTALLER_SHADOW = (char *)strdup(entrydata);
|
INSTALLER_SHADOW = (char *)strdup(entrydata);
|
||||||
if(stricmp(entry, "INSTALLER_OBJECT") == 0)
|
if(stricmp(entry, "INSTALLER_OBJECT") == 0)
|
||||||
INSTALLER_OBJECT = (char *)strdup(entrydata);
|
INSTALLER_OBJECT = (char *)strdup(entrydata);
|
||||||
if(stricmp(entry, "INSTALLER_SETS") == 0)
|
if(stricmp(entry, "INSTALLER_SETS") == 0)
|
||||||
INSTALLER_SETS = (char *)strdup(entrydata);
|
INSTALLER_SETS = (char *)strdup(entrydata);
|
||||||
if(stricmp(entry, "INSTALLER_SYSVAR") == 0)
|
if(stricmp(entry, "INSTALLER_SYSVAR") == 0)
|
||||||
INSTALLER_SYSVAR = (char *)strdup(entrydata);
|
INSTALLER_SYSVAR = (char *)strdup(entrydata);
|
||||||
if(stricmp(entry, "INSTALLER_SYSLINE") == 0)
|
if(stricmp(entry, "INSTALLER_SYSLINE") == 0)
|
||||||
INSTALLER_SYSLINE = (char *)strdup(entrydata);
|
INSTALLER_SYSLINE = (char *)strdup(entrydata);
|
||||||
if(stricmp(entry, "INSTALLER_CONFIRM_WPS") == 0)
|
if(stricmp(entry, "INSTALLER_CONFIRM_WPS") == 0)
|
||||||
INSTALLER_CONFIRM_WPS = (char *)strdup(entrydata);
|
INSTALLER_CONFIRM_WPS = (char *)strdup(entrydata);
|
||||||
if(stricmp(entry, "INSTALLER_CONFIRM_CONFIGSYS") == 0)
|
if(stricmp(entry, "INSTALLER_CONFIRM_CONFIGSYS") == 0)
|
||||||
INSTALLER_CONFIRM_CONFIGSYS = (char *)strdup(entrydata);
|
INSTALLER_CONFIRM_CONFIGSYS = (char *)strdup(entrydata);
|
||||||
if(stricmp(entry, "INSTALLER_CONFIRM_OVERWRITE") == 0)
|
if(stricmp(entry, "INSTALLER_CONFIRM_OVERWRITE") == 0)
|
||||||
INSTALLER_CONFIRM_OVERWRITE = (char *)strdup(entrydata);
|
INSTALLER_CONFIRM_OVERWRITE = (char *)strdup(entrydata);
|
||||||
if(stricmp(entry, "INSTALLER_PACKAGE") == 0)
|
if(stricmp(entry, "INSTALLER_PACKAGE") == 0)
|
||||||
{
|
{
|
||||||
for(z=0;z<strlen(entrydata);z++)
|
for(z=0;z<strlen(entrydata);z++)
|
||||||
{
|
{
|
||||||
if(entrydata[z] == ',')
|
if(entrydata[z] == ',')
|
||||||
{
|
{
|
||||||
entrydata[z] = 0;
|
entrydata[z] = 0;
|
||||||
packagefilename[INSTALLER_PACKAGE_COUNT] = (char *)strdup(entrydata);
|
packagefilename[INSTALLER_PACKAGE_COUNT] = (char *)strdup(entrydata);
|
||||||
INSTALLER_PACKAGES[INSTALLER_PACKAGE_COUNT] = (char *)strdup(&entrydata[z+1]);
|
INSTALLER_PACKAGES[INSTALLER_PACKAGE_COUNT] = (char *)strdup(&entrydata[z+1]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
resetglobals();
|
resetglobals();
|
||||||
files=0;
|
files=0;
|
||||||
include_unpack(packagefilename[INSTALLER_PACKAGE_COUNT]);
|
include_unpack(packagefilename[INSTALLER_PACKAGE_COUNT]);
|
||||||
packagefiles[INSTALLER_PACKAGE_COUNT] = files;
|
packagefiles[INSTALLER_PACKAGE_COUNT] = files;
|
||||||
INSTALLER_PACKAGE_COUNT++;
|
INSTALLER_PACKAGE_COUNT++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
fclose(cfgfile);
|
fclose(cfgfile);
|
||||||
fprintf(installfile, "%s-%s-%s-%s-%s-%s-%s-%s-%s-%s-%s-%s-%s-%s-%d",
|
fprintf(installfile, "%s-%s-%s-%s-%s-%s-%s-%s-%s-%s-%s-%s-%s-%s-%d",
|
||||||
INSTALLER_APPLICATION, INSTALLER_VERSION, INSTALLER_TITLE,
|
INSTALLER_APPLICATION, INSTALLER_VERSION, INSTALLER_TITLE,
|
||||||
INSTALLER_PATH, INSTALLER_FOLDER, INSTALLER_PROGRAM,
|
INSTALLER_PATH, INSTALLER_FOLDER, INSTALLER_PROGRAM,
|
||||||
INSTALLER_SHADOW, INSTALLER_OBJECT, INSTALLER_SETS, INSTALLER_SYSVAR,
|
INSTALLER_SHADOW, INSTALLER_OBJECT, INSTALLER_SETS, INSTALLER_SYSVAR,
|
||||||
INSTALLER_SYSLINE, INSTALLER_CONFIRM_WPS, INSTALLER_CONFIRM_CONFIGSYS,
|
INSTALLER_SYSLINE, INSTALLER_CONFIRM_WPS, INSTALLER_CONFIRM_CONFIGSYS,
|
||||||
INSTALLER_CONFIRM_OVERWRITE, INSTALLER_PACKAGE_COUNT);
|
INSTALLER_CONFIRM_OVERWRITE, INSTALLER_PACKAGE_COUNT);
|
||||||
for(z=0;z<INSTALLER_PACKAGE_COUNT;z++)
|
for(z=0;z<INSTALLER_PACKAGE_COUNT;z++)
|
||||||
fprintf(installfile, "-%s", INSTALLER_PACKAGES[z]);
|
fprintf(installfile, "-%s", INSTALLER_PACKAGES[z]);
|
||||||
fwrite("*", 1, 1, installfile);
|
fwrite("*", 1, 1, installfile);
|
||||||
for(z=0;z<INSTALLER_PACKAGE_COUNT;z++)
|
for(z=0;z<INSTALLER_PACKAGE_COUNT;z++)
|
||||||
{
|
{
|
||||||
struct stat blah;
|
struct stat blah;
|
||||||
|
|
||||||
stat(packagefilename[z], &blah);
|
stat(packagefilename[z], &blah);
|
||||||
fprintf(installfile, "DBSOFT-ACE%d%d-%lu*", z, packagefiles[z], blah.st_size);
|
fprintf(installfile, "DBSOFT-ACE%d%d-%lu*", z, packagefiles[z], blah.st_size);
|
||||||
append_file(packagefilename[z]);
|
append_file(packagefilename[z]);
|
||||||
printf("Package: %s - %d files in %s (%lu bytes).\n", INSTALLER_PACKAGES[z], packagefiles[z], packagefilename[z], blah.st_size);
|
printf("Package: %s - %d files in %s (%lu bytes).\n", INSTALLER_PACKAGES[z], packagefiles[z], packagefilename[z], blah.st_size);
|
||||||
}
|
}
|
||||||
fclose(installfile);
|
fclose(installfile);
|
||||||
fclose(cfgfile);
|
fclose(cfgfile);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user