/* Socket status display code * Copyright 1991 Phil Karn, KA9Q */ #include #include "global.h" #include "mbuf.h" #include "proc.h" #include "lzw.h" #include "usock.h" #include "socket.h" #include "commands.h" /* Socket status display command */ int dosock(argc,argv,p) int argc; char *argv[]; void *p; { register struct usock *up; int s,i; struct sockaddr fsock; struct socklink *sp; char *cp; if(argc < 2){ tprintf("S# Type PCB Remote socket Owner\n"); for(s=SOCKBASE;stype],ptol(up->cb.p),cp, ptol(up->owner),up->owner->name); } return 0; } s = atoi(argv[1]); if(s < SOCKBASE || s >= Nusock+SOCKBASE){ tprintf("Number out of range\n"); return 1; } up = itop(s); if(up == NULLUSOCK){ tprintf("Socket not in use\n"); return 0; } sp = up->sp; tprintf("%s %lx %s",Socktypes[up->type],ptol(up->cb.p), up->flag == SOCK_ASCII ? "ascii" : "binary"); if(up->eol[0] != '\0'){ tprintf(" eol seq:"); for(i=0;up->eol[i] != '\0' && ieol);i++) tprintf(" %02x",up->eol[i]); } tprintf("\n"); if(up->cb.p == NULL) return 0; if(sp->status != NULLFP) (*sp->status)(up); if(up->zout != NULLLZW) tprintf("Compressed %ld bytes.\n",up->zout->cnt); if(up->zin != NULLLZW) tprintf("Decompressed %ld bytes.\n",up->zin->cnt); return 0; }