/usr/share/gauche-0.9/0.9.4/lib/dbm/restore is in gauche-gdbm 0.9.4-3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 | ;; -*- mode:scheme -*-
;;
;; A script to restore dbm content
;;
;; Usage: gosh dbm/restore [-i <infile>][-t <type>] <dbmname>
;;
(use gauche.parseopt)
(use dbm)
(use util.match)
(use file.filter)
(define (main args)
(let-args (cdr args) ([ifile "i=s" #f]
[type "t=y" 'gdbm]
[else _ (usage)]
. args)
(let1 class (dbm-type->class type)
(unless class (exit 1 "dbm type `~a' unknown" type))
(match args
[(dbmname) (do-dump dbmname class (or ifile (current-input-port)))]
[else (usage)]))
0))
(define (usage)
(print "Usage: gosh dbm/restore [-i infile][-t type] dbmname")
(exit 0))
(define (do-dump name class input)
(let1 dbm (guard (e [else (exit 1 "couldn't create dbm database: ~a"
(~ e'message))])
(dbm-open class :path name :rw-mode :create))
(file-filter
(^(in out)
(port-for-each
(^p (if (and (pair? p)
(string? (car p))
(string? (cdr p)))
(dbm-put! dbm (car p) (cdr p))
(warn "invalid entry in input ignored: ~,,,,65s" p)))
(cut read in)))
:input input)
(dbm-close dbm)))
|