/usr/share/scsh-0.6/scsh/db.scm is in scsh-common-0.6 0.6.7-8.
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 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 | ;;; Very vanilla DBM processing code
;;; Copyright (c) 1995 by David Albertz (dalbertz@clark.lcs.mit.edu).
;;; See file COPYING
;;; This is just a straight translation of the UNIX freebie NDBM code.
;;; Usage: (db-open name flags mode type info)
;;; name := name of database file (no extension)
;;; flags := file access flags (open/create etc.)
;;; mode := file access modes (privileges)
;;; type := DBTYPE as defined in db.h (btree, hash, recno)
;;; info := access method specific structure
;;; (NULL gives defaults)
;;; Return: Alien value pointer to the open DBM structure
;;; Usage: (dbm-close db)
;;; db := The pointer returned by dbm-open
;;; Return: Always returns 0
;;; Usage: (dbm-fetch db key)
;;; db := The pointer returned by dbm-open
;;; key := The key value of data to be retrieved
;;; Return: String containing data associated with key
;;; Usage: (dbm-store db key data flag)
;;; db := The pointer returned by dbm-open
;;; key := The key value to be associated with data
;;; data := The data to be stored with the key
;;; flag := 0 for insert, 1 for replace
;;; Return: Integer returned by UNIX dbm_store routine
;;; Usage: (dbm-delete db key)
;;; db := The pointer returned by dbm-open
;;; key := The key value of data to be deleted
;;; Return: Integer returned by UNIX dbm_delete routine
;;; Usage: (dbm-firstkey db)
;;; db := The pointer returned by dbm-open
;;; Return: First key value stored in database hash table.
;;; Usage: (dbm-nextkey db)
;;; db := The pointer returned by dbm-open
;;; Return: Next key value stored in database hash table.
;;; Usage: (dbm-error db)
;;; db := The pointer returned by dbm-open
;;; Return: Error number returned by UNIX dbm_error routine
;;; Usage: (dbm-clearerr db)
;;; db := The pointer returned by dbm-open
;;; Return: Clears any database error condition and returns the
;;; integer from the UNIX dbm_clearerr routine
;;; ***NOTE: All key and data elements must be strings
;;; Scheme48 implementation.
(foreign-source
"#include <sys/types.h>"
"#include <limits.h>"
"#include <db.h>"
""
"extern int errno;"
""
"#define errno_or_false(x) (((x) == -1) ? s48_enter_integer(errno) : S48_FALSE)"
"" "")
(define-foreign %db-open (db_open (string file)
(integer flags)
(integer mode)
(integer type))
(to-scheme integer errno_or_false) ; error flag
(C DB**)) ; DBM structure
(define (db-open file flags mode type)
(receive (err dbm) (%db-open file flags mode type)
(if err
(errno-error err db-open)
dbm)))
|