7 void attach_to_server();
10 * num_parms() - discover number of parameters...
17 for (a=0; a<strlen(source); ++a)
18 if (source[a]=='|') ++count;
24 * extract() - extract a parameter from a series of "|" separated...
26 void extract(dest,source,parmnum)
34 n = num_parms(source);
41 if ( (parmnum == 0) && (n == 1) ) {
46 while (count++ < parmnum) do {
48 } while( (strlen(buf)>0) && (buf[0]!='|') );
49 if (buf[0]=='|') strcpy(buf,&buf[1]);
50 for (count = 0; count<strlen(buf); ++count)
51 if (buf[count] == '|') buf[count] = 0;
56 * extract_int() - extract an int parm w/o supplying a buffer
58 int extract_int(source,parmnum)
63 extract(buf,source,parmnum);
85 attach_to_server(argc,argv);
87 if ((buf[0]!='2')&&(strncmp(buf,"551",3))) {
88 fprintf(stderr,"%s: %s\n",argv[0],&buf[4]);
91 strcpy(nodetitle, "this BBS");
96 while (serv_gets(buf), strcmp(buf,"000")) {
97 if (a==0) my_pid = atoi(buf);
98 if (a==2) strcpy(nodetitle, buf);
102 printf(" Users currently logged on to %s\n", nodetitle);
106 fprintf(stderr,"%s: %s\n",argv[0],&buf[4]);
110 printf("Session User name Room From host\n");
111 printf("------- ------------------------- -------------------- ------------------------\n");
112 while (serv_gets(buf), strcmp(buf,"000")) {
113 s_pid = extract_int(buf,0);
114 extract(s_user,buf,1);
115 extract(s_room,buf,2);
116 extract(s_host,buf,3);
117 if (s_pid != my_pid) {
118 printf("%-7d%c%-25s %-20s %-24s\n",
120 ((s_pid == my_pid) ? '*' : ' '),
121 s_user,s_room,s_host);
133 * replacement strerror() for systems that don't have it
139 sprintf(buf,"errno = %d",e);