94 lines
5.4 KiB
Plaintext
94 lines
5.4 KiB
Plaintext
$OpenBSD: patch-main_cc,v 1.4 2004/01/08 07:36:54 wilfried Exp $
|
|
--- main.cc.orig 2001-04-11 21:12:20.000000000 +0200
|
|
+++ main.cc 2004-01-05 19:13:31.000000000 +0100
|
|
@@ -15,10 +15,12 @@
|
|
#define koliko 1
|
|
#endif
|
|
#include <sys/stat.h>
|
|
+#include <FL/filename.H>
|
|
+#include <strstream>
|
|
extern "C" {
|
|
char *intern_filename(char *,const char *); extern char *home_dir;
|
|
char *fn_format(char *to,const char *name,const char *dsk,const char *form,int flag);
|
|
- void load_defaults(const char *conf_file, const char **groups, int *argc, char ***argv);
|
|
+ int load_defaults(const char *conf_file, const char **groups, int *argc, char ***argv);
|
|
void free_defaults(char **argv);
|
|
void mysql_read_default_options(struct st_mysql_options *options, const char *filename,const char *group);
|
|
int strcasecmp(const char *,const char *);
|
|
@@ -134,7 +136,7 @@ static void recurse (string &s, Fl_Menu_
|
|
path += (string)de->d_name;
|
|
if ( !stat ( path.c_str(), &sb ) ) {
|
|
if (sb.st_mode & S_IRUSR){
|
|
- if ((filename_isdir(path.c_str()) && ( sb.st_mode & S_IXUSR)) || (!strcmp(filename_ext(path.c_str()),".sql")))
|
|
+ if ((fl_filename_isdir(path.c_str()) && ( sb.st_mode & S_IXUSR)) || (!strcmp(fl_filename_ext(path.c_str()),".sql")))
|
|
total_menu_length++;
|
|
}
|
|
}
|
|
@@ -148,7 +150,7 @@ static void recurse (string &s, Fl_Menu_
|
|
if (((string)de->d_name == (string)".") || ((string)de->d_name == (string)"..")) continue;
|
|
path+=de->d_name;
|
|
if ( !stat ( path.c_str(), &sb ) ) {
|
|
- if (filename_isdir(path.c_str()) && ( sb.st_mode & S_IXUSR)) {
|
|
+ if (fl_filename_isdir(path.c_str()) && ( sb.st_mode & S_IXUSR)) {
|
|
Fl_Menu_Item *xx=(Fl_Menu_Item *)0;
|
|
recurse(path,&xx);
|
|
stringovi.insert(stringovi.end(),path);
|
|
@@ -156,7 +158,7 @@ static void recurse (string &s, Fl_Menu_
|
|
xx = new Fl_Menu_Item[2]; memset (xx,0,sizeof(Fl_Menu_Item)*2); xx[0].text = "empty"; xx[1].text=NULL;
|
|
}
|
|
stringovi.insert(stringovi.end(),(string) de->d_name); (*ord_menu)[i].text =stringovi[stringovi.size()-1].c_str(); (*ord_menu)[i].flags = FL_MENU_DIVIDER | FL_SUBMENU_POINTER; (*ord_menu)[i].user_data_=(void *)xx; i++;
|
|
- } else if ((sb.st_mode & S_IRUSR) && (!strcmp(filename_ext(path.c_str()),".sql"))) {
|
|
+ } else if ((sb.st_mode & S_IRUSR) && (!strcmp(fl_filename_ext(path.c_str()),".sql"))) {
|
|
#ifdef _WIN32
|
|
FILE *fd = fopen(path.c_str(),"r");
|
|
if (fd) {
|
|
@@ -461,7 +463,7 @@ void if_disconn (void) {
|
|
}
|
|
|
|
static void if_conn (void) {
|
|
- unsigned int j = 0, counter = 0; c_info=con->clinet_info(); s_info=con->server_info();
|
|
+ unsigned int j = 0, counter = 0; c_info=con->client_info(); s_info=con->server_info();
|
|
try {
|
|
Query query = con->query(); if (ldb) {ddd=(string)ldb; ldb=(char*)ddd.c_str();}
|
|
query << "show databases";
|
|
@@ -526,7 +528,7 @@ static void if_conn (void) {
|
|
tables.insert(tables.end(),xx);
|
|
}
|
|
qSortHelp (0, (size_t) tables.size(), Fcmp, Exchange);
|
|
- ldb = (char *)databases[j].c_str(); c_info=con->clinet_info(); s_info=con->server_info();
|
|
+ ldb = (char *)databases[j].c_str(); c_info=con->client_info(); s_info=con->server_info();
|
|
b_connect->set(); down_group->activate(); query_browser->activate();
|
|
if (databases.size()) choice_db->activate(); choice_db->redraw();
|
|
; if (query_menus) hier->activate();
|
|
@@ -722,8 +724,8 @@ void insert_command (Fl_Widget *w, void
|
|
void save_query(Fl_Button *ssw,void *ssp) {
|
|
char Ime[256]; Ime[0]=0;
|
|
int i = fl_file_dialog("Save Query",Ime,Fl_File_Dialog::SAVEMODE | Fl_File_Dialog::MESSAGES,0,0); if (!i) { s_fl_message("You gave up!"); return;} Trim(Ime);
|
|
- if (!Ime[0] || filename_isdir(Ime)) {s_fl_alert("You have to supply file name !!!!!!!\n"); return;}
|
|
- if (strcmp(filename_ext(Ime),".sql")) filename_setext(Ime,".sql");
|
|
+ if (!Ime[0] || fl_filename_isdir(Ime)) {s_fl_alert("You have to supply file name !!!!!!!\n"); return;}
|
|
+ if (strcmp(fl_filename_ext(Ime),".sql")) fl_filename_setext(Ime,".sql");
|
|
string dir(Ime), query(sql_command->value()); strip(query); strip(dir);
|
|
if (!query.length()) {s_fl_alert("We do not save empty queries !!!!!!!\n"); return;}
|
|
#ifdef _WIN32
|
|
@@ -884,7 +886,9 @@ void get_results(Fl_Button *, void *) {
|
|
if ((con->errnum() && (con->errnum()!=1065))) {
|
|
s_fl_alert(er.error.c_str()); s_fl_alert("\n");
|
|
if ((kuda != TO_COUNT) && (con->errnum() == 1064)) {
|
|
- string str = er.error.erase(0,er.error.find("\'")+1); str = str.erase(str.find("\'"),-1);
|
|
+ string str(er.error);
|
|
+ str.erase(0, str.find("\'")+1);
|
|
+ str.erase(str.find("\'"));
|
|
int ii = real_sql.find(str); offset = 0;
|
|
if (ii != -1) {
|
|
if (total_value_size && total_var_size) {
|
|
@@ -921,7 +925,7 @@ void get_results(Fl_Button *, void *) {
|
|
case TO_SCREEN: if (commands29->value()) editing_stuff(real_sql.c_str()); else do_sql(); s_fl_message(con->info().c_str()); s_fl_message("\n"); break;
|
|
case TO_FILE: {i = fl_file_dialog("Save Results",file_name,Fl_File_Dialog::APPEND | Fl_File_Dialog::SAVEMODE | Fl_File_Dialog::MESSAGES,0,0); if (!file_name[0] || !i) break;
|
|
how_to_open=(i>1000) ? ios::app : ios::trunc;
|
|
- if (strcmp(filename_ext(file_name),".res")) filename_setext(file_name,".res");
|
|
+ if (strcmp(fl_filename_ext(file_name),".res")) fl_filename_setext(file_name,".res");
|
|
Fl_Cursor cursor = Fl_Cursor(FL_CURSOR_WAIT); fl_cursor(cursor); do_save_file(real_sql); cursor = Fl_Cursor(FL_CURSOR_DEFAULT); fl_cursor(cursor);
|
|
s_fl_message(con->info().c_str()); } break;
|
|
case TO_COUNT: s_fl_message("Number of rows = %s",counts.c_str()); break;
|