int TextInput( int x, int y, const char *prompt, int maxlen, int fieldlen, char *strres, void (*handlekey)( int key, VString &s, int &pos ) ) { VString str = strres; int res = TextInput( x, y, prompt, maxlen, fieldlen, &str, handlekey ); strcpy( strres, str.data() ); return res; }
void vfu_edit_conf_file() { if (opt.internal_editor) { opt.seo.cs = cINFO; SeeEditor editor( &opt.seo ); if( editor.open( filename_conf ) == 0 ) { int r = 1; while ( r ) { editor.run(); r = editor.request_quit(); } } else say1( "Error loading file..." ); editor.close(); } else { VString line = shell_editor; str_replace( line, "%f", filename_conf ); str_replace( line, "%F", filename_conf ); vfu_shell( line.data(), 0 ); } vfu_settings_save(); vfu_settings_load(); do_draw = 2; say1(""); say2(""); }
void printBinaryHll(ServerInterface& srvInterface, const char* prefix, const VString& hll) { return; unsigned int i; char buf_str[10000]; char* buf_ptr = buf_str; if (!hll.isNull()) { for (i = 0; i < hll.length(); i++) { buf_ptr += sprintf(buf_ptr, "%02X ", hll.data()[i]); } } *(buf_ptr + 1) = '\0'; srvInterface.log("%s: %d %s", prefix, hll.length(), buf_str); }
void vfu_extract_files( int one ) { if ( sel_count == 0 && one == 0 ) one = 1; char t[MAX_PATH]; VString target; if ( one == 0 ) sprintf( t, "EXTRACT SELECTION to: " ); else sprintf( t, "EXTRACT `%s' to:", files_list[FLI]->full_name() ); target = opt.last_copy_path[ CM_COPY ]; if ( !vfu_get_dir_name( t, target ) ) return; strcpy( opt.last_copy_path[ CM_COPY ], target ); VArray va; int z; for( z = 0; z < files_count; z++ ) if ((files_list[z]->sel && one == 0) || (z == FLI && one != 0)) va.push( files_list[z]->full_name() ); if (chdir(target)) { sprintf( t, "Cannot chdir to: %s", target.data() ); say1( t ); say2errno(); return; } VString tmpfile = vfu_temp(); if (va.fsave( tmpfile )) { sprintf( t, "Error writing list file: %s", tmpfile.data() ); say1( t ); return; } chmod( tmpfile, S_IRUSR|S_IWUSR ); VString s; s = "rx_auto x \""; s += work_path; s += archive_name; s += "\" @"; s += tmpfile; s += " 2> /dev/null"; vfu_shell( s, "" ); if (unlink( tmpfile )) { /* sprintf( t, "Cannot unlink/erase temp file: %s", tmpfile ); say2( t ); */ } if (chdir(work_path)) { sprintf( t, "Cannot chdir back to to: %s", work_path.data() ); say1( t ); say2errno(); return; } say1( "EXTRACT ok." ); };
void addItemToHll(void* hll, const VString& item) { SerializedHyperLogLog* phll = (SerializedHyperLogLog*)hll; phll->add(item.data(), item.length()); }
void updateStringFromHll(VString& str, SerializedHyperLogLog* hll) { char* cstr = hll->toString(str.data()); str.copy(cstr, 9 + hll->registerSize()); // size of prefix + size of binary array. prefix is %d|%d|bin_ }
void SimpleHllAggregateFunctionBase::addItem(ServerInterface &srvInterface, void* hll, const VString& item) { HllHolder* phll = (HllHolder*)hll; if (phll->hll == NULL) phll->hll = (SerializedHyperLogLog*)createNewHll(); phll->hll->add(item.data(), item.length()); }
void vfu_chdir( const char *a_new_dir ) { char t[MAX_PATH]; VString target; if ( a_new_dir && a_new_dir[0] ) { target = a_new_dir; str_fix_path( target ); } else { target = vfu_hist_get( HID_CHDIR, 0 ); if (!vfu_get_dir_name( "ChDir to? (TAB, PageUp, PageDown, ^X, ^A)", target, 0 )) return; /* get_dir_name canceled */ } /* get_dir_name confirmed */ /* if ( work_path[0] != target[0] && DirTreeChanged && opt.AutoTree ) SaveTree(); */ if ( work_mode == WM_ARCHIVE ) { archive_name = ""; archive_path = ""; } vfu_hist_add( HID_CHDIR, work_path ); char ch = work_path[0]; if (opt.tree_cd) if (!dir_exist( target )) { int z = 0; if ( dir_tree.count() == 0 ) tree_load(); mb.undef(); z = tree_find( target, &mb ); if (z > 1) { z = vfu_menu_box( 10, 5, "Change dir to..." ); if (z > -1) target = mb.get(z); else return; } else if (z == 1) target = mb.get(0); } VString str = target; str_cut_spc( str ); #ifdef _TARGET_GO32_ if ( str[0] == '/' ) { str_ins_ch( str, 0, ':' ); str_ins_ch( str, 0, work_path[0] ); } else if ( str[1] == ':' && str[2] == 0 ) /* c: d: e: */ { expand_path( str, t ); str = t; } if ( str[1] == ':' && str[2] == '/' ) #else /* _TARGET_GO32_ -> i.e. _TARGET_UNIX_ here*/ if (str[0] == '/') #endif /* _TARGET_GO32_ */ { /* root directory */ target = str; } else { str = work_path + str; str_fix_path( str ); target = str_reduce_path( str ); } if (chdir( target ) != 0) { sprintf( t, "chdir: %s", target.data() ); say1( t ); say2errno(); return; } else { work_path = target; if ( work_mode == WM_ARCHIVE ) work_mode = WM_NORMAL; } if ( ch != work_path[0] ) tree_drop(); /* drop tree--it is for another drive*/ vfu_read_files(); }