76 |
76 |
77 if (!filename) { |
77 if (!filename) { |
78 // Use default config file locations |
78 // Use default config file locations |
79 char *home = getenv("HOME"); |
79 char *home = getenv("HOME"); |
80 if (!home) { |
80 if (!home) { |
81 ut_WriteLog("Can't find home dir!\n"); |
81 scr_LogPrint(LPRINT_LOG, "Can't find home dir!"); |
82 fprintf(stderr, "Can't find home dir!\n"); |
82 fprintf(stderr, "Can't find home dir!\n"); |
83 return -1; |
83 return -1; |
84 } |
84 } |
85 filename = g_new(char, strlen(home)+24); |
85 filename = g_new(char, strlen(home)+24); |
86 sprintf(filename, "%s/.mcabber/mcabberrc", home); |
86 sprintf(filename, "%s/.mcabber/mcabberrc", home); |
136 if ((strchr(line, '=') != NULL)) { |
136 if ((strchr(line, '=') != NULL)) { |
137 // Only accept the set, alias and bind commands |
137 // Only accept the set, alias and bind commands |
138 if (strncmp(line, "set ", 4) && |
138 if (strncmp(line, "set ", 4) && |
139 strncmp(line, "bind ", 5) && |
139 strncmp(line, "bind ", 5) && |
140 strncmp(line, "alias ", 6)) { |
140 strncmp(line, "alias ", 6)) { |
141 scr_LogPrint("Error in configuration file (l. %d): bad command", ln); |
141 scr_LogPrint(LPRINT_LOGNORM, |
|
142 "Error in configuration file (l. %d): bad command", ln); |
142 err++; |
143 err++; |
143 continue; |
144 continue; |
144 } |
145 } |
145 *(--line) = '/'; // Set the leading '/' to build a command line |
146 *(--line) = '/'; // Set the leading '/' to build a command line |
146 process_command(line); // Process the command |
147 process_command(line); // Process the command |
147 } else { |
148 } else { |
148 scr_LogPrint("Error in configuration file (l. %d): no assignment", ln); |
149 scr_LogPrint(LPRINT_LOGNORM, |
|
150 "Error in configuration file (l. %d): no assignment", ln); |
149 err++; |
151 err++; |
150 } |
152 } |
151 } |
153 } |
152 g_free(buf); |
154 g_free(buf); |
153 fclose(fp); |
155 fclose(fp); |