From 2f0aa254aa48723f172bcf33aca4c8fcf6f9cdba Mon Sep 17 00:00:00 2001 From: Nick Briggs Date: Fri, 30 Jun 2017 11:53:55 -0700 Subject: [PATCH] Create dsk.h to declare functions defined in dsk.c Update files that depend on dsk functions to include dsk.h Declare as static all functions in dsk.c that are not needed externally. Add dependencies to makefile. modified: makefile-tail new file: ../inc/dsk.h modified: ../src/dir.c modified: ../src/dsk.c modified: ../src/subr.c modified: ../src/ufs.c modified: ../src/vmemsave.c --- bin/makefile-tail | 10 +++--- inc/dsk.h | 21 ++++++++++++ src/dir.c | 1 + src/dsk.c | 84 ++++++++++++++++++++++++++--------------------- src/subr.c | 1 + src/ufs.c | 1 + src/vmemsave.c | 1 + 7 files changed, 76 insertions(+), 43 deletions(-) create mode 100644 inc/dsk.h diff --git a/bin/makefile-tail b/bin/makefile-tail index 7d3667f..2cd5511 100755 --- a/bin/makefile-tail +++ b/bin/makefile-tail @@ -481,18 +481,18 @@ $(OBJECTDIR)findkey.o : $(SRCDIR)findkey.c $(REQUIRED-INCS) $(INCDIR)lispemul. $(OBJECTDIR)dsk.o : $(SRCDIR)dsk.c $(REQUIRED-INCS) $(INCDIR)lispemul.h $(INCDIR)lispmap.h \ $(INCDIR)adr68k.h $(INCDIR)lsptypes.h $(INCDIR)lspglob.h \ $(INCDIR)fp.h $(INCDIR)arith.h $(INCDIR)stream.h $(INCDIR)timeout.h \ - $(INCDIR)locfile.h $(INCDIR)osmsg.h $(INCDIR)dbprint.h $(INCDIR)car-cdr.h + $(INCDIR)locfile.h $(INCDIR)osmsg.h $(INCDIR)dbprint.h $(INCDIR)car-cdr.h $(INCDIR)dsk.h $(CC) $(RFLAGS) $(SRCDIR)dsk.c $(INLINE) -o $(OBJECTDIR)dsk$(OEXT) $(OBJECTDIR)ufs.o : $(SRCDIR)ufs.c $(REQUIRED-INCS) $(INCDIR)lispemul.h $(INCDIR)lispmap.h \ $(INCDIR)adr68k.h $(INCDIR)dbprint.h $(INLINE)\ $(INCDIR)lsptypes.h $(INCDIR)lspglob.h $(INCDIR)arith.h \ - $(INCDIR)stream.h $(INCDIR)timeout.h $(INCDIR)locfile.h $(INCDIR)dbprint.h + $(INCDIR)stream.h $(INCDIR)timeout.h $(INCDIR)locfile.h $(INCDIR)dbprint.h $(INCDIR)dsk.h $(CC) $(RFLAGS) $(SRCDIR)ufs.c $(INLINE) -o $(OBJECTDIR)ufs$(OEXT) $(OBJECTDIR)dir.o : $(SRCDIR)dir.c $(REQUIRED-INCS) $(INCDIR)lispemul.h \ $(INCDIR)lispmap.h $(INCDIR)adr68k.h $(INCDIR)lsptypes.h \ - $(INCDIR)arith.h $(INCDIR)lspglob.h $(INCDIR)timeout.h $(INCDIR)locfile.h + $(INCDIR)arith.h $(INCDIR)lspglob.h $(INCDIR)timeout.h $(INCDIR)locfile.h $(INCDIR)dsk.h $(CC) $(RFLAGS) $(SRCDIR)dir.c $(INLINE) -o $(OBJECTDIR)dir$(OEXT) $(OBJECTDIR)fvar.o : $(SRCDIR)fvar.c $(REQUIRED-INCS) $(INCDIR)lispemul.h \ @@ -716,7 +716,7 @@ $(OBJECTDIR)subr.o : $(SRCDIR)subr.c $(REQUIRED-INCS) \ $(INCDIR)adr68k.h $(INCDIR)subrs.h \ $(INCDIR)lsptypes.h $(INCDIR)lispmap.h $(INCDIR)emlglob.h \ $(INCDIR)lspglob.h $(INCDIR)cell.h $(INCDIR)stack.h \ - $(INCDIR)arith.h $(INCDIR)profile.h + $(INCDIR)arith.h $(INCDIR)profile.h $(INCDIR)dsk.h $(CC) $(RFLAGS) $(SRCDIR)subr.c $(INLINE) -o $(OBJECTDIR)subr$(OEXT) $(OBJECTDIR)miscn.o : $(SRCDIR)miscn.c $(REQUIRED-INCS) \ @@ -789,7 +789,7 @@ $(OBJECTDIR)vars3.o : $(SRCDIR)vars3.c $(REQUIRED-INCS) $(INCDIR)lispemul.h \ $(OBJECTDIR)vmemsave.o : $(SRCDIR)vmemsave.c $(REQUIRED-INCS) $(INCDIR)lispemul.h \ $(INCDIR)lispmap.h $(INCDIR)lspglob.h \ - $(INCDIR)ifpage.h $(INCDIR)vmemsave.h + $(INCDIR)ifpage.h $(INCDIR)dsk.h $(INCDIR)vmemsave.h $(CC) $(RFLAGS) $(SRCDIR)vmemsave.c $(INLINE) -o $(OBJECTDIR)vmemsave$(OEXT) $(OBJECTDIR)array2.o : $(SRCDIR)array2.c $(REQUIRED-INCS) $(INCDIR)lispemul.h \ diff --git a/inc/dsk.h b/inc/dsk.h new file mode 100644 index 0000000..df895b7 --- /dev/null +++ b/inc/dsk.h @@ -0,0 +1,21 @@ +#ifdef DOS +void separate_host(char *lfname, char *host, char *drive); +#else +void separate_host(char *lfname, char *host); +#endif +LispPTR COM_openfile(register LispPTR *args); +LispPTR COM_closefile(register LispPTR *args); +LispPTR DSK_getfilename(register LispPTR *args); +LispPTR DSK_deletefile(register LispPTR *args); +LispPTR DSK_renamefile(register LispPTR *args); +LispPTR DSK_directorynamep(register LispPTR *args); +LispPTR COM_getfileinfo(register LispPTR *args); +LispPTR COM_setfileinfo(register LispPTR *args); +LispPTR COM_readpage(register LispPTR *args); +LispPTR COM_writepage(register LispPTR *args); +LispPTR COM_truncatefile(register LispPTR *args); +LispPTR COM_changedir(register LispPTR *args); +LispPTR COM_getfreeblock(register LispPTR *args); +void separate_version(char *name, char *ver, int checkp); +int unpack_filename(char *file, char *dir, char *name, char *ver, int checkp); +int true_name(register char *path); diff --git a/src/dir.c b/src/dir.c index 64c7f6f..367bd65 100644 --- a/src/dir.c +++ b/src/dir.c @@ -87,6 +87,7 @@ static char *id = "$Id: dir.c,v 1.4 2001/12/26 22:17:01 sybalsky Exp $ Copyright #include "lspglob.h" #include "timeout.h" #include "locfile.h" +#include "dsk.h" extern int *Lisp_errno; extern int Dummy_errno; diff --git a/src/dsk.c b/src/dsk.c index 9590771..11d432e 100644 --- a/src/dsk.c +++ b/src/dsk.c @@ -110,7 +110,9 @@ static char *id = "$Id: dsk.c,v 1.4 2001/12/24 01:09:01 sybalsky Exp $ Copyright #include "locfile.h" #include "osmsg.h" #include "dbprint.h" +#include "conspage.h" #include "car-cdr.h" +#include "dsk.h" #if defined(ULTRIX) || defined(MACOSX) || defined(FREEBSD) #include @@ -158,10 +160,40 @@ typedef struct current_varray { FileName VersionArray[VERSIONARRAYLENGTH]; CurrentVArray VArrayInfo; -FileName *GetHighestVersion(); -FileName *GetNextHighestVersion(); -FileName *GetLowestVersion(); -FileName *VersionlessP(); +static int locate_file(char *dir, char *name); +static int make_directory(register char *dir); +static int maintain_version(char *file, FileName *varray, int forcep); +static int get_versionless(FileName *varray, char *file, char *dir); +static int check_vless_link(char *vless, FileName *varray, char *to_file, int *highest_p); +static int get_old(char *dir, FileName *varray, char *afile, char *vfile); +static int get_oldest(char *dir, FileName *varray, char *afile, char *vfile); +static int get_new(char *dir, FileName *varray, char *afile, char *vfile); +static int get_old_new(char *dir, FileName *varray, char *afile, char *vfile); +static int get_version_array(char *dir, char *file, FileName *varray, CurrentVArray *cache); + +#ifdef DOS +static void separate_drive(char *lfname, char *drive) +{ + register char *cp; + + cp = lfname; + + /* Check if there's a drive specified. */ + + if (*(cp + 1) == DRIVESEP) { + *drive = *cp; /* copy the drive letter, if there is one */ + cp++; + cp++; /* Move to the real `<`/ */ + while (*cp) /* Move the rest to the left to cover. */ + { + *(cp - 2) = *cp; + cp++; + } + *(cp - 2) = '\0'; + } else + *drive = '\0'; /* no drive */ +} +#endif /* DOS */ /* * Name: separate_host @@ -2549,30 +2581,6 @@ NO: *ver = '\0'; } -#ifdef DOS -void separate_drive(char *lfname, char *drive) -{ - register char *cp; - - cp = lfname; - - /* Check if there's a drive specified. */ - - if (*(cp + 1) == DRIVESEP) { - *drive = *cp; /* copy the drive letter, if there is one */ - cp++; - cp++; /* Move to the real `<`/ */ - while (*cp) /* Move the rest to the left to cover. */ - { - *(cp - 2) = *cp; - cp++; - } - *(cp - 2) = '\0'; - } else - *drive = '\0'; /* no drive */ -} -#endif /* DOS */ - /* * Name: unpack_filename * @@ -2736,7 +2744,7 @@ int true_name(register char *path) * */ -int locate_file(char *dir, char *name) +static int locate_file(char *dir, char *name) { #ifdef DOS char path[MAXPATHLEN]; @@ -2837,7 +2845,7 @@ int locate_file(char *dir, char *name) * */ -int make_directory(register char *dir) +static int make_directory(register char *dir) { register char *cp, *dp; register int maked, rval; @@ -3092,7 +3100,7 @@ int make_directory(register char *dir) /* */ /************************************************************************/ -int get_version_array(char *dir, char *file, FileName *varray, CurrentVArray *cache) +static int get_version_array(char *dir, char *file, FileName *varray, CurrentVArray *cache) { #ifdef DOS @@ -3328,7 +3336,7 @@ int get_version_array(char *dir, char *file, FileName *varray, CurrentVArray *ca * to maintain the directory on which a file is being created. */ -int maintain_version(char *file, FileName *varray, int forcep) +static int maintain_version(char *file, FileName *varray, int forcep) { char dir[MAXPATHLEN], fname[MAXNAMLEN], ver[VERSIONLEN]; char old_file[MAXPATHLEN], vless[MAXPATHLEN]; @@ -3489,7 +3497,7 @@ int maintain_version(char *file, FileName *varray, int forcep) * */ -int get_versionless(FileName *varray, char *file, char *dir) +static int get_versionless(FileName *varray, char *file, char *dir) { #ifdef DOS return (0); @@ -3542,7 +3550,7 @@ int get_versionless(FileName *varray, char *file, char *dir) * */ -int check_vless_link(char *vless, FileName *varray, char *to_file, int *highest_p) +static int check_vless_link(char *vless, FileName *varray, char *to_file, int *highest_p) { register int rval, max_no, found; ino_t vless_ino; @@ -3643,7 +3651,7 @@ int check_vless_link(char *vless, FileName *varray, char *to_file, int *highest_ * */ -int get_old(char *dir, FileName *varray, char *afile, char *vfile) +static int get_old(char *dir, FileName *varray, char *afile, char *vfile) { char name[MAXPATHLEN], vless[MAXPATHLEN], to_file[MAXPATHLEN]; char ver[VERSIONLEN], vbuf[VERSIONLEN]; @@ -3842,7 +3850,7 @@ int get_old(char *dir, FileName *varray, char *afile, char *vfile) * */ -int get_oldest(char *dir, FileName *varray, char *afile, char *vfile) +static int get_oldest(char *dir, FileName *varray, char *afile, char *vfile) { char name[MAXPATHLEN], vless[MAXPATHLEN], to_file[MAXPATHLEN]; char ver[VERSIONLEN], vbuf[VERSIONLEN]; @@ -4039,7 +4047,7 @@ int get_oldest(char *dir, FileName *varray, char *afile, char *vfile) * */ -int get_new(char *dir, FileName *varray, char *afile, char *vfile) +static int get_new(char *dir, FileName *varray, char *afile, char *vfile) { char name[MAXPATHLEN], vless[MAXPATHLEN], to_file[MAXPATHLEN]; char ver[VERSIONLEN], vbuf[VERSIONLEN]; @@ -4333,7 +4341,7 @@ int get_new(char *dir, FileName *varray, char *afile, char *vfile) * */ -int get_old_new(char *dir, FileName *varray, char *afile, char *vfile) +static int get_old_new(char *dir, FileName *varray, char *afile, char *vfile) { char name[MAXPATHLEN], vless[MAXPATHLEN], to_file[MAXPATHLEN]; char ver[VERSIONLEN], vbuf[VERSIONLEN]; diff --git a/src/subr.c b/src/subr.c index 2441f63..43c7193 100644 --- a/src/subr.c +++ b/src/subr.c @@ -47,6 +47,7 @@ static char *id = "$Id: subr.c,v 1.3 1999/05/31 23:35:42 sybalsky Exp $ Copyrigh #include "subrs.h" #include "profile.h" #include "dbprint.h" +#include "dsk.h" extern LispPTR *PENDINGINTERRUPT68k; diff --git a/src/ufs.c b/src/ufs.c index a7f2668..a8ea4b3 100644 --- a/src/ufs.c +++ b/src/ufs.c @@ -87,6 +87,7 @@ static char *id = "$Id: ufs.c,v 1.2 1999/01/03 02:07:41 sybalsky Exp $ Copyright #include "timeout.h" #include "locfile.h" #include "dbprint.h" +#include "dsk.h" int *Lisp_errno; int Dummy_errno; /* If errno cell is not provided by Lisp, dummy_errno is used. */ diff --git a/src/vmemsave.c b/src/vmemsave.c index 9d64ca7..0afdcb1 100644 --- a/src/vmemsave.c +++ b/src/vmemsave.c @@ -76,6 +76,7 @@ static char *id = "$Id: vmemsave.c,v 1.2 1999/01/03 02:07:45 sybalsky Exp $ Copy #include "locfile.h" #include "dbprint.h" #include "devif.h" +#include "dsk.h" #ifdef GCC386 #include "inlnPS2.h"