Exemple #1
0
void iosFdShow (void)
    {
    char *stin;
    char *stout;
    char *sterr;
    FD_ENTRY *pFdEntry;
    int fd;
    int xfd;

    printf ("%3s %-20s %3s\n", "fd", "name", "drv");

    for (fd = 0; fd < maxFiles; fd++)
	{
	pFdEntry = &fdTable [fd];
	if (pFdEntry->inuse)
	    {
	    xfd = STD_FIX(fd);

	    stin  = (xfd == ioGlobalStdGet (STD_IN))  ? "in"  : "";
	    stout = (xfd == ioGlobalStdGet (STD_OUT)) ? "out" : "";
	    sterr = (xfd == ioGlobalStdGet (STD_ERR)) ? "err" : "";

	    printf ("%3d %-20s %3d %s %s %s\n",
		    xfd,
		    (pFdEntry->name == NULL) ? "(unknown)" : pFdEntry->name,
		    pFdEntry->pDevHdr->drvNum, stin, stout, sterr);
	    }
	}
    }
Exemple #2
0
void iosFdShow(
    void
    )
{
    int i, fd;
    FD_ENTRY *pFd;
    char inStr[3], outStr[3], errStr[3];
    char name[80];

    printf("%3s %-20s %3s\n", "fd", "name", "drv");

    for (i = 0; i < iosMaxFd; i++)
    {
        pFd = &iosFdTable[i];
        if (pFd->used == TRUE)
        {
            fd = STD_FIX(i);

            /* Get filedescriptor names */
            if (fd == ioGlobalStdGet(STDIN_FILENO))
            {
                strcpy(inStr, "in");
            }
            else
            {
                strcpy(inStr, "");
            }

            if (fd == ioGlobalStdGet(STDOUT_FILENO))
            {
                strcpy(outStr, "out");
            }
            else
            {
                strcpy(outStr, "");
            }

            if (fd == ioGlobalStdGet(STDERR_FILENO))
            {
                strcpy(errStr, "err");
            }
            else
            {
                strcpy(errStr, "");
            }

            if (pFd->name == NULL)
            {
                strcpy(name, "(unknown)");
            }
            else
            {
                strcpy(name, pFd->name);
            }

            printf(
                "%3d %-20s %3d %s %s %s\n",
                fd,
                name,
                pFd->pDevHeader->drvNumber,
                inStr,
                outStr,
                errStr
                );
        }
    }
}