comparison plugins/filectl.c @ 10589:0f7452b1f777

[gaim-migrate @ 11994] Use GLib 2.6's gstdio functions. This should fix gaim not liking non-ascii filenames in win32. committer: Tailor Script <tailor@pidgin.im>
author Daniel Atallah <daniel.atallah@gmail.com>
date Fri, 11 Feb 2005 05:10:40 +0000
parents 73d3a64d5574
children 55af3fa46329
comparison
equal deleted inserted replaced
10588:529111933c9c 10589:0f7452b1f777
45 char *command, *arg1, *arg2; 45 char *command, *arg1, *arg2;
46 FILE *file; 46 FILE *file;
47 47
48 sprintf(filename, "%s" G_DIR_SEPARATOR_S "control", gaim_user_dir()); 48 sprintf(filename, "%s" G_DIR_SEPARATOR_S "control", gaim_user_dir());
49 49
50 file = fopen(filename, "r+"); 50 file = g_fopen(filename, "r+");
51 while (fgets(buffer, sizeof(buffer), file)) { 51 while (fgets(buffer, sizeof(buffer), file)) {
52 52
53 /* Read the next command */ 53 /* Read the next command */
54 if (buffer[strlen(buffer) - 1] == '\n') 54 if (buffer[strlen(buffer) - 1] == '\n')
55 buffer[strlen(buffer) - 1] = 0; 55 buffer[strlen(buffer) - 1] = 0;
129 free(command); 129 free(command);
130 } 130 }
131 131
132 fclose(file); 132 fclose(file);
133 133
134 if (stat (filename, &finfo) != 0) 134 if (g_stat(filename, &finfo) != 0)
135 return; 135 return;
136 mtime = finfo.st_mtime; 136 mtime = finfo.st_mtime;
137 } 137 }
138 138
139 /** 139 /**
146 struct stat finfo; 146 struct stat finfo;
147 char filename[256]; 147 char filename[256];
148 148
149 sprintf(filename, "%s" G_DIR_SEPARATOR_S "control", gaim_user_dir()); 149 sprintf(filename, "%s" G_DIR_SEPARATOR_S "control", gaim_user_dir());
150 150
151 if ((stat(filename, &finfo) == 0) && (finfo.st_size > 0)) 151 if ((g_stat(filename, &finfo) == 0) && (finfo.st_size > 0))
152 run_commands(); 152 run_commands();
153 } 153 }
154 154
155 /** 155 /**
156 * Check to see if we need to run commands from the file. 156 * Check to see if we need to run commands from the file.
162 struct stat finfo; 162 struct stat finfo;
163 char filename[256]; 163 char filename[256];
164 164
165 sprintf(filename, "%s" G_DIR_SEPARATOR_S "control", gaim_user_dir()); 165 sprintf(filename, "%s" G_DIR_SEPARATOR_S "control", gaim_user_dir());
166 166
167 if ((stat(filename, &finfo) == 0) && (finfo.st_size > 0)) 167 if ((g_stat(filename, &finfo) == 0) && (finfo.st_size > 0))
168 { 168 {
169 if (mtime != finfo.st_mtime) { 169 if (mtime != finfo.st_mtime) {
170 gaim_debug_info("filectl", "control changed, checking\n"); 170 gaim_debug_info("filectl", "control changed, checking\n");
171 run_commands(); 171 run_commands();
172 } 172 }