masqmail-0.2

diff src/mservdetect.c @ 0:08114f7dcc23

this is masqmail-0.2.21 from oliver kurth
author meillo@marmaro.de
date Fri, 26 Sep 2008 17:05:23 +0200
parents
children 26e34ae9a3e3
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/src/mservdetect.c	Fri Sep 26 17:05:23 2008 +0200
     1.3 @@ -0,0 +1,76 @@
     1.4 +/*  MasqMail
     1.5 +    Copyright (C) 1999-2001 Oliver Kurth
     1.6 +
     1.7 +    This program is free software; you can redistribute it and/or modify
     1.8 +    it under the terms of the GNU General Public License as published by
     1.9 +    the Free Software Foundation; either version 2 of the License, or
    1.10 +    (at your option) any later version.
    1.11 +
    1.12 +    This program is distributed in the hope that it will be useful,
    1.13 +    but WITHOUT ANY WARRANTY; without even the implied warranty of
    1.14 +    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    1.15 +    GNU General Public License for more details.
    1.16 +
    1.17 +    You should have received a copy of the GNU General Public License
    1.18 +    along with this program; if not, write to the Free Software
    1.19 +    Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
    1.20 +*/
    1.21 +
    1.22 +/*
    1.23 +#include "masqmail.h"
    1.24 +#include "readsock.h"
    1.25 +#include "mserver.h"
    1.26 +*/
    1.27 +
    1.28 +#include "config.h"
    1.29 +
    1.30 +/* ugly hack */
    1.31 +#ifndef ENABLE_MSERVER
    1.32 +#define ENABLE_MSERVER 1
    1.33 +#include "mserver.c"
    1.34 +#else
    1.35 +#include "masqmail.h"
    1.36 +#include "readsock.h"
    1.37 +#include "mserver.h"
    1.38 +#endif /* ENABLE_MSERVER */
    1.39 +
    1.40 +void logwrite(int pri, const char *fmt, ...)
    1.41 +{
    1.42 +  va_list args;
    1.43 +  va_start(args, fmt);
    1.44 +
    1.45 +  vfprintf(stdout, fmt, args);
    1.46 +
    1.47 +  va_end(args);
    1.48 +}
    1.49 +
    1.50 +void debugf(const char *fmt, ...)
    1.51 +{
    1.52 +  va_list args;
    1.53 +  va_start(args, fmt);
    1.54 +
    1.55 +  vfprintf(stdout, fmt, args);
    1.56 +
    1.57 +  va_end(args);
    1.58 +}
    1.59 +
    1.60 +int main(int argc, char *argv[])
    1.61 +{
    1.62 +  if(argc == 3){
    1.63 +    interface iface;
    1.64 +    gchar *name;
    1.65 +
    1.66 +    iface.address = g_strdup(argv[1]);
    1.67 +    iface.port = atoi(argv[2]);
    1.68 +
    1.69 +    name = mserver_detect_online(&iface);
    1.70 +
    1.71 +    printf("%s\n", name);
    1.72 +
    1.73 +    exit(EXIT_SUCCESS);
    1.74 +  }else{
    1.75 +    fprintf(stderr, "usage %s <host> <port>\n", argv[0]);
    1.76 +    exit(EXIT_FAILURE);
    1.77 +  }
    1.78 +}
    1.79 +