35 lines
1.0 KiB
Plaintext
35 lines
1.0 KiB
Plaintext
$OpenBSD: patch-rubynative_estcmd_rb,v 1.3 2012/09/21 13:17:46 jasper 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
|
|
+#! ${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))
|