Exemplo n.º 1
0
/* Input Arguments: ch -> Character to be displayed */
void putchar(unsigned char ch){
	unsigned char i, temp;
	if ( (ch < 0x20) || (ch > 0x7b) ){
		ch = 92;
	}
	for(i=0;i<5;i++){
		temp = FontLookup[ch - 32][i] << 1;
		wrdata(temp);
	}
	wrdata(0x00);
}
Exemplo n.º 2
0
void main()
{
	int i;
	initlcd();
	for(i=0;i<504;i++) {
		pixelxy((i%84)-1,i/84);
		wrdata(tri[i]);
	}

	while(1);
}
Exemplo n.º 3
0
void
get_ps_data(void)
{
    ps_ldata_t *ps_last = PS_LNULL;
    ps_ldata_t *ps_head = PS_LNULL;
    ps_ldata_t *psp;
    ps_data_t  *pstp;
    static char *usrname;
    int i = 0;
    DIR *dirp;
    struct dirent *dentp;
    char pname[MAXNAMELEN];
    int pdlen;
    char *gettty();

    if (pstable != PS_NULL) {  /* Don't run ps unless we need to */
        if ((cache_now - ps_cache_time) <= cache_lifetime)
            return;
        free(pstable);
    }

    pstable_lines = 0;
    ps_cache_time = cache_now;
    /*
     * Determine root path for remote machine.
     */
    if (!readata()) {        /* get data from psfile */
        call_ftw_for_dev();
        wrdata();
    }

    /*
     * Determine which processes to print info about by searching
     * the /proc directory and looking at each process.
     */
    if ((dirp = opendir(procdir)) == NULL) {
        (void) SYSLOG0("Cannot open PROC directory\n");
        return;
    }

    (void) strcpy(pname, procdir);
    pdlen = strlen(pname);
    pname[pdlen++] = '/';

    /* for each active process --- */
    while (dentp = readdir(dirp)) {
        int procfd;

        if (dentp->d_name[0] == '.')                /* skip . and .. */
                continue;
        (void) strcpy(pname + pdlen, dentp->d_name);
retry:
        if ((procfd = open(pname, O_RDONLY)) == -1)
                continue;

        /*
         * Get the info structure for the process and close quickly.
         */
        if (ioctl(procfd, PIOCPSINFO, (char *)&info) == -1) {
            int saverr = errno;

            (void) close(procfd);
            if (saverr == EAGAIN)
                goto retry;
            if (saverr != ENOENT)
                (void) SYSLOG2("PIOCPSINFO on %s: %s\n",
                               pname, strerror(saverr));
            continue;
        }
        (void) close(procfd);
        if ((psp = (ps_ldata_t *)malloc(sizeof (ps_ldata_t))) == PS_LNULL)
            break;
        memset((char *)psp, 0, sizeof (ps_ldata_t));
        psp->pdata.uid = info.pr_uid;
        psp->pdata.pid = info.pr_pid;
        psp->pdata.ppid = info.pr_ppid;
        psp->pdata.sz = info.pr_size;
        if (info.pr_wchan)
            sprintf(psp->pdata.wchan, "%9x", info.pr_wchan);
        else
            strcpy(psp->pdata.wchan, "         ");
        memset(&psp->pdata.stat[0], 0, STAT_SZ+1);
        if (info.pr_sname)
            psp->pdata.stat[0] = info.pr_sname;
        i = 0;
        strcpy(psp->pdata.tty, (char *)gettty(&i));
        psp->pdata.cpu = info.pr_time.tv_sec;
        strcpy(psp->pdata.cmd, info.pr_fname);

        if ((usrname = (get_usr_name(psp->pdata.uid))) != NULL)
            strncpy(psp->pdata.usrname, usrname, USRNM_SZ);
        else {
            free(psp);
            continue;
        }

        psp->pdata.usrname[USRNM_SZ] = '\0';
        pstable_lines++;
        if (ps_last == PS_LNULL)
            ps_head = psp;
        else
            ps_last->link = psp;
        ps_last = psp;
    }

    (void) closedir(dirp);
    if ((pstable = (ps_data_t *)malloc(pstable_lines
                    * sizeof (ps_data_t))) == PS_NULL) {
        clean_ps(ps_head);
        return;
    }
    for (pstp = pstable, psp = ps_head; psp != PS_LNULL;
                                    pstp++, psp = psp->link) {
        memcpy((char *)pstp, (char *)&(psp->pdata), sizeof (ps_data_t));
    }
    clean_ps(ps_head);
    qsort(pstable, pstable_lines, sizeof (ps_data_t), (int (*)())pscomp);
}
Exemplo n.º 4
0
/* Clears the screen */
void clearram(void)
{
	int ddram;
	pixelxy(0,0);	 // Cursor Home.
	for (ddram=700;ddram>0;ddramñ)	{wrdata(0x00);}	 // 6*84 = 504 DDRAM addresses.
}