/* **++ ** ROUTINE: sp_show_subprocess ** ** FUNCTIONAL DESCRIPTION: ** ** Uses $GETJPI to get info on the subprocess and ** displays it à la CTRL/T. ** ** RETURNS: cond_value, longword (unsigned), write only, by value ** ** PROTOTYPE: ** ** sp_show_subprocess(SPHANDLE ctx) ** ** IMPLICIT INPUTS: None. ** ** IMPLICIT OUTPUTS: None. ** ** COMPLETION CODES: ** ** ** SIDE EFFECTS: None. ** **-- */ unsigned int sp_show_subprocess (SPHANDLE ctx) { static $DESCRIPTOR(ctrstr, "<<!AD!AD !8%T !9AD CPU=!%T PF=!UL IO=!UL MEM=!UL>>"); static int neg10000 = -10000; static int zero = 0; struct dsc$descriptor bufdsc; struct { unsigned short len, code; char *ptr; unsigned int term; } fscnlst = {0, FSCN$_NAME, 0, 0}; ITMLST jpilst[8]; char nodename[33], buf[256]; char prcnam[16], imgnam[256]; unsigned short prcnamlen, imgnamlen, iosb[4], buflen; unsigned int cputim[2], xcputim; unsigned int pageflts, biocnt, diocnt, wssize; unsigned int status; if (!get_logical("SYS$NODE", nodename, sizeof(nodename))) nodename[0] = '\0'; ITMLST_INIT(jpilst[0], JPI$_PRCNAM, sizeof(prcnam), prcnam, &prcnamlen); ITMLST_INIT(jpilst[1], JPI$_IMAGNAME, sizeof(imgnam), imgnam, &imgnamlen); ITMLST_INIT(jpilst[2], JPI$_CPUTIM, sizeof(xcputim), &xcputim, 0); ITMLST_INIT(jpilst[3], JPI$_PAGEFLTS, sizeof(pageflts), &pageflts, 0); ITMLST_INIT(jpilst[4], JPI$_DIOCNT, sizeof(diocnt), &diocnt, 0); ITMLST_INIT(jpilst[5], JPI$_BIOCNT, sizeof(biocnt), &biocnt, 0); ITMLST_INIT(jpilst[6], JPI$_WSSIZE, sizeof(wssize), &wssize, 0); ITMLST_INIT(jpilst[7], 0, 0, 0, 0); status = sys$getjpiw(0, &ctx->pid, 0, jpilst, iosb, 0, 0); if (OK(status)) status = iosb[0]; if (!OK(status)) return SS$_NORMAL; while (imgnamlen > 0 && isspace(imgnam[imgnamlen-1])) imgnamlen--; if (imgnamlen > 0) { INIT_SDESC(bufdsc, imgnamlen, imgnam); status = sys$filescan(&bufdsc, &fscnlst, 0); if (!OK(status)) { fscnlst.ptr = imgnam; fscnlst.len = imgnamlen; } } else { strcpy(imgnam, " (DCL)"); imgnamlen = 7; } lib$emul(&neg10000, &xcputim, &zero, cputim); INIT_SDESC(bufdsc, sizeof(buf), buf); status = sys$fao(&ctrstr, &buflen, &bufdsc, strlen(nodename), nodename, prcnamlen, prcnam, 0, fscnlst.len, fscnlst.ptr, cputim, pageflts, diocnt+biocnt, wssize); if (OK(status)) { bufdsc.dsc$w_length = buflen; lib$put_output(&bufdsc); } return SS$_NORMAL; } /* sp_show_subprocess */
void* recv_msg(void* arg) { int client = *(int*) arg; char message[MSGSIZE]; while(1) { memset(message, 0, MSGSIZE); recv(client, &message, MSGSIZE, 0); if(strcmp(message, "\0")) put_output(message); } }
int main(int argc, char* argv[]) { // Get the seed-key if (get_input()) return -1; // Generate the BlowFish32 subkeys blowfish_keygen(); // Output the subkeys if (put_output()) return -1; return 0; }
/* **++ ** ROUTINE: put_command ** ** FUNCTIONAL DESCRIPTION: ** ** LIB$PUT_OUTPUT replacement that directs things either ** to SYS$OUTPUT or to the file specified in /OUTPUT (for commands). ** ** RETURNS: cond_value, longword (unsigned), write only, by value ** ** PROTOTYPE: ** ** put_command(struct dsc$descriptor *dsc) ** ** IMPLICIT INPUTS: None. ** ** IMPLICIT OUTPUTS: None. ** ** COMPLETION CODES: ** ** ** SIDE EFFECTS: None. ** **-- */ unsigned int put_command (void *dsc) { return lib$put_output(dsc); } /* put_output */
main(){ $DESCRIPTOR(hello,"HELLO\n"); $DESCRIPTOR(world,"WORLD\n"); lib$put_output(&hello); lib$put_output(&world); }