Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

* {ext,lib,test}/**/*.rb: removed trailing spaces.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22784 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
  • Loading branch information...
commit 287a34ae0dfc23e4158f67cb7783d239f202c368 1 parent 9b52ae2
@nobu nobu authored
Showing with 4,534 additions and 4,534 deletions.
  1. +1 −1  ext/bigdecimal/lib/bigdecimal/ludcmp.rb
  2. +4 −4 ext/bigdecimal/lib/bigdecimal/math.rb
  3. +2 −2 ext/bigdecimal/lib/bigdecimal/newton.rb
  4. +4 −4 ext/curses/view.rb
  5. +1 −1  ext/digest/lib/digest.rb
  6. +3 −3 ext/digest/lib/digest/hmac.rb
  7. +1 −1  ext/dl/callback/mkcallback.rb
  8. +3 −3 ext/dl/lib/dl/pack.rb
  9. +2 −2 ext/dl/lib/dl/stack.rb
  10. +85 −85 ext/dl/win32/lib/win32/registry.rb
  11. +23 −23 ext/dl/win32/lib/win32/resolv.rb
  12. +42 −42 ext/dl/win32/lib/win32/sspi.rb
  13. +3 −3 ext/json/lib/json.rb
  14. +1 −1  ext/json/lib/json/common.rb
  15. +16 −16 ext/json/lib/json/editor.rb
  16. +4 −4 ext/json/lib/json/pure/generator.rb
  17. +2 −2 ext/json/lib/json/pure/parser.rb
  18. +3 −3 ext/nkf/lib/kconv.rb
  19. +4 −4 ext/openssl/lib/openssl/x509-internal.rb
  20. +4 −4 ext/pty/expect_sample.rb
  21. +1 −1  ext/pty/script.rb
  22. +1 −1  ext/ripper/lib/ripper/lexer.rb
  23. +1 −1  ext/socket/lib/socket.rb
  24. +8 −8 ext/socket/mkconstants.rb
  25. +1 −1  ext/syslog/test.rb
  26. +15 −15 ext/tk/extconf.rb
  27. +93 −93 ext/tk/lib/multi-tk.rb
  28. +8 −8 ext/tk/lib/remote-tk.rb
  29. +9 −9 ext/tk/lib/tcltk.rb
  30. +167 −167 ext/tk/lib/tk.rb
  31. +47 −47 ext/tk/lib/tk/autoload.rb
  32. +22 −22 ext/tk/lib/tk/canvas.rb
  33. +2 −2 ext/tk/lib/tk/canvastag.rb
  34. +1 −1  ext/tk/lib/tk/checkbutton.rb
  35. +3 −3 ext/tk/lib/tk/composite.rb
  36. +3 −3 ext/tk/lib/tk/console.rb
  37. +15 −15 ext/tk/lib/tk/dialog.rb
  38. +3 −3 ext/tk/lib/tk/encodedstr.rb
  39. +100 −100 ext/tk/lib/tk/event.rb
  40. +62 −62 ext/tk/lib/tk/font.rb
  41. +7 −7 ext/tk/lib/tk/grid.rb
  42. +2 −2 ext/tk/lib/tk/image.rb
  43. +72 −72 ext/tk/lib/tk/itemconfig.rb
  44. +18 −18 ext/tk/lib/tk/itemfont.rb
  45. +3 −3 ext/tk/lib/tk/kinput.rb
  46. +16 −16 ext/tk/lib/tk/listbox.rb
  47. +28 −28 ext/tk/lib/tk/menu.rb
  48. +10 −10 ext/tk/lib/tk/menubar.rb
  49. +15 −15 ext/tk/lib/tk/menuspec.rb
  50. +2 −2 ext/tk/lib/tk/mngfocus.rb
  51. +28 −28 ext/tk/lib/tk/msgcat.rb
  52. +13 −13 ext/tk/lib/tk/namespace.rb
  53. +23 −23 ext/tk/lib/tk/optiondb.rb
  54. +9 −9 ext/tk/lib/tk/optionobj.rb
  55. +2 −2 ext/tk/lib/tk/palette.rb
  56. +19 −19 ext/tk/lib/tk/panedwindow.rb
  57. +6 −6 ext/tk/lib/tk/place.rb
  58. +1 −1  ext/tk/lib/tk/radiobutton.rb
  59. +4 −4 ext/tk/lib/tk/root.rb
  60. +4 −4 ext/tk/lib/tk/scale.rb
  61. +4 −4 ext/tk/lib/tk/scrollbar.rb
  62. +3 −3 ext/tk/lib/tk/selection.rb
  63. +6 −6 ext/tk/lib/tk/spinbox.rb
  64. +76 −76 ext/tk/lib/tk/text.rb
  65. +5 −5 ext/tk/lib/tk/textimage.rb
  66. +5 −5 ext/tk/lib/tk/textmark.rb
  67. +11 −11 ext/tk/lib/tk/texttag.rb
  68. +10 −10 ext/tk/lib/tk/textwindow.rb
  69. +18 −18 ext/tk/lib/tk/timer.rb
  70. +8 −8 ext/tk/lib/tk/toplevel.rb
  71. +31 −31 ext/tk/lib/tk/ttk_selector.rb
  72. +14 −14 ext/tk/lib/tk/validation.rb
  73. +64 −64 ext/tk/lib/tk/variable.rb
  74. +4 −4 ext/tk/lib/tk/virtevent.rb
  75. +5 −5 ext/tk/lib/tk/winfo.rb
  76. +2 −2 ext/tk/lib/tk/winpkg.rb
  77. +5 −5 ext/tk/lib/tk/wm.rb
  78. +2 −2 ext/tk/lib/tk/xim.rb
  79. +4 −4 ext/tk/lib/tkextlib/ICONS/icons.rb
  80. +2 −2 ext/tk/lib/tkextlib/ICONS/setup.rb
  81. +1 −1  ext/tk/lib/tkextlib/blt/barchart.rb
  82. +46 −46 ext/tk/lib/tkextlib/blt/component.rb
  83. +10 −10 ext/tk/lib/tkextlib/blt/dragdrop.rb
  84. +2 −2 ext/tk/lib/tkextlib/blt/setup.rb
  85. +1 −1  ext/tk/lib/tkextlib/blt/stripchart.rb
  86. +1 −1  ext/tk/lib/tkextlib/blt/tabnotebook.rb
  87. +26 −26 ext/tk/lib/tkextlib/blt/tree.rb
  88. +18 −18 ext/tk/lib/tkextlib/blt/treeview.rb
  89. +2 −2 ext/tk/lib/tkextlib/blt/vector.rb
  90. +6 −6 ext/tk/lib/tkextlib/blt/winop.rb
  91. +1 −1  ext/tk/lib/tkextlib/bwidget/dialog.rb
  92. +10 −10 ext/tk/lib/tkextlib/bwidget/listbox.rb
  93. +1 −1  ext/tk/lib/tkextlib/bwidget/messagedlg.rb
  94. +3 −3 ext/tk/lib/tkextlib/bwidget/notebook.rb
  95. +3 −3 ext/tk/lib/tkextlib/bwidget/passwddlg.rb
  96. +2 −2 ext/tk/lib/tkextlib/bwidget/selectcolor.rb
  97. +1 −1  ext/tk/lib/tkextlib/bwidget/selectfont.rb
  98. +2 −2 ext/tk/lib/tkextlib/bwidget/setup.rb
  99. +13 −13 ext/tk/lib/tkextlib/bwidget/tree.rb
  100. +2 −2 ext/tk/lib/tkextlib/itcl/setup.rb
  101. +2 −2 ext/tk/lib/tkextlib/itk/incr_tk.rb
  102. +2 −2 ext/tk/lib/tkextlib/itk/setup.rb
  103. +1 −1  ext/tk/lib/tkextlib/iwidgets/calendar.rb
  104. +8 −8 ext/tk/lib/tkextlib/iwidgets/entryfield.rb
  105. +1 −1  ext/tk/lib/tkextlib/iwidgets/extfileselectionbox.rb
  106. +1 −1  ext/tk/lib/tkextlib/iwidgets/fileselectionbox.rb
  107. +1 −1  ext/tk/lib/tkextlib/iwidgets/finddialog.rb
  108. +10 −10 ext/tk/lib/tkextlib/iwidgets/hierarchy.rb
  109. +5 −5 ext/tk/lib/tkextlib/iwidgets/scrolledcanvas.rb
  110. +1 −1  ext/tk/lib/tkextlib/iwidgets/scrolledlistbox.rb
  111. +29 −29 ext/tk/lib/tkextlib/iwidgets/scrolledtext.rb
  112. +2 −2 ext/tk/lib/tkextlib/iwidgets/setup.rb
  113. +8 −8 ext/tk/lib/tkextlib/iwidgets/spinner.rb
  114. +6 −6 ext/tk/lib/tkextlib/iwidgets/tabset.rb
  115. +1 −1  ext/tk/lib/tkextlib/iwidgets/toolbar.rb
  116. +1 −1  ext/tk/lib/tkextlib/iwidgets/watch.rb
  117. +2 −2 ext/tk/lib/tkextlib/pkg_checker.rb
  118. +4 −4 ext/tk/lib/tkextlib/setup.rb
  119. +12 −12 ext/tk/lib/tkextlib/tcllib/autoscroll.rb
  120. +5 −5 ext/tk/lib/tkextlib/tcllib/ctext.rb
  121. +7 −7 ext/tk/lib/tkextlib/tcllib/cursor.rb
  122. +6 −6 ext/tk/lib/tkextlib/tcllib/datefield.rb
  123. +1 −1  ext/tk/lib/tkextlib/tcllib/dialog.rb
  124. +1 −1  ext/tk/lib/tkextlib/tcllib/getstring.rb
  125. +7 −7 ext/tk/lib/tkextlib/tcllib/ico.rb
  126. +2 −2 ext/tk/lib/tkextlib/tcllib/ip_entry.rb
  127. +1 −1  ext/tk/lib/tkextlib/tcllib/panelframe.rb
  128. +52 −52 ext/tk/lib/tkextlib/tcllib/plotchart.rb
  129. +1 −1  ext/tk/lib/tkextlib/tcllib/ruler.rb
  130. +1 −1  ext/tk/lib/tkextlib/tcllib/screenruler.rb
  131. +1 −1  ext/tk/lib/tkextlib/tcllib/scrollwin.rb
  132. +2 −2 ext/tk/lib/tkextlib/tcllib/setup.rb
  133. +1 −1  ext/tk/lib/tkextlib/tcllib/superframe.rb
  134. +4 −4 ext/tk/lib/tkextlib/tcllib/swaplist.rb
  135. +12 −12 ext/tk/lib/tkextlib/tcllib/tablelist_core.rb
  136. +11 −11 ext/tk/lib/tkextlib/tcllib/tkpiechart.rb
  137. +1 −1  ext/tk/lib/tkextlib/tcllib/tooltip.rb
  138. +2 −2 ext/tk/lib/tkextlib/tclx/setup.rb
  139. +20 −20 ext/tk/lib/tkextlib/tile.rb
  140. +2 −2 ext/tk/lib/tkextlib/tile/setup.rb
  141. +13 −13 ext/tk/lib/tkextlib/tile/style.rb
  142. +1 −1  ext/tk/lib/tkextlib/tile/tcheckbutton.rb
  143. +1 −1  ext/tk/lib/tkextlib/tile/tlabelframe.rb
  144. +1 −1  ext/tk/lib/tkextlib/tile/tmenubutton.rb
  145. +2 −2 ext/tk/lib/tkextlib/tile/tnotebook.rb
  146. +11 −11 ext/tk/lib/tkextlib/tile/tpaned.rb
  147. +1 −1  ext/tk/lib/tkextlib/tile/tradiobutton.rb
  148. +6 −6 ext/tk/lib/tkextlib/tile/treeview.rb
  149. +2 −2 ext/tk/lib/tkextlib/tkDND/setup.rb
  150. +26 −26 ext/tk/lib/tkextlib/tkDND/tkdnd.rb
  151. +2 −2 ext/tk/lib/tkextlib/tkHTML/htmlwidget.rb
  152. +2 −2 ext/tk/lib/tkextlib/tkHTML/setup.rb
  153. +2 −2 ext/tk/lib/tkextlib/tkimg/setup.rb
  154. +2 −2 ext/tk/lib/tkextlib/tktable/setup.rb
  155. +55 −55 ext/tk/lib/tkextlib/tktable/tktable.rb
  156. +2 −2 ext/tk/lib/tkextlib/tktrans/setup.rb
  157. +2 −2 ext/tk/lib/tkextlib/treectrl/setup.rb
  158. +77 −77 ext/tk/lib/tkextlib/treectrl/tktreectrl.rb
  159. +2 −2 ext/tk/lib/tkextlib/trofs/setup.rb
  160. +4 −4 ext/tk/lib/tkextlib/vu/bargraph.rb
  161. +1 −1  ext/tk/lib/tkextlib/vu/charts.rb
  162. +2 −2 ext/tk/lib/tkextlib/vu/setup.rb
  163. +1 −1  ext/tk/lib/tkextlib/vu/spinbox.rb
  164. +2 −2 ext/tk/lib/tkextlib/winico/setup.rb
  165. +16 −16 ext/tk/lib/tkextlib/winico/winico.rb
  166. +65 −65 ext/tk/sample/24hr_clock.rb
  167. +4 −4 ext/tk/sample/binding_sample.rb
  168. +19 −19 ext/tk/sample/bindtag_sample.rb
  169. +1 −1  ext/tk/sample/binstr_usage.rb
  170. +8 −8 ext/tk/sample/cd_timer.rb
  171. +1 −1  ext/tk/sample/cmd_res_test.rb
  172. +7 −7 ext/tk/sample/demos-en/anilabel.rb
  173. +5 −5 ext/tk/sample/demos-en/aniwave.rb
  174. +33 −33 ext/tk/sample/demos-en/arrow.rb
  175. +17 −17 ext/tk/sample/demos-en/bind.rb
  176. +4 −4 ext/tk/sample/demos-en/bitmap.rb
  177. +5 −5 ext/tk/sample/demos-en/button.rb
  178. +5 −5 ext/tk/sample/demos-en/check.rb
  179. +17 −17 ext/tk/sample/demos-en/check2.rb
  180. +4 −4 ext/tk/sample/demos-en/clrpick.rb
  181. +1 −1  ext/tk/sample/demos-en/colors.rb
  182. +20 −20 ext/tk/sample/demos-en/combo.rb
  183. +13 −13 ext/tk/sample/demos-en/cscroll.rb
  184. +22 −22 ext/tk/sample/demos-en/ctext.rb
  185. +3 −3 ext/tk/sample/demos-en/entry1.rb
  186. +2 −2 ext/tk/sample/demos-en/entry2.rb
  187. +14 −14 ext/tk/sample/demos-en/entry3.rb
  188. +16 −16 ext/tk/sample/demos-en/filebox.rb
  189. +275 −275 ext/tk/sample/demos-en/floor.rb
  190. +275 −275 ext/tk/sample/demos-en/floor2.rb
  191. +3 −3 ext/tk/sample/demos-en/form.rb
  192. +201 −201 ext/tk/sample/demos-en/goldberg.rb
  193. +2 −2 ext/tk/sample/demos-en/icon.rb
  194. +1 −1  ext/tk/sample/demos-en/image1.rb
  195. +3 −3 ext/tk/sample/demos-en/image2.rb
  196. +8 −8 ext/tk/sample/demos-en/image3.rb
  197. +43 −43 ext/tk/sample/demos-en/items.rb
  198. +16 −16 ext/tk/sample/demos-en/knightstour.rb
  199. +8 −8 ext/tk/sample/demos-en/label.rb
  200. +7 −7 ext/tk/sample/demos-en/labelframe.rb
  201. +28 −28 ext/tk/sample/demos-en/mclist.rb
  202. +24 −24 ext/tk/sample/demos-en/menu.rb
  203. +30 −30 ext/tk/sample/demos-en/menu84.rb
  204. +2 −2 ext/tk/sample/demos-en/menubu.rb
  205. +12 −12 ext/tk/sample/demos-en/msgbox.rb
  206. +12 −12 ext/tk/sample/demos-en/msgbox2.rb
  207. +4 −4 ext/tk/sample/demos-en/paned1.rb
  208. +23 −23 ext/tk/sample/demos-en/paned2.rb
  209. +16 −16 ext/tk/sample/demos-en/pendulum.rb
  210. +15 −15 ext/tk/sample/demos-en/plot.rb
  211. +3 −3 ext/tk/sample/demos-en/puzzle.rb
  212. +6 −6 ext/tk/sample/demos-en/radio.rb
  213. +14 −14 ext/tk/sample/demos-en/radio2.rb
  214. +25 −25 ext/tk/sample/demos-en/radio3.rb
  215. +18 −18 ext/tk/sample/demos-en/ruler.rb
  216. +4 −4 ext/tk/sample/demos-en/sayings.rb
  217. +16 −16 ext/tk/sample/demos-en/search.rb
  218. +8 −8 ext/tk/sample/demos-en/spin.rb
  219. +11 −11 ext/tk/sample/demos-en/states.rb
  220. +19 −19 ext/tk/sample/demos-en/style.rb
  221. +3 −3 ext/tk/sample/demos-en/text.rb
  222. +4 −4 ext/tk/sample/demos-en/textpeer.rb
  223. +16 −16 ext/tk/sample/demos-en/toolbar.rb
  224. +13 −13 ext/tk/sample/demos-en/tree.rb
  225. +24 −24 ext/tk/sample/demos-en/ttkbut.rb
  226. +9 −9 ext/tk/sample/demos-en/ttkmenu.rb
  227. +11 −11 ext/tk/sample/demos-en/ttknote.rb
  228. +23 −23 ext/tk/sample/demos-en/ttkpane.rb
  229. +11 −11 ext/tk/sample/demos-en/ttkprogress.rb
  230. +30 −30 ext/tk/sample/demos-en/twind.rb
  231. +65 −65 ext/tk/sample/demos-en/twind2.rb
  232. +20 −20 ext/tk/sample/demos-en/unicodeout.rb
  233. +7 −7 ext/tk/sample/demos-jp/anilabel.rb
  234. +5 −5 ext/tk/sample/demos-jp/aniwave.rb
  235. +31 −31 ext/tk/sample/demos-jp/arrow.rb
  236. +13 −13 ext/tk/sample/demos-jp/bind.rb
  237. +3 −3 ext/tk/sample/demos-jp/bitmap.rb
  238. +1 −1  ext/tk/sample/demos-jp/button.rb
  239. +2 −2 ext/tk/sample/demos-jp/check.rb
  240. +17 −17 ext/tk/sample/demos-jp/check2.rb
  241. +3 −3 ext/tk/sample/demos-jp/clrpick.rb
  242. +1 −1  ext/tk/sample/demos-jp/colors.rb
  243. +20 −20 ext/tk/sample/demos-jp/combo.rb
  244. +12 −12 ext/tk/sample/demos-jp/cscroll.rb
  245. +19 −19 ext/tk/sample/demos-jp/ctext.rb
  246. +1 −1  ext/tk/sample/demos-jp/entry1.rb
  247. +1 −1  ext/tk/sample/demos-jp/entry2.rb
  248. +18 −18 ext/tk/sample/demos-jp/entry3.rb
  249. +16 −16 ext/tk/sample/demos-jp/filebox.rb
  250. +273 −273 ext/tk/sample/demos-jp/floor.rb
  251. +273 −273 ext/tk/sample/demos-jp/floor2.rb
  252. +1 −1  ext/tk/sample/demos-jp/form.rb
  253. +204 −204 ext/tk/sample/demos-jp/goldberg.rb
  254. +1 −1  ext/tk/sample/demos-jp/icon.rb
  255. +1 −1  ext/tk/sample/demos-jp/image1.rb
  256. +1 −1  ext/tk/sample/demos-jp/image2.rb
  257. +8 −8 ext/tk/sample/demos-jp/image3.rb
Sorry, we could not display the entire diff because too many files (856) changed.
View
2  ext/bigdecimal/lib/bigdecimal/ludcmp.rb
@@ -17,7 +17,7 @@ def ludecomp(a,n,zero=0,one=1)
end
if nrmrow>zero then
scales <<= one.div(nrmrow,prec)
- else
+ else
raise "Singular matrix"
end
end
View
8 ext/bigdecimal/lib/bigdecimal/math.rb
@@ -30,10 +30,10 @@
#
module BigMath
- # Computes the square root of x to the specified number of digits of
+ # Computes the square root of x to the specified number of digits of
# precision.
#
- # BigDecimal.new('2').sqrt(16).to_s
+ # BigDecimal.new('2').sqrt(16).to_s
# -> "0.14142135623730950488016887242096975E1"
#
def sqrt(x,prec)
@@ -120,7 +120,7 @@ def atan(x, prec)
y
end
- # Computes the value of e (the base of natural logarithms) raised to the
+ # Computes the value of e (the base of natural logarithms) raised to the
# power of x, to the specified number of digits of precision.
#
# If x is infinite or NaN, returns NaN.
@@ -148,7 +148,7 @@ def exp(x, prec)
y
end
- # Computes the natural logarithm of x to the specified number of digits
+ # Computes the natural logarithm of x to the specified number of digits
# of precision.
#
# Returns x if x is infinite or NaN.
View
4 ext/bigdecimal/lib/bigdecimal/newton.rb
@@ -1,5 +1,5 @@
#
-# newton.rb
+# newton.rb
#
# Solves the nonlinear algebraic equation system f = 0 by Newton's method.
# This program is not dependent on BigDecimal.
@@ -28,7 +28,7 @@
module Newton
include LUSolve
include Jacobian
-
+
def norm(fv,zero=0.0)
s = zero
n = fv.size
View
8 ext/curses/view.rb
@@ -67,10 +67,10 @@
else
break
end
- i += 1
+ i += 1
end
#wscrl(i)
-
+
when "p" #when KEY_UP
i = 0
while i < n
@@ -79,8 +79,8 @@
else
break
end
- i += 1
- end
+ i += 1
+ end
#wscrl(-i)
when "q"
View
2  ext/digest/lib/digest.rb
@@ -22,7 +22,7 @@ def self.const_missing(name)
class ::Digest::Class
# creates a digest object and reads a given file, _name_.
- #
+ #
# p Digest::SHA256.file("X11R6.8.2-src.tar.bz2").hexdigest
# # => "f02e3c85572dc9ad7cb77c2a638e3be24cc1b5bea9fdbb0b0299c9668475c534"
def self.file(name)
View
6 ext/digest/lib/digest/hmac.rb
@@ -2,8 +2,8 @@
#
# An implementation of HMAC keyed-hashing algorithm
#
-# == Overview
-#
+# == Overview
+#
# This library adds a method named hmac() to Digest classes, which
# creates a Digest class for calculating HMAC digests.
#
@@ -142,7 +142,7 @@ def test_reset
}
}
end
-end
+end
class TC_HMAC_MD5 < Test::Unit::TestCase
include TM_HMAC
View
2  ext/dl/callback/mkcallback.rb
@@ -206,7 +206,7 @@ def gen_callback_file(ty)
VALUE tmp;
VALUE rb_mDL = rb_path2class("DL");
- rb_dl_cb_call = rb_intern("call");
+ rb_dl_cb_call = rb_intern("call");
tmp = rb_DLCdeclCallbackProcs = rb_ary_new();
rb_define_const(rb_mDL, "CdeclCallbackProcs", tmp);
View
6 ext/dl/lib/dl/pack.rb
@@ -74,7 +74,7 @@ def initialize(types)
def size()
@size
end
-
+
def pack(ary)
case SIZEOF_VOIDP
when SIZEOF_LONG
@@ -96,9 +96,9 @@ def unpack(ary)
raise(RuntimeError, "sizeof(void*)?")
end
end
-
+
private
-
+
def parse_types(types)
@template = ""
addr = 0
View
4 ext/dl/lib/dl/stack.rb
@@ -39,9 +39,9 @@ def unpack(ary)
raise(RuntimeError, "sizeof(void*)?")
end
end
-
+
private
-
+
def align(addr, align)
d = addr % align
if( d == 0 )
View
170 ext/dl/win32/lib/win32/registry.rb
@@ -11,10 +11,10 @@
reg['foo'] = 'bar' # write a value
reg['foo', Win32::Registry::REG_SZ] = 'bar' # write a value with type
reg.write('foo', Win32::Registry::REG_SZ, 'bar') # write a value
-
+
reg.each_value { |name, type, data| ... } # Enumerate values
reg.each_key { |key, wtime| ... } # Enumerate subkeys
-
+
reg.delete_value(name) # Delete a value
reg.delete_key(name) # Delete a subkey
reg.delete_key(name, true) # Delete a subkey recursively
@@ -35,26 +35,26 @@
Open the registry key ((|subkey|)) under ((|key|)).
((|key|)) is Win32::Registry object of parent key.
You can use predefined key HKEY_* (see ((<constants>)))
-
+
((|desired|)) and ((|opt|)) is access mask and key option.
For detail, see ((<MSDN Library|URL:http://msdn.microsoft.com/library/en-us/sysinfo/base/regopenkeyex.asp>)).
-
+
If block is given, the key is closed automatically.
--- Registry.create(key, subkey, desired = KEY_ALL_ACCESS, opt = REG_OPTION_RESERVED)
--- Registry.create(key, subkey, desired = KEY_ALL_ACCESS, opt = REG_OPTION_RESERVED) { |reg| ... }
Create or open the registry key ((|subkey|)) under ((|key|)).
You can use predefined key HKEY_* (see ((<constants>)))
-
+
If subkey is already exists, key is opened and Registry#((<created?>))
method will return false.
-
+
If block is given, the key is closed automatically.
--- Registry.expand_environ(str)
Replace (({%\w+%})) into the environment value of ((|str|)).
This method is used for REG_EXPAND_SZ.
-
+
For detail, see ((<ExpandEnvironmentStrings|URL:http://msdn.microsoft.com/library/en-us/sysinfo/base/expandenvironmentstrings.asp>)) Win32 API.
--- Registry.type2name(type)
@@ -75,14 +75,14 @@
--- close
Close key.
-
+
After closed, most method raises error.
--- read(name, *rtype)
Read a registry value named ((|name|)) and return array of
[ ((|type|)), ((|data|)) ].
When name is nil, the `default' value is read.
-
+
((|type|)) is value type. (see ((<Win32::Registry::Constants module>)))
((|data|)) is value data, its class is:
:REG_SZ, REG_EXPAND_SZ
@@ -93,19 +93,19 @@
Integer
:REG_BINARY
String (contains binary data)
-
+
When ((|rtype|)) is specified, the value type must be included by
((|rtype|)) array, or TypeError is raised.
--- self[name, *rtype]
Read a registry value named ((|name|)) and return its value data.
The class of value is same as ((<read>)) method returns.
-
+
If the value type is REG_EXPAND_SZ, returns value data whose environment
variables are replaced.
If the value type is neither REG_SZ, REG_MULTI_SZ, REG_DWORD,
REG_DWORD_BIG_ENDIAN, nor REG_QWORD, TypeError is raised.
-
+
The meaning of ((|rtype|)) is same as ((<read>)) method.
--- read_s(name)
@@ -113,26 +113,26 @@
--- read_bin(name)
Read a REG_SZ(read_s), REG_DWORD(read_i), or REG_BINARY(read_bin)
registry value named ((|name|)).
-
+
If the values type does not match, TypeError is raised.
--- read_s_expand(name)
Read a REG_SZ or REG_EXPAND_SZ registry value named ((|name|)).
-
+
If the value type is REG_EXPAND_SZ, environment variables are replaced.
Unless the value type is REG_SZ or REG_EXPAND_SZ, TypeError is raised.
--- write(name, type, data)
Write ((|data|)) to a registry value named ((|name|)).
When name is nil, write to the `default' value.
-
+
((|type|)) is type value. (see ((<Registry::Constants module>)))
Class of ((|data|)) must be same as which ((<read>))
method returns.
--- self[name, wtype = nil] = value
Write ((|value|)) to a registry value named ((|name|)).
-
+
If ((|wtype|)) is specified, the value type is it.
Otherwise, the value type is depend on class of ((|value|)):
:Integer
@@ -146,7 +146,7 @@
--- write_i(name, value)
--- write_bin(name, value)
Write ((|value|)) to a registry value named ((|name|)).
-
+
The value type is REG_SZ(write_s), REG_DWORD(write_i), or
REG_BINARY(write_bin).
@@ -156,7 +156,7 @@
--- each_key { |subkey, wtime| ... }
Enumerate subkeys.
-
+
((|subkey|)) is String which contains name of subkey.
((|wtime|)) is last write time as FILETIME (64-bit integer).
(see ((<Registry.wtime2time>)))
@@ -168,7 +168,7 @@
--- delete_key(name, recursive = false)
Delete a subkey named ((|name|)) and all its values.
-
+
If ((|recursive|)) is false, the subkey must not have subkeys.
Otherwise, this method deletes all subkeys and values recursively.
@@ -215,7 +215,7 @@
Length of security descriptor.
:wtime
Last write time as FILETIME(64-bit integer)
-
+
For detail, see ((<RegQueryInfoKey|URL:http://msdn.microsoft.com/library/en-us/sysinfo/base/regqueryinfokey.asp>)) Win32 API.
--- num_keys
@@ -275,7 +275,7 @@ module Constants
HKEY_PERFORMANCE_NLSTEXT = 0x80000060
HKEY_CURRENT_CONFIG = 0x80000005
HKEY_DYN_DATA = 0x80000006
-
+
REG_NONE = 0
REG_SZ = 1
REG_EXPAND_SZ = 2
@@ -290,7 +290,7 @@ module Constants
REG_RESOURCE_REQUIREMENTS_LIST = 10
REG_QWORD = 11
REG_QWORD_LITTLE_ENDIAN = 11
-
+
STANDARD_RIGHTS_READ = 0x00020000
STANDARD_RIGHTS_WRITE = 0x00020000
KEY_QUERY_VALUE = 0x0001
@@ -305,7 +305,7 @@ module Constants
KEY_SET_VALUE | KEY_CREATE_SUB_KEY
KEY_EXECUTE = KEY_READ
KEY_ALL_ACCESS = KEY_READ | KEY_WRITE | KEY_CREATE_LINK
-
+
REG_OPTION_RESERVED = 0x0000
REG_OPTION_NON_VOLATILE = 0x0000
REG_OPTION_VOLATILE = 0x0001
@@ -315,21 +315,21 @@ module Constants
REG_LEGAL_OPTION = REG_OPTION_RESERVED |
REG_OPTION_NON_VOLATILE | REG_OPTION_CREATE_LINK |
REG_OPTION_BACKUP_RESTORE | REG_OPTION_OPEN_LINK
-
+
REG_CREATED_NEW_KEY = 1
REG_OPENED_EXISTING_KEY = 2
-
+
REG_WHOLE_HIVE_VOLATILE = 0x0001
REG_REFRESH_HIVE = 0x0002
REG_NO_LAZY_FLUSH = 0x0004
REG_FORCE_RESTORE = 0x0008
-
+
MAX_KEY_LENGTH = 514
MAX_VALUE_LENGTH = 32768
end
include Constants
include Enumerable
-
+
#
# Error
#
@@ -348,7 +348,7 @@ def initialize(code)
end
attr_reader :code
end
-
+
#
# Predefined Keys
#
@@ -359,23 +359,23 @@ def initialize(hkey, keyname)
@keyname = keyname
@disposition = REG_OPENED_EXISTING_KEY
end
-
+
# Predefined keys cannot be closed
def close
raise Error.new(5) ## ERROR_ACCESS_DENIED
end
-
+
# Fake class for Registry#open, Registry#create
def class
Registry
end
-
+
# Make all
Constants.constants.grep(/^HKEY_/) do |c|
Registry.const_set c, new(Constants.const_get(c), c)
end
end
-
+
#
# Win32 APIs
#
@@ -398,37 +398,37 @@ module API
cfunc = extern fn, :stdcall
const_set cfunc.name.intern, cfunc
end
-
+
module_function
-
+
def check(result)
raise Error, result, caller(2) if result != 0
end
-
+
def packdw(dw)
[dw].pack('V')
end
-
+
def unpackdw(dw)
dw += [0].pack('V')
dw.unpack('V')[0]
end
-
+
def packqw(qw)
[ qw & 0xFFFFFFFF, qw >> 32 ].pack('VV')
end
-
+
def unpackqw(qw)
qw = qw.unpack('VV')
(qw[1] << 32) | qw[0]
end
-
+
def OpenKey(hkey, name, opt, desired)
result = packdw(0)
check RegOpenKeyExA.call(hkey, name, opt, desired, result)
unpackdw(result)
end
-
+
def CreateKey(hkey, name, opt, desired)
result = packdw(0)
disp = packdw(0)
@@ -436,14 +436,14 @@ def CreateKey(hkey, name, opt, desired)
0, result, disp)
[ unpackdw(result), unpackdw(disp) ]
end
-
+
def EnumValue(hkey, index)
name = ' ' * Constants::MAX_KEY_LENGTH
size = packdw(Constants::MAX_KEY_LENGTH)
check RegEnumValueA.call(hkey, index, name, size, 0, 0, 0, 0)
name[0, unpackdw(size)]
end
-
+
def EnumKey(hkey, index)
name = ' ' * Constants::MAX_KEY_LENGTH
size = packdw(Constants::MAX_KEY_LENGTH)
@@ -451,7 +451,7 @@ def EnumKey(hkey, index)
check RegEnumKeyExA.call(hkey, index, name, size, 0, 0, 0, wtime)
[ name[0, unpackdw(size)], unpackqw(wtime) ]
end
-
+
def QueryValue(hkey, name)
type = packdw(0)
size = packdw(0)
@@ -460,27 +460,27 @@ def QueryValue(hkey, name)
check RegQueryValueExA.call(hkey, name, 0, type, data, size)
[ unpackdw(type), data[0, unpackdw(size)] ]
end
-
+
def SetValue(hkey, name, type, data, size)
check RegSetValueExA.call(hkey, name, 0, type, data, size)
end
-
+
def DeleteValue(hkey, name)
check RegDeleteValue.call(hkey, name)
end
-
+
def DeleteKey(hkey, name)
check RegDeleteKey.call(hkey, name)
end
-
+
def FlushKey(hkey)
check RegFlushKey.call(hkey)
end
-
+
def CloseKey(hkey)
check RegCloseKey.call(hkey)
end
-
+
def QueryInfoKey(hkey)
subkeys = packdw(0)
maxsubkeylen = packdw(0)
@@ -496,14 +496,14 @@ def QueryInfoKey(hkey)
unpackdw(secdescs), unpackqw(wtime) ]
end
end
-
+
#
# utility functions
#
def self.expand_environ(str)
str.gsub(/%([^%]+)%/) { ENV[$1] || ENV[$1.upcase] || $& }
end
-
+
@@type2name = { }
%w[
REG_NONE REG_SZ REG_EXPAND_SZ REG_BINARY REG_DWORD
@@ -513,24 +513,24 @@ def self.expand_environ(str)
].each do |type|
@@type2name[Constants.const_get(type)] = type
end
-
+
def self.type2name(type)
@@type2name[type] || type.to_s
end
-
+
def self.wtime2time(wtime)
Time.at((wtime - 116444736000000000) / 10000000)
end
-
+
def self.time2wtime(time)
time.to_i * 10000000 + 116444736000000000
end
-
+
#
# constructors
#
private_class_method :new
-
+
def self.open(hkey, subkey, desired = KEY_READ, opt = REG_OPTION_RESERVED)
subkey = subkey.chomp('\\')
newkey = API.OpenKey(hkey.hkey, subkey, opt, desired)
@@ -545,7 +545,7 @@ def self.open(hkey, subkey, desired = KEY_READ, opt = REG_OPTION_RESERVED)
obj
end
end
-
+
def self.create(hkey, subkey, desired = KEY_ALL_ACCESS, opt = REG_OPTION_RESERVED)
newkey, disp = API.CreateKey(hkey.hkey, subkey, opt, desired)
obj = new(newkey, hkey, subkey, disp)
@@ -559,12 +559,12 @@ def self.create(hkey, subkey, desired = KEY_ALL_ACCESS, opt = REG_OPTION_RESERVE
obj
end
end
-
+
#
# finalizer
#
@@final = proc { |hkey| proc { API.CloseKey(hkey[0]) if hkey[0] } }
-
+
#
# initialize
#
@@ -577,18 +577,18 @@ def initialize(hkey, parent, keyname, disposition)
ObjectSpace.define_finalizer self, @@final.call(@hkeyfinal)
end
attr_reader :hkey, :parent, :keyname, :disposition
-
+
#
# attributes
#
def created?
@disposition == REG_CREATED_NEW_KEY
end
-
+
def open?
!@hkey.nil?
end
-
+
def name
parent = self
name = @keyname
@@ -597,35 +597,35 @@ def name
end
name
end
-
+
def inspect
"\#<Win32::Registry key=#{name.inspect}>"
end
-
+
#
# marshalling
#
def _dump(depth)
raise TypeError, "can't dump Win32::Registry"
end
-
+
#
# open/close
#
def open(subkey, desired = KEY_READ, opt = REG_OPTION_RESERVED, &blk)
self.class.open(self, subkey, desired, opt, &blk)
end
-
+
def create(subkey, desired = KEY_ALL_ACCESS, opt = REG_OPTION_RESERVED, &blk)
self.class.create(self, subkey, desired, opt, &blk)
end
-
+
def close
API.CloseKey(@hkey)
@hkey = @parent = @keyname = nil
@hkeyfinal[0] = nil
end
-
+
#
# iterator
#
@@ -648,7 +648,7 @@ def each_value
index
end
alias each each_value
-
+
def each_key
index = 0
while true
@@ -662,13 +662,13 @@ def each_key
end
index
end
-
+
def keys
keys_ary = []
each_key { |key,| keys_ary << key }
keys_ary
end
-
+
#
# reader
#
@@ -694,7 +694,7 @@ def read(name, *rtype)
raise TypeError, "Type #{type} is not supported."
end
end
-
+
def [](name, *rtype)
type, data = read(name, *rtype)
case type
@@ -706,11 +706,11 @@ def [](name, *rtype)
raise TypeError, "Type #{type} is not supported."
end
end
-
+
def read_s(name)
read(name, REG_SZ)[1]
end
-
+
def read_s_expand(name)
type, data = read(name, REG_SZ, REG_EXPAND_SZ)
if type == REG_EXPAND_SZ
@@ -719,15 +719,15 @@ def read_s_expand(name)
data
end
end
-
+
def read_i(name)
read(name, REG_DWORD, REG_DWORD_BIG_ENDIAN, REG_QWORD)[1]
end
-
+
def read_bin(name)
read(name, REG_BINARY)[1]
end
-
+
#
# writer
#
@@ -750,7 +750,7 @@ def write(name, type, data)
end
API.SetValue(@hkey, name, type, data, data.length)
end
-
+
def []=(name, rtype, value = nil)
if value
write name, rtype, value
@@ -768,19 +768,19 @@ def []=(name, rtype, value = nil)
end
value
end
-
+
def write_s(name, value)
write name, REG_SZ, value.to_s
end
-
+
def write_i(name, value)
write name, REG_DWORD, value.to_i
end
-
+
def write_bin(name, value)
write name, REG_BINARY, value.to_s
end
-
+
#
# delete
#
@@ -788,7 +788,7 @@ def delete_value(name)
API.DeleteValue(@hkey, name)
end
alias delete delete_value
-
+
def delete_key(name, recursive = false)
if recursive
open(name, KEY_ALL_ACCESS) do |reg|
@@ -810,14 +810,14 @@ def delete_key(name, recursive = false)
raise Error.new(5) ## ERROR_ACCESS_DENIED
end
end
-
+
#
# flush
#
def flush
API.FlushKey @hkey
end
-
+
#
# key information
#
View
46 ext/dl/win32/lib/win32/resolv.rb
@@ -9,13 +9,13 @@
module Win32
module Resolv
API = Registry::API
-
+
def self.get_hosts_path
path = get_hosts_dir
path = File.expand_path('hosts', path)
File.exist?(path) ? path : nil
end
-
+
def self.get_resolv_info
search, nameserver = get_info
if search.empty?
@@ -47,7 +47,7 @@ module Kernel32
#====================================================================
module_eval <<-'__EOS__', __FILE__, __LINE__+1
TCPIP_NT = 'SYSTEM\CurrentControlSet\Services\Tcpip\Parameters'
-
+
class << self
private
def get_hosts_dir
@@ -55,7 +55,7 @@ def get_hosts_dir
reg.read_s_expand('DataBasePath')
end
end
-
+
def get_info
search = nil
nameserver = []
@@ -65,7 +65,7 @@ def get_info
search = slist.split(/,\s*/) unless slist.empty?
rescue Registry::Error
end
-
+
if add_search = search.nil?
search = []
begin
@@ -81,7 +81,7 @@ def get_info
rescue Registry::Error
end
end
-
+
reg.open('Interfaces') do |h|
h.each_key do |iface,|
h.open(iface) do |regif|
@@ -99,7 +99,7 @@ def get_info
end
rescue Registry::Error
end
-
+
if add_search
begin
[ 'Domain', 'DhcpDomain' ].each do |key|
@@ -129,16 +129,16 @@ def get_info
TCPIP_9X = 'SYSTEM\CurrentControlSet\Services\VxD\MSTCP'
DHCP_9X = 'SYSTEM\CurrentControlSet\Services\VxD\DHCP'
WINDOWS = 'Software\Microsoft\Windows\CurrentVersion'
-
+
class << self
# private
-
+
def get_hosts_dir
Registry::HKEY_LOCAL_MACHINE.open(WINDOWS) do |reg|
reg.read_s_expand('SystemRoot')
end
end
-
+
def get_info
search = []
nameserver = []
@@ -155,13 +155,13 @@ def get_info
end
rescue Registry::Error
end
-
+
dhcpinfo = get_dhcpinfo
search.concat(dhcpinfo[0])
nameserver.concat(dhcpinfo[1])
[ search, nameserver ]
end
-
+
def get_dhcpinfo
macaddrs = {}
ipaddrs = {}
@@ -170,7 +170,7 @@ def get_dhcpinfo
ipaddr.each { |ipaddr| ipaddrs[ipaddr] = 1 }
end
iflist = [ macaddrs, ipaddrs ]
-
+
search = []
nameserver = []
version = -1
@@ -179,7 +179,7 @@ def get_dhcpinfo
version = API.unpackdw(reg.read_bin("Version"))
rescue Registry::Error
end
-
+
reg.each_key do |key,|
catch(:not_used) do
reg.open(key) do |regdi|
@@ -192,7 +192,7 @@ def get_dhcpinfo
end
[ search, nameserver ]
end
-
+
def get_dhcpinfo_95(reg)
dhcp = reg.read_bin("DhcpInfo")
[
@@ -203,7 +203,7 @@ def get_dhcpinfo_95(reg)
reg.read_bin("OptionInfo"),
]
end
-
+
def get_dhcpinfo_98(reg)
[
API.unpackdw(reg.read_bin("DhcpIPAddress")),
@@ -213,7 +213,7 @@ def get_dhcpinfo_98(reg)
reg.read_bin("OptionInfo"),
]
end
-
+
def get_dhcpinfo_key(version, reg, iflist)
info = case version
when 1
@@ -234,7 +234,7 @@ def get_dhcpinfo_key(version, reg, iflist)
macaddr and macaddr.size == 6 and
hwtype == 1 and
iflist[0][macaddr] and iflist[1][ipaddr]
-
+
size = opt.size
idx = 0
while idx <= size
@@ -258,7 +258,7 @@ def get_dhcpinfo_key(version, reg, iflist)
throw :not_used
end
end
-
+
module WsControl
module WSock32
extend DL::Importer
@@ -266,7 +266,7 @@ module WSock32
end
WsControl = WSock32.extern "int WsControl(int, int, void *, void *, void *, void *", :stdcall
WSAGetLastError = WSock32.extern "int WSAGetLastError(void)", :stdcall
-
+
MAX_TDI_ENTITIES = 512
IPPROTO_TCP = 6
WSCTL_TCP_QUERY_INFORMATION = 0
@@ -282,7 +282,7 @@ module WSock32
IF_MIB = 0x202
IF_MIB_STATS_ID = 1
IP_MIB_ADDRTABLE_ENTRY_ID = 0x102
-
+
def self.wsctl(tei_entity, tei_instance,
toi_class, toi_type, toi_id,
buffsize)
@@ -308,7 +308,7 @@ def self.wsctl(tei_entity, tei_instance,
[ buff, API.unpackdw(buffsize) ]
end
private_class_method :wsctl
-
+
def self.get_iflist
# Get TDI Entity List
entities, size =
@@ -345,7 +345,7 @@ def self.get_iflist
end
end
end
-
+
# Get IP Addresses
entities.each do |entity, instance|
if entity == CL_NL_ENTITY
View
84 ext/dl/win32/lib/win32/sspi.rb
@@ -2,7 +2,7 @@
# = win32/sspi.rb
#
# Copyright (c) 2006-2007 Justin Bailey
-#
+#
# Written and maintained by Justin Bailey <jgbailey@gmail.com>.
#
# This program is free software. You can re-distribute and/or
@@ -33,7 +33,7 @@ module SSPI
ISC_REQ_PROMPT_FOR_CREDS = 0x00000040
ISC_REQ_CONNECTION = 0x00000800
- # Win32 API Functions. Uses Win32API to bind methods to constants contained in class.
+ # Win32 API Functions. Uses Win32API to bind methods to constants contained in class.
module API
# Can be called with AcquireCredentialsHandle.call()
AcquireCredentialsHandle = Win32API.new("secur32", "AcquireCredentialsHandle", 'ppLpppppp', 'L')
@@ -44,22 +44,22 @@ module API
# Can be called with FreeCredentialsHandle.call()
FreeCredentialsHandle = Win32API.new("secur32", "FreeCredentialsHandle", 'P', 'L')
end
-
+
# SecHandle struct
class SecurityHandle
def upper
@struct.unpack("LL")[1]
end
-
+
def lower
@struct.unpack("LL")[0]
end
-
+
def to_p
@struct ||= "\0" * 8
end
end
-
+
# Some familiar aliases for the SecHandle structure
CredHandle = CtxtHandle = SecurityHandle
@@ -71,13 +71,13 @@ def to_p
@struct ||= "\0" * 8
end
end
-
+
# Creates binary representaiton of a SecBufferDesc structure,
# including the SecBuffer contained inside.
class SecurityBuffer
SECBUFFER_TOKEN = 2 # Security token
-
+
TOKENBUFSIZE = 12288
SECBUFFER_VERSION = 0
@@ -86,22 +86,22 @@ def initialize(buffer = nil)
@bufferSize = @buffer.length
@type = SECBUFFER_TOKEN
end
-
+
def bufferSize
unpack
@bufferSize
end
-
+
def bufferType
unpack
@type
end
-
+
def token
unpack
@buffer
end
-
+
def to_p
# Assumption is that when to_p is called we are going to get a packed structure. Therefore,
# set @unpacked back to nil so we know to unpack when accessors are next accessed.
@@ -110,14 +110,14 @@ def to_p
# will not be able to unpack changes to the structure. Alternative, nested unpacks,
# does not work (i.e. @struct.unpack("LLP12")[2].unpack("LLP12") results in "no associated pointer")
@sec_buffer ||= [@bufferSize, @type, @buffer].pack("LLP")
- @struct ||= [SECBUFFER_VERSION, 1, @sec_buffer].pack("LLP")
+ @struct ||= [SECBUFFER_VERSION, 1, @sec_buffer].pack("LLP")
end
-
+
private
-
+
# Unpacks the SecurityBufferDesc structure into member variables. We
# only want to do this once per struct, so the struct is deleted
- # after unpacking.
+ # after unpacking.
def unpack
if ! @unpacked && @sec_buffer && @struct
@bufferSize, @type = @sec_buffer.unpack("LL")
@@ -128,30 +128,30 @@ def unpack
end
end
end
-
+
# SEC_WINNT_AUTH_IDENTITY structure
class Identity
SEC_WINNT_AUTH_IDENTITY_ANSI = 0x1
attr_accessor :user, :domain, :password
-
+
def initialize(user = nil, domain = nil, password = nil)
@user = user
@domain = domain
@password = password
@flags = SEC_WINNT_AUTH_IDENTITY_ANSI
end
-
+
def to_p
- [@user, @user ? @user.length : 0,
+ [@user, @user ? @user.length : 0,
@domain, @domain ? @domain.length : 0,
@password, @password ? @password.length : 0,
@flags].pack("PLPLPLL")
- end
+ end
end
# Takes a return result from an SSPI function and interprets the value.
- class SSPIResult
+ class SSPIResult
# Good results
SEC_E_OK = 0x00000000
SEC_I_CONTINUE_NEEDED = 0x00090312
@@ -172,27 +172,27 @@ class SSPIResult
SEC_E_NOT_OWNER = 0x80090306
SEC_E_SECPKG_NOT_FOUND = 0x80090305
SEC_E_UNKNOWN_CREDENTIALS = 0x8009030D
-
+
@@map = {}
constants.each { |v| @@map[self.const_get(v.to_s)] = v }
attr_reader :value
-
+
def initialize(value)
# convert to unsigned long
value = [value].pack("L").unpack("L").first
raise "#{value.to_s(16)} is not a recognized result" unless @@map.has_key? value
@value = value
end
-
+
def to_s
@@map[@value].to_s
end
-
+
def ok?
@value == SEC_I_CONTINUE_NEEDED || @value == SEC_E_OK
end
-
+
def ==(other)
if other.is_a?(SSPIResult)
@value == other.value
@@ -205,14 +205,14 @@ def ==(other)
end
# Handles "Negotiate" type authentication. Geared towards authenticating with a proxy server over HTTP
- class NegotiateAuth
+ class NegotiateAuth
attr_accessor :credentials, :context, :contextAttributes, :user, :domain
# Default request flags for SSPI functions
REQUEST_FLAGS = ISC_REQ_CONFIDENTIALITY | ISC_REQ_REPLAY_DETECT | ISC_REQ_CONNECTION
# NTLM tokens start with this header always. Encoding alone adds "==" and newline, so remove those
- B64_TOKEN_PREFIX = ["NTLMSSP"].pack("m").delete("=\n")
+ B64_TOKEN_PREFIX = ["NTLMSSP"].pack("m").delete("=\n")
# Given a connection and a request path, performs authentication as the current user and returns
# the response from a GET request. The connnection should be a Net::HTTP object, and it should
@@ -222,7 +222,7 @@ class NegotiateAuth
def NegotiateAuth.proxy_auth_get(http, path, user = nil, domain = nil)
raise "http must respond to :get" unless http.respond_to?(:get)
nego_auth = self.new user, domain
-
+
resp = http.get path, { "Proxy-Authorization" => "Negotiate " + nego_auth.get_initial_token }
if resp["Proxy-Authenticate"]
resp = http.get path, { "Proxy-Authorization" => "Negotiate " + nego_auth.complete_authentication(resp["Proxy-Authenticate"].split(" ").last.strip) }
@@ -230,7 +230,7 @@ def NegotiateAuth.proxy_auth_get(http, path, user = nil, domain = nil)
resp
end
-
+
# Creates a new instance ready for authentication as the given user in the given domain.
# Defaults to current user and domain as defined by ENV["USERDOMAIN"] and ENV["USERNAME"] if
# no arguments are supplied.
@@ -238,7 +238,7 @@ def initialize(user = nil, domain = nil)
if user.nil? && domain.nil? && ENV["USERNAME"].nil? && ENV["USERDOMAIN"].nil?
raise "A username or domain must be supplied since they cannot be retrieved from the environment"
end
-
+
@user = user || ENV["USERNAME"]
@domain = domain || ENV["USERDOMAIN"]
end
@@ -253,7 +253,7 @@ def get_initial_token
@context = CtxtHandle.new
@contextAttributes = "\0" * 4
- result = SSPIResult.new(API::InitializeSecurityContext.call(@credentials.to_p, nil, nil,
+ result = SSPIResult.new(API::InitializeSecurityContext.call(@credentials.to_p, nil, nil,
REQUEST_FLAGS,0, SECURITY_NETWORK_DREP, nil, 0, @context.to_p, outputBuffer.to_p, @contextAttributes, TimeStamp.new.to_p))
if result.ok? then
@@ -262,15 +262,15 @@ def get_initial_token
raise "Error: #{result.to_s}"
end
end
-
- # Takes a token and gets the next token in the Negotiate authentication chain. Token can be Base64 encoded or not.
+
+ # Takes a token and gets the next token in the Negotiate authentication chain. Token can be Base64 encoded or not.
# The token can include the "Negotiate" header and it will be stripped.
# Does not indicate if SEC_I_CONTINUE or SEC_E_OK was returned.
# Token returned is Base64 encoded w/ all new lines removed.
def complete_authentication(token)
raise "This object is no longer usable because its resources have been freed." if @cleaned_up
- # Nil token OK, just set it to empty string
+ # Nil token OK, just set it to empty string
token = "" if token.nil?
if token.include? "Negotiate"
@@ -278,17 +278,17 @@ def complete_authentication(token)
token = token.split(" ").last
end
- if token.include? B64_TOKEN_PREFIX
+ if token.include? B64_TOKEN_PREFIX
# indicates base64 encoded token
token = token.strip.unpack("m")[0]
end
-
+
outputBuffer = SecurityBuffer.new
- result = SSPIResult.new(API::InitializeSecurityContext.call(@credentials.to_p, @context.to_p, nil,
- REQUEST_FLAGS, 0, SECURITY_NETWORK_DREP, SecurityBuffer.new(token).to_p, 0,
+ result = SSPIResult.new(API::InitializeSecurityContext.call(@credentials.to_p, @context.to_p, nil,
+ REQUEST_FLAGS, 0, SECURITY_NETWORK_DREP, SecurityBuffer.new(token).to_p, 0,
@context.to_p,
outputBuffer.to_p, @contextAttributes, TimeStamp.new.to_p))
-
+
if result.ok? then
return encode_token(outputBuffer.token)
else
@@ -316,7 +316,7 @@ def get_credentials
@credentials = CredHandle.new
ts = TimeStamp.new
@identity = Identity.new @user, @domain
- result = SSPIResult.new(API::AcquireCredentialsHandle.call(nil, "Negotiate", SECPKG_CRED_OUTBOUND, nil, @identity.to_p,
+ result = SSPIResult.new(API::AcquireCredentialsHandle.call(nil, "Negotiate", SECPKG_CRED_OUTBOUND, nil, @identity.to_p,
nil, nil, @credentials.to_p, ts.to_p))
raise "Error acquire credentials: #{result}" unless result.ok?
end
View
6 ext/json/lib/json.rb
@@ -48,7 +48,7 @@
# * http://json.rubyforge.org
#
# == Usage
-#
+#
# To use JSON you can
# require 'json'
# to load the installed variant (either the extension 'json' or the pure
@@ -141,7 +141,7 @@
#
# JSON.parse json
# # => [1, 2, {"a"=>3.141}, false, true, nil, "4..10"]
-#
+#
# Note, that the range from the original data structure is a simple
# string now. The reason for this is, that JSON doesn't support ranges
# or arbitrary classes. In this case the json library falls back to call
@@ -170,7 +170,7 @@
# if the given class responds to the json_create class method. If so, it is
# called with the JSON object converted to a Ruby hash. So a range can
# be deserialised by implementing Range.json_create like this:
-#
+#
# class Range
# def self.json_create(o)
# new(*o['data'])
View
2  ext/json/lib/json/common.rb
@@ -160,7 +160,7 @@ def parse!(source, opts = {})
# * *indent*: a string used to indent levels (default: ''),
# * *space*: a string that is put after, a : or , delimiter (default: ''),
# * *space_before*: a string that is put before a : pair delimiter (default: ''),
- # * *object_nl*: a string that is put at the end of a JSON object (default: ''),
+ # * *object_nl*: a string that is put at the end of a JSON object (default: ''),
# * *array_nl*: a string that is put at the end of a JSON array (default: ''),
# * *check_circular*: true if checking for circular data structures
# should be done (the default), false otherwise.
View
32 ext/json/lib/json/editor.rb
@@ -48,14 +48,14 @@ def Editor.fetch_icon(name)
# Opens an error dialog on top of _window_ showing the error message
# _text_.
def Editor.error_dialog(window, text)
- dialog = MessageDialog.new(window, Dialog::MODAL,
- MessageDialog::ERROR,
+ dialog = MessageDialog.new(window, Dialog::MODAL,
+ MessageDialog::ERROR,
MessageDialog::BUTTONS_CLOSE, text)
dialog.show_all
dialog.run
rescue TypeError
- dialog = MessageDialog.new(Editor.window, Dialog::MODAL,
- MessageDialog::ERROR,
+ dialog = MessageDialog.new(Editor.window, Dialog::MODAL,
+ MessageDialog::ERROR,
MessageDialog::BUTTONS_CLOSE, text)
dialog.show_all
dialog.run
@@ -67,8 +67,8 @@ def Editor.error_dialog(window, text)
# message _text_. If yes was answered _true_ is returned, otherwise
# _false_.
def Editor.question_dialog(window, text)
- dialog = MessageDialog.new(window, Dialog::MODAL,
- MessageDialog::QUESTION,
+ dialog = MessageDialog.new(window, Dialog::MODAL,
+ MessageDialog::QUESTION,
MessageDialog::BUTTONS_YES_NO, text)
dialog.show_all
dialog.run do |response|
@@ -465,7 +465,7 @@ def create
add_separator
add_item("Append new node", ?a, &method(:append_new_node))
add_item("Insert new node before", ?i, &method(:insert_new_node))
- add_separator
+ add_separator
add_item("Collapse/Expand node (recursively)", ?e,
&method(:collapse_expand))
@@ -504,7 +504,7 @@ def open_location(item)
# Revert the current JSON document in the editor to the saved version.
def revert(item)
window.instance_eval do
- @filename and file_open(@filename)
+ @filename and file_open(@filename)
end
end
@@ -666,7 +666,7 @@ def collapsed_nodes(item)
collapse_all
else
self.expanded = true
- expand_all
+ expand_all
end
end
@@ -880,7 +880,7 @@ def ask_for_hash_pair(parent)
dialog.signal_connect(:'key-press-event', &DEFAULT_DIALOG_KEY_PRESS_HANDLER)
dialog.show_all
self.focus = dialog
- dialog.run do |response|
+ dialog.run do |response|
if response == Dialog::RESPONSE_ACCEPT
@key = key_input.text
type = ALL_TYPES[@type = type_input.active]
@@ -932,7 +932,7 @@ def ask_for_element(parent = nil, default_type = nil, value_text = @content)
dialog.signal_connect(:'key-press-event', &DEFAULT_DIALOG_KEY_PRESS_HANDLER)
dialog.show_all
self.focus = dialog
- dialog.run do |response|
+ dialog.run do |response|
if response == Dialog::RESPONSE_ACCEPT
type = types[type_input.active]
@content = case type
@@ -973,7 +973,7 @@ def ask_for_order
dialog.signal_connect(:'key-press-event', &DEFAULT_DIALOG_KEY_PRESS_HANDLER)
dialog.show_all
self.focus = dialog
- dialog.run do |response|
+ dialog.run do |response|
if response == Dialog::RESPONSE_ACCEPT
return @order = order_input.text, reverse_checkbox.active?
end
@@ -1008,7 +1008,7 @@ def ask_for_find_term(search = nil)
dialog.signal_connect(:'key-press-event', &DEFAULT_DIALOG_KEY_PRESS_HANDLER)
dialog.show_all
self.focus = dialog
- dialog.run do |response|
+ dialog.run do |response|
if response == Dialog::RESPONSE_ACCEPT
begin
return Regexp.new(regex_input.text, icase_checkbox.active? ? Regexp::IGNORECASE : 0)
@@ -1207,7 +1207,7 @@ def file_save
end
end
- # Save the current file as the filename
+ # Save the current file as the filename
def file_save_as
filename = select_file('Save as a JSON file')
store_file(filename)
@@ -1233,7 +1233,7 @@ def store_file(path)
rescue SystemCallError => e
Editor.error_dialog(self, "Failed to store JSON file: #{e}!")
end
-
+
# Load the file named _filename_ into the editor as a JSON document.
def load_file(filename)
if filename
@@ -1326,7 +1326,7 @@ def ask_for_location
dialog.signal_connect(:'key-press-event', &DEFAULT_DIALOG_KEY_PRESS_HANDLER)
dialog.show_all
- dialog.run do |response|
+ dialog.run do |response|
if response == Dialog::RESPONSE_ACCEPT
return @location = location_input.text
end
View
8 ext/json/lib/json/pure/generator.rb
@@ -86,7 +86,7 @@ def self.from_state(opts)
# * *indent*: a string used to indent levels (default: ''),
# * *space*: a string that is put after, a : or , delimiter (default: ''),
# * *space_before*: a string that is put before a : pair delimiter (default: ''),
- # * *object_nl*: a string that is put at the end of a JSON object (default: ''),
+ # * *object_nl*: a string that is put at the end of a JSON object (default: ''),
# * *array_nl*: a string that is put at the end of a JSON array (default: ''),
# * *check_circular*: true if checking for circular data structures
# should be done (the default), false otherwise.
@@ -148,13 +148,13 @@ def allow_nan?
end
# Returns _true_, if _object_ was already seen during this generating
- # run.
+ # run.
def seen?(object)
@seen.key?(object.__id__)
end
# Remember _object_, to find out if it was already encountered (if a
- # cyclic data structure is if a cyclic data structure is rendered).
+ # cyclic data structure is if a cyclic data structure is rendered).
def remember(object)
@seen[object.__id__] = true
end
@@ -300,7 +300,7 @@ def json_transform(state, depth)
json_shift(state, depth + 1) << value.to_json(state, depth + 1)
}.join(delim)
result << state.array_nl if state
- result << json_shift(state, depth)
+ result << json_shift(state, depth)
result << ']'
result
end
View
4 ext/json/lib/json/pure/parser.rb
@@ -39,7 +39,7 @@ class Parser < StringScanner
[^*/]| # normal chars
/[^*]| # slashes that do not start a nested comment
\*[^/]| # asterisks that do not end this comment
- /(?=\*/) # single slash before this comment's end
+ /(?=\*/) # single slash before this comment's end
)*
\*/ # the End of this comment
|[ \t\r\n]+ # whitespaces: space, horicontal tab, lf, cr
@@ -116,7 +116,7 @@ def parse
?n => "\n",
?r => "\r",
?t => "\t",
- ?u => nil,
+ ?u => nil,
})
def parse_string
View
6 ext/nkf/lib/kconv.rb
@@ -47,7 +47,7 @@ module Kconv
#
# Public Methods
#
-
+
# call-seq:
# Kconv.kconv(str, to_enc, from_enc=nil)
#
@@ -205,11 +205,11 @@ def kconv(to_enc, from_enc=nil)
form_enc = self.encoding if !from_enc && self.encoding != Encoding.list[0]
Kconv::kconv(self, to_enc, from_enc)
end
-
+
#
# to Encoding
#
-
+
# call-seq:
# String#tojis => string
#
View
8 ext/openssl/lib/openssl/x509-internal.rb
@@ -26,7 +26,7 @@ def create_extension(*arg)
end
def create_ext_from_array(ary)
- raise ExtensionError, "unexpected array form" if ary.size > 3
+ raise ExtensionError, "unexpected array form" if ary.size > 3
create_ext(ary[0], ary[1], ary[2])
end
@@ -36,12 +36,12 @@ def create_ext_from_string(str) # "oid = critical, value"
value.strip!
create_ext(oid, value)
end
-
+
def create_ext_from_hash(hash)
create_ext(hash["oid"], hash["value"], hash["critical"])
end
end
-
+
class Extension
def to_s # "oid = critical, value"
str = self.oid
@@ -49,7 +49,7 @@ def to_s # "oid = critical, value"
str << "critical, " if self.critical?
str << self.value.gsub(/\n/, ", ")
end
-
+
def to_h # {"oid"=>sn|ln, "value"=>value, "critical"=>true|false}
{"oid"=>self.oid,"value"=>self.value,"critical"=>self.critical?}
end
View
8 ext/pty/expect_sample.rb
@@ -12,9 +12,9 @@
fnames = []
PTY.spawn("ftp ftp.ruby-lang.org") do |r_f,w_f,pid|
w_f.sync = true
-
+
$expect_verbose = false
-
+
if !ENV['USER'].nil?
username = ENV['USER']
elsif !ENV['LOGNAME'].nil?
@@ -22,14 +22,14 @@
else
username = 'guest'
end
-
+
r_f.expect(/^(Name).*: |(word):|> /) do
w_f.puts($1 ? "ftp" : $2 ? "#{username}@" : "cd pub/ruby")
end
r_f.expect("> ") do
w_f.print "dir\n"
end
-
+
r_f.expect(/[^\-]> /) do |output|
for x in output[0].split("\n")
if x =~ /(ruby.*?\.tar\.gz)/ then
View
2  ext/pty/script.rb
@@ -18,7 +18,7 @@
w_pty.flush
end
end
-
+
begin
while true
c = r_pty.sysread(512)
View
2  ext/ripper/lib/ripper/lexer.rb
@@ -173,7 +173,7 @@ def match(n = 0)
@tokens[@match.begin(n)...@match.end(n)].map {|pos,type,str| str }
end
end
-
+
end
end
View
2  ext/socket/lib/socket.rb
@@ -388,7 +388,7 @@ def self.tcp_server_sockets(host=nil, port)
# yield socket and client address for each a connection accepted via given sockets.
#
# The arguments are a list of sockets.
- # The individual argument should be a socket or an array of sockets.
+ # The individual argument should be a socket or an array of sockets.
#
# This method yields the block sequentially.
# It means that the next connection is not accepted until the block returns.
View
16 ext/socket/mkconstants.rb
@@ -417,14 +417,14 @@ def def_intern(func_name, pat, prefix_optional=nil)
MSG_HAVEMORE
MSG_RCVMORE
MSG_COMPAT
-MSG_PROXY
-MSG_FIN
-MSG_SYN
-MSG_CONFIRM
-MSG_RST
-MSG_ERRQUEUE
-MSG_NOSIGNAL
-MSG_MORE
+MSG_PROXY
+MSG_FIN
+MSG_SYN
+MSG_CONFIRM
+MSG_RST
+MSG_ERRQUEUE
+MSG_NOSIGNAL
+MSG_MORE
SOL_SOCKET