mldonkey-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Mldonkey-commits] mldonkey distrib/ChangeLog src/daemon/common/co...


From: mldonkey-commits
Subject: [Mldonkey-commits] mldonkey distrib/ChangeLog src/daemon/common/co...
Date: Wed, 28 Dec 2005 10:36:26 +0000

CVSROOT:        /sources/mldonkey
Module name:    mldonkey
Branch:         
Changes by:     spiralvoice <address@hidden>    05/12/28 10:36:26

Modified files:
        distrib        : ChangeLog 
        src/daemon/common: commonComplexOptions.ml 
                           commonComplexOptions.mli commonMessages.ml 
        src/daemon/driver: driverCommands.ml 

Log message:
        patch #4736

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/mldonkey/mldonkey/distrib/ChangeLog.diff?tr1=1.635&tr2=1.636&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/mldonkey/mldonkey/src/daemon/common/commonComplexOptions.ml.diff?tr1=1.41&tr2=1.42&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/mldonkey/mldonkey/src/daemon/common/commonComplexOptions.mli.diff?tr1=1.13&tr2=1.14&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/mldonkey/mldonkey/src/daemon/common/commonMessages.ml.diff?tr1=1.45&tr2=1.46&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/mldonkey/mldonkey/src/daemon/driver/driverCommands.ml.diff?tr1=1.106&tr2=1.107&r1=text&r2=text

Patches:
Index: mldonkey/distrib/ChangeLog
diff -u mldonkey/distrib/ChangeLog:1.635 mldonkey/distrib/ChangeLog:1.636
--- mldonkey/distrib/ChangeLog:1.635    Wed Dec 28 10:32:31 2005
+++ mldonkey/distrib/ChangeLog  Wed Dec 28 10:36:26 2005
@@ -12,6 +12,14 @@
 http://mldonkey.berlios.de/modules.php?name=Wiki&pagename=Windows
 
 2005/12/28
+4736: New commands: sysinfo, runinfo and diskinfo
+* removed temp_directory and core_directory from shares command output
+* new commands sysinfo, runinfo and diskinfo
+* buildinfo now prints only buildinfo
+* runinfo prints run-time information
+* new command diskinfo prints filesystem data about temp_directory,
+  core_directory and all shared dirs
+* sysinfo prints buildinfo, runinfo and diskinfo alltogether
 4712: Change terminal color for downloading files from blue to cyan (romildo)
 
 2005/12/24
Index: mldonkey/src/daemon/common/commonComplexOptions.ml
diff -u mldonkey/src/daemon/common/commonComplexOptions.ml:1.41 
mldonkey/src/daemon/common/commonComplexOptions.ml:1.42
--- mldonkey/src/daemon/common/commonComplexOptions.ml:1.41     Sun Dec 18 
14:50:38 2005
+++ mldonkey/src/daemon/common/commonComplexOptions.ml  Wed Dec 28 10:36:26 2005
@@ -1089,7 +1089,8 @@
   end;
   lprintf_nl () "Options backup as %s correctly saved" format
              
-let buildinfo () =
+let buildinfo o buf =
+  let s =
   (
         "MLNet Multi-Network p2p client version " ^ Autoconf.current_version
       ^ (if Autoconf.scm_version <> "" then "\nSCM version info: " ^ 
Autoconf.scm_version else "")
@@ -1137,8 +1138,22 @@
           ^ (if Autoconf.has_iconv then " iconv" else " no-iconv")
           ^ (if Autoconf.check_bounds then " check-bounds" else " 
no-check-bounds")
   )
+  in
+  if o.conn_output = HTML then
+    begin
+      Printf.bprintf buf "\\<div class=\\\"cs\\\"\\>";
+      html_mods_table_header buf "versionTable" "results" [];
+      Printf.bprintf buf "\\<tr\\>";
+      html_mods_td buf [ ("", "srh", "Buildinfo"); ];
+      Printf.bprintf buf "\\</tr\\>\\<tr class=\\\"dl-1\\\"\\>";
+      html_mods_td buf [ ("", "sr", Str.global_replace (Str.regexp "\n") 
"\\<br\\>" s); ];
+      Printf.bprintf buf "\\</tr\\>\\</table\\>\\</div\\>\\</div\\>";
+    end
+  else
+    Printf.bprintf buf "Buildinfo:\n%s\n" s
   
-let runinfo () =
+let runinfo o buf =
+  let s =
   (
         "Enabled Networks: " 
       ^   (if Autoconf.donkey = "yes" && !!enable_donkey then " Donkey" else 
"")
@@ -1166,4 +1181,92 @@
             |  _ -> Printf.sprintf "2^%d-1 bits (do the maths ;-p)" 
((Unix2.c_sizeofoff_t () *8)-1)
             )
   )    
-  
\ No newline at end of file
+  in
+  if o.conn_output = HTML then
+    begin
+      Printf.bprintf buf "\\<div class=\\\"cs\\\"\\>";
+      html_mods_table_header buf "versionTable" "results" [];
+      Printf.bprintf buf "\\<tr\\>";
+      html_mods_td buf [ ("", "srh", "Runinfo"); ];
+      Printf.bprintf buf "\\</tr\\>\\<tr class=\\\"dl-1\\\"\\>";
+      html_mods_td buf [ ("", "sr", Str.global_replace (Str.regexp "\n") 
"\\<br\\>" s); ];
+      Printf.bprintf buf "\\</tr\\>\\</table\\>\\</div\\>\\</div\\>";
+    end
+  else
+    Printf.bprintf buf "Runinfo:\n%s\n" s
+
+let diskinfo o buf =
+  let list = ref [] in
+  ignore (search_incoming_files ());
+  ignore (search_incoming_directories ());
+  List.iter (fun dir ->
+     list := (dir.shdir_dirname, (Printf.sprintf "shared (%s)" 
dir.shdir_strategy))
+     :: !list) !!shared_directories;
+  list := (!!temp_directory, "temp/downloading") :: !list;
+  list := (Sys.getcwd (), "core/ini files") :: !list;
+
+  let len_dir = ref 9 in
+  let len_strategy = ref 29 in (* "shared (incoming_directories)" *)
+  List.iter ( fun (dir, strategy) ->
+    len_dir := maxi !len_dir (String.length dir);
+    len_strategy := maxi !len_strategy (String.length strategy)
+  ) !list;
+  let fill_dir = String.make (!len_dir - 9) ' ' in
+  let fill_dir_line = String.make (!len_dir - 9) '-' in
+  let fill_strategy = String.make (!len_strategy - 4) ' ' in
+  let fill_strategy_line = String.make (!len_strategy - 4) '-' in
+  let counter = ref 0 in
+  if o.conn_output = HTML then
+      html_mods_table_header buf "sharesTable" "shares" [
+       ( "0", "srh", "Directory", "Directory" ) ;
+       ( "0", "srh", "Directory type", "Type" ) ;
+       ( "1", "srh ar", "HDD used", "used" ) ;
+       ( "1", "srh ar", "HDD free", "free" ) ;
+       ( "1", "srh ar", "% free", "% free" ) ;
+       ( "0", "srh", "Filesystem", "FS" ) ]
+  else
+    begin
+      Printf.bprintf buf "Diskinfo:\n";
+      Printf.bprintf buf "Directory%s|Type%s|    used|    
free|%%free|Filesystem\n"
+        fill_dir fill_strategy;
+      Printf.bprintf buf 
"---------%s+----%s+--------+--------+-----+----------\n"
+        fill_dir_line fill_strategy_line;
+    end;
+  List.iter (fun (dir, strategy) ->
+       incr counter;
+       let diskused =
+         match Unix32.diskused dir with
+         | None -> Printf.sprintf "---"
+         | Some du -> size_of_int64 du
+       in
+       let diskfree =
+         match Unix32.diskfree dir with
+         | None -> Printf.sprintf "---"
+         | Some df -> size_of_int64 df
+       in
+       let percentfree =
+         match Unix32.percentfree dir with
+         | None -> Printf.sprintf "---"
+         | Some p -> Printf.sprintf "%d%%" p
+       in
+       let filesystem = Unix32.filesystem dir in
+       if o.conn_output = HTML then
+         begin
+           Printf.bprintf buf "\\<tr class=\\\"%s\\\"\\>
+       \\<td class=\\\"sr\\\"\\>%s\\</td\\>
+       \\<td class=\\\"sr\\\"\\>%s\\</td\\>
+       \\<td class=\\\"sr ar\\\"\\>%s\\</td\\>
+       \\<td class=\\\"sr ar\\\"\\>%s\\</td\\>
+       \\<td class=\\\"sr ar\\\"\\>%s\\</td\\>
+       \\<td class=\\\"sr\\\"\\>%s\\</td\\>\\</tr\\>"
+           (if !counter mod 2 == 0 then "dl-1" else "dl-2")
+           dir strategy diskused diskfree percentfree filesystem
+         end
+       else
+         Printf.bprintf buf "%-*s|%-*s|%8s|%8s|%5s|%-s\n"
+           (maxi !len_dir (!len_dir - String.length dir)) dir
+           (maxi !len_strategy (!len_strategy - String.length strategy)) 
strategy
+           diskused diskfree percentfree filesystem
+       ) !list;
+  if o.conn_output = HTML then
+    Printf.bprintf buf "\\</table\\>\\</td\\>\\<tr\\>\\</table\\>\\</div\\>"
Index: mldonkey/src/daemon/common/commonComplexOptions.mli
diff -u mldonkey/src/daemon/common/commonComplexOptions.mli:1.13 
mldonkey/src/daemon/common/commonComplexOptions.mli:1.14
--- mldonkey/src/daemon/common/commonComplexOptions.mli:1.13    Sat Nov 12 
20:07:01 2005
+++ mldonkey/src/daemon/common/commonComplexOptions.mli Wed Dec 28 10:36:26 2005
@@ -21,8 +21,9 @@
 val save : unit -> unit
 val save_sources : unit -> unit
 val backup_options : unit -> unit
-val buildinfo : unit -> string
-val runinfo : unit -> string
+val buildinfo : CommonTypes.ui_conn -> Buffer.t -> unit
+val runinfo : CommonTypes.ui_conn -> Buffer.t -> unit
+val diskinfo : CommonTypes.ui_conn -> Buffer.t -> unit
   
 val done_files :  CommonTypes.file list Options.option_record
 val files :  CommonTypes.file list Options.option_record
Index: mldonkey/src/daemon/common/commonMessages.ml
diff -u mldonkey/src/daemon/common/commonMessages.ml:1.45 
mldonkey/src/daemon/common/commonMessages.ml:1.46
--- mldonkey/src/daemon/common/commonMessages.ml:1.45   Tue Dec  6 19:34:04 2005
+++ mldonkey/src/daemon/common/commonMessages.ml        Wed Dec 28 10:36:26 2005
@@ -666,9 +666,9 @@
 <TD class=\"bu bbig\" title=\"Network listing\"
 onMouseOver=\"mOvr(this,'mOvr1');\" onMouseOut=\"mOut(this);\"
 onClick=\"mSub('output','networks')\">Networks</TD>
-<TD class=\"bu bbig\" title=\"Buildinfo\"
+<TD class=\"bu bbig\" title=\"Sysinfo\"
 onMouseOver=\"mOvr(this,'mOvr1');\" onMouseOut=\"mOut(this);\"
-onClick=\"mSub('output','buildinfo')\">Buildinfo</TD>
+onClick=\"mSub('output','sysinfo')\">Sysinfo</TD>
 <TD class=\"bu bbig\" title=\"View ChangeLog\"
 onMouseOver=\"mOvr(this,'mOvr1');\" onMouseOut=\"mOut(this);\"
 
onClick=\"top.output.location.href='http://savannah.nongnu.org/cgi-bin/viewcvs/mldonkey/mldonkey/distrib/ChangeLog?rev=HEAD&amp;content-type=text/vnd.viewcvs-markup'\">ChangeLog</TD>
Index: mldonkey/src/daemon/driver/driverCommands.ml
diff -u mldonkey/src/daemon/driver/driverCommands.ml:1.106 
mldonkey/src/daemon/driver/driverCommands.ml:1.107
--- mldonkey/src/daemon/driver/driverCommands.ml:1.106  Fri Dec 16 20:57:57 2005
+++ mldonkey/src/daemon/driver/driverCommands.ml        Wed Dec 28 10:36:26 2005
@@ -21,7 +21,6 @@
 open Printf2
 open Md4
 open Options
-open Options
 open BasicSocket
 open TcpBufferedSocket
 open Ip_set
@@ -450,28 +449,31 @@
         ""
     ), ":\t\t\t\tcore uptime";
 
+    "sysinfo", Arg_none (fun o ->
+       let buf = o.conn_buf in
+        let buildinfo = CommonComplexOptions.buildinfo o buf in
+        let runinfo = CommonComplexOptions.runinfo o buf in
+        let diskinfo = CommonComplexOptions.diskinfo o buf in
+        ""
+    ), ":\t\t\t\tprint mldonkey core build, runtime and disk information";
+
     "buildinfo", Arg_none (fun o ->
-        let buf = o.conn_buf in
-        let runinfo = CommonComplexOptions.runinfo () in
-        let buildinfo = CommonComplexOptions.buildinfo () in
-        if o.conn_output = HTML then
-          begin
-            Printf.bprintf buf "\\<div class=\\\"cs\\\"\\>";
-            html_mods_table_header buf "versionTable" "results" [];
-            Printf.bprintf buf "\\<tr\\>";
-            html_mods_td buf [ ("", "srh", "Buildinfo"); ];
-            Printf.bprintf buf "\\</tr\\>\\<tr class=\\\"dl-1\\\"\\>";
-            html_mods_td buf [ ("", "sr", Str.global_replace (Str.regexp "\n") 
"\\<br\\>" buildinfo); ];
-            Printf.bprintf buf "\\</tr\\>\\<tr\\>";
-            html_mods_td buf [ ("", "srh", "Runinfo"); ];            
-            Printf.bprintf buf "\\</tr\\>\\<tr class=\\\"dl-1\\\"\\>";
-            html_mods_td buf [ ("", "sr", Str.global_replace (Str.regexp "\n") 
"\\<br\\>" runinfo); ];            
-            Printf.bprintf buf "\\</tr\\>\\</table\\>\\</div\\>\\</div\\>";
-          end
-        else
-            Printf.bprintf buf "Buildinfo:\n%s\nRuninfo:\n%s" buildinfo 
runinfo;
+       let buf = o.conn_buf in
+        let buildinfo = CommonComplexOptions.buildinfo o buf in
+        ""
+    ), ":\t\t\t\tprint mldonkey core build information";
+
+    "runinfo", Arg_none (fun o ->
+       let buf = o.conn_buf in
+        let runinfo = CommonComplexOptions.runinfo o buf in
         ""
-    ), ":\t\t\t\tprint mldonkey core build and runtime information";
+    ), ":\t\t\t\tprint mldonkey runtime information";
+
+    "diskinfo", Arg_none (fun o ->
+       let buf = o.conn_buf in
+        let diskinfo = CommonComplexOptions.diskinfo o buf in
+        ""
+    ), ":\t\t\t\tprint mldonkey disk information";
 
     "activity", Arg_one (fun arg o ->
         let arg = int_of_string arg in
@@ -2013,11 +2015,6 @@
 
             let counter = ref 0 in
 
-(* TODO update HTML for incoming directories now in shared_directories
-            Printf.bprintf buf "\\<tr class=\\\"dl-1\\\"\\>\\<td 
title=\\\"Incoming directory is always shared\\\" 
class=\\\"srb\\\"\\>Incoming\\</td\\>
-\\<td class=\\\"sr ar\\\"\\>0\\</td\\>\\<td title=\\\"Incoming\\\" 
class=\\\"sr\\\"\\>%s\\</td\\>\\</tr\\>" !!incoming_directory;
-*)
-
             List.iter (fun shared_dir ->
                let dir = shared_dir.shdir_dirname in
                incr counter;
@@ -2054,67 +2051,12 @@
             )
             !!shared_directories;
   
-               incr counter;
-             let dir = !!temp_directory in
-               Printf.bprintf buf "\\<tr class=\\\"%s\\\"\\>
-       \\<td title=\\\"\\\"
-       class=\\\"srb\\\"\\>------\\</td\\>
-       \\<td class=\\\"sr ar\\\"\\>%d\\</td\\>
-       \\<td class=\\\"sr\\\"\\>%s\\</td\\>
-       \\<td class=\\\"sr\\\"\\>%s\\</td\\>
-       \\<td class=\\\"sr ar\\\"\\>%s\\</td\\>
-       \\<td class=\\\"sr ar\\\"\\>%s\\</td\\>
-       \\<td class=\\\"sr ar\\\"\\>%s\\</td\\>
-       \\<td class=\\\"sr\\\"\\>%s\\</td\\>\\</tr\\>"
-               (if !counter mod 2 == 0 then "dl-1" else "dl-2")
-               0
-               dir
-               "temp_directory"
-             (match Unix32.diskused dir with
-             | None -> "---"
-             | Some du -> size_of_int64 du)
-             (match Unix32.diskfree dir with
-             | None -> "---"
-             | Some df -> size_of_int64 df)
-             (match Unix32.percentfree dir with
-             | None -> "---"
-             | Some p -> Printf.sprintf "%d%%" p)
-             (Unix32.filesystem dir);
-
-           let dir = Sys.getcwd () in
-               incr counter;
-               Printf.bprintf buf "\\<tr class=\\\"%s\\\"\\>
-       \\<td title=\\\"\\\"
-       class=\\\"srb\\\"\\>------\\</td\\>
-       \\<td class=\\\"sr ar\\\"\\>%d\\</td\\>
-       \\<td class=\\\"sr\\\"\\>%s\\</td\\>
-       \\<td class=\\\"sr\\\"\\>%s\\</td\\>
-       \\<td class=\\\"sr ar\\\"\\>%s\\</td\\>
-       \\<td class=\\\"sr ar\\\"\\>%s\\</td\\>
-       \\<td class=\\\"sr ar\\\"\\>%s\\</td\\>
-       \\<td class=\\\"sr\\\"\\>%s\\</td\\>\\</tr\\>"
-               (if !counter mod 2 == 0 then "dl-1" else "dl-2")
-               0
-               dir
-               "core_directory"
-             (match Unix32.diskused dir with
-             | None -> "---"
-             | Some du -> size_of_int64 du)
-             (match Unix32.diskfree dir with
-             | None -> "---"
-             | Some df -> size_of_int64 df)
-             (match Unix32.percentfree dir with
-             | None -> "---"
-             | Some p -> Printf.sprintf "%d%%" p)
-             (Unix32.filesystem dir);
-
             Printf.bprintf buf 
"\\</table\\>\\</td\\>\\<tr\\>\\</table\\>\\</div\\>";
           end
         else
           begin
 
             Printf.bprintf buf "Shared directories:\n";
-(*            Printf.bprintf buf "  %d %s\n" !!incoming_directory_prio 
!!incoming_directory; *)
             List.iter (fun sd ->
                 Printf.bprintf buf "  %d %s %s\n"
                 sd.shdir_priority sd.shdir_dirname sd.shdir_strategy)




reply via email to

[Prev in Thread] Current Thread [Next in Thread]