summaryrefslogtreecommitdiff
path: root/sample
diff options
context:
space:
mode:
Diffstat (limited to 'sample')
-rw-r--r--sample/Artistic117
-rw-r--r--sample/MANIFEST63
-rw-r--r--sample/biorhythm.rb201
-rw-r--r--sample/blk.rb8
-rw-r--r--sample/clone.rb2
-rw-r--r--sample/dir.rb2
-rw-r--r--sample/evaldef.rb2
-rw-r--r--sample/export.rb6
-rw-r--r--sample/exyacc.rb22
-rw-r--r--sample/gctest2.rb71
-rw-r--r--sample/list.rb19
-rw-r--r--sample/list2.rb6
-rw-r--r--sample/list3.rb6
-rw-r--r--sample/rcs.awk33
-rw-r--r--sample/rcs.dat17
-rw-r--r--sample/rcs.rb49
-rw-r--r--sample/sieve.rb3
-rwxr-xr-xsample/uumerge.rb6
18 files changed, 593 insertions, 40 deletions
diff --git a/sample/Artistic b/sample/Artistic
new file mode 100644
index 00000000000..fbf79897758
--- /dev/null
+++ b/sample/Artistic
@@ -0,0 +1,117 @@
+
+
+
+
+ The "Artistic License"
+
+ Preamble
+
+The intent of this document is to state the conditions under which a
+Package may be copied, such that the Copyright Holder maintains some
+semblance of artistic control over the development of the package,
+while giving the users of the package the right to use and distribute
+the Package in a more-or-less customary fashion, plus the right to make
+reasonable modifications.
+
+Definitions:
+
+ "Package" refers to the collection of files distributed by the
+ Copyright Holder, and derivatives of that collection of files
+ created through textual modification.
+
+ "Standard Version" refers to such a Package if it has not been
+ modified, or has been modified in accordance with the wishes
+ of the Copyright Holder.
+
+ "Copyright Holder" is whoever is named in the copyright or
+ copyrights for the package.
+
+ "You" is you, if you're thinking about copying or distributing
+ this Package.
+
+ "Reasonable copying fee" is whatever you can justify on the
+ basis of media cost, duplication charges, time of people involved,
+ and so on. (You will not be required to justify it to the
+ Copyright Holder, but only to the computing community at large
+ as a market that must bear the fee.)
+
+ "Freely Available" means that no fee is charged for the item
+ itself, though there may be fees involved in handling the item.
+ It also means that recipients of the item may redistribute it
+ under the same conditions they received it.
+
+1. You may make and give away verbatim copies of the source form of the
+Standard Version of this Package without restriction, provided that you
+duplicate all of the original copyright notices and associated disclaimers.
+
+2. You may apply bug fixes, portability fixes and other modifications
+derived from the Public Domain or from the Copyright Holder. A Package
+modified in such a way shall still be considered the Standard Version.
+
+3. You may otherwise modify your copy of this Package in any way, provided
+that you insert a prominent notice in each changed file stating how and
+when you changed that file, and provided that you do at least ONE of the
+following:
+
+ a) place your modifications in the Public Domain or otherwise make them
+ Freely Available, such as by posting said modifications to Usenet or
+ an equivalent medium, or placing the modifications on a major archive
+ site such as uunet.uu.net, or by allowing the Copyright Holder to include
+ your modifications in the Standard Version of the Package.
+
+ b) use the modified Package only within your corporation or organization.
+
+ c) rename any non-standard executables so the names do not conflict
+ with standard executables, which must also be provided, and provide
+ a separate manual page for each non-standard executable that clearly
+ documents how it differs from the Standard Version.
+
+ d) make other distribution arrangements with the Copyright Holder.
+
+4. You may distribute the programs of this Package in object code or
+executable form, provided that you do at least ONE of the following:
+
+ a) distribute a Standard Version of the executables and library files,
+ together with instructions (in the manual page or equivalent) on where
+ to get the Standard Version.
+
+ b) accompany the distribution with the machine-readable source of
+ the Package with your modifications.
+
+ c) accompany any non-standard executables with their corresponding
+ Standard Version executables, giving the non-standard executables
+ non-standard names, and clearly documenting the differences in manual
+ pages (or equivalent), together with instructions on where to get
+ the Standard Version.
+
+ d) make other distribution arrangements with the Copyright Holder.
+
+5. You may charge a reasonable copying fee for any distribution of this
+Package. You may charge any fee you choose for support of this Package.
+You may not charge a fee for this Package itself. However,
+you may distribute this Package in aggregate with other (possibly
+commercial) programs as part of a larger (possibly commercial) software
+distribution provided that you do not advertise this Package as a
+product of your own.
+
+6. The scripts and library files supplied as input to or produced as
+output from the programs of this Package do not automatically fall
+under the copyright of this Package, but belong to whomever generated
+them, and may be sold commercially, and may be aggregated with this
+Package.
+
+7. C subroutines supplied by you and linked into this Package in order
+to emulate subroutines and variables of the language defined by this
+Package shall not be considered part of this Package, but are the
+equivalent of input as in Paragraph 6, provided these subroutines do
+not change the language in any way that would cause it to fail the
+regression tests for the language.
+
+8. The name of the Copyright Holder may not be used to endorse or promote
+products derived from this software without specific prior written permission.
+
+9. THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR
+IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
+WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+
+ The End
diff --git a/sample/MANIFEST b/sample/MANIFEST
new file mode 100644
index 00000000000..c54adf31ef5
--- /dev/null
+++ b/sample/MANIFEST
@@ -0,0 +1,63 @@
+MANIFEST
+Artistic
+aset.rb
+attr.rb
+biorhythm.rb
+blk.rb
+case.rb
+cat.rb
+cat2.rb
+cbreak.rb
+clnt.rb
+clone.rb
+const.rb
+dbm.rb
+dir.rb
+evaldef.rb
+export.rb
+exyacc.rb
+fib.awk
+fib.pl
+fib.rb
+fib.scm
+freq.rb
+fullpath.pl
+fullpath.rb
+gctest.rb
+gctest2.rb
+getopts.rb
+getopts.test
+hash.rb
+io.rb
+less.rb
+list.rb
+list2.rb
+list3.rb
+math.rb
+mpart.rb
+occur.pl
+occur.rb
+occur2.rb
+opt_s.rb
+opt_x.rb
+parsearg.rb
+rcs.awk
+rcs.dat
+rcs.rb
+ruby-mode.el
+samp.rb
+sieve.rb
+split.rb
+struct.rb
+svr.rb
+system.rb
+t1.rb
+t2.rb
+test.rb
+time.rb
+trap.pl
+trap.rb
+trojan.pl
+trojan.rb
+tt.rb
+uumerge.rb
diff --git a/sample/biorhythm.rb b/sample/biorhythm.rb
new file mode 100644
index 00000000000..eb14ca73654
--- /dev/null
+++ b/sample/biorhythm.rb
@@ -0,0 +1,201 @@
+#!/mp/free/bin/ruby
+#
+# biorhythm.rb -
+# $Release Version: $
+# $Revision: 1.6 $
+# $Date: 1994/02/24 10:23:34 $
+# by Yasuo OHBA(STAFS Development Room)
+#
+# --
+#
+#
+#
+
+$RCS_ID="$Header: /var/ohba/RCS/biorhythm.rb,v 1.6 1994/02/24 10:23:34 ohba Exp ohba $"
+
+include Math
+load("parsearg.rb")
+
+$wochentag = ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday" ]
+monatstag1 = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]
+monatstag2 = [31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]
+
+def usage()
+ print("Usage:\n")
+ print("biorhythm.rb [options]\n")
+ print(" options...\n")
+ print(" -D YYYYMMDD(birthday) : すべて default 値を使う. \n")
+ print(" --sdate | --date YYYYMMDD : system date もしくは指定した日付を使う.\n")
+ print(" --birthday YYYYMMDD : 誕生日の指定をする. \n")
+ print(" -v | -g : Values or Graph の指定. \n")
+ print(" --days DAYS : 期間の指定をする(Graph の時のみ有効). \n")
+ print(" --help : help\n")
+end
+$USAGE = 'usage'
+
+def leapyear(y)
+ ta = 0
+ if ((y % 4.0) == 0); ta = 1; end
+ if ((y % 100.0) == 0); ta = 0; end
+ if ((y % 400.0) == 0); ta = 1; end
+ return ta
+end
+
+def bcalc(tt, m, j)
+ ta = 0
+ if (m <= 2)
+ ta = (m - 1) * 31
+ else
+ ta = leapyear(j)
+ ta = ta + ((306 * m - 324) / 10.0).to_i
+ end
+ ta = ta + (j - 1) * 365 + ((j - 1) / 4.0).to_i
+ ta = ta - ((j - 1) / 100) + ((j - 1) / 400.0).to_i
+ ta = ta + tt
+ return ta
+end
+
+def printHeader(tg, mg, jg, gtag, tage)
+ print("\n")
+ print(" Biorhythm\n")
+ print(" =========\n")
+ print("\n")
+ printf("The birthday %04d.%02d.%02d is a %s\n", jg, mg, tg, $wochentag[gtag])
+ printf("Age in days: [%d]\n", tage)
+end
+
+def getPosition(z)
+ pi = 3.14159265
+ $phys = (50.0 * (1.0 + sin((z / 23.0 - (z / 23)) * 360.0 * pi / 180.0))).to_i
+ $emot = (50.0 * (1.0 + sin((z / 28.0 - (z / 28)) * 360.0 * pi / 180.0))).to_i
+ $geist =(50.0 * (1.0 + sin((z / 33.0 - (z / 33)) * 360.0 * pi / 180.0))).to_i
+end
+
+#
+# main program
+#
+parseArgs(0, nil, "vg", "D:", "sdate", "date:", "birthday:", "days:")
+
+printf($stderr, "\n")
+printf($stderr, "Biorhythm (c) 1987-1994 V3.0\n")
+printf($stderr, "\n")
+if ($OPT_D)
+ dtmp = Time.now.strftime("%Y%m%d")
+ jh = dtmp[0,4].to_i
+ mh = dtmp[4,2].to_i
+ th = dtmp[6,2].to_i
+ dtmp = $OPT_D
+ jg = dtmp[0,4].to_i
+ mg = dtmp[4,2].to_i
+ tg = dtmp[6,2].to_i
+ gtag = bcalc(tg, mg, jg) % 7
+ ausgabeart = "g"
+else
+ if ($OPT_birthday)
+ dtmp = $OPT_birthday
+ else
+ printf($stderr, "Birthday (YYYYMMDD) : ")
+ dtmp = $stdin.gets.chop
+ end
+ if (dtmp.length != 8)
+ printf($stderr, "BAD Input Birthday!!\n")
+ exit()
+ end
+ jg = dtmp[0,4].to_i
+ mg = dtmp[4,2].to_i
+ tg = dtmp[6,2].to_i
+
+ gtag = bcalc(tg, mg, jg) % 7
+
+ if ($OPT_sdate)
+ dtmp = Time.now.strftime("%Y%m%d")
+ elsif ($OPT_date)
+ dtmp = $OPT_date
+ else
+ printf($stderr, "Date [<RETURN> for Systemdate] (YYYYMMDD) : ")
+ dtmp = $stdin.gets.chop
+ end
+ if (dtmp.length != 8)
+ dtmp = Time.now.strftime("%Y%m%d")
+ end
+ jh = dtmp[0,4].to_i
+ mh = dtmp[4,2].to_i
+ th = dtmp[6,2].to_i
+
+ if ($OPT_v)
+ ausgabeart = "v"
+ elsif ($OPT_g)
+ ausgabeart = "g"
+ else
+ printf($stderr, "Values for today or Graph (v/g) [default g] : ")
+ ausgabeart = $stdin.gets.chop
+ end
+end
+if (ausgabeart == "v")
+ tag = bcalc(tg, mg, jg)
+ tah = bcalc(th, mh, jh)
+ tage = tah - tag
+ printHeader(tg, mg, jg, gtag, tage)
+ print("\n")
+
+ getPosition(tage)
+ printf("Biorhythm: %04d.%02d.%02d\n", jh, mh, th)
+ printf("Physical: %d%%\n", $phys)
+ printf("Emotional: %d%%\n", $emot)
+ printf("Mental: %d%%\n", $geist)
+ print("\n")
+else
+ if ($OPT_days)
+ ktage = $OPT_days.to_i
+ else
+ if ($OPT_D)
+ ktage = 9
+ else
+ printf($stderr, "Graph for how many days [default 10] : ")
+ ktage = $stdin.gets.chop
+ if (ktage == "")
+ ktage = 9
+ else
+ ktage = ktage.to_i - 1
+ end
+ end
+ end
+ tag = bcalc(tg, mg, jg)
+ tah = bcalc(th, mh, jh)
+ tage = tah - tag
+ printHeader(tg, mg, jg, gtag, tage)
+ print(" P=physical, E=emotional, M=mental\n")
+ print(" -------------------------+-------------------------\n")
+ print(" Bad Condition | Good Condition\n")
+ print(" -------------------------+-------------------------\n")
+
+ for z in tage..(tage + ktage)
+ getPosition(z)
+
+ printf("%04d.%02d.%02d : ", jh, mh, th)
+ p = ($phys / 2.0 + 0.5).to_i
+ e = ($emot / 2.0 + 0.5).to_i
+ g = ($geist / 2.0 + 0.5).to_i
+ graph = "." * 51
+ graph[25] = ?|
+ graph[p] = ?P
+ graph[e] = ?E
+ graph[g] = ?M
+ print(graph, "\n")
+ th = th + 1
+ if (leapyear(jh) == 0)
+ $MONATSTAG = monatstag1
+ else
+ $MONATSTAG = monatstag2
+ end
+ if (th > $MONATSTAG[mh - 1])
+ mh = mh + 1
+ th = 1
+ end
+ if (mh > 12)
+ jh = jh + 1
+ mh = 1
+ end
+ end
+ print(" -------------------------+-------------------------\n\n")
+end
diff --git a/sample/blk.rb b/sample/blk.rb
index 4e618bce2d2..12d1038fd09 100644
--- a/sample/blk.rb
+++ b/sample/blk.rb
@@ -2,8 +2,8 @@ def foo()
$block = Block.new
end
-foo(){i | print "i = ", i, "\n"}
-$block.do(2)
+foo(){i| print "i = ", i, "\n"}
+$block.call(2)
-foo(){i | print "i*2 = ", i*2, "\n"}
-$block.do(2)
+foo(){i| print "i*2 = ", i*2, "\n"}
+$block.call(2)
diff --git a/sample/clone.rb b/sample/clone.rb
index 69d2f1d52b8..e7d6b00a314 100644
--- a/sample/clone.rb
+++ b/sample/clone.rb
@@ -3,7 +3,7 @@
# test2
# test
# test
-# clone.rb:13: undefined method `test2' for "#<Object: 0xbfca4>"(Object)
+# clone.rb:18: undefined method `test2' for "#<Object: 0xbfca4>"(Object)
foo = Object.new
def foo.test
print("test\n")
diff --git a/sample/dir.rb b/sample/dir.rb
index f269c568bab..3349dc7b6d4 100644
--- a/sample/dir.rb
+++ b/sample/dir.rb
@@ -3,7 +3,7 @@
dirp = Dir.open(".")
dirp.rewind
for f in dirp
- unless (~/^\./ || ~/~$/ || ~/\.o/)
+ if !(~/^\./ || ~/~$/ || ~/\.o/)
print f, "\n"
end
end
diff --git a/sample/evaldef.rb b/sample/evaldef.rb
index 021f65800a3..1d77a3c0080 100644
--- a/sample/evaldef.rb
+++ b/sample/evaldef.rb
@@ -1,7 +1,7 @@
# method definition by eval()
# output:
# bar
-# (eval):21: method `baz' not available for "#<foo: 0xbfc5c>"(foo)
+# (eval):26: method `baz' not available for "#<foo: 0xbfc5c>"(foo)
class foo
def foo
diff --git a/sample/export.rb b/sample/export.rb
index be7b6bc797e..03b9492e5a6 100644
--- a/sample/export.rb
+++ b/sample/export.rb
@@ -4,7 +4,7 @@
# foo
class foo
- export(\printf)
+ export :printf
end
def foobar
@@ -12,7 +12,7 @@ def foobar
end
f = foo.new
-#foo.unexport(\printf)
-foo.export(\foobar)
+#foo.unexport :printf
+foo.export :foobar
f.foobar
f.printf "%s\n", foo
diff --git a/sample/exyacc.rb b/sample/exyacc.rb
new file mode 100644
index 00000000000..ad6191c03d0
--- /dev/null
+++ b/sample/exyacc.rb
@@ -0,0 +1,22 @@
+#! /usr/local/bin/ruby -Cn
+# usage: exyacc.rb [yaccfiles]
+# this is coverted from exyacc.pl in the camel book
+
+$/ = nil
+
+while gets()
+ sbeg = $_.index("\n%%") + 1
+ send = $_.rindex("\n%%") + 1
+ $_ = $_[sbeg, send-sbeg]
+ sub(/.*\n/, "")
+ gsub(/'{'/, "'\001'")
+ gsub(/'}'/, "'\002'")
+ gsub('\*/', "\003\003")
+ gsub("/\\*[^\003]*\003\003", '')
+ while gsub(/{[^}{]*}/, ''); end
+ gsub(/'\001'/, "'{'")
+ gsub(/'\002'/, "'}'")
+ while gsub(/^[ \t]*\n(\s)/, '\1'); end
+ gsub(/([:|])[ \t\n]+(\w)/, '\1 \2')
+ print $_
+end
diff --git a/sample/gctest2.rb b/sample/gctest2.rb
new file mode 100644
index 00000000000..851d14f2177
--- /dev/null
+++ b/sample/gctest2.rb
@@ -0,0 +1,71 @@
+# GC stress test
+def cons(car, cdr)
+ car::cdr
+end
+
+def car(x)
+ x.car
+end
+
+def cdr(x)
+ x.cdr
+end
+
+def reverse1(x, y)
+ if x == nil then
+ y
+ else
+ reverse1(cdr(x), cons(car(x), y))
+ end
+end
+
+def reverse(x)
+ reverse1(x, nil)
+end
+
+def ints(low, up)
+ if low > up
+ nil
+ else
+ cons(low, ints(low+1, up))
+ end
+end
+
+def print_int_list(x)
+ if x == nil
+ print("NIL\n")
+ else
+ print(car(x))
+ if cdr(x)
+ print(", ")
+ print_int_list(cdr(x))
+ else
+ print("\n")
+ end
+ end
+end
+
+print("start\n")
+
+a = ints(1, 100)
+print_int_list(a)
+b = ints(1, 50)
+print_int_list(b)
+print_int_list(reverse(a))
+print_int_list(reverse(b))
+for i in 1 .. 100
+ b = reverse(reverse(b))
+# print(i, ": ")
+# print_int_list(b)
+end
+print("a: ")
+print_int_list(a)
+print("b: ")
+print_int_list(b)
+print("reverse(a): ")
+print_int_list(reverse(a))
+print("reverse(b): ")
+print_int_list(reverse(b))
+a = b = nil
+print("finish\n")
+GC.start()
diff --git a/sample/list.rb b/sample/list.rb
index 1a20c954d0d..fa145f46277 100644
--- a/sample/list.rb
+++ b/sample/list.rb
@@ -1,19 +1,10 @@
# Linked list example
class MyElem
- #クラスメソッド(相当)の定義
- def MyElem.new(item)
- # スーパークラスのメソッドの呼び出し(この場合はクラスClass)
- elm = super # 変数宣言は要らない
- #elmに対するメソッドの呼び出し
- elm.init(item)
- end
-
- # 通常のメソッド定義
- def init(item)
+ # オブジェクト生成時に自動的に呼ばれるメソッド
+ def init_object(item)
# @変数はインスタンス変数(宣言は要らない)
@data = item
@next = nil
- self
end
def data
@@ -63,11 +54,7 @@ class MyList
end
class Point
- def Point.new(x, y)
- super.init(x, y)
- end
-
- def init(x, y)
+ def init_object(x, y)
@x = x; @y = y
self
end
diff --git a/sample/list2.rb b/sample/list2.rb
index fef9d35a841..1c2ca08150e 100644
--- a/sample/list2.rb
+++ b/sample/list2.rb
@@ -1,10 +1,6 @@
# Linked list example -- short version
class Point
- def Point.new(x, y)
- super.init(x, y)
- end
-
- def init(x, y)
+ def init_object(x, y)
@x = x; @y = y
self
end
diff --git a/sample/list3.rb b/sample/list3.rb
index c6278574bf9..6bedc6ced98 100644
--- a/sample/list3.rb
+++ b/sample/list3.rb
@@ -2,11 +2,7 @@
# using _inspect
class Point
- def Point.new(x, y)
- super.init(x, y)
- end
-
- def init(x, y)
+ def init_object(x, y)
@x = x; @y = y
self
end
diff --git a/sample/rcs.awk b/sample/rcs.awk
new file mode 100644
index 00000000000..08979285c92
--- /dev/null
+++ b/sample/rcs.awk
@@ -0,0 +1,33 @@
+BEGIN {
+ sw = 40.0;
+ dw = 78.0;
+ hdw = dw / 2.0;
+ w = 20.0;
+ h =1.0;
+ d = 0.2;
+ ss="abcdefghijklmnopqrstuvwxyz0123456789!#$%^&*()-=\\[];'`,./";
+ rnd = srand();
+}
+
+{
+ xr = -hdw; y = h * 1.0; maxxl = -999;
+ s = "";
+ while (xr < hdw) {
+ x = xr * (1 + y) - y * w / 2;
+ i = (x / (1 + h) + sw /2);
+ c = (0 < i && i < length($0)) ? substr($0, i, 1) : "0";
+ y = h - d * c;
+ xl = xr - w * y / (1 + y);
+ if (xl < -hdw || xl >= hdw || xl <= maxxl) {
+ t = rand() * length(ss);
+ c = substr(ss, t, 1);
+ }
+ else {
+ c = substr(s, xl + hdw, 1);
+ maxxl = xl;
+ }
+ s = s c;
+ xr = xr + 1;
+ }
+ print s;
+}
diff --git a/sample/rcs.dat b/sample/rcs.dat
new file mode 100644
index 00000000000..61c88bff893
--- /dev/null
+++ b/sample/rcs.dat
@@ -0,0 +1,17 @@
+0000000000000000220000000000000000
+0000000000000111221110000000000000
+0000000000111112222111110000000000
+0000000111111112222111111110000000
+0000111111111122222211111111110000
+0111111111111222222221111111111110
+2222222222222222222222222222222222
+1122222222222222222222222222222211
+0111122222222222222222222222211110
+0011111122222222222222222211111100
+0001111111222222222222221111111000
+0000111112222222222222222111110000
+0000011122222222112222222211100000
+0000001122222221111222222211000000
+0000000122221111111111222210000000
+0000000221111111111111111220000000
+0000000000000000000000000000000000
diff --git a/sample/rcs.rb b/sample/rcs.rb
new file mode 100644
index 00000000000..faa46067880
--- /dev/null
+++ b/sample/rcs.rb
@@ -0,0 +1,49 @@
+# random dot steraogram
+# usage: rcs.rb rcs.dat
+
+sw = 40.0 # p^[
+dw = 78.0 # Random Character Streogram
+hdw = dw / 2.0
+w = 20.0 #
+h =1.0 #
+d = 0.2 # P
+ss="abcdefghijklmnopqrstuvwxyz0123456789!#$%^&*()-=\\[];'`,./"
+rnd = srand()
+
+while gets()
+# print($_)
+ xr = -hdw; y = h * 1.0; maxxl = -999
+ s = "";
+ while xr < hdw
+ x = xr * (1 + y) - y * w / 2
+ i = (x / (1 + h) + sw /2)
+ if (1 < i && i < $_.length);
+ c = $_[i, 1].to_i
+ else
+ c = 0
+ end
+ y = h - d * c
+ xl = xr - w * y / (1 + y);
+ if xl < -hdw || xl >= hdw || xl <= maxxl
+ tt = rand(ss.length)
+ c = ss[tt, 1]
+ else
+ c = s[xl + hdw, 1]
+ maxxl = xl
+ end
+ s += c
+ xr += 1
+ end
+ print(s, "\n")
+end
+
+
+
+
+
+
+
+
+
+
+
diff --git a/sample/sieve.rb b/sample/sieve.rb
index 192a5865d8a..eaf4e33e2cd 100644
--- a/sample/sieve.rb
+++ b/sample/sieve.rb
@@ -1,6 +1,6 @@
# sieve of Eratosthenes
sieve = []
-unless max = $ARGV.shift; max = 100; end
+if ! max = $ARGV.shift; max = 100; end
max = max.to_i
print "1"
@@ -15,3 +15,4 @@ for i in 2 .. max
resque
end
end
+print "\n"
diff --git a/sample/uumerge.rb b/sample/uumerge.rb
index 420a3924b67..d0bd016036a 100755
--- a/sample/uumerge.rb
+++ b/sample/uumerge.rb
@@ -8,7 +8,7 @@ while gets()
end
end
-fail "missing begin" unless $sawbegin;
+fail "missing begin" if !$sawbegin;
OUT = open($file, "w") if $file != "";
while gets()
@@ -18,10 +18,10 @@ while gets()
end
sub(/[a-z]+$/, ""); # handle stupid trailing lowercase letters
continue if /[a-z]/
- continue unless ((($_[0] - 32) & 077) + 2) / 3 == $_.length / 4
+ continue if !(((($_[0] - 32) & 077) + 2) / 3 == $_.length / 4)
OUT << $_.unpack("u");
end
-fail "missing end" unless $sawend;
+fail "missing end" if ! $sawend;
File.chmod $mode.oct, $file;
exit 0;