| 2918 |
void FAR PASCAL CopySerialList(PCHAR IniSrc, PCHAR IniDest, PCHAR section, |
void FAR PASCAL CopySerialList(PCHAR IniSrc, PCHAR IniDest, PCHAR section, |
| 2919 |
PCHAR key, int MaxList) |
PCHAR key, int MaxList) |
| 2920 |
{ |
{ |
| 2921 |
int i; |
int i, j; |
| 2922 |
char EntName[10]; |
char EntName[10], EntName2[10]; |
| 2923 |
char TempHost[HostNameMaxLength + 1]; |
char TempHost[HostNameMaxLength + 1]; |
| 2924 |
|
|
| 2925 |
if (_stricmp(IniSrc, IniDest) == 0) |
if (_stricmp(IniSrc, IniDest) == 0) |
| 2927 |
|
|
| 2928 |
WritePrivateProfileString(section, NULL, NULL, IniDest); |
WritePrivateProfileString(section, NULL, NULL, IniDest); |
| 2929 |
|
|
| 2930 |
i = 1; |
i = j = 1; |
| 2931 |
do { |
do { |
| 2932 |
_snprintf_s(EntName, sizeof(EntName), _TRUNCATE, "%s%i", key, i); |
_snprintf_s(EntName, sizeof(EntName), _TRUNCATE, "%s%i", key, i); |
| 2933 |
|
_snprintf_s(EntName2, sizeof(EntName2), _TRUNCATE, "%s%i", key, j); |
| 2934 |
|
|
| 2935 |
/* Get one hostname from file IniSrc */ |
/* Get one hostname from file IniSrc */ |
| 2936 |
GetPrivateProfileString(section, EntName, "", |
GetPrivateProfileString(section, EntName, "", |
| 2937 |
TempHost, sizeof(TempHost), IniSrc); |
TempHost, sizeof(TempHost), IniSrc); |
| 2938 |
/* Copy it to the file IniDest */ |
/* Copy it to the file IniDest */ |
| 2939 |
if (strlen(TempHost) > 0) |
if (strlen(TempHost) > 0) { |
| 2940 |
WritePrivateProfileString(section, EntName, TempHost, IniDest); |
WritePrivateProfileString(section, EntName2, TempHost, IniDest); |
| 2941 |
|
j++; |
| 2942 |
|
} |
| 2943 |
i++; |
i++; |
| 2944 |
} |
} |
| 2945 |
while ((i <= MaxList) && (strlen(TempHost) > 0)); |
while (i <= MaxList); |
| 2946 |
|
|
| 2947 |
/* update file */ |
/* update file */ |
| 2948 |
WritePrivateProfileString(NULL, NULL, NULL, IniDest); |
WritePrivateProfileString(NULL, NULL, NULL, IniDest); |
| 2980 |
if (i == 1) |
if (i == 1) |
| 2981 |
Update = FALSE; |
Update = FALSE; |
| 2982 |
} |
} |
| 2983 |
else |
else if (Len > 0) { |
| 2984 |
j = j + Len + 1; |
j = j + Len + 1; |
| 2985 |
|
} |
| 2986 |
i++; |
i++; |
| 2987 |
} while ((i <= MaxList) && (Len != 0) && Update); |
} while ((i <= MaxList) && Update); |
| 2988 |
|
|
| 2989 |
if (Update) { |
if (Update) { |
| 2990 |
WritePrivateProfileString(section, NULL, NULL, FName); |
WritePrivateProfileString(section, NULL, NULL, FName); |