⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 xrs.in

📁 一套客户/服务器模式的备份系统代码,跨平台,支持linux,AIX, IRIX, FreeBSD, Digital Unix (OSF1), Solaris and HP-UX.
💻 IN
📖 第 1 页 / 共 2 页
字号:
  frame $p.rel -relief sunken -borderwidth 2  label $p.rel.label -text [ T_ "Relocate to directory:" ] -anchor w  entry $p.rel.entry -textvariable relocdir  button $p.rel.button -text [ T_ "Browse" ] -command "file_browse relocdir"  frame $p.par -relief sunken -borderwidth 2  checkbutton $p.par.merge -variable keep_existing  label $p.par.label -text [ T_ "Do not overwrite existing files" ]#  frame $p.case -relief sunken -borderwidth 2#  checkbutton $p.case.ignore -variable ignore_case#  label $p.case.label -text [ T_ "Ignore case in filenames" ]  frame $p.date_a -relief sunken -borderwidth 2  label $p.date_a.label -text [ T_ "After date:" ]  set date_a_w [ GGUI_chooseTimeDateWidget $p.date_a min_a hour_a day_a month_a year_a ]  frame $p.date_b -relief sunken -borderwidth 2  label $p.date_b.label -text [ T_ "Before date:" ]  set date_b_w [ GGUI_chooseTimeDateWidget $p.date_b min_b hour_b day_b month_b year_b ]  frame $p.tapes -relief sunken -borderwidth 2  label $p.tapes.label -text [ T_ "Use Tapes:" ]  entry $p.tapes.entry -textvariable restoretapes  frame $p.detailfmt -relief sunken -borderwidth 2  label $p.detailfmt.label -text [ T_ "Details Format:" ]  entry $p.detailfmt.entry -textvariable detailfmt  frame $p.clcache -relief sunken -borderwidth 2  button $p.clcache.button -text [ T_ "Clear Cache" ] -command { catch { unset dirscache } }  frame $p.cmds -relief sunken -borderwidth 2  button $p.cmds.button -text [ T_ "Done" ] -command "set tkPriv($tkpvar) 1"  button $p.cmds.help -text [ T_ "Help" ] -command help_on_options  bind $p.rel.entry <F1> help_on_relocate  bind $p.rel.entry <F2> help_on_relocate  bind $p.rel.entry <Escape> help_on_relocate  pack $p.rel.label $p.rel.entry -side left -fill both  pack $p.rel.entry -expand 1  pack $p.rel.button -side top -pady 2  pack $p.par.merge $p.par.label -side left -fill both#  pack $p.case.ignore $p.case.label -side left -fill both  pack $p.date_a.label $date_a_w -side left -expand 1 -fill x  pack $p.date_b.label $date_b_w -side left -expand 1 -fill x  pack $p.tapes.label $p.tapes.entry -side left -fill x  pack $p.tapes.entry -expand 1  pack $p.detailfmt.label $p.detailfmt.entry -side left -fill x  pack $p.detailfmt.entry -expand 1  bind $p.tapes.entry <F1> help_on_restoretapes  bind $p.tapes.entry <F2> help_on_restoretapes  bind $p.tapes.entry <Escape> help_on_restoretapes  pack $p.clcache.button -expand 1 -side left  pack $p.cmds.button $p.cmds.help -expand 1 -side left  pack $p.rel $p.par $p.date_a $p.date_b $p.tapes $p.detailfmt $p.clcache $p.cmds -side top -fill x -pady 2 -expand 1}proc flat_text { text } {  set text [ GStr_replSubstring $text "\n" " " ]  return [ GStr_replSubstring $text "\\" "\n" ]}proc what_now { } {  global	genericDialogWidth  set genericDialogWidth 7i  GGUI_genericDialog .help [ T_ "Help on: Restore program" ] [ T_ "The `Subentries' list allows to browse through the index of saved files and directories. Clicking with the left mouse key selects an entry, so it can be copied to the lower list pressing the `Select' key. When entries are selected, details can be listed for them pressing the `Show Details' button. The format string from the Options dialog will be used. Clicking the right mouse button over an item in the `Subentries' list climbs down (or up in case of the item ..) the tree. The character / (slash) at the end of a `Subentries' item indicates, that navigation below this item is possible. Several items in the subentries can be selected.\nAt top level there are two entries: The slash / and a dot . The slash represents the absolute entries in the backup file index, the dot all relative entries (the recommended way). Clicking on items in the list below is useful for deselection pressing the `Delete' button.\nNavigation to a known subentry (i.e. a full path) is possible editing the top entry under `Path' and pressing the Return key. The path, that will prefix the recovered files and directories, can be adjusted changing the relocation directory in the `Options' dialog. A browser can be opened for this purpose.\nPressing `Start Restore' will start the recovery of the items in the lower list. A window displaying the messages of the restore program will pop up.\nSelecting a directory will restore everything below.\nThe Exit button terminates the program.\nA status display on the bottom of the window indicates the progress of index scans etc. Please be patient, scanning the index can be very time consuming, if it is big, and due to the terrible implementation of this program.\nContext sensitive help is available, when F1 is pressed over an item of the dialog, that has the input focus (can be changed using the TAB key)." ] "" 0 OK}proc help_on_path { } {  GGUI_genericDialog .help [ T_ "Help on: Directory index path" ] [ T_ "Here a known directory path can be typed. This speeds up the search in the index, cause fewer entries must be processed and this leads faster to the path, you are interested in. When done entering the path, press the Return key." ] "" 0 OK}proc help_on_subentries { } {  global	genericDialogWidth  set genericDialogWidth 7i  GGUI_genericDialog .help [ T_ "Help on: Subentries" ] [ T_ "This list displays the entries found in the current directory shown in the path entry. These are not the entries currently found in the filesystem, but those stored in the backup and thus present in the file index. One or more entries can be selected using the left mouse key and the Shift or Ctrl key in the usual manner. Pressing the `Select' button below moves them into the list below, that shows the entries selected for restore. Pressing the right mouse key over an item with a trailing slash / will navigate to this entry and show all the subentries i.e. files and subdirectories of this entry. Pressing the right mouse key over .. (which can't be selected for restore) will go up one step in the hierarchy. If you are using this program as normal user (and not as superuser), you will only see the entries, that you own." ] "" 0 OK}proc help_on_selected { } {  global	genericDialogWidth  set genericDialogWidth 5i  GGUI_genericDialog .help [ T_ "Help on: Selected entries" ] [ T_ "This list shows all items selected for restore. If a directory entry with a trailing slash / is selected, everything below this directory will be restored. Items can be moved into this list from the above one selecting them and pressing the `Select' button. Items can be deleted selecting them in this list and pressing the `Delete' button. Pressing `Start Restore' below will initiate the recovery of all selected entries." ] "" 0 OK}proc help_on_options { } {  global	genericDialogWidth  set genericDialogWidth 5i  GGUI_genericDialog .help [ T_ "Help on: Restore Options" ] [ T_ "The relocation directory is the place, where recovered files and directories should be put. The `After Date' specifies a time, that the stored files should have as the earliest modification time stamp. Versions stored earlier are not recovered. For the `Before Date' the inverse criterion applies. Both dates can be given. If the time is not fully specified, 00:00 is assumed. If the year is not given, the current year is used. Day and month must both be present, only one of them is not sufficient, or both may be omitted. In the latter case the year is ignored. If no date is given, the latest version of a file is restored. The `Clear Cache' button clears the index scanning cache. When the Before or After Date are changed, the index cache is quite likely invalid. Pressing this button enforces a rescan. The `Details Format' string will be used when listing file details. For applicable patterns see the section FORMAT STRING in the manual pages of afrestore." ] "" 0 OK}proc help_on_relocate { } {  global	genericDialogWidth  set genericDialogWidth 5i  GGUI_genericDialog .help [ T_ "Help on: Relocation directory" ] [ T_ "This entry shows the directory, where all recovered files are relocated to. The stored path will be appended to the path shown here. The path can be selected using a file browser. To open the browser press the `Browse' button on the right. If this program is run as normal user and the relocation directory is not the one configured in the client side configuration file, the relocation directory must be owned by the user running this program." ] "" 0 OK}proc help_on_restoretapes { } {    global	genericDialogWidth  set genericDialogWidth 5i  GGUI_genericDialog .help [ T_ "Help on: Use Tapes" ] [ T_ "If this entry is not empty and numbers of tapes are supplied using digits, commas and dashes (e.g. 3,6-8,1), only those are used for restore and only files saved on these tapes are displayed in the browse list" ] "" 0 OK}proc file_browse { varname } {  upvar	$varname path  set path [ GGUI_fileSelDialog [ T_ "Select Relocation Directory" ] [ T_ "Set Directory" ] path ]}  proc show_status { text } {  global	statuswidget  $statuswidget configure -text $text  update idletasks}proc select_callback { widget } {  global selected_paths pathentry    set allnsel [ $widget curselection ]  if { ! [ info exists selected_paths ] } {    set selected_paths ""  }  foreach nsel $allnsel {    set sel [ $widget get $nsel ]    if { $sel == ".." || $sel == "" || $sel == "." } {      continue    }    set dirsep [ string first "/" $sel ]#    if { $dirsep >= 0 && $sel != "/" } {#      incr dirsep -1#      set sel [ string range $sel 0 $dirsep ]#    }    set pathlen [ string length $pathentry ]    incr pathlen -1    if { [ string index $pathentry $pathlen ] == "/" || $pathentry == "" } {      set newentry "$pathentry$sel"    } else {      set newentry "$pathentry/$sel"    }    set sidx [ lsearch -exact $selected_paths $newentry ]    if { $sidx < 0 } {      lappend selected_paths $newentry    }  }  set_list .top.sel.list.listbox $selected_paths}proc deselect_callback { widget } {  global selected_paths pathentry    set allnsel [ $widget curselection ]  foreach nsel $allnsel {    set sel [ $widget get $nsel ]    set sidx [ lsearch -exact $selected_paths $sel ]    set selected_paths [ lreplace $selected_paths $sidx $sidx ]  }  set_list .top.sel.list.listbox $selected_paths}proc button3_callback { widget x y } {  global pathentry    set sel [ string trim [ $widget get [ $widget nearest $y ] ] ]  set dirsep [ string first "/" $sel ]  if { $dirsep >= 0 && $sel != "/" } {    incr dirsep -1    set sel [ string range $sel 0 $dirsep ]  }    if { $sel != ".." && $dirsep < 0 && $sel != "." } {    return  }    case $sel in {   "" {      return   }      "/" {    set pathentry "/"        update_list $widget   }      ".." {    if { $pathentry == "/" || $pathentry == ""			|| [ file tail $pathentry ] == $pathentry } {      set pathentry ""            set_list $widget "/ ."    } else {      set pathentry [ file dirname $pathentry ]          update_list $widget    }   }   "." {    set pathentry ""        update_list $widget   }     default {    append_to_path $widget $sel   }  }}proc append_to_path { widget selection } {  global pathentry    set separator "/"  if { $pathentry == "/" || $pathentry == "" } {    set separator ""  }  append pathentry $separator $selection    update_list $widget}proc set_list { widget list } {  $widget delete 0 end    foreach m $list { $widget insert end $m }}proc update_list { widget } {  global pathentry    set matches [ filter_indexfiles $pathentry ]  set matches [ linsert $matches 0 ".." ]    $widget delete 0 end    foreach m $matches { $widget insert end $m }}proc do_restore { widget } {  global	relocdir restoreprog rootdir  global	cmdprefixlast CMDPREFIX  set allsel [ $widget curselection ]  set paths ""  foreach sel [ $widget get 0 end ] {    if { [ string range $sel 0 $cmdprefixlast ] == $CMDPREFIX } {      append paths " -p '$sel'"      continue    }    set plen [ string length $sel ]    incr plen -1    if { [ string range $sel $plen $plen ] == "/" } {      incr plen -1      append paths " -p '$sel*' -p '" [ string range $sel 0 $plen ] "'"    } else {      append paths " -p '$sel'"    }  }  if { [ llength $paths ] < 1 } {    GGUI_errorDialog [ T_ "Nothing has been selected." ]    return  }  set rootdir [ GFile_cleanPath $rootdir ]  set relocdir [ GFile_cleanPath $relocdir ]  if { $relocdir == "" } {    set relocdir $rootdir  }  set restore_opts [ restore_all_opts shell ]  if { ! [ file exists $relocdir ] } {    GGUI_warningDialog [ format [ T_ "The relocation directory `%s' does not exist." ] $relocdir ]  }  set restorecmd {/bin/sh -c "echo '>>> Restore command:'; echo }  append restorecmd "$restoreprog $restore_opts $paths"  append restorecmd {; echo ' '; echo '*** Restore program starting ***';}  append restorecmd { echo ' '; }  append restorecmd "echo n | $restoreprog $restore_opts $paths 2>&1;"  append restorecmd { echo ' '; echo '*** Restore program finished ***'"}  GGUI_runCommand Restore [ GStr_replSubstring $restorecmd "\\" "\\\\" ]}proc restore_all_opts { mode } {  global	keep_existing ignore_case restoretapes  set all_opts "[ restore_reloc_opt $mode ] [ restore_date_opt $mode ]"  if { $keep_existing } {    append all_opts " -m"  }  if { $ignore_case } {    append all_opts " -i"  }  if { [ llength $restoretapes ] > 0 } {    set all_opts " -T '$restoretapes'"  }  return $all_opts}proc restore_reloc_opt { mode } {  global	relocdir rootdir  set relocopt ""  if { $relocdir != $rootdir } {    set relocopt "-C $relocdir"  }  return $relocopt}proc restore_date_opt { mode } {  set opt ""  set a [ after_date ]  set b [ before_date ]  if { $a != "" } {    case $mode in {      shell {	append opt " -A '$a'"      }      open {	append opt " -A {$a}"      }      default {	GGUI_errorDialog [ format [ T_ "Unknown mode: %s, internal error. Please report." ] $mode ]      }    }  }  if { $b != "" } {    case $mode in {      shell {	append opt " -B '$b'"      }      open {	append opt " -B {$b}"      }    }  }  return $opt}proc after_date { } {  global	hour_a min_a day_a month_a year_a  return [ construct_date_spec $min_a $hour_a $day_a $month_a $year_a ]}proc before_date { } {  global	hour_b min_b day_b month_b year_b  return [ construct_date_spec $min_b $hour_b $day_b $month_b $year_b ]}proc construct_date_spec { m h D M Y } {  set date ""  if { $D != "" && $M != "" } {    append date " [ GDate_getMonthname $M ] $D"    if { $Y != "" } {      append date " $Y"    }  }  if { $m != "" && $h != "" } {    append date " $h:$m"  }  return [ string trim $date ]}set relocdir "/"set pathentry ""set initlist "/ ."set keep_existing 0set ignore_case 0set restoretapes ""set detailfmt [ T_ "\\n%n\\nOwner:         %O\\nLast Modified: %M\\nBackup Time:   %T\\n" ]if { [ info exists env(HOME) ] } {  file stat $env(HOME) hstat  if { $hstat(uid) } {    set hdir [ GFile_resolvePath__ $env(HOME) ]    set alldirstobu ""    if { $numparts == 1 } {      eval lappend alldirstobu $dirstobackup    } else {      for { set i 1 } { $i <= $numparts } { incr i } {	eval lappend alldirstobu $dirstobackup($i)      }    }    foreach d $alldirstobu {      if { [ string range $d 0 0 ] == "/" } {	if { [ string match [ GFile_cleanPath "$d*" ] $hdir ] } {	  set pathentry [ file dirname $hdir ]	  set list [ file tail $hdir ]	  break	}      } else {	if { [ string match [ GFile_cleanPath "$rootdir/$d*" ] $hdir ] } {	  set rdir [ GFile_cleanPath $rootdir ]	  set plen [ string length $rdir ]	  set relhdir [ string range $hdir $plen end ]	  while { [ string range $relhdir 0 0 ] == "/" } {	    set relhdir [ string range $relhdir 1 end ]	  }	  set pathentry [ file dirname $relhdir ]	  set list [ file tail $relhdir ]	  break	}      }    }    if { [ info exists list ] } {      set initlist ".. $list/"    }  }}foreach var "hour_a min_a day_a month_a year_a hour_b min_b day_b month_b year_b" {  set $var ""}set entrywidth 60show_win

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -