From 7b0995ea20afed2632893f8528ce9d57772d5498 Mon Sep 17 00:00:00 2001 From: Ben Burwell Date: Wed, 1 Apr 2015 20:01:07 -0400 Subject: as of 2013-09-19 --- direct.c | 55 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 direct.c (limited to 'direct.c') diff --git a/direct.c b/direct.c new file mode 100644 index 0000000..b6181d5 --- /dev/null +++ b/direct.c @@ -0,0 +1,55 @@ +/* + * file: direct.c + * + * This file contains the function which reads the names and + * sizes of the MPX/OS process files from the disk, and stores + * them in the directory entry array. + */ + +#include /* Borland header file */ +#include /* Borland header file */ +#include /* Borland header file */ +#include /* Borland header file */ +#include "mpx.h" + +dir direct[MAXSIZE]; /* The array of directory entries. */ + +/* + * + * directory - This procedure performs a sequential read of the MPX + * directory, obtaining all .MPX files up to the size of the + * directory. These are the file that can be loaded by + * COMHAN. Note that the file specific details are saved in + * the dir structure, direct. + * + * Parameters: direct - the array of directory entries. + * dir_size - the capacity of the direct array. + * + * Return value: The number of files entries made to the + * direct array. + */ + + +int directory(dir *direct, int dir_size) +{ + int num_procs; /* Number of .mpx files found. */ + char filename[15]; /* Name of a file with .mpx extension. */ + int done; /* Flags when no more .mpx files can be found. */ + struct ffblk ffblk; + + num_procs = 0; /* number of .MPX file entries placed in directory */ + + done = findfirst ("*.MPX",&ffblk,0); + while (!done && num_procs < dir_size) { + strcpy (filename,ffblk.ff_name); + strcpy(direct->dirnam,filename); + direct->dirnam[strcspn(filename,".")] = '\0'; + direct->dirsiz = ffblk.ff_fsize; + ++num_procs; + direct++; + done = findnext(&ffblk); + } + + return(num_procs); +} + -- cgit v1.2.3