Open System Services Programmer's Guide

spt_unregFile(fnum);
FILE_CLOSE_(fnum);
printf("==> Grd_WRITE_thread() wrote %d bytes to file %s\n",
WRITE_FILESIZE, Grd_WRITE_file);
return(NULL);
}
int main(int argc, char *argv[])
{
/* the following variables correspond to the OSS filenames specified */
/* as command line parameters to the program */
char OSS_read_filename[PATH_MAX];
char OSS_write_filename[PATH_MAX];
char Grd_READ_filename[PATH_MAX];
char Grd_WRITE_filename[PATH_MAX];
/* total number of threads that have been created */
int nmbr_created_threads = 0;
/* array of handles for each thread created */
pthread_t thread_handle[MAX_THREADS];
int i;
/*************************************/
/* Process command line arguments */
/*************************************/
if (argc > 9)
{
printf("Usage: sptdio [-r <OSS-file>] [-w <OSS-file>] [-R <OSS-file>] [-W
<OSS-file>]\n");
exit(0);
}
/* verify that an even number of command line parameters was specified */
if (((argc - 1) % 2) == 1)
{
printf("Usage: sptdio [-r <OSS-file>] [-w <OSS-file>] [-R <OSS-file>] [-W
<OSS-file>]\n");
exit(0);
}
for (i = 1; i < argc; i = i + 2)
{
if (strcmp(argv[i], "-r") == 0)
{
strcpy(OSS_read_filename, argv[i+1]);
}
else if (strcmp(argv[i], "-w") == 0)
{
strcpy(OSS_write_filename, argv[i+1]);
}
else if (strcmp(argv[i], "-R") == 0)
{
strcpy(Grd_READ_filename, argv[i+1]);
}
else if (strcmp(argv[i], "-W") == 0)
{
strcpy(Grd_WRITE_filename, argv[i+1]);
}
else
{
printf("Usage: sptdio [-r <OSS-file>] [-w <OSS-file>] [-R <OSS-file>]
[-W <OSS-file>]\n");
exit(0);
}
}
358 Using the Standard POSIX Threads Library