]> code.citadel.org Git - citadel.git/blobdiff - citadel/userlist.c
* Changed the comments at the beginning of each file to a consistent format
[citadel.git] / citadel / userlist.c
index effccf59ff1682feab7e61bf87b8ed66e6872032..db120a9f16ec1f69a6151955bd192489a8caf448 100644 (file)
@@ -1,4 +1,10 @@
-/* $Id$ */
+/*
+ * $Id$
+ *
+ * Command-line user list utility.
+ *
+ */
+
 #include <stdlib.h>
 #include <unistd.h>
 #include <stdio.h>
@@ -7,74 +13,7 @@
 #include "citadel.h"
 #include <unistd.h>
 #include "ipc.h"
-
-/*
- * num_parms()  -  discover number of parameters...
- */
-int num_parms(char *source)
-{
-       int a;
-       int count = 1;
-
-       for (a=0; a<strlen(source); ++a) 
-               if (source[a]=='|') ++count;
-       return(count);
-       }
-
-
-/*
- * extract()  -  extract a parameter from a series of "|" separated...
- */
-void extract(char *dest, char *source, int parmnum)
-{
-       char buf[256];
-       int count = 0;
-       int n;
-
-       n = num_parms(source);
-
-       if (parmnum >= n) {
-               strcpy(dest,"");
-               return;
-               }
-       strcpy(buf,source);
-       if ( (parmnum == 0) && (n == 1) ) {
-               strcpy(dest,buf);
-               return;
-               }
-
-       while (count++ < parmnum) do {
-               strcpy(buf,&buf[1]);
-               } while( (strlen(buf)>0) && (buf[0]!='|') );
-       if (buf[0]=='|') strcpy(buf,&buf[1]);
-       for (count = 0; count<strlen(buf); ++count)
-               if (buf[count] == '|') buf[count] = 0;
-       strcpy(dest,buf);
-       }
-
-/*
- * extract_int()  -  extract an int parm w/o supplying a buffer
- */
-int extract_int(char *source, int parmnum)
-{
-       char buf[256];
-       
-       extract(buf,source,parmnum);
-       return(atoi(buf));
-       }
-
-
-/*
- * extract_long()  -  extract an long parm w/o supplying a buffer
- */
-long extract_long(char *source, int parmnum)
-{
-       char buf[256];
-       
-       extract(buf,source,parmnum);
-       return(atol(buf));
-       }
-
+#include "tools.h"
 
 void logoff(int code)
 {
@@ -116,8 +55,9 @@ void userlist(void) {
 int main(int argc, char **argv)
 {
        char buf[256];
+       char hostbuf[256], portbuf[256];
 
-       attach_to_server(argc,argv);
+       attach_to_server(argc, argv, hostbuf, portbuf);
        serv_gets(buf);
        if ((buf[0]!='2')&&(strncmp(buf,"551",3))) {
                fprintf(stderr,"%s: %s\n",argv[0],&buf[4]);