home *** CD-ROM | disk | FTP | other *** search
/ Source Code 1994 March / Source_Code_CD-ROM_Walnut_Creek_March_1994.iso / compsrcs / misc / volume40 / sybperl / patch09 < prev    next >
Encoding:
Text File  |  1993-10-29  |  20.5 KB  |  752 lines

  1. Newsgroups: comp.sources.misc
  2. From: mpeppler@itf.ch (Michael Peppler)
  3. Subject: v40i005:  sybperl - Sybase DB-library extensions to Perl, v1.9, Patch09
  4. Message-ID: <1993Oct11.031306.22317@sparky.sterling.com>
  5. X-Md4-Signature: a010aba437da4a034a2a812dea5f32c4
  6. Sender: kent@sparky.sterling.com (Kent Landfield)
  7. Organization: Sterling Software
  8. Date: Mon, 11 Oct 1993 03:13:06 GMT
  9. Approved: kent@sparky.sterling.com
  10.  
  11. Submitted-by: mpeppler@itf.ch (Michael Peppler)
  12. Posting-number: Volume 40, Issue 5
  13. Archive-name: sybperl/patch09
  14. Environment: UNIX, Perl, Sybase
  15. Patch-To: sybperl: Volume 39, Issues 101-103
  16.  
  17. This is patch 9 to Sybperl.
  18.  
  19. [ NOTE: Sybperl was initially posted at patchlevel 8.  In order to ]
  20. [       get the version number to match the patchlevel, this patch ]
  21. [       is being posted as patch09.  There have been *no* previous ]
  22. [       patches since the initial posting in volume39.   -Kent+    ]
  23.  
  24. Sybperl is an extension to Perl which allows you to access Sybase
  25. databases directly from Perl scripts using standard OpenClient (aka
  26. DB-Library) calls.
  27.  
  28. >From the CHANGES file:
  29.  
  30.     1.009   The script name is now used to set the application
  31.         name in sysprocesses via the DBSETLAPP() macro.
  32.         Calling &dbsafestr() with three arguments would result
  33.         in an erroneous fatal error message.
  34.         Sybperl now sets the application name in sysprocesses
  35.         (via DBSETLAPP()) to the name of the script that is
  36.         running.
  37.         Some problems with dbschema.pl which only showed up
  38.         when PACKAGE_BUG is defined have been corrected.
  39.  
  40. --
  41. Michael Peppler                           mpeppler@itf.ch
  42. ITF Management SA                      mpeppler@bix.com     
  43. 13 Rue de la Fontaine                  Phone: (+4122) 312 1311
  44. CH-1204 Geneva, Switzerland            Fax:   (+4122) 312 1325
  45.  
  46.  
  47. Index: patchlevel.h
  48. Prereq: 1.2
  49. *** ../sybperl-1.8/patchlevel.h    Thu Sep 30 16:28:24 1993
  50. --- patchlevel.h    Tue Sep 28 19:16:26 1993
  51. ***************
  52. *** 1,7 ****
  53.   
  54. ! /*     @(#)patchlevel.h    1.2    9/6/93     */
  55.   
  56.   #define VERSION 1
  57. ! #define PATCHLEVEL 8
  58.   
  59. --- 1,6 ----
  60.   
  61. ! /*     @(#)patchlevel.h    1.3    9/28/93     */
  62.   
  63.   #define VERSION 1
  64. ! #define PATCHLEVEL 9
  65.   
  66. Index: BUGS
  67. Prereq: 1.1
  68. *** ../sybperl-1.8/BUGS    Thu Sep 30 16:28:29 1993
  69. --- BUGS    Mon Oct  4 15:14:17 1993
  70. ***************
  71. *** 1,4 ****
  72. !     @(#)BUGS    1.1    9/2/93
  73.       
  74.       The Sybase DB-Library - Perl savestr() conflict
  75.       ------------------------------------------------
  76. --- 1,4 ----
  77. !     @(#)BUGS    1.3    10/4/93
  78.       
  79.       The Sybase DB-Library - Perl savestr() conflict
  80.       ------------------------------------------------
  81. ***************
  82. *** 11,28 ****
  83.       list of commands pointed to by dpproc->dbcmdbuf, and in dbuse() as
  84.       well. Now there are several ways to work around this problem.
  85.   
  86. !     1) Compile sybperl.c with -DBROKEN_DBCMD. I've written some code
  87. !        that emulates calls to dbcmd() and dbuse(). This works OK on my
  88. !        machine/OS/Version of Perl/Version of DBlib, but it relies on
  89. !        the internal storing method used by DBlib, and that might
  90. !        change in the future.
  91. !     2) Recompile Perl (specifically, uperl.o in the Perl source
  92.          directory) with some suitable flags (eg -Dsavestr=p_savestr).
  93.          This does not create any compatibility problems, but is a
  94.          lengthy procedure.
  95.   
  96. !     3) Do something like:
  97.          cc -c sybperl.c
  98.          ld -r -o sybperl2.o sybperl.o -lsybdb
  99.          [edit sybperl2.o and replace `_savestr' with something like `_savest1']
  100. --- 11,22 ----
  101.       list of commands pointed to by dpproc->dbcmdbuf, and in dbuse() as
  102.       well. Now there are several ways to work around this problem.
  103.   
  104. !     1) Recompile Perl (specifically, uperl.o in the Perl source
  105.          directory) with some suitable flags (eg -Dsavestr=p_savestr).
  106.          This does not create any compatibility problems, but is a
  107.          lengthy procedure.
  108.   
  109. !     2) Do something like:
  110.          cc -c sybperl.c
  111.          ld -r -o sybperl2.o sybperl.o -lsybdb
  112.          [edit sybperl2.o and replace `_savestr' with something like `_savest1']
  113. ***************
  114. *** 30,36 ****
  115.          This is not a bad solution, but won't work if you have shared
  116.          library versions of libsybdb.a
  117.   
  118. !     4) Edit uperl.o and replace savestr with something else. This is
  119.          the solution I've chosen as the default. It is relatively fast,
  120.          does not rely on any internal knowledge of DB-Library, and does
  121.          not require Perl to be recompiled.
  122. --- 24,30 ----
  123.          This is not a bad solution, but won't work if you have shared
  124.          library versions of libsybdb.a
  125.   
  126. !     3) Edit uperl.o and replace savestr with something else. This is
  127.          the solution I've chosen as the default. It is relatively fast,
  128.          does not rely on any internal knowledge of DB-Library, and does
  129.          not require Perl to be recompiled.
  130. ***************
  131. *** 146,152 ****
  132. --- 140,154 ----
  133.   
  134.       It's not the cleanest of solutions, but it works...
  135.   
  136. +     However, be aware of the Perl @_ array assignement problems if you
  137. +     call sybperl functions without a parameter list (as in &dbsqlexec;
  138. +     instead of &dbsqlexec($dbproc);). When calling Sybperl functions
  139. +     via the glue routines, the @_ array will default to the parameters
  140. +     passed to last previously called Perl subroutine if it's called
  141. +     without a parameter list. And that's almost certainly not what you
  142. +     want.
  143.   
  144. +     
  145.   
  146.       
  147.       Please let me know if you find any other problems with Sybperl so
  148. ***************
  149. *** 155,159 ****
  150.       Thank you.
  151.   
  152.       Michael Peppler    <mpeppler@itf.ch>
  153.   
  154. --- 157,160 ----
  155. Index: CHANGES
  156. Prereq: 1.4
  157. *** ../sybperl-1.8/CHANGES    Thu Sep 30 16:28:29 1993
  158. --- CHANGES    Mon Oct  4 15:20:04 1993
  159. ***************
  160. *** 1,8 ****
  161. !     @(#)CHANGES    1.4    9/7/93
  162.   
  163.       
  164.       Sybperl CHANGES:
  165.   
  166.       1.008   Added user settable variables to control whether
  167.           Sybperl returns 'NULL' or Perl's 'undef' value on NULL
  168.           values from a query, whether numeric results are kept
  169. --- 1,17 ----
  170. !     @(#)CHANGES    1.7    10/4/93
  171.   
  172.       
  173.       Sybperl CHANGES:
  174.   
  175. +     1.009   The script name is now used to set the application
  176. +         name in sysprocesses via the DBSETLAPP() macro.
  177. +         Calling &dbsafestr() with three arguments would result
  178. +         in an erroneous fatal error message.
  179. +         Sybperl now sets the application name in sysprocesses
  180. +         (via DBSETLAPP()) to the name of the script that is
  181. +         running.
  182. +         Some problems with dbschema.pl which only showed up
  183. +         when PACKAGE_BUG is defined have been corrected.
  184.       1.008   Added user settable variables to control whether
  185.           Sybperl returns 'NULL' or Perl's 'undef' value on NULL
  186.           values from a query, whether numeric results are kept
  187. ***************
  188. *** 67,70 ****
  189.           Added a couple of example scripts in eg/*.pl, courtesy
  190.           of Gijs Mos (Thank You!).
  191.       1.003    Base version.
  192. --- 76,78 ----
  193. Index: Makefile
  194. Prereq: 1.16
  195. *** ../sybperl-1.8/Makefile    Thu Sep 30 16:28:24 1993
  196. --- Makefile    Tue Oct  5 16:27:15 1993
  197. ***************
  198. *** 1,4 ****
  199. ! #    @(#)Makefile    1.16    9/6/93
  200.   #
  201.       
  202.   CC = gcc
  203. --- 1,4 ----
  204. ! #    @(#)Makefile    1.18    10/5/93
  205.   #
  206.       
  207.   CC = gcc
  208. ***************
  209. *** 30,68 ****
  210.   # The default is to use the third solution:
  211.   UPERL = uperl2.o
  212.   
  213.   
  214. ! HAS_CALLBACK= -DHAS_CALLBACK        # Remove this if you don't
  215. !                     # have Perl 4 patchlevel 18
  216. !                     # User defined, perl based
  217. !                     # error/message handlers are
  218. !                     # not possible without this, however.
  219. ! OLD_SYBPERL= -DOLD_SYBPERL        # some backward compatibility stuff.
  220.   
  221. ! DBLIBVS = -DDBLIB461            # Comment this if your version
  222. !                     # of DBlib is older than
  223. !                     # version 4.2
  224.   
  225. ! #SET_VAL = -DUSERVAL_SET_FATAL        # Uncomment this if you wish
  226. !                     # to get a fatal error message
  227. !                     # if you attempt to set on of
  228. !                     # Sybperl's variables from a
  229. !                     # script. Normally such
  230. !                     # actions are silently ignored.
  231.   
  232. ! #PACKAGE_BUG = -DPACKAGE_BUG        # Uncomment to enable code
  233. !                     # to circumvent a bug that
  234. !                     # shows up when calling usubs from
  235. !                     # within nested packages.
  236. !                     
  237.   
  238.   CFLAGS = -O2 -g
  239.   CPPFLAGS = -I$(PERLSRC) -I$(LOCINCS) -I$(SYBINCS) $(PERL_VERSION) \
  240.           $(HAS_CALLBACK) $(OLD_SYBPERL) $(DBLIBVS) \
  241. !         $(SET_VAL) $(PACKAGE_BUG)
  242.   
  243.   BINDIR = /usr/local/bin            # where does the executable go
  244. ! PERLLIB = /usr/local/lib/perl        # where does lib/sybperl.pl
  245. !                     # and lib/sybdb.ph go
  246.   MANDIR = /usr/local/man            # where do we put the manual page
  247.   MANEXT = l
  248.   
  249. --- 30,70 ----
  250.   # The default is to use the third solution:
  251.   UPERL = uperl2.o
  252.   
  253. + # HAS_CALLBACK: This should be defined if you have Perl 4 patchlevel
  254. + # 18 or later. User defined error/message handlers in Perl are not
  255. + # possible if this is not defined, however.
  256. + HAS_CALLBACK= -DHAS_CALLBACK
  257.   
  258. ! # OLD_SYBPERL: A number of backwards compatibility stuff. Mainly, when
  259. ! # this is turned on, automatic logging in to Sybase is enabled.
  260. ! # Otherwise, failing to call &dblogin is a fatal error.
  261. ! OLD_SYBPERL= -DOLD_SYBPERL
  262.   
  263. ! # DBLIBVS: The DBlib version that you have. Valid values are DBLIB42
  264. ! # and DBLIB461. Controls the inclusion of routines which are available
  265. ! # only in more recent versions of DB library.
  266. ! DBLIBVS = -DDBLIB461
  267.   
  268. ! # SET_VAL: If this is set, then assigning a value to Sybperl's
  269. ! # read-only variables is a fatal error. Normally, this would be
  270. ! # silently ignored.
  271. ! #SET_VAL = -DUSERVAL_SET_FATAL
  272.   
  273. ! # PACKAGE_BUG: Controls whether code to circumvent a bug in Perl that
  274. ! # shows up when calling usubs from within nested packages is included.
  275. ! # See also the BUGS file.
  276. ! #PACKAGE_BUG = -DPACKAGE_BUG
  277.   
  278. + # RINDEX: Does your system know rindex(), but not strrchr() ?
  279. + #RINDEX = -Dstrrchr=rindex
  280.   CFLAGS = -O2 -g
  281.   CPPFLAGS = -I$(PERLSRC) -I$(LOCINCS) -I$(SYBINCS) $(PERL_VERSION) \
  282.           $(HAS_CALLBACK) $(OLD_SYBPERL) $(DBLIBVS) \
  283. !         $(SET_VAL) $(PACKAGE_BUG) $(RINDEX)
  284.   
  285.   BINDIR = /usr/local/bin            # where does the executable go
  286. ! PERLLIB = /usr/local/lib/perl        # where does lib/*.pl go
  287.   MANDIR = /usr/local/man            # where do we put the manual page
  288.   MANEXT = l
  289.   
  290. ***************
  291. *** 105,111 ****
  292.       lib/sybdb_redefs.pl t/sbex.pl \
  293.       eg/sql.pl eg/space.pl eg/capture.pl eg/report.pl \
  294.       eg/dbschema.pl eg/dbtext.pl eg/test_dbmoney.pl eg/README
  295.   
  296.   
  297.   
  298. --- 107,112 ----
  299. Index: PACKING.LST
  300. Prereq: 1.1
  301. *** ../sybperl-1.8/PACKING.LST    Thu Sep 30 16:28:29 1993
  302. --- PACKING.LST    Thu Sep  2 18:09:42 1993
  303. ***************
  304. *** 33,36 ****
  305.                   views, triggers and stored procedures),
  306.                   extracting the information from the
  307.                   database's system tables.
  308. --- 33,35 ----
  309. Index: README
  310. Prereq: 1.4
  311. *** ../sybperl-1.8/README    Thu Sep 30 16:28:23 1993
  312. --- README    Thu Sep 23 19:53:15 1993
  313. ***************
  314. *** 114,117 ****
  315.      Anders Ardo            Gijs Mos
  316.      Minh Ton Ha            G. Roderick Singleton
  317.      Peter Gutmann
  318. --- 114,116 ----
  319. Index: eg/README
  320. Prereq: 1.5
  321. *** ../sybperl-1.8/eg/README    Thu Sep 30 16:28:29 1993
  322. --- eg/README    Tue Aug 31 17:31:34 1993
  323. ***************
  324. *** 48,51 ****
  325.   
  326.   
  327.       Michael Peppler        mpeppler@itf.ch
  328. --- 48,50 ----
  329. Index: eg/capture.pl
  330. Prereq: 1.1
  331. *** ../sybperl-1.8/eg/capture.pl    Thu Sep 30 16:28:30 1993
  332. --- eg/capture.pl    Wed Jun 24 12:11:39 1992
  333. ***************
  334. *** 91,94 ****
  335.       );
  336.   };
  337.   endgrent;
  338. --- 91,93 ----
  339. Index: eg/dbschema.pl
  340. Prereq: 1.5
  341. *** ../sybperl-1.8/eg/dbschema.pl    Thu Sep 30 16:28:26 1993
  342. --- eg/dbschema.pl    Mon Oct  4 14:40:15 1993
  343. ***************
  344. *** 1,6 ****
  345.   #! /usr/local/bin/sybperl
  346.   #
  347. ! #    @(#)dbschema.pl    1.5    9/10/93
  348.   #
  349.   #
  350.   #    dbschema.pl    A script to extract a database structure from
  351. --- 1,6 ----
  352.   #! /usr/local/bin/sybperl
  353.   #
  354. ! #    @(#)dbschema.pl    1.7    10/4/93
  355.   #
  356.   #
  357.   #    dbschema.pl    A script to extract a database structure from
  358. ***************
  359. *** 219,225 ****
  360.       print "Bind rules & defaults to columns...\n" if $opt_v;
  361.       print SCRIPT "/* Bind rules & defaults to columns... */\n\n";
  362.   
  363. !     if($tab[1] ne 'dbo' && (keys(%dflt) || keys(%rules)))
  364.       {
  365.       print SCRIPT "/* The owner of the table is $tab[1].
  366.   ** I can't bind the rules/defaults to a table of which I am not the owner.
  367. --- 219,225 ----
  368.       print "Bind rules & defaults to columns...\n" if $opt_v;
  369.       print SCRIPT "/* Bind rules & defaults to columns... */\n\n";
  370.   
  371. !     if($tab[1] ne 'dbo' && (keys(%dflt) || keys(%rule)))
  372.       {
  373.       print SCRIPT "/* The owner of the table is $tab[1].
  374.   ** I can't bind the rules/defaults to a table of which I am not the owner.
  375. ***************
  376. *** 310,321 ****
  377.       local($ret, @dat, $act, $cnt);
  378.   
  379.       &dbcmd($dbproc, "sp_helprotect '$obj'\n");
  380. !     &dbsqlexec;
  381.   
  382.       $cnt = 0;
  383. !     while(($ret = &dbresults) != $NO_MORE_RESULTS && $ret != $FAIL)
  384.       {
  385. !     while(@dat = &dbnextrow)
  386.       {
  387.           $act = 'to';
  388.           $act = 'from' if $dat[0] =~ /Revoke/;
  389. --- 310,321 ----
  390.       local($ret, @dat, $act, $cnt);
  391.   
  392.       &dbcmd($dbproc, "sp_helprotect '$obj'\n");
  393. !     &dbsqlexec($dbproc);
  394.   
  395.       $cnt = 0;
  396. !     while(($ret = &dbresults($dbproc)) != $NO_MORE_RESULTS && $ret != $FAIL)
  397.       {
  398. !     while(@dat = &dbnextrow($dbproc))
  399.       {
  400.           $act = 'to';
  401.           $act = 'from' if $dat[0] =~ /Revoke/;
  402. ***************
  403. *** 351,363 ****
  404.       $found = 0;
  405.   
  406.       &dbcmd($dbproc, "select text from syscomments where id = $vi[2]");
  407. !     &dbsqlexec;
  408. !     &dbresults;
  409.       
  410.       print SCRIPT
  411.           "/* $objname $vi[0], owner $vi[1] */\n";
  412.   
  413. !     while(($text) = &dbnextrow)
  414.       {
  415.           if(!$found && $vi[1] ne 'dbo')
  416.           {
  417. --- 351,363 ----
  418.       $found = 0;
  419.   
  420.       &dbcmd($dbproc, "select text from syscomments where id = $vi[2]");
  421. !     &dbsqlexec($dbproc);
  422. !     &dbresults($dbproc);
  423.       
  424.       print SCRIPT
  425.           "/* $objname $vi[0], owner $vi[1] */\n";
  426.   
  427. !     while(($text) = &dbnextrow($dbproc))
  428.       {
  429.           if(!$found && $vi[1] ne 'dbo')
  430.           {
  431. ***************
  432. *** 373,377 ****
  433.       }
  434.       }
  435.   }
  436.   
  437. --- 373,376 ----
  438. Index: eg/dbtext.pl
  439. Prereq: 1.1
  440. *** ../sybperl-1.8/eg/dbtext.pl    Thu Sep 30 16:28:30 1993
  441. --- eg/dbtext.pl    Tue Aug 31 17:31:09 1993
  442. ***************
  443. *** 29,32 ****
  444.   print @result, "\n";
  445.   
  446.   &dbclose($d);
  447. --- 29,31 ----
  448. Index: eg/report.pl
  449. Prereq: 1.1
  450. *** ../sybperl-1.8/eg/report.pl    Thu Sep 30 16:28:26 1993
  451. --- eg/report.pl    Wed Jun 24 12:12:06 1992
  452. ***************
  453. *** 38,41 ****
  454.       ($n,$u,$gn,$s,$d) = split("~",$x);
  455.       write;
  456.   }
  457. --- 38,40 ----
  458. Index: eg/space.pl
  459. Prereq: 1.2
  460. *** ../sybperl-1.8/eg/space.pl    Thu Sep 30 16:28:30 1993
  461. --- eg/space.pl    Fri Apr  2 15:47:05 1993
  462. ***************
  463. *** 70,73 ****
  464.   $name,      $size,     $res,       $data,     $index,    $free,     $unused
  465.   . 
  466.   
  467. --- 70,72 ----
  468. Index: eg/sql.pl
  469. Prereq: 1.2
  470. *** ../sybperl-1.8/eg/sql.pl    Thu Sep 30 16:28:31 1993
  471. --- eg/sql.pl    Mon Aug  9 22:02:25 1993
  472. ***************
  473. *** 75,78 ****
  474.   
  475.   
  476.   1;
  477. --- 75,77 ----
  478. Index: eg/test_dbmoney.pl
  479. Prereq: 1.1
  480. *** ../sybperl-1.8/eg/test_dbmoney.pl    Thu Sep 30 16:28:31 1993
  481. --- eg/test_dbmoney.pl    Tue Aug 31 13:01:04 1993
  482. ***************
  483. *** 173,176 ****
  484.   &dbexit;
  485.   
  486.   exit( $STDEXIT );
  487. --- 173,175 ----
  488. Index: lib/sybdb.ph
  489. Prereq: 1.2
  490. *** ../sybperl-1.8/lib/sybdb.ph    Thu Sep 30 16:28:31 1993
  491. --- lib/sybdb.ph    Mon Aug 30 16:23:34 1993
  492. ***************
  493. *** 254,257 ****
  494.   sub INT_CANCEL {2;}
  495.   
  496.   1;
  497. --- 254,256 ----
  498. Index: lib/sybdb_redefs.pl
  499. Prereq: 1.2
  500. *** ../sybperl-1.8/lib/sybdb_redefs.pl    Thu Sep 30 16:28:32 1993
  501. --- lib/sybdb_redefs.pl    Tue Aug 31 12:07:20 1993
  502. ***************
  503. *** 613,616 ****
  504.   # ----- end of sybdb_redefs.pl -----
  505.   
  506.   1;
  507. --- 613,615 ----
  508. Index: lib/sybperl.pl
  509. Prereq: 1.5
  510. *** ../sybperl-1.8/lib/sybperl.pl    Thu Sep 30 16:28:32 1993
  511. --- lib/sybperl.pl    Thu Sep 23 18:18:41 1993
  512. ***************
  513. *** 73,76 ****
  514.   
  515.   
  516.   1;
  517. --- 73,75 ----
  518. Index: sybperl.1
  519. Prereq: 1
  520. *** ../sybperl-1.8/sybperl.1    Thu Sep 30 16:28:27 1993
  521. --- sybperl.1    Tue Sep  7 15:05:34 1993
  522. ***************
  523. *** 290,293 ****
  524.   Don Preuss (donp@niaid.nih.gov) contributed the &dbcolXXX() calls.
  525.   Jeffrey Wong (jtw@comdyn.cdsyd.oz.au) contributed the
  526.   OpenClient R4.6.1 DBMONEY routines
  527. --- 290,292 ----
  528. Index: sybperl.c
  529. Prereq: 1.25
  530. *** ../sybperl-1.8/sybperl.c    Thu Sep 30 16:28:27 1993
  531. --- sybperl.c    Mon Oct  4 15:22:44 1993
  532. ***************
  533. *** 1,4 ****
  534. ! static char SccsId[] = "@(#)sybperl.c    1.25    9/13/93";
  535.   /************************************************************************/
  536.   /*    Copyright 1991, 1992, 1993 by Michael Peppler            */
  537.   /*                               and ITF Management SA             */
  538. --- 1,4 ----
  539. ! static char SccsId[] = "@(#)sybperl.c    1.28    10/4/93";
  540.   /************************************************************************/
  541.   /*    Copyright 1991, 1992, 1993 by Michael Peppler            */
  542.   /*                               and ITF Management SA             */
  543. ***************
  544. *** 247,256 ****
  545. --- 247,268 ----
  546.   static int userval();
  547.   static int err_handler(), msg_handler();
  548.   static int getDbProc();
  549. + static char scriptName[32];
  550.   
  551.   int
  552.   userinit()
  553.   {
  554. +     char *p;
  555. +     int len;
  556. +     if(!(p = strrchr(origfilename, '/')))
  557. +     p = origfilename;
  558. +     else
  559. +     ++p;
  560. +     if((len = strlen(p)) > 30)
  561. +     len = 30;
  562. +     strncpy(scriptName, p, len);
  563. +     
  564.       init_sybase();
  565.   }
  566.   
  567. ***************
  568. *** 484,491 ****
  569.   register int sp;
  570.   register int items;
  571.   {
  572.       STR **st = stack->ary_array + sp;
  573. !     ARRAY *ary = stack;    
  574.       STR *Str;        /* used in str_get and str_gnum macros */
  575.       int inx = -1;    /* Index into dbProc[] array. Passed as */
  576.                   /* first parameter to nearly all &dbxxx() calls */
  577. --- 496,505 ----
  578.   register int sp;
  579.   register int items;
  580.   {
  581. + #if 0
  582.       STR **st = stack->ary_array + sp;
  583. ! #endif
  584. !     ARRAY *ary = stack;
  585.       STR *Str;        /* used in str_get and str_gnum macros */
  586.       int inx = -1;    /* Index into dbProc[] array. Passed as */
  587.                   /* first parameter to nearly all &dbxxx() calls */
  588. ***************
  589. *** 509,514 ****
  590. --- 523,529 ----
  591.       {        /* You can call &dbmsghandle/errhandle before calling &dblogin */
  592.   #ifdef OLD_SYBPERL
  593.       login = dblogin();
  594. +     DBSETLAPP(login, scriptName);
  595.       dbProc[0].dbproc = dbopen(login, NULL);
  596.   #else
  597.       fatal("&dblogin has not been called yet!");
  598. ***************
  599. *** 526,532 ****
  600. --- 541,550 ----
  601.           char *server = NULL, *user = NULL, *pwd = NULL;
  602.   
  603.           if (!login)
  604. +         {
  605.           login = dblogin();
  606. +         DBSETLAPP(login, scriptName);
  607. +         }
  608.           switch(items)
  609.           {
  610.             case 3:
  611. ***************
  612. *** 1377,1383 ****
  613.       break;
  614.   #if defined(DBLIB42)
  615.         case US_dbsafestr:
  616. !     if (items > 3 || items != 2)
  617.           fatal ("Usage: $string = &dbsafestr($dbproc,$instring[,$quote_char])");
  618.       else
  619.       {
  620. --- 1395,1401 ----
  621.       break;
  622.   #if defined(DBLIB42)
  623.         case US_dbsafestr:
  624. !     if (!(items == 3 || items == 2))
  625.           fatal ("Usage: $string = &dbsafestr($dbproc,$instring[,$quote_char])");
  626.       else
  627.       {
  628. ***************
  629. *** 1414,1420 ****
  630.       break;
  631.   #elif defined(DBLIB461)
  632.         case US_dbsafestr:
  633. !     if (items > 3 || items != 2)
  634.           fatal ("Usage: $string = &dbsafestr($dbproc,$instring[,$quote_char])");
  635.       else
  636.       {
  637. --- 1432,1438 ----
  638.       break;
  639.   #elif defined(DBLIB461)
  640.         case US_dbsafestr:
  641. !     if (!(items == 3 || items == 2))
  642.           fatal ("Usage: $string = &dbsafestr($dbproc,$instring[,$quote_char])");
  643.       else
  644.       {
  645. ***************
  646. *** 2401,2406 ****
  647. --- 2419,2434 ----
  648.           (void)astore(ary,++sp,str_2mortal(str_make(mnybuf, 0)));
  649.       }
  650.       break;
  651. +       case US_dbrecftos:
  652. +     if (items != 1)
  653. +         fatal("Usage: &dbrecftos($filename);");
  654. +     else
  655. +     {
  656. +         dbrecftos((char *)str_get(STACK(sp)[1]));
  657. +         
  658. +         str_numset(STACK(sp)[0], (double) 0);
  659. +     }
  660. +     break;
  661.   #endif
  662.         case US_dbwritetext:
  663.           if (items != 5)
  664. ***************
  665. *** 2499,2514 ****
  666.           str_numset(STACK(sp)[0], (double) j);
  667.       }
  668.       break;
  669. -       case US_dbrecftos:
  670. -     if (items != 1)
  671. -         fatal("Usage: &dbrecftos($filename);");
  672. -     else
  673. -     {
  674. -         dbrecftos((char *)str_get(STACK(sp)[1]));
  675. -         
  676. -         str_numset(STACK(sp)[0], (double) 0);
  677. -     }
  678. -     break;
  679.   
  680.         case US_BCP_SETL:
  681.       if (items != 1)
  682. --- 2527,2532 ----
  683. ***************
  684. *** 3353,3356 ****
  685.   }
  686.   
  687.   #endif  /* DBLIB461 */
  688. --- 3371,3373 ----
  689. Index: t/sbex.pl
  690. *** ../sybperl-1.8/t/sbex.pl    Thu Sep 30 16:28:33 1993
  691. --- t/sbex.pl    Fri Oct  1 08:59:54 1993
  692. ***************
  693. *** 9,14 ****
  694. --- 9,15 ----
  695.   require "sybperl.pl";
  696.   
  697.   print "Sybperl version $SybperlVer\n\n";
  698. + print "PACKAGE_BUG is defined - sybdb_redefs.pl has been loaded\n" if (defined($SybPackageBug) && $SybPackageBug == 1);
  699.   
  700.   print "This script tests some of sybperl's functions, and prints out\n";
  701.   print "description of the databases that are defined in your Sybase\n";
  702. ***************
  703. *** 113,119 ****
  704.   
  705.   # now get the indexes...
  706.   #
  707. !     print "\nIndexes on $db[0].$tab[0].$tab[1]...\n\n";
  708.       &dbuse($dbproc2, $db[0]);
  709.       &dbcmd($dbproc2, "sp_helpindex '$tab[1].$tab[0]'\n");
  710.   
  711. --- 114,120 ----
  712.   
  713.   # now get the indexes...
  714.   #
  715. !     print "\nIndexes on $db[0].$tab[1].$tab[0]...\n\n";
  716.       &dbuse($dbproc2, $db[0]);
  717.       &dbcmd($dbproc2, "sp_helpindex '$tab[1].$tab[0]'\n");
  718.   
  719. ***************
  720. *** 188,193 ****
  721.   
  722.       &INT_CANCEL;
  723.   }
  724.   
  725.   
  726. --- 189,193 ----
  727.  
  728. exit 0 # Just in case...
  729.