e9b9e48e93
Submitted by Jeremy Evans (MAINTAINER), thanks.
35 lines
1.1 KiB
Plaintext
35 lines
1.1 KiB
Plaintext
$OpenBSD: patch-rubynative_estcmd_rb,v 1.2 2007/04/30 17:30:40 bernd Exp $
|
|
--- rubynative/estcmd.rb.orig Tue Feb 20 00:13:15 2007
|
|
+++ rubynative/estcmd.rb Thu Apr 12 14:42:29 2007
|
|
@@ -1,4 +1,4 @@
|
|
-#! /usr/bin/ruby -w
|
|
+#! /usr/bin/env ruby
|
|
#--
|
|
# Ruby binding of Hyper Estraier
|
|
# Copyright (C) 2004-2007 Mikio Hirabayashi
|
|
@@ -373,6 +373,12 @@ end
|
|
|
|
# perform the put command
|
|
def procput(dbname, file, opts)
|
|
+ db = Database::new
|
|
+ unless db.open(dbname, Database::DBWRITER | Database::DBCREAT)
|
|
+ printerror(dbname + ": " + db.err_msg(db.error))
|
|
+ return 1
|
|
+ end
|
|
+
|
|
if file
|
|
begin
|
|
ifp = open(file, "rb")
|
|
@@ -388,11 +394,6 @@ def procput(dbname, file, opts)
|
|
draft = STDIN.read
|
|
end
|
|
doc = Document::new(draft)
|
|
- db = Database::new
|
|
- unless db.open(dbname, Database::DBWRITER | Database::DBCREAT)
|
|
- printerror(dbname + ": " + db.err_msg(db.error))
|
|
- return 1
|
|
- end
|
|
db.set_informer(Informer::new)
|
|
unless db.put_doc(doc, opts)
|
|
printerror(dbname + ": " + db.err_msg(db.error))
|