home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Usenet 1994 October
/
usenetsourcesnewsgroupsinfomagicoctober1994disk2.iso
/
unix
/
volume22
/
undel2
/
patch10
/
delete.patch10
Wrap
Text File
|
1990-06-07
|
27KB
|
943 lines
*** /tmp/,RCSt1018872 Fri Jun 8 00:10:39 1990
--- README Thu Jun 7 22:56:38 1990
***************
*** 16,34 ****
SUPPORTED PLATFORMS
! I've personally compiled these sources under 4.3BSD on VAXen and IBM
! RT/PC's, under Mach on the NeXT Machine, under Ultrix on the
! DECstation 3100, and under SunOS 4.0, and I assume they should compile
! with minimal trouble on other architectures. If you make it compile
! on another platform and you have to make changes, please send me
! patches.
WHAT YOU NEED TO DO
! 1. Compile the com_err library (see below for more details) found in
! the sub-directory et, and install it if you want to (you'll have to
! modify the delete Makefile a bit if you don't).
2. Edit the Makefile to fit your site. See below for details.
--- 16,36 ----
SUPPORTED PLATFORMS
! I've personally compiled these sources under Vax 4.3BSD, IBM AOS 4.3,
! Mach on the NeXT Machine (with the "-bsd" flag to the compiler),
! Ultrix 3.1 on the DECstation 3100, SunOS 4.0, A/UX, and HP-UX, and I
! assume they should compile with minimal trouble on other architectures
! (However, I've been told that there may be some problems compiling on
! POSIX-compliant architectures; they're being worked on.). If you make
! it compile on another platform and you have to make changes, please
! send me patches.
WHAT YOU NEED TO DO
! 1. Compile the com_err library (see below for more details) and
! install it if you want to (you'll have to modify the delete
! Makefile a bit if you don't).
2. Edit the Makefile to fit your site. See below for details.
***************
*** 45,83 ****
1. Change the install binary directory and install man page directory
(and possibly man section).
! 2. Change the "-I/usr/include" to point to the et subdirectory if you
! have not installed the com_err header file in a standard location,
! or to wherever you have installed it. Change the COMPILE_ET
! variable to use et/compile_et if you haven't installed the
! compile_et utility. Change the -L/usr/athena/lib flag to point to
! wherever you have installed the library, or to the et subdirectory
! if you have not.
! 3. Deal with the AFS_MOUNTPOINTS flag, which specifies whether
! undelete, expunge and lsdel will check for Andrew File System mount
! points in addition to standard Unix mount points.
! a. If you undefine it, remove the -I and -L flags that point to AFS
! includes and libraries, and remove the "-lsys" from the LIBS
! variable.
- b. If you leave it defined, change the -I and -L flags to point to
- wherever you keep your AFS includes and libraries.
-
COM_ERR LIBRARY
! This is the second release of this package. Unlike the first release,
! this release requires (for error-handling) a library called com_err,
! which was written by members of the MIT Student Information Processing
! Board (SIPB). Along with that library comes a utility called
! compile_et. The sources to the com_err library and compile_et are
! included with the sources to the delete package; you should compile
! them and then either install them in a "standard location" on your
! machine or modify the delete Makefile so that it knows where they are.
! The delete Makefile does not compile them by default, since they are
! already compiled and installed at Athena, so you should compile and
! install them separately from delete etc.
The files texinfo.tex and com_err.texinfo in the et sources are
compressed and uuencoded because they have control characters in them.
--- 47,78 ----
1. Change the install binary directory and install man page directory
(and possibly man section).
! 2. Change the ETINCS and ETLDFLAGS variables to point to the right
! place. Also, change the COMPILE_ET variable to point to a
! compile_et executable if you haven't installed it somewhere in your
! search path.
! 3. If your system is SYSV-like (e.g. it uses strchr and strrchr
! instead of index and rindex, or it has memcpy and doesn't have
! bcopy), and your compile doesn't define the symbol SYSV
! automatically, then put "-DSYSV" in the DEFINES variable.
! 4. You probably won't want to include AFS support, in which case you
! should empty all the variables starting with "AFS". If you do want
! to support AFS, then set the variables appropriately.
COM_ERR LIBRARY
! In order to compile delete, you need to get your hands on the com_err
! package, which was written by members of the MIT Student Information
! Processing Board (SIPB); it should be archived in the same place
! delete is. You should compile the library and compile_et utility that
! comes with it and then either install them in a "standard location" on
! your machine or modify the delete Makefile so that it knows where they
! are. The delete Makefile does not compile them by default, since they
! are already compiled and installed at Athena, so you should compile
! and install them separately from delete etc.
The files texinfo.tex and com_err.texinfo in the et sources are
compressed and uuencoded because they have control characters in them.
***************
*** 85,116 ****
of them is necessary for just building the library and using it to
build delete et al -- they are just documentation about the library.
- The version of the com_err library I've included here is "in flux" --
- its authors tell me that several enhancements are planned for the near
- future. When the library is worked into a more final form, it will
- probably be distributed (to comp.sources.unix, etc.) separately from
- delete.
-
FINAL NOTES
-
- The final patch level used for the first release of this package was
- patch level 2. Since this is a whole new release, and there were some
- unofficial patches here and there during the life of the first
- release, I upped the patch level to 5 for the first distribution of
- the second release of the delete package.
-
- There were NO REAL PATCHES numbered 3, 4, or 5 -- I simply chose to
- jump from 2 to 5 when issuing a new release. Therefore, if you have
- delete sources with a patch level less than 5, you will need to get a
- whole new copy of the sources.
-
- In other words, treat patch level 5 as patch level 0 for all intents
- and purposes (gee, tha sounds stupid, but you get the idea :-). See
- the file PATCHLEVEL in the sources to find out what patch level of the
- sources you currently have in your position (if you're reading this
- README file out of a source distribution, you almost definitely have
- patch level 6 or later).
As usual, suggestions and bug fixes are always welcomed.
--- 80,87 ----
*** /tmp/,RCSt1018879 Fri Jun 8 00:10:46 1990
--- Makefile Thu Jun 7 23:37:59 1990
***************
*** 5,11 ****
#
# $Source: /afs/athena.mit.edu/user/j/jik/src/delete/RCS/Makefile,v $
# $Author: jik $
! # $Header: /afs/athena.mit.edu/user/j/jik/src/delete/RCS/Makefile,v 1.17 89/12/20 15:14:34 jik Exp $
#
DESTDIR=
--- 5,11 ----
#
# $Source: /afs/athena.mit.edu/user/j/jik/src/delete/RCS/Makefile,v $
# $Author: jik $
! # $Header: /afs/athena.mit.edu/user/j/jik/src/delete/RCS/Makefile,v 1.22 90/06/07 23:36:17 jik Exp $
#
DESTDIR=
***************
*** 16,30 ****
CC= cc
COMPILE_ET= compile_et
LINT= lint
! DEFINES= -DAFS_MOUNTPOINTS
! INCLUDES= -I/usr/include\
! -I/afs/athena.mit.edu/astaff/project/afsdev/build/$(MACHINE)/include
CFLAGS= -O $(INCLUDES) $(DEFINES) $(CDEBUGFLAGS)
! LDFLAGS= -L/usr/athena/lib\
! -L/afs/athena.mit.edu/astaff/project/afsdev/build/$(MACHINE)/lib/afs
! LIBS= -lcom_err -lsys
! LINTFLAGS= $(DEFINES) $(INCLUDES) $(CDEBUGFLAGS) -u
LINTLIBS=
SRCS= delete.c undelete.c directories.c pattern.c util.c\
expunge.c lsdel.c col.c shell_regexp.c\
errors.c stack.c
--- 16,55 ----
CC= cc
COMPILE_ET= compile_et
LINT= lint
! DEFINES= $(AFSDEFINES)
!
!
! # These variables apply only if you want this program to recognize
! # Andrew File System mount points. If you don't want to support AFS,
! # then set all the variables starting with "AFS" to nothing.
! AFSBLD= bld
! AFSINC= /afs/athena.mit.edu/astaff/project/afsdev/sandbox/$(AFSBLD)/dest/include
! AFSLIB= /afs/athena.mit.edu/astaff/project/afsdev/sandbox/$(AFSBLD)/dest/lib
! AFSINCS= -I$(AFSINC)
! AFSLDFLAGS= -L$(AFSLIB) -L$(AFSLIB)/afs
! AFSLIBS= -lsys -lrx -llwp $(AFSLIB)/afs/util.a
! AFSDEFINES= -DAFS_MOUNTPOINTS
!
!
! # ETINCS is a -I flag pointing to the directory in which the et header
! # files are stored.
! # ETLDFLAGS is a -L flag pointing to the directory where the et
! # library is stored.
! # ETLIBS lists the et libraries we want to link against
! ETINCS= -I/usr/include
! ETLDFLAGS= -L/usr/athena/lib
! ETLIBS= -lcom_err
!
!
! # You probably won't have to edit anything below this line.
!
! INCLUDES= $(ETINCS) $(AFSINCS)
! LDFLAGS= $(ETLDFLAGS) $(AFSLDFLAGS)
! LIBS= $(ETLIBS) $(AFSLIBS)
CFLAGS= -O $(INCLUDES) $(DEFINES) $(CDEBUGFLAGS)
! LINTFLAGS= -u $(INCLUDES) $(DEFINES) $(CDEBUGFLAGS)
LINTLIBS=
+
SRCS= delete.c undelete.c directories.c pattern.c util.c\
expunge.c lsdel.c col.c shell_regexp.c\
errors.c stack.c
***************
*** 37,48 ****
MANS= man1/delete.1 man1/expunge.1 man1/lsdel.1 man1/purge.1\
man1/undelete.1
! ETLIBSRCS= et/Makefile et/com_err.3 et/compile_et.1\
! et/com_err.texinfo.Z.uu et/error_table.y et/et_lex.lex.l\
! et/texinfo.tex.Z.uu et/*.c et/*.h et/*.et
! ARCHIVE= README Makefile PATCHLEVEL $(SRCS) $(INCS) $(ETSRCS)\
! $(MANS)
! ARCHIVEDIRS= man1 et et/profiled
DELETEOBJS= delete.o util.o delete_errs.o errors.o
UNDELETEOBJS= undelete.o directories.o util.o pattern.o\
--- 62,70 ----
MANS= man1/delete.1 man1/expunge.1 man1/lsdel.1 man1/purge.1\
man1/undelete.1
! ARCHIVE= README Makefile PATCHLEVEL $(SRCS) $(INCS) $(MANS)\
! $(ETSRCS)
! ARCHIVEDIRS= man1
DELETEOBJS= delete.o util.o delete_errs.o errors.o
UNDELETEOBJS= undelete.o directories.o util.o pattern.o\
***************
*** 138,144 ****
tar cvf - $(ARCHIVE) $(ETLIBSRCS) | compress > delete.tar.Z
shar: $(ARCHIVE)
! makekit -oMANIFEST -h2 MANIFEST $(ARCHIVEDIRS) $(ARCHIVE) $(ETLIBSRCS)
patch: $(ARCHIVE)
makepatch $(ARCHIVE)
--- 160,166 ----
tar cvf - $(ARCHIVE) $(ETLIBSRCS) | compress > delete.tar.Z
shar: $(ARCHIVE)
! makekit -oMANIFEST $(ARCHIVEDIRS) $(ARCHIVE) $(ETLIBSRCS)
patch: $(ARCHIVE)
makepatch $(ARCHIVE)
*** /tmp/,RCSt1018886 Fri Jun 8 00:10:52 1990
--- PATCHLEVEL Fri Jun 8 00:09:29 1990
***************
*** 1 ****
! 9
--- 1 ----
! 10
*** /tmp/,RCSt1018893 Fri Jun 8 00:10:58 1990
--- delete.c Thu Jun 7 19:17:25 1990
***************
*** 11,17 ****
*/
#if (!defined(lint) && !defined(SABER))
! static char rcsid_delete_c[] = "$Header: /afs/athena.mit.edu/user/j/jik/src/delete/RCS/delete.c,v 1.21 89/12/15 04:39:22 jik Exp $";
#endif
#include <sys/types.h>
--- 11,17 ----
*/
#if (!defined(lint) && !defined(SABER))
! static char rcsid_delete_c[] = "$Header: /afs/athena.mit.edu/user/j/jik/src/delete/RCS/delete.c,v 1.22 90/06/06 19:06:17 jik Exp $";
#endif
#include <sys/types.h>
***************
*** 18,24 ****
--- 18,30 ----
#include <stdio.h>
#include <sys/stat.h>
#include <sys/dir.h>
+ #ifdef SYSV
+ #include <string.h>
+ #define index strchr
+ #define rindex strrchr
+ #else
#include <strings.h>
+ #endif /* SYSV */
#include <sys/param.h>
#include <sys/file.h>
#include <errno.h>
*** /tmp/,RCSt1018900 Fri Jun 8 00:11:04 1990
--- undelete.c Thu Jun 7 19:17:41 1990
***************
*** 11,17 ****
*/
#if (!defined(lint) && !defined(SABER))
! static char rcsid_undelete_c[] = "$Header: /afs/athena.mit.edu/user/j/jik/src/delete/RCS/undelete.c,v 1.19 89/12/15 04:39:31 jik Exp $";
#endif
#include <stdio.h>
--- 11,17 ----
*/
#if (!defined(lint) && !defined(SABER))
! static char rcsid_undelete_c[] = "$Header: /afs/athena.mit.edu/user/j/jik/src/delete/RCS/undelete.c,v 1.20 90/06/06 19:06:43 jik Exp $";
#endif
#include <stdio.h>
***************
*** 18,24 ****
--- 18,30 ----
#include <sys/types.h>
#include <sys/dir.h>
#include <sys/param.h>
+ #ifdef SYSV
+ #include <string.h>
+ #define index strchr
+ #define rindex strrchr
+ #else
#include <strings.h>
+ #endif /* SYSV */
#include <sys/stat.h>
#include <com_err.h>
#include <errno.h>
*** /tmp/,RCSt1018907 Fri Jun 8 00:11:10 1990
--- directories.c Thu Jun 7 19:17:27 1990
***************
*** 11,17 ****
*/
#if !defined(lint) && !defined(SABER)
! static char rcsid_directories_c[] = "$Header: /afs/athena.mit.edu/user/j/jik/src/delete/RCS/directories.c,v 1.15 89/11/22 21:32:24 jik Exp $";
#endif
#include <stdio.h>
--- 11,17 ----
*/
#if !defined(lint) && !defined(SABER)
! static char rcsid_directories_c[] = "$Header: /afs/athena.mit.edu/user/j/jik/src/delete/RCS/directories.c,v 1.16 90/06/06 19:06:24 jik Exp $";
#endif
#include <stdio.h>
***************
*** 19,25 ****
--- 19,31 ----
#include <sys/stat.h>
#include <sys/param.h>
#include <sys/dir.h>
+ #ifdef SYSV
+ #include <string.h>
+ #define index strchr
+ #define rindex strrchr
+ #else
#include <strings.h>
+ #endif /* SYSV */
#include <errno.h>
#include <com_err.h>
#include "delete_errs.h"
*** /tmp/,RCSt1018914 Fri Jun 8 00:11:18 1990
--- pattern.c Thu Jun 7 22:33:55 1990
***************
*** 11,17 ****
*/
#if (!defined(lint) && !defined(SABER))
! static char rcsid_pattern_c[] = "$Header: /afs/athena.mit.edu/user/j/jik/src/delete/RCS/pattern.c,v 1.16 90/01/11 04:11:58 jik Exp $";
#endif
#include <stdio.h>
--- 11,17 ----
*/
#if (!defined(lint) && !defined(SABER))
! static char rcsid_pattern_c[] = "$Header: /afs/athena.mit.edu/user/j/jik/src/delete/RCS/pattern.c,v 1.18 90/06/07 22:33:45 jik Exp $";
#endif
#include <stdio.h>
***************
*** 18,24 ****
--- 18,30 ----
#include <sys/types.h>
#include <sys/dir.h>
#include <sys/param.h>
+ #ifdef SYSV
+ #include <string.h>
+ #define index strchr
+ #define rindex strrchr
+ #else
#include <strings.h>
+ #endif /* SYSV */
#include <sys/stat.h>
#include <errno.h>
#include <com_err.h>
***************
*** 410,415 ****
--- 416,424 ----
char first[MAXNAMLEN], rest[MAXPATHLEN];
int retval;
int strsize;
+ #ifdef PATTERN_DEBUG
+ int j;
+ #endif
#ifdef DEBUG
printf("do_match: looking for %s\n", name);
***************
*** 429,434 ****
--- 438,446 ----
if (! *found) {
set_error(errno);
error("Malloc");
+ #ifdef PATTERN_DEBUG
+ fprintf(stderr, "do_match: return 1.\n");
+ #endif
return error_code;
}
*num_found = 0;
***************
*** 437,442 ****
--- 449,457 ----
if (! dirp) {
set_error(errno);
error(base);
+ #ifdef PATTERN_DEBUG
+ fprintf(stderr, "do_match: return 2.\n");
+ #endif
return error_code;
}
(void) strcpy(first, firstpart(name, rest));
***************
*** 445,453 ****
--- 460,474 ----
if (retval) {
error("add_str");
(void) popall();
+ #ifdef PATTERN_DEBUG
+ fprintf(stderr, "do_match: return 3.\n");
+ #endif
return retval;
}
(*num_found)++;
+ #ifdef PATTERN_DEBUG
+ fprintf(stderr, "do_match: return 4.\n");
+ #endif
return 0;
}
***************
*** 456,461 ****
--- 477,486 ----
if (! dp) goto updir;
retval = reg_cmp(first, dp->d_name);
+ #ifdef PATTERN_DEBUG
+ fprintf(stderr, "do_match: comparing %s to %s returns %d.\n",
+ first, dp->d_name, retval);
+ #endif
if (retval < 0) {
error("reg_cmp");
goto updir;
***************
*** 465,470 ****
--- 490,500 ----
if (is_deleted(dp->d_name) && match_deleted) {
retval = reg_cmp(first, &dp->d_name[2]);
+ #ifdef PATTERN_DEBUG
+ fprintf(stderr,
+ "do_match: deleted compare of %s to %s returns %d.\n",
+ first, &dp->d_name[2], retval);
+ #endif
if (retval < 0) {
error("reg_cmp");
goto updir;
***************
*** 479,490 ****
--- 509,529 ----
continue;
downdir:
+ #ifdef PATTERN_DEBUG
+ fprintf(stderr, "do_match: downdir\n");
+ #endif
retval = push(&dirp, sizeof(DIR *));
if (retval) {
error("push");
(void) popall();
+ #ifdef PATTERN_DEBUG
+ fprintf(stderr, "do_match: return 5.\n");
+ #endif
return retval;
}
+ #ifdef PATTERN_DEBUG
+ fprintf(stderr, "do_match: pushing %s, %s, %s\n", first, rest, base);
+ #endif
string_push(first);
string_push(rest);
string_push(base);
***************
*** 497,502 ****
--- 536,544 ----
if (retval) {
error("add_str");
(void) popall();
+ #ifdef PATTERN_DEBUG
+ fprintf(stderr, "do_match: return 6.\n");
+ #endif
return retval;
}
(*num_found)++;
***************
*** 507,512 ****
--- 549,557 ----
if (retval) {
error("add_str");
(void) popall();
+ #ifdef PATTERN_DEBUG
+ fprintf(stderr, "do_match: return 7.\n");
+ #endif
return retval;
}
(*num_found)++;
***************
*** 514,519 ****
--- 559,568 ----
string_pop(base);
string_pop(rest);
string_pop(first);
+ #ifdef PATTERN_DEBUG
+ fprintf(stderr, "do_match: popped %s, %s, %s\n", first,
+ rest, base);
+ #endif
(void) pop(&dirp, sizeof(DIR *));
continue;
}
***************
*** 527,532 ****
--- 576,585 ----
string_pop(base);
string_pop(rest);
string_pop(first);
+ #ifdef PATTERN_DEBUG
+ fprintf(stderr, "do_match: popped %s, %s, %s\n", first,
+ rest, base);
+ #endif
(void) pop(&dirp, sizeof(DIR *));
continue;
}
***************
*** 534,555 ****
--- 587,631 ----
continue;
updir:
+ #ifdef PATTERN_DEBUG
+ fprintf(stderr, "do_match: updir\n");
+ #endif
closedir(dirp);
string_pop(base);
+ #ifdef PATTERN_DEBUG
+ fprintf(stderr, "do_match: popped %s\n", base);
+ #endif
if (retval) {
if (retval != STACK_EMPTY) {
error("pop");
(void) popall();
+ #ifdef PATTERN_DEBUG
+ fprintf(stderr, "do_match: return 8.\n");
+ #endif
return retval;
}
+ #ifdef PATTERN_DEBUG
+ fprintf(stderr, "Returning %d word%s from do_match:\n",
+ *num_found,
+ *num_found == 1 ? "" : "s");
+ for (j = 0; j < *num_found; j++)
+ fprintf(stderr, "\t%s\n", (*found)[j]);
+ fprintf(stderr, "do_match: return 9.\n");
+ #endif
return 0;
}
string_pop(rest);
string_pop(first);
+ #ifdef PATTERN_DEBUG
+ fprintf(stderr, "do_match: popped %s, %s\n", rest, first);
+ #endif
retval = pop(&dirp, sizeof(DIR *));
if (retval) {
error("pop");
(void) popall();
+ #ifdef PATTERN_DEBUG
+ fprintf(stderr, "do_match: return 10.\n");
+ #endif
return retval;
}
continue;
*** /tmp/,RCSt1018921 Fri Jun 8 00:11:28 1990
--- util.c Thu Jun 7 19:17:42 1990
***************
*** 11,25 ****
*/
#if (!defined(lint) && !defined(SABER))
! static char rcsid_util_c[] = "$Header: /afs/athena.mit.edu/user/j/jik/src/delete/RCS/util.c,v 1.15 90/01/11 03:47:11 jik Exp $";
#endif
#include <stdio.h>
#include <sys/param.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/dir.h>
#include <strings.h>
#include <pwd.h>
#include <errno.h>
#ifdef AFS_MOUNTPOINTS
--- 11,34 ----
*/
#if (!defined(lint) && !defined(SABER))
! static char rcsid_util_c[] = "$Header: /afs/athena.mit.edu/user/j/jik/src/delete/RCS/util.c,v 1.17 90/06/07 13:05:30 jik Exp $";
#endif
#include <stdio.h>
#include <sys/param.h>
#include <sys/types.h>
+ #ifdef SYSV /* SYSV doesn't define uid_t */
+ typedef unsigned short uid_t;
+ #endif
#include <sys/stat.h>
#include <sys/dir.h>
+ #ifdef SYSV
+ #include <string.h>
+ #define index strchr
+ #define rindex strrchr
+ #else
#include <strings.h>
+ #endif /* SYSV */
#include <pwd.h>
#include <errno.h>
#ifdef AFS_MOUNTPOINTS
*** /tmp/,RCSt1018928 Fri Jun 8 00:11:36 1990
--- expunge.c Thu Jun 7 19:17:30 1990
***************
*** 11,17 ****
*/
#if (!defined(lint) && !defined(SABER))
! static char rcsid_expunge_c[] = "$Header: /afs/athena.mit.edu/user/j/jik/src/delete/RCS/expunge.c,v 1.13 89/12/28 14:45:15 jik Exp $";
#endif
#include <stdio.h>
--- 11,17 ----
*/
#if (!defined(lint) && !defined(SABER))
! static char rcsid_expunge_c[] = "$Header: /afs/athena.mit.edu/user/j/jik/src/delete/RCS/expunge.c,v 1.14 90/06/06 19:06:29 jik Exp $";
#endif
#include <stdio.h>
***************
*** 19,25 ****
--- 19,31 ----
#include <sys/time.h>
#include <sys/dir.h>
#include <sys/param.h>
+ #ifdef SYSV
+ #include <string.h>
+ #define index strchr
+ #define rindex strrchr
+ #else
#include <strings.h>
+ #endif /* SYSV */
#include <sys/stat.h>
#include <com_err.h>
#include <errno.h>
*** /tmp/,RCSt1018935 Fri Jun 8 00:11:43 1990
--- lsdel.c Thu Jun 7 22:31:48 1990
***************
*** 11,17 ****
*/
#if (!defined(lint) && !defined(SABER))
! static char rcsid_lsdel_c[] = "$Header: /afs/athena.mit.edu/user/j/jik/src/delete/RCS/lsdel.c,v 1.9 89/11/22 21:31:08 jik Exp $";
#endif
#include <stdio.h>
--- 11,17 ----
*/
#if (!defined(lint) && !defined(SABER))
! static char rcsid_lsdel_c[] = "$Header: /afs/athena.mit.edu/user/j/jik/src/delete/RCS/lsdel.c,v 1.11 90/06/07 22:31:31 jik Exp $";
#endif
#include <stdio.h>
***************
*** 19,25 ****
--- 19,34 ----
#include <sys/dir.h>
#include <sys/param.h>
#include <sys/stat.h>
+ #ifdef SYSV
+ #include <string.h>
+ #define index strchr
+ #define rindex strrchr
+ #else
#include <strings.h>
+ #endif /* SYSV */
+ #ifdef _AUX_SOURCE
+ extern char *strcmp();
+ #endif
#include <errno.h>
#include <com_err.h>
#include "col.h"
*** /tmp/,RCSt1018942 Fri Jun 8 00:11:51 1990
--- col.c Thu Jun 7 19:17:24 1990
***************
*** 11,17 ****
*/
#if (!defined(lint) && !defined(SABER))
! static char rcsid_col_c[] = "$Header: /afs/athena.mit.edu/user/j/jik/src/delete/RCS/col.c,v 1.6 89/11/22 21:24:21 jik Exp $";
#endif
/*
--- 11,17 ----
*/
#if (!defined(lint) && !defined(SABER))
! static char rcsid_col_c[] = "$Header: /afs/athena.mit.edu/user/j/jik/src/delete/RCS/col.c,v 1.7 90/06/06 19:05:56 jik Exp $";
#endif
/*
***************
*** 21,27 ****
--- 21,33 ----
*/
#include <stdio.h>
+ #ifdef SYSV
+ #include <string.h>
+ #define index strchr
+ #define rindex strrchr
+ #else
#include <strings.h>
+ #endif /* SYSV */
#include "errors.h"
#include "delete_errs.h"
#include "col.h"
*** /tmp/,RCSt1018963 Fri Jun 8 00:12:07 1990
--- stack.c Thu Jun 7 22:35:00 1990
***************
*** 11,17 ****
*/
#if (!defined(lint) && !defined(SABER))
! static char rcsid_stack_c[] = "$Header: /afs/athena.mit.edu/user/j/jik/src/delete/RCS/stack.c,v 1.5 89/12/11 03:32:37 jik Exp $";
#endif
#include <sys/types.h>
--- 11,17 ----
*/
#if (!defined(lint) && !defined(SABER))
! static char rcsid_stack_c[] = "$Header: /afs/athena.mit.edu/user/j/jik/src/delete/RCS/stack.c,v 1.7 90/06/07 22:34:48 jik Exp $";
#endif
#include <sys/types.h>
***************
*** 36,42 ****
{
static caddr_t stack = (caddr_t) NULL;
static int size = 0, count = 0;
!
switch (op) {
case EMPTY_STACK:
if (size) {
--- 36,42 ----
{
static caddr_t stack = (caddr_t) NULL;
static int size = 0, count = 0;
!
switch (op) {
case EMPTY_STACK:
if (size) {
***************
*** 44,53 ****
stack = (caddr_t) NULL;
size = count = 0;
}
return 0;
case STACK_PUSH:
! if (bytes == 0)
return 0;
if (size - count < bytes) {
do
size += STACK_INC;
--- 44,61 ----
stack = (caddr_t) NULL;
size = count = 0;
}
+ #ifdef STACK_DEBUG
+ fprintf(stderr, "dostack: return 1 (EMPTY_STACK).\n");
+ #endif
return 0;
case STACK_PUSH:
! if (bytes == 0) {
! #ifdef STACK_DEBUG
! fprintf(stderr, "Pushing 0 bytes at %d offset.\n", count);
! fprintf(stderr, "dostack: return 2 (STACK_PUSH).\n");
! #endif
return 0;
+ }
if (size - count < bytes) {
do
size += STACK_INC;
***************
*** 59,75 ****
size = count = 0;
set_error(errno);
error("Malloc");
return error_code;
}
}
bcopy(data, stack + count, bytes);
count += bytes;
return 0;
case STACK_POP:
! if (bytes == 0)
return 0;
if (count == 0) {
set_status(STACK_EMPTY);
return error_code;
}
else {
--- 67,104 ----
size = count = 0;
set_error(errno);
error("Malloc");
+ #ifdef STACK_DEBUG
+ fprintf(stderr, "dostack: return 3 (STACK_PUSH).\n");
+ #endif
return error_code;
}
}
+ #ifdef STACK_DEBUG
+ fprintf(stderr, "Pushing %d bytes at %d offset.\n", bytes, count);
+ #endif
+ #if defined(SYSV) || (defined(__STDC__) && !defined(__HIGHC__))
+ memcpy(stack + count, data, bytes);
+ #else
bcopy(data, stack + count, bytes);
+ #endif
count += bytes;
+ #ifdef STACK_DEBUG
+ fprintf(stderr, "dostack: return 4 (STACK_PUSH).\n");
+ #endif
return 0;
case STACK_POP:
! if (bytes == 0) {
! #ifdef STACK_DEBUG
! fprintf(stderr, "Popping 0 bytes at %d offset.\n", count);
! fprintf(stderr, "dostack: return 5 (STACK_POP).\n");
! #endif
return 0;
+ }
if (count == 0) {
set_status(STACK_EMPTY);
+ #ifdef STACK_DEBUG
+ fprintf(stderr, "dostack: return 6 (STACK_POP).\n");
+ #endif
return error_code;
}
else {
***************
*** 76,82 ****
--- 105,119 ----
int newblocks, newsize;
count -= bytes;
+ #ifdef STACK_DEBUG
+ fprintf(stderr, "Popping %d bytes at %d offset.\n", bytes,
+ count);
+ #endif
+ #if defined(SYSV) || (defined(__STDC__) && !defined(__HIGHC__))
+ memcpy(data, stack + count, bytes);
+ #else
bcopy(stack + count, data, bytes);
+ #endif
newblocks = count / STACK_INC + ((count % STACK_INC) ? 1 : 0);
newsize = newblocks * STACK_INC;
if (newsize < size) {
***************
*** 85,97 ****
--- 122,143 ----
if (! stack) {
set_error(errno);
error("realloc");
+ #ifdef STACK_DEBUG
+ fprintf(stderr, "dostack: return 7 (STACK_POP).\n");
+ #endif
return error_code;
}
}
+ #ifdef STACK_DEBUG
+ fprintf(stderr, "dostack: return 8 (STACK_POP).\n");
+ #endif
return 0;
}
default:
set_error(STACK_BAD_OP);
+ #ifdef STACK_DEBUG
+ fprintf(stderr, "dostack: return 9.\n");
+ #endif
return error_code;
}
}