projects
/
mspang
/
plceo1.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
52bafec
)
Use tie instead of dbmopen for the library database
author
ceo
<ceo>
Thu, 24 Oct 1996 18:24:07 +0000
(18:24 +0000)
committer
ceo
<ceo>
Thu, 24 Oct 1996 18:24:07 +0000
(18:24 +0000)
Gopher.pl
patch
|
blob
|
history
lib_sys.pl
patch
|
blob
|
history
diff --git
a/Gopher.pl
b/Gopher.pl
index
84bd26f
..
b9a3da9
100644
(file)
--- a/
Gopher.pl
+++ b/
Gopher.pl
@@
-3,9
+3,13
@@
# ---- ---- ------------
# 94/11/20 Alex Brodsky Split off from main ceo file
# 96/10/23 Nikita Borisov Use dbmtie instead of fakedbm
# ---- ---- ------------
# 94/11/20 Alex Brodsky Split off from main ceo file
# 96/10/23 Nikita Borisov Use dbmtie instead of fakedbm
+# 96/10/24 Nikita Borisov Use tie instead of dbmopen for $LIBDB
#
#
#
#
+use NDBM_File;
+use Fcntl;
+
sub Gopher_Quota
{
local($useQUOTALOG) = $QUOTALOG;
sub Gopher_Quota
{
local($useQUOTALOG) = $QUOTALOG;
@@
-94,7
+98,7
@@
sub Gopher_Members
sub Gopher_Outstanding
{
## Read the library file
sub Gopher_Outstanding
{
## Read the library file
-
dbmopen(LIB, $LIBDB
, 0600) || do
+
tie(%LIB, NDBM_File, $LIBDB, O_RDONLY
, 0600) || do
{
print "\n${beep}Error opening library database: $!\n";
return;
{
print "\n${beep}Error opening library database: $!\n";
return;
@@
-108,7
+112,7
@@
sub Gopher_Outstanding
($bodate) = $LIB{$bid} =~ /D\{([^\}]*)\}/;
$Outstand{$bid}="$whohas#$btitle#$bodate";
}
($bodate) = $LIB{$bid} =~ /D\{([^\}]*)\}/;
$Outstand{$bid}="$whohas#$btitle#$bodate";
}
-
dbmclose(
LIB);
+
untie(%
LIB);
eval { dbmtie($MEMDB,\%MEM) } || do
{
eval { dbmtie($MEMDB,\%MEM) } || do
{
diff --git
a/lib_sys.pl
b/lib_sys.pl
index
63a1a95
..
51df4eb
100644
(file)
--- a/
lib_sys.pl
+++ b/
lib_sys.pl
@@
-8,11
+8,12
@@
# use that format. Should really
# replace them with 'tie' sometime
# soon.
# use that format. Should really
# replace them with 'tie' sometime
# soon.
-#
+#
96/10/24 Nikita Borisov 'soon' came sooner than expected
#
require "/u/ceo/ceo/isbn.pl";
use NDBM_File;
#
require "/u/ceo/ceo/isbn.pl";
use NDBM_File;
+use Fcntl;
sub librarymenu
{
sub librarymenu
{
@@
-63,7
+64,7
@@
sub dobookin
last;
}
last;
}
-
dbmopen(LIB, $LIBDB
, 0600) || do
+
tie(%LIB, NDBM_File, $LIBDB, O_RDWR
, 0600) || do
{
print "\n${beep}Error opening library database: $!\n";
return;
{
print "\n${beep}Error opening library database: $!\n";
return;
@@
-81,7
+82,7
@@
sub dobookin
($btitle) = $LIB{$bid} =~ /N\{([^\}]*)\}/;
($btitle) = $LIB{$bid} =~ /N\{([^\}]*)\}/;
-
dbmclose(
LIB);
+
untie(%
LIB);
&Backup("$LIBDB.db");
&Backup("$LIBDB.dir");
&Backup("$LIBDB.pag");
&Backup("$LIBDB.db");
&Backup("$LIBDB.dir");
&Backup("$LIBDB.pag");
@@
-190,7
+191,7
@@
sub dobookout
}
## Read the library file
}
## Read the library file
-
dbmopen(LIB, $LIBDB
, 0600) || do
+
tie(%LIB, NDBM_File, $LIBDB, O_RDWR
, 0600) || do
{
print "\n${beep}Error opening library database: $!\n";
return;
{
print "\n${beep}Error opening library database: $!\n";
return;
@@
-207,7
+208,7
@@
sub dobookout
if ($whohad > 0)
{
## Who has it?
if ($whohad > 0)
{
## Who has it?
-
dbmclose(
LIB);
+
untie(%
LIB);
eval { dbmtie($MEMDB,\%MEM) } || do
{
print "\n${beep}Unable to open members database: $!\n";
eval { dbmtie($MEMDB,\%MEM) } || do
{
print "\n${beep}Unable to open members database: $!\n";
@@
-228,7
+229,7
@@
sub dobookout
{
## Red dot
print "This book has a red dot. It may not be removed from the CSC.\n";
{
## Red dot
print "This book has a red dot. It may not be removed from the CSC.\n";
-
dbmclose(
LIB);
+
untie(%
LIB);
return;
}
if ($flags =~ /b/i)
return;
}
if ($flags =~ /b/i)
@@
-245,7
+246,7
@@
sub dobookout
($btitle) = $LIB{$bid} =~ /N\{([^\}]*)\}/;
($btitle) = $LIB{$bid} =~ /N\{([^\}]*)\}/;
-
dbmclose(
LIB);
+
untie(%
LIB);
&Backup("$LIBDB.db");
&Backup("$LIBDB.dir");
&Backup("$LIBDB.pag");
&Backup("$LIBDB.db");
&Backup("$LIBDB.dir");
&Backup("$LIBDB.pag");
@@
-332,7
+333,7
@@
EOS
sub MakeOutstandFile
{
## Read the library file
sub MakeOutstandFile
{
## Read the library file
-
dbmopen(LIB, $LIBDB
, 0600) || do
+
tie(%LIB, NDBM_File, $LIBDB, O_RDWR
, 0600) || do
{
print "\n${beep}Error opening library database: $!\n";
return;
{
print "\n${beep}Error opening library database: $!\n";
return;
@@
-347,7
+348,7
@@
sub MakeOutstandFile
$bodate =~ s/^[^ ]* (.*):\d* E.T/$1/;
$Outstand{$bid}="$whohas#$btitle#$bodate";
}
$bodate =~ s/^[^ ]* (.*):\d* E.T/$1/;
$Outstand{$bid}="$whohas#$btitle#$bodate";
}
-
dbmclose(
LIB);
+
untie(%
LIB);
eval { dbmtie($MEMDB,\%MEM) } || do
{
eval { dbmtie($MEMDB,\%MEM) } || do
{
@@
-408,7
+409,7
@@
sub DisplayLibLog
sub Gopher_Outstanding
{
## Read the library file
sub Gopher_Outstanding
{
## Read the library file
-
dbmopen(LIB, $LIBDB
, 0600) || do
+
tie(%LIB, NDBM_File, $LIBDB, O_RDWR
, 0600) || do
{
print "\n${beep}Error opening library database: $!\n";
return;
{
print "\n${beep}Error opening library database: $!\n";
return;
@@
-422,7
+423,7
@@
sub Gopher_Outstanding
($bodate) = $LIB{$bid} =~ /D\{([^\}]*)\}/;
$Outstand{$bid}="$whohas#$btitle#$bodate";
}
($bodate) = $LIB{$bid} =~ /D\{([^\}]*)\}/;
$Outstand{$bid}="$whohas#$btitle#$bodate";
}
-
dbmclose(
LIB);
+
untie(%
LIB);
eval { dbmtie($MEMDB,\%MEM) } || do
{
eval { dbmtie($MEMDB,\%MEM) } || do
{
@@
-525,7
+526,7
@@
sub doeditdb
}
## Read the library file
}
## Read the library file
-
dbmopen(LIB, $LIBDB
, 0600) || do
+
tie(%LIB, NDBM_File, $LIBDB, O_RDWR
, 0600) || do
{
print "\n${beep}Error opening library database: $!\n";
close TMPFILE;
{
print "\n${beep}Error opening library database: $!\n";
close TMPFILE;
@@
-553,7
+554,7
@@
sub doeditdb
print "\n${beep}Error opening temporary file: $!\n";
}
print "\n${beep}Error opening temporary file: $!\n";
}
-
dbmclose(
LIB);
+
untie(%
LIB);
&Backup("$LIBDB.db");
&Backup("$LIBDB.dir");
&Backup("$LIBDB.pag");
&Backup("$LIBDB.db");
&Backup("$LIBDB.dir");
&Backup("$LIBDB.pag");