Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
6a550b4
Replaces ConcNameAndVersion and ConcDirAndName macros with functions
nbriggs Feb 4, 2025
409617b
Adds destination size to conc_... functions and switch to strlcpy/str…
nbriggs Feb 25, 2025
4c6aef8
Replaces all strcpy() by strlcpy() in dsk.c
nbriggs Feb 25, 2025
d1f7361
Replaces strcat() with strlcat() in dsk.c
nbriggs Feb 25, 2025
9557ae8
Updates unixpathname() signature to include output string length, rep…
nbriggs Feb 25, 2025
11b81f6
Replaces all calls to sprintf() with snprintf() in ufs.c
nbriggs Feb 25, 2025
dfb820c
Replace sprintf() with snprintf()
nbriggs Feb 25, 2025
55209aa
Adds size of output parameter to lisppathname() and replaces various …
nbriggs Mar 3, 2025
353f6d2
Clean up quote_fname, quote_fname_ufs, and quote_dname
nbriggs May 12, 2025
4de8b73
Replaces unchecked strcpy/strcat with strlcpy/strlcat
nbriggs May 19, 2025
987fa63
Replaces unchecked strcpy with strlcpy.
nbriggs May 19, 2025
2432792
Replaces unchecked strcpy with strlcpy.
nbriggs May 19, 2025
d4a9286
Replaces unchecked strcpy with strlcpy.
nbriggs May 19, 2025
38d65df
Replaces unchecked strcpy/strcat with strlcpy/strlcat
nbriggs May 20, 2025
babe728
Improves performance of some file operations, fixes some memory leaks…
nbriggs May 23, 2025
5190a39
Resolves issue medley #2165 ignored quoting characters in filename
nbriggs May 23, 2025
e745381
Fixup: wrong quoting function used in updates to enum_ufs, enum_ufs_prop
nbriggs May 25, 2025
fe7beaf
"as if" => "as is" in comments.
nbriggs Jun 2, 2025
04ad740
Adds GETFILEATTRIBUTE processing for INODE_LO and INODE_HI attributes.
nbriggs Aug 19, 2025
67f8cc0
Cleanup UnixVersionToLispVersion and LispVersionToUnixVersion
nbriggs Oct 20, 2025
d4a882a
Uses sizeof() or passed size, where known, in calls to conc_name_and_…
nbriggs Oct 20, 2025
51a3368
Resolves error and style complaints by Gemini code review
nbriggs Oct 20, 2025
4dfbdf2
Responds to Gemini review of potential buffer overflows in quote_... fns
nbriggs Oct 20, 2025
9f1bcb9
Simplify conc_dir_and_name implementation for Gemini
nbriggs Oct 20, 2025
e2f69f4
Adds comment clarifying requirement to call alarm(0) after S_TOUT
nbriggs Oct 20, 2025
60e12da
Removes comment that is now unnecessary/confusing
nbriggs Oct 20, 2025
673ec07
Updates CMakeLists.txt to reflect removal of inc/lispver2.h
nbriggs Oct 22, 2025
8ad8b4d
Removes unused local variable len
nbriggs Oct 22, 2025
3d09555
Removes assigned-but-not-used rval in DSK_getfilename and redundant …
nbriggs Oct 22, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -364,7 +364,6 @@ SET(MAIKO_HDRS
inc/lispemul.h
inc/lispmap.h
inc/lispver1.h
inc/lispver2.h
inc/llcolordefs.h
inc/lldsp.h
inc/llstkdefs.h
Expand Down
2 changes: 1 addition & 1 deletion bin/makefile-dos
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ SRCFILES = conspage.c gcoflow.c shift.c dbgtool.c gcr.c gcrcell.c llstk.
OFILES = conspage.obj gcoflow.obj shift.obj dbgtool.obj gcr.obj gcrcell.obj llstk.obj gcscan.obj loopsops.obj storage.obj allocmds.obj dir.obj gvar2.obj lowlev1.obj subr.obj arithops.obj lowlev2.obj subr0374.obj doscomm.obj hardrtn.obj lsthandl.obj sxhash.obj draw.obj main.obj testtool.obj array.obj dsk.obj inet.obj misc7.obj timer.obj array2.obj dspif.obj initdsp.obj miscn.obj typeof.obj array3.obj initkbd.obj ubf1.obj array4.obj dspsubrs.obj initsout.obj mkatom.obj ubf2.obj array5.obj eqf.obj intcall.obj mkcell.obj ubf3.obj array6.obj ether.obj ufn.obj atom.obj findkey.obj kbdsubrs.obj mouseif.obj ufs.obj bbtsub.obj foreign.obj keyevent.obj unixcomm.obj bin.obj fp.obj binds.obj fvar.obj mvs.obj unwind.obj bitblt.obj gc.obj uraid.obj blt.obj gc2.obj kprint.obj osmsg.obj usrsubr.obj byteswap.obj gcarray.obj perrno.obj uutils.obj carcdr.obj asmbbt.obj gccode.obj vars3.obj gcfinal.obj ldsout.obj return.obj vmemsave.obj chardev.obj gchtfind.obj lineblt8.obj rpc.obj xc.obj common.obj gcmain3.obj lisp2c.obj rplcons.obj z2.obj vdate.obj $(COLORFILES) $(ARCHFILES) $(LPFILES)


HFILES = address.h adr68k.h arithopsdefs.h arith.h cell.h dbprint.h display.h dspif.h ifpage.h iopage.h lispemul.h lispmap.h lsptypes.h miscstat.h lspglob.h array.h bb.h bbtmacro.h debug.h devconf.h dspdata.h fast_dsp.h gcdata.h initatms.h inlinec.h keyboard.h lispver1.h lispver2.h lldsp.h locfile.h medleyfp.h mouseif.h my.h opcodes.h osmsgprint.h pilotbbt.h print.h retmacro.h stack.h stream.h subrs.h timeout.h tos1defs.h tosfns.h tosret.h xdefs.h xbitmaps.h xkeymap.h
HFILES = address.h adr68k.h arithopsdefs.h arith.h cell.h dbprint.h display.h dspif.h ifpage.h iopage.h lispemul.h lispmap.h lsptypes.h miscstat.h lspglob.h array.h bb.h bbtmacro.h debug.h devconf.h dspdata.h fast_dsp.h gcdata.h initatms.h inlinec.h keyboard.h lispver1.h lldsp.h locfile.h medleyfp.h mouseif.h my.h opcodes.h osmsgprint.h pilotbbt.h print.h retmacro.h stack.h stream.h subrs.h timeout.h tos1defs.h tosfns.h tosret.h xdefs.h xbitmaps.h xkeymap.h



Expand Down
18 changes: 9 additions & 9 deletions bin/makefile-tail
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,7 @@ $(OBJECTDIR)car-cdr.o: $(SRCDIR)car-cdr.c $(REQUIRED-INCS) \
$(OBJECTDIR)chardev.o: $(SRCDIR)chardev.c $(REQUIRED-INCS) \
$(INCDIR)lispemul.h $(INCDIR)lispmap.h \
$(INCDIR)adr68k.h $(INCDIR)lsptypes.h $(INCDIR)arith.h $(INCDIR)timeout.h \
$(INCDIR)locfile.h $(INCDIR)lispver2.h $(INCDIR)dbprint.h \
$(INCDIR)locfile.h $(INCDIR)dbprint.h \
$(INCDIR)chardevdefs.h $(INCDIR)byteswapdefs.h $(INCDIR)commondefs.h \
$(INCDIR)perrnodefs.h
$(CC) $(RFLAGS) $(SRCDIR)chardev.c -o $(OBJECTDIR)chardev.o
Expand Down Expand Up @@ -505,7 +505,7 @@ $(OBJECTDIR)dsk.o: $(SRCDIR)dsk.c $(REQUIRED-INCS) \
$(INCDIR)lispemul.h $(INCDIR)lispmap.h \
$(INCDIR)adr68k.h $(INCDIR)lsptypes.h $(INCDIR)lspglob.h $(INCDIR)ifpage.h \
$(INCDIR)iopage.h $(INCDIR)miscstat.h $(INCDIR)arith.h $(INCDIR)stream.h \
$(INCDIR)timeout.h $(INCDIR)locfile.h $(INCDIR)lispver2.h \
$(INCDIR)timeout.h $(INCDIR)locfile.h \
$(INCDIR)dbprint.h $(INCDIR)dskdefs.h $(INCDIR)byteswapdefs.h \
$(INCDIR)car-cdrdefs.h $(INCDIR)cell.h $(INCDIR)commondefs.h \
$(INCDIR)ufsdefs.h
Expand All @@ -515,15 +515,15 @@ $(OBJECTDIR)ufs.o: $(SRCDIR)ufs.c $(REQUIRED-INCS) \
$(INCDIR)lispemul.h $(INCDIR)lispmap.h \
$(INCDIR)adr68k.h $(INCDIR)lsptypes.h $(INCDIR)lspglob.h $(INCDIR)ifpage.h \
$(INCDIR)iopage.h $(INCDIR)miscstat.h $(INCDIR)arith.h $(INCDIR)stream.h \
$(INCDIR)timeout.h $(INCDIR)locfile.h $(INCDIR)lispver2.h $(INCDIR)dbprint.h \
$(INCDIR)timeout.h $(INCDIR)locfile.h $(INCDIR)dbprint.h \
$(INCDIR)ufsdefs.h $(INCDIR)commondefs.h $(INCDIR)dskdefs.h
$(CC) $(RFLAGS) $(SRCDIR)ufs.c -o $(OBJECTDIR)ufs.o

$(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)ifpage.h $(INCDIR)iopage.h $(INCDIR)miscstat.h $(INCDIR)timeout.h \
$(INCDIR)locfile.h $(INCDIR)lispver2.h $(INCDIR)dirdefs.h \
$(INCDIR)locfile.h $(INCDIR)dirdefs.h \
$(INCDIR)commondefs.h $(INCDIR)dskdefs.h $(INCDIR)ufsdefs.h
$(CC) $(RFLAGS) $(SRCDIR)dir.c -o $(OBJECTDIR)dir.o

Expand Down Expand Up @@ -640,7 +640,7 @@ $(OBJECTDIR)inet.o: $(SRCDIR)inet.c $(REQUIRED-INCS) \
$(INCDIR)lispemul.h $(INCDIR)lispmap.h \
$(INCDIR)lsptypes.h $(INCDIR)arith.h $(INCDIR)emlglob.h $(INCDIR)lspglob.h \
$(INCDIR)ifpage.h $(INCDIR)iopage.h $(INCDIR)miscstat.h $(INCDIR)adr68k.h \
$(INCDIR)dbprint.h $(INCDIR)locfile.h $(INCDIR)lispver2.h \
$(INCDIR)dbprint.h $(INCDIR)locfile.h \
$(INCDIR)inetdefs.h $(INCDIR)byteswapdefs.h $(INCDIR)commondefs.h \
$(INCDIR)mkcelldefs.h
$(CC) $(RFLAGS) $(SRCDIR)inet.c -o $(OBJECTDIR)inet.o
Expand Down Expand Up @@ -758,7 +758,7 @@ $(OBJECTDIR)osmsg.o: $(SRCDIR)osmsg.c $(REQUIRED-INCS) \
$(INCDIR)lispemul.h $(INCDIR)lispmap.h \
$(INCDIR)adr68k.h $(INCDIR)lsptypes.h $(INCDIR)arith.h $(INCDIR)stream.h \
$(INCDIR)lspglob.h $(INCDIR)ifpage.h $(INCDIR)iopage.h $(INCDIR)miscstat.h \
$(INCDIR)timeout.h $(INCDIR)locfile.h $(INCDIR)lispver2.h $(INCDIR)osmsgprint.h \
$(INCDIR)timeout.h $(INCDIR)locfile.h $(INCDIR)osmsgprint.h \
$(INCDIR)dbprint.h $(INCDIR)commondefs.h $(INCDIR)osmsgdefs.h
$(CC) $(RFLAGS) $(SRCDIR)osmsg.c -o $(OBJECTDIR)osmsg.o

Expand Down Expand Up @@ -865,7 +865,7 @@ $(OBJECTDIR)unixcomm.o: $(SRCDIR)unixcomm.c $(REQUIRED-INCS) \
$(INCDIR)lspglob.h $(INCDIR)ifpage.h $(INCDIR)iopage.h $(INCDIR)miscstat.h \
$(INCDIR)cell.h $(INCDIR)stack.h $(INCDIR)arith.h $(INCDIR)dbprint.h \
$(INCDIR)timeout.h $(INCDIR)unixcommdefs.h $(INCDIR)byteswapdefs.h \
$(INCDIR)commondefs.h $(INCDIR)locfile.h $(INCDIR)lispver2.h
$(INCDIR)commondefs.h $(INCDIR)locfile.h
$(CC) $(RFLAGS) $(SRCDIR)unixcomm.c -o $(OBJECTDIR)unixcomm.o

$(OBJECTDIR)unixfork.o: $(SRCDIR)unixfork.c $(REQUIRED-INCS) \
Expand All @@ -888,7 +888,7 @@ $(OBJECTDIR)rpc.o: $(SRCDIR)rpc.c $(REQUIRED-INCS) \
$(INCDIR)lispemul.h $(INCDIR)lispmap.h \
$(INCDIR)lsptypes.h $(INCDIR)lspglob.h $(INCDIR)ifpage.h $(INCDIR)iopage.h \
$(INCDIR)miscstat.h $(INCDIR)emlglob.h $(INCDIR)adr68k.h $(INCDIR)arith.h \
$(INCDIR)locfile.h $(INCDIR)lispver2.h $(INCDIR)rpcdefs.h \
$(INCDIR)locfile.h $(INCDIR)rpcdefs.h \
$(INCDIR)commondefs.h
$(CC) $(RFLAGS) $(SRCDIR)rpc.c -o $(OBJECTDIR)rpc.o

Expand All @@ -909,7 +909,7 @@ $(OBJECTDIR)vmemsave.o: $(SRCDIR)vmemsave.c $(REQUIRED-INCS) \
$(INCDIR)lispemul.h \
$(INCDIR)lispmap.h $(INCDIR)lspglob.h $(INCDIR)ifpage.h $(INCDIR)iopage.h \
$(INCDIR)miscstat.h $(INCDIR)timeout.h $(INCDIR)adr68k.h \
$(INCDIR)lsptypes.h $(INCDIR)locfile.h $(INCDIR)lispver2.h $(INCDIR)dbprint.h \
$(INCDIR)lsptypes.h $(INCDIR)locfile.h $(INCDIR)dbprint.h \
$(INCDIR)devif.h $(INCDIR)vmemsavedefs.h $(INCDIR)byteswapdefs.h $(INCDIR)commondefs.h \
$(INCDIR)dskdefs.h $(INCDIR)initkbddefs.h $(INCDIR)perrnodefs.h \
$(INCDIR)ufsdefs.h
Expand Down
2 changes: 1 addition & 1 deletion inc/dirdefs.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ typedef struct dfinfo {
} DFINFO;

#ifdef DOS
int make_old_version(char *old, char *file);
int make_old_version(char *old, size_t oldsize, char *file);
#endif
#ifdef FSDEBUG
void print_finfo(FINFO *fp);
Expand Down
6 changes: 4 additions & 2 deletions inc/dskdefs.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@ LispPTR COM_writepage(LispPTR *args);
LispPTR COM_truncatefile(LispPTR *args);
LispPTR COM_changedir(LispPTR *args);
LispPTR COM_getfreeblock(LispPTR *args);
void separate_version(char *name, char *ver, int checkp);
void conc_dir_and_name(char *dir, char *name, char *fname, size_t fname_size);
void conc_name_and_version(char *name, char *ver, char *rname, size_t rname_size);
void separate_version(char *name, size_t namesize, char *ver, size_t versize, int checkp);
int unpack_filename(char *file, char *dir, char *name, char *ver, int checkp);
int true_name(char *path);
int true_name(char *path, size_t pathsize);
#endif
74 changes: 0 additions & 74 deletions inc/lispver2.h

This file was deleted.

174 changes: 4 additions & 170 deletions inc/locfile.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@
#define PROTECTION (S_POSITIVE | 6)
#define EOL (S_POSITIVE | 7)
#define ALL (S_POSITIVE | 8)
#define INODE_LO (S_POSITIVE | 9)
#define INODE_HI (S_POSITIVE | 10)

#define ToLispTime(x) ((int)(x) + 29969152)
/* For getfileinfo. For WDATE&RDATE */
Expand Down Expand Up @@ -310,178 +312,10 @@ do { \
/* * * * * it gave "Too many characters in a character constant" errors! */
#include "lispver1.h"
#else /* DOS */
/* NON-DOS version of the macro LispVersionToUnixVersion */
#include "lispver2.h"
/* NON-DOS version is inline in ufs.c */
#endif /* DOS */


/*
* Name: UnixVersionToLispVersion
*
* Argument: char *pathname
* UNIX syntax pathname.
* int vlessp
* If 0, versionless file is converted to version 1.
* Otherwise, remains as versionless.
*
* Value: On success returns 1, otherwise 0.
*
* Side Effect: The version part of pathname is destructively modified.
*
* Description:
*
* Destructively modifies the version part of pathname which is following the
* UNIX file naming convention to Xerox Lisp one.
* This macro should be called, in the routines which convert the UNIX pathname
* to Lisp one, just before it returns the result to Lisp, because converting
* version field will append a semicolon which may confuse the routine
* The file which does not have a valid version field, that is ".~##~" form, is
* dealt with as version 1.
*/

#define UnixVersionToLispVersion(pathname, vlessp) do { \
\
char *start; \
char *end; \
char *lf_cp; \
int ver_no; \
size_t len; \
char ver_buf[VERSIONLEN]; \
\
if ((start = strchr(pathname, '~')) != NULL) { \
/* First of all, find the version field in pathname. */ \
end = start; \
lf_cp = start + 1; \
while (*lf_cp) { \
if (*lf_cp == '~') { \
start = end; \
end = lf_cp; \
lf_cp++; \
} else { \
lf_cp++; \
} \
} \
\
if (start != end && *(start - 1) == '.' && end == (lf_cp - 1)) { \
/* \
* pathname ends in the form ".~###~". But we \
* check ### is a valid number or not. \
*/ \
len = (end - start) - 1; \
strncpy(ver_buf, start + 1, len); \
ver_buf[len] = '\0'; \
NumericStringP(ver_buf, YES, NO); \
YES: \
*(start - 1) = ';'; \
*start = '\0'; \
*end = '\0'; \
/* call strtoul() to eliminate leading 0s. */ \
ver_no = strtoul(start + 1, (char **)NULL, 10); \
sprintf(ver_buf, "%u", ver_no); \
strcat(pathname, ver_buf); \
goto CONT; \
\
NO: \
/* Dealt with as version 1 unless vlessp */ \
if (!(vlessp)) strcat(pathname, ";1"); \
CONT: \
lf_cp--; /* Just for label */ \
} else { \
/* Dealt with as version 1 unless vlessp. */ \
if (!(vlessp)) strcat(pathname, ";1"); \
} \
} else { \
/* Dealt with as version 1 unless vlessp. */ \
if (!(vlessp)) strcat(pathname, ";1"); \
} \
} while (0)

/*
* Name: ConcDirAndName
*
* Argument: char *dir The name of the directory.
* char *name The name of a file.
* char *fname The place where the full file name should be
* stored.
* Value: N/A
*
* Side Effect: fname is replaced with the full file name.
*
* Description:
*
* Concatenate the directory name and root file name. Checks if dir contains
* the trail directory delimiter or not.
*
*/

#define ConcDirAndName(dir, name, fname) do { \
\
char *lf_cp1, *lf_cp2; \
\
lf_cp1 = dir; \
lf_cp2 = dir; \
\
while (*lf_cp2 != '\0') { \
switch (*lf_cp2) { \
\
case '/': \
lf_cp1 = lf_cp2; \
lf_cp2++; \
break; \
\
default: \
lf_cp2++; \
break; \
} \
} \
if (lf_cp1 == (lf_cp2 - 1)) { \
if (lf_cp1 == (dir)) { \
/* dir is a root directory. */ \
strcpy(fname, "/"); \
strcat(fname, name); \
} else { \
/* The trail directory is included. */ \
strcpy(fname, dir); \
strcat(fname, name); \
} \
} else { \
/* The trail directory is not included */ \
strcpy(fname, dir); \
strcat(fname, "/"); \
strcat(fname, name); \
} \
} while (0)

/*
* Name: ConcNameAndVersion
*
* Argument: char *name The root file name.
* char *ver The file version.
* char *rname The place where the concatenated file name will be
* stored.
* Value: N/A
*
* Side Effect: rname is replaced with the concatenated file name.
*
* Description:
*
* Concatenate the root file name and its version in UNIX format.
*
*/

#define ConcNameAndVersion(name, ver, rname) do { \
if (*(ver) != '\0') { \
strcpy(rname, name); \
strcat(rname, ".~"); \
strcat(rname, ver); \
strcat(rname, "~"); \
} else { \
strcpy(rname, name); \
} \
} while (0)

#define VERSIONLEN 16

#define VERSIONLEN 24
#define MAXVERSION 999999999

#define LASTVERSIONARRAY ((unsigned) -1)
Expand Down
Loading