diff options
author | LuzZza <LuzZza@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2006-03-01 13:20:49 +0000 |
---|---|---|
committer | LuzZza <LuzZza@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2006-03-01 13:20:49 +0000 |
commit | 01e69083e5081cb6675aae5dfe260c535d8ad45b (patch) | |
tree | 37d7d84c19e5e7452c61fbc7ade58838c6fdf960 /src/login/login.c | |
parent | 723fef12828281ce0031b6e8102a5022a06804e8 (diff) | |
download | hercules-01e69083e5081cb6675aae5dfe260c535d8ad45b.tar.gz hercules-01e69083e5081cb6675aae5dfe260c535d8ad45b.tar.bz2 hercules-01e69083e5081cb6675aae5dfe260c535d8ad45b.tar.xz hercules-01e69083e5081cb6675aae5dfe260c535d8ad45b.zip |
Some small changes in LAN support code.
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@5410 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/login/login.c')
-rw-r--r-- | src/login/login.c | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/src/login/login.c b/src/login/login.c index 4f405449b..a1aabc9e8 100644 --- a/src/login/login.c +++ b/src/login/login.c @@ -2984,17 +2984,16 @@ int parse_admin(int fd) { int lan_subnetcheck(unsigned char *p) {
int i;
- char *sbn, *msk;
+ unsigned char *sbn, *msk;
for(i=0; i<subnet_count; i++) {
- printf("%ld - %ld - %ld", subnet[i].subnet, subnet[i].mask, (long)p);
if((subnet[i].subnet & subnet[i].mask) == ((long)p & subnet[i].mask)) {
sbn = (char *)&subnet[i].subnet;
msk = (char *)&subnet[i].mask;
- ShowMessage("Subnet check result: "CL_CYAN"%d.%d.%d.%d/%d.%d.%d.%d"CL_RESET"\n",
+ ShowMessage("Subnet check result: "CL_CYAN"%u.%u.%u.%u/%u.%u.%u.%u"CL_RESET"\n",
sbn[0], sbn[1], sbn[2], sbn[3], msk[0], msk[1], msk[2], msk[3]);
return subnet[i].char_ip;
@@ -3466,8 +3465,9 @@ int config_switch(const char *str) { int login_lan_config_read(const char *lancfgName) {
FILE *fp;
+ int line_num = 0;
char line[1024], w1[64], w2[64], w3[64], w4[64], w5[64];
-
+
if((fp = fopen(lancfgName, "r")) == NULL) {
ShowWarning("LAN Support configuration file is not found: %s\n", lancfgName);
return 1;
@@ -3477,13 +3477,14 @@ int login_lan_config_read(const char *lancfgName) { while(fgets(line, sizeof(line)-1, fp)) {
- if (line[0] == '/' && line[1] == '/')
+ line_num++;
+ if ((line[0] == '/' && line[1] == '/') || line[0] == '\n' || line[1] == '\n')
continue;
line[sizeof(line)-1] = '\0';
if(sscanf(line,"%[^:]: %[^/]/%[^:]:%[^:]:%[^\r\n]", w1, w2, w3, w4, w5) != 5) {
- ShowWarning("Error syntax of configuration file %s. Line skipped.\n", lancfgName);
+ ShowWarning("Error syntax of configuration file %s in line %d.\n", lancfgName, line_num);
continue;
}
@@ -3510,6 +3511,7 @@ int login_lan_config_read(const char *lancfgName) { return 0;
}
+
//-----------------------------------
// Reading general configuration file
//-----------------------------------
|