Article 2862 of comp.sys.handhelds: Path: en.ecn.purdue.edu!noose.ecn.purdue.edu!news.cs.indiana.edu!julius.cs.uiuc.edu!usc!apple!rutgers!netnews.upenn.edu!hoford@sequoia.upenn.edu From: hoford@sequoia.upenn.edu (John Hoford) Newsgroups: comp.sys.handhelds Subject: hp48 as a client? Message-ID: <34588@netnews.upenn.edu> Date: 11 Dec 90 22:30:54 GMT Sender: news@netnews.upenn.edu Organization: CIRC,Radiology,U. of Pennsylvania Lines: 128 This c progam allows you to type hp commands on your unix machine. ------ cut here -------- /* This progams runs on a sun4 os4.1 and should run on most unix boxes. It runs kermit in background and sends the commands you type in to the hp48 by appending them to "remote host". All commands should be upper case. You can place multiple commands on a line ( 10 2 / ). It responds by outputing the stack. You can also type the dir command which runs "remote dir" and done which quits configure your .kermrc to your "line" and "baud" and run progam. please send improvements to hoford@gynko.circ.upenn.edu */ #include #include #define TRUE 1 int reap_kermit(); char str[80]; char cmd_str[30]; main() { int kin[2]; int pid; int head_len; int i; strcpy(str,"remote host "); head_len = strlen(str); pipe(kin); /* make a pipe */ signal(SIGCHLD,kermit_end); /* when child exits call kermit_end func */ if ((pid = fork()) == -1) { fprintf(stderr,"erro cannot fork\n"); exit(1); } if (pid==0) /* in child child*/ { close(0); dup(kin[0]); execl("/usr/local/bin/kermit",NULL); /*call kermit fprintf(stderr,"could not execl\n"); /* shold not reach hear */ exit(2); } /*-------- in parent---------- */ while(TRUE) /* loop forever */ { gets(cmd_str); /* read cmd line */ if (strcmp("done",cmd_str)) /* if cmd is not done */ { if (strcmp("dir",cmd_str)) /* if cmd is not dir */ { if (strlen(cmd_str) != 0) { cmd_str[strlen(cmd_str)] = '\n'; /* append "\n" */ cmd_str[strlen(cmd_str)+1] = (char) 0; for(i=0;i