Wing Commander II
Reconstructed Win32 source (1996)
Loading...
Searching...
No Matches
config.c
Go to the documentation of this file.
1/*
2 * Reads the WINGCMDR.CFG installation configuration.
3 *
4 * Retail object 0x401000-0x40111F (link order; see docs/ORDER.md).
5 */
6#include "game.h"
7
8#pragma function(strcpy)
9/* Function start: 0x401000 */
10short LoadWingCmdrCfgFile(short argc, char **argv)
11{
12 FILE *file;
13 char *destination;
14 short argumentIndex;
15 short argumentCount;
16 short result;
17
18 argumentCount = 0;
19 argumentIndex = 1;
20 destination = g_16_szTextBufferBuffer;
21 file = fopen("wc2.cfg", "rb");
22 while (file != 0) {
23 result = (short)fscanf(file, "%s", destination);
24 if (result == -1) {
25 fclose(file);
26 break;
27 }
28 g_pInitialArguments[argumentCount++] =
29 destination;
30 destination = strchr(destination, 0);
31 destination++;
32 }
33
34 while (argc-- != 0) {
35 strcpy(destination, argv[argumentIndex++]);
36 g_pInitialArguments[argumentCount++] = destination;
37 destination = strchr(destination, 0);
38 destination++;
39 }
40 return (short)(argumentCount - 1);
41}
short LoadWingCmdrCfgFile(short argc, char **argv)
Definition config.c:10
Shared Win32 declarations, types and library interfaces.
char * g_pInitialArguments[31]
Definition main.c:2003
char g_16_szTextBufferBuffer[256]
Definition cockpt.c:3793