]> code.citadel.org Git - citadel.git/blobdiff - citadel/routines.c
* Moved num_parms() and all the extract() type functions into tools.c
[citadel.git] / citadel / routines.c
index 08051a136baf0f95e65cf4f73fc9521b045ca150..c74732a9188dbd9d404599fbcd2b2fb8cd009b0d 100644 (file)
@@ -22,6 +22,7 @@
 #include "citadel.h"
 #include "routines.h"
 #include "commands.h"
+#include "tools.h"
 
 void sttybbs(int cmd);
 void newprompt(char *prompt, char *str, int len);
@@ -71,71 +72,6 @@ int haschar(char *st, int ch)
        }
 
 
-/*
- * 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 a long parm w/o supplying a buffer
- */
-long extract_long(char *source, int parmnum)
-{
-       char buf[256];
-       
-       extract(buf,source,parmnum);
-       return(atol(buf));
-       }
-
 void back(int spaces) /* Destructive backspace */
             {
 int a;