comparison plugins/filectl.c @ 179:8d8faeab01f6

[gaim-migrate @ 189] Added a TOC interface plugin. committer: Tailor Script <tailor@pidgin.im>
author Eric Warmenhoven <eric@warmenhoven.org>
date Wed, 26 Apr 2000 02:49:59 +0000
parents e05e6373ea5a
children bb22fb4a7d39
comparison
equal deleted inserted replaced
178:5d62a5d50c89 179:8d8faeab01f6
7 #include <sys/types.h> 7 #include <sys/types.h>
8 #include <sys/stat.h> 8 #include <sys/stat.h>
9 #include <string.h> 9 #include <string.h>
10 #include <ctype.h> 10 #include <ctype.h>
11 11
12 void *handle; 12 static void *handle;
13 int check; 13 static int check;
14 time_t mtime; 14 static time_t mtime;
15 15
16 void init_file(); 16 static void init_file();
17 void check_file(); 17 static void check_file();
18 18
19 extern void dologin(GtkWidget *, GtkWidget *); 19 extern void dologin(GtkWidget *, GtkWidget *);
20 extern void do_quit(); 20 extern void do_quit();
21 21
22 /* parse char * as if were word array */ 22 /* parse char * as if were word array */
34 34
35 file = fopen(filename, "r+"); 35 file = fopen(filename, "r+");
36 while (fgets(buffer, sizeof buffer, file)) { 36 while (fgets(buffer, sizeof buffer, file)) {
37 if (buffer[strlen(buffer) - 1] == '\n') 37 if (buffer[strlen(buffer) - 1] == '\n')
38 buffer[strlen(buffer) - 1] = 0; 38 buffer[strlen(buffer) - 1] = 0;
39 printf("read: %s\n", buffer); 39 sprintf(debug_buff, "read: %s\n", buffer);
40 debug_print(debug_buff);
40 command = getarg(buffer, 0, 0); 41 command = getarg(buffer, 0, 0);
41 if (!strncasecmp(command, "signon", 6)) { 42 if (!strncasecmp(command, "signon", 6)) {
42 if (!blist) { 43 if (!blist) {
43 show_login(); 44 show_login();
44 dologin(NULL, NULL); 45 dologin(NULL, NULL);
114 char file[256]; 115 char file[256];
115 116
116 sprintf(file, "%s/.gaim/control", getenv("HOME")); 117 sprintf(file, "%s/.gaim/control", getenv("HOME"));
117 118
118 if ((stat (file, &finfo) == 0) && (finfo.st_size > 0)) 119 if ((stat (file, &finfo) == 0) && (finfo.st_size > 0))
119 if (mtime != finfo.st_mtime) 120 if (mtime != finfo.st_mtime) {
121 sprintf(debug_buff, "control changed, checking\n");
122 debug_print(debug_buff);
120 run_commands(); 123 run_commands();
124 }
121 } 125 }
122 126
123 char *getarg(char *line, int which, int remain) { 127 char *getarg(char *line, int which, int remain) {
124 char *arr; 128 char *arr;
125 char *val; 129 char *val;