]> 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 77c04ef659ce2771a40803dea0103a39f6e51f70..db120a9f16ec1f69a6151955bd192489a8caf448 100644 (file)
@@ -1,3 +1,10 @@
+/*
+ * $Id$
+ *
+ * Command-line user list utility.
+ *
+ */
+
 #include <stdlib.h>
 #include <unistd.h>
 #include <stdio.h>
 #include <time.h>
 #include "citadel.h"
 #include <unistd.h>
+#include "ipc.h"
+#include "tools.h"
 
-void attach_to_server();
-
-/*
- * num_parms()  -  discover number of parameters...
- */
-int num_parms(source)
-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(dest,source,parmnum)
-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(source,parmnum)
-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(source,parmnum)
-char *source;
-int parmnum; {
-       char buf[256];
-       
-       extract(buf,source,parmnum);
-       return(atol(buf));
-       }
-
-
-void logoff(code)
-int code; {
+void logoff(int code)
+{
        exit(code);
        }
 
-void userlist() { 
+void userlist(void) { 
        char buf[256];
        char fl[256];
        struct tm *tmbuf;
-       long lc;
+       time_t lc;
 
        serv_puts("LIST");
        serv_gets(buf);
@@ -117,12 +52,12 @@ void userlist() {
        }
 
 
-void main(argc,argv)
-int argc;
-char *argv[]; {
+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]);
@@ -137,12 +72,12 @@ char *argv[]; {
        }
 
 
-#ifdef NO_STRERROR
+#ifndef HAVE_STRERROR
 /*
  * replacement strerror() for systems that don't have it
  */
-char *strerror(e)
-int e; {
+char *strerror(int e)
+{
        static char buf[32];
 
        sprintf(buf,"errno = %d",e);