Use the new parsing stuff in remote.c

This commit is contained in:
dcp1990 2005-06-13 21:04:13 +00:00
parent d8eeaa1f3c
commit 0cecdf5879
3 changed files with 21 additions and 18 deletions

View File

@ -3,7 +3,7 @@
* (C)2005, Dan Ponte
* BSDL w/ advert.
*/
/* $Amigan: phoned/include/phoned.h,v 1.10 2005/06/13 03:40:27 dcp1990 Exp $ */
/* $Amigan: phoned/include/phoned.h,v 1.11 2005/06/13 21:04:13 dcp1990 Exp $ */
#include <pcre.h> /* fugly, I know... */
#define VERSION "0.1"
#define LOGFILE "/var/log/phoned.log"
@ -97,6 +97,17 @@ typedef struct cnd_t {
struct cnd_t* last;
struct cnd_t* next;
} cond_t;
typedef enum stat {
init = 0,
loginstage,
pass
} states_t;
typedef struct si_t {
states_t st;
short freeit;
FILE* fpo;
} state_info_t;
#ifdef HAVE_INET_INCS
typedef struct adll_t {
in_addr_t addr;
@ -132,3 +143,5 @@ cond_t* copy_condition(cond_t* con);
void check_condition(cid_t* cid);
void *modem_io(void *k);
void give_me_modem(char* str);
char *parse_command(const char *cmd, short *cont, state_info_t *s);
void begin_dialogue(FILE* fp);

View File

@ -28,7 +28,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
/* $Amigan: phoned/phoned/remote.c,v 1.1 2005/06/13 21:00:07 dcp1990 Exp $ */
/* $Amigan: phoned/phoned/remote.c,v 1.2 2005/06/13 21:04:14 dcp1990 Exp $ */
/* system includes */
#include <string.h>
#include <stdio.h>
@ -39,16 +39,6 @@
#define MAXARGS 15
#define CHK(m) strcasecmp(m, argvect[cpos]) == 0
#define RNF(m) s->freeit = 0; free(is); return(m)
typedef enum stat {
init = 0,
login,
pass
} states_t;
typedef struct si_t {
states_t st;
short freeit;
FILE* fpo;
} state_info_t;
char *parse_command(cmd, cont, s)
const char *cmd;
@ -98,7 +88,7 @@ char *parse_command(cmd, cont, s)
RNF("500 OK: Give Me Modem tested.\n");
}
break;
case login:
case loginstage:
break;
case pass:
break;

View File

@ -54,11 +54,11 @@ void *handclient(k)
void* k;
{
int sk = (int)k;
char buffer[1024];
int rlen;
rlen = recv(sk, buffer, sizeof(buffer), 0);
lprintf(debug, "Client said %s.", buffer);
close(sk);
FILE* tf;
lprintf(info, "Incoming client.");
tf = fdopen(sk, "r+");
begin_dialogue(tf);
fclose(tf);
pthread_exit(NULL);
return 0;
}