Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replaces ConcNameAndVersion and ConcDirAndName macros with functions #533

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 2 additions & 0 deletions inc/dskdefs.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ LispPTR COM_writepage(LispPTR *args);
LispPTR COM_truncatefile(LispPTR *args);
LispPTR COM_changedir(LispPTR *args);
LispPTR COM_getfreeblock(LispPTR *args);
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, char *ver, int checkp);
int unpack_filename(char *file, char *dir, char *name, char *ver, int checkp);
int true_name(char *path);
Expand Down
84 changes: 0 additions & 84 deletions inc/locfile.h
Original file line number Diff line number Diff line change
Expand Up @@ -410,90 +410,6 @@ do { \
} \
} 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 MAXVERSION 999999999
Expand Down
Loading