예제 #1
0
void delete_config()
{
	if ((unlink("gsd.config")) < 0) {
		window_message(MSG_16);
	}
	else {
		window_message(MSG_17);
	}
}
예제 #2
0
int GSDParser(char *tofind, char *buffer)
{
  int res = 0;
  int pos = 0;
  int start_pos;
  for (start_pos = 0; start_pos < strlen(buffer) && pos < strlen(tofind); start_pos++) {
    if (buffer[start_pos] == tofind[pos]) {
      pos++;
    }
    else {
      pos = 0;
    }
  }
  if (pos == strlen(tofind)) {
    res++;
    start_pos++;
    int final_pos = start_pos;
    while (buffer[final_pos+1] != '<' && buffer[final_pos+2] != '/' && final_pos < strlen(buffer)) {
      final_pos++;
    }
    char error_message[final_pos-start_pos];
    for (int i = 0; i < (final_pos-start_pos); i++) {
      error_message[i] = buffer[start_pos+i];
    }
    window_message(error_message);
  }
  return res;
}
예제 #3
0
void make_config()
{
	for (int i = 0; i < 4; i++) {
		char *p = gtk_entry_get_text(entry[i]);
		strcpy(data[i], p);
	}
	int fd;
	creat("gsd.config", 0600);
	if ((fd = open("gsd.config", O_WRONLY)) >= 0) {
		for (int i = 0; i < 3; i++) {
			write(fd, data[i], strlen(data[i]));
			write(fd, "\n", 1);
		}
		close(fd);
		window_message(MSG_13);
	}
	else {
		window_message(MSG_14);
	}
}