Skip to content

Commit f28c014

Browse files
committed
Replaces ConcNameAndVersion and ConcDirAndName macros with functions
Replaces ConcNameAndVersion and ConcDirAndName macros with conc_name_and_version and conc_dir_and_name functions respectively, moves the definitions from locfile.h to dsk.c, and adds them to dskdefs.h for use by other source files.
1 parent 40d4fca commit f28c014

File tree

4 files changed

+183
-178
lines changed

4 files changed

+183
-178
lines changed

inc/dskdefs.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ LispPTR COM_writepage(LispPTR *args);
1919
LispPTR COM_truncatefile(LispPTR *args);
2020
LispPTR COM_changedir(LispPTR *args);
2121
LispPTR COM_getfreeblock(LispPTR *args);
22+
void conc_dir_and_name(char *dir, char *name, char *fname);
23+
void conc_name_and_version(char *name, char *ver, char *rname);
2224
void separate_version(char *name, char *ver, int checkp);
2325
int unpack_filename(char *file, char *dir, char *name, char *ver, int checkp);
2426
int true_name(char *path);

inc/locfile.h

Lines changed: 0 additions & 84 deletions
Original file line numberDiff line numberDiff line change
@@ -410,90 +410,6 @@ do { \
410410
} \
411411
} while (0)
412412

413-
/*
414-
* Name: ConcDirAndName
415-
*
416-
* Argument: char *dir The name of the directory.
417-
* char *name The name of a file.
418-
* char *fname The place where the full file name should be
419-
* stored.
420-
* Value: N/A
421-
*
422-
* Side Effect: fname is replaced with the full file name.
423-
*
424-
* Description:
425-
*
426-
* Concatenate the directory name and root file name. Checks if dir contains
427-
* the trail directory delimiter or not.
428-
*
429-
*/
430-
431-
#define ConcDirAndName(dir, name, fname) do { \
432-
\
433-
char *lf_cp1, *lf_cp2; \
434-
\
435-
lf_cp1 = dir; \
436-
lf_cp2 = dir; \
437-
\
438-
while (*lf_cp2 != '\0') { \
439-
switch (*lf_cp2) { \
440-
\
441-
case '/': \
442-
lf_cp1 = lf_cp2; \
443-
lf_cp2++; \
444-
break; \
445-
\
446-
default: \
447-
lf_cp2++; \
448-
break; \
449-
} \
450-
} \
451-
if (lf_cp1 == (lf_cp2 - 1)) { \
452-
if (lf_cp1 == (dir)) { \
453-
/* dir is a root directory. */ \
454-
strcpy(fname, "/"); \
455-
strcat(fname, name); \
456-
} else { \
457-
/* The trail directory is included. */ \
458-
strcpy(fname, dir); \
459-
strcat(fname, name); \
460-
} \
461-
} else { \
462-
/* The trail directory is not included */ \
463-
strcpy(fname, dir); \
464-
strcat(fname, "/"); \
465-
strcat(fname, name); \
466-
} \
467-
} while (0)
468-
469-
/*
470-
* Name: ConcNameAndVersion
471-
*
472-
* Argument: char *name The root file name.
473-
* char *ver The file version.
474-
* char *rname The place where the concatenated file name will be
475-
* stored.
476-
* Value: N/A
477-
*
478-
* Side Effect: rname is replaced with the concatenated file name.
479-
*
480-
* Description:
481-
*
482-
* Concatenate the root file name and its version in UNIX format.
483-
*
484-
*/
485-
486-
#define ConcNameAndVersion(name, ver, rname) do { \
487-
if (*(ver) != '\0') { \
488-
strcpy(rname, name); \
489-
strcat(rname, ".~"); \
490-
strcat(rname, ver); \
491-
strcat(rname, "~"); \
492-
} else { \
493-
strcpy(rname, name); \
494-
} \
495-
} while (0)
496-
497413
#define VERSIONLEN 16
498414

499415
#define MAXVERSION 999999999

0 commit comments

Comments
 (0)