masqmail-0.2

annotate src/mservdetect.c @ 78:6538aa6969e5

next version will be 0.2.24
author meillo@marmaro.de
date Sat, 19 Jun 2010 10:51:23 +0200
parents 08114f7dcc23
children
rev   line source
meillo@0 1 /* MasqMail
meillo@0 2 Copyright (C) 1999-2001 Oliver Kurth
meillo@0 3
meillo@0 4 This program is free software; you can redistribute it and/or modify
meillo@0 5 it under the terms of the GNU General Public License as published by
meillo@0 6 the Free Software Foundation; either version 2 of the License, or
meillo@0 7 (at your option) any later version.
meillo@0 8
meillo@0 9 This program is distributed in the hope that it will be useful,
meillo@0 10 but WITHOUT ANY WARRANTY; without even the implied warranty of
meillo@0 11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
meillo@0 12 GNU General Public License for more details.
meillo@0 13
meillo@0 14 You should have received a copy of the GNU General Public License
meillo@0 15 along with this program; if not, write to the Free Software
meillo@0 16 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
meillo@0 17 */
meillo@0 18
meillo@0 19 /*
meillo@0 20 #include "masqmail.h"
meillo@0 21 #include "readsock.h"
meillo@0 22 #include "mserver.h"
meillo@0 23 */
meillo@0 24
meillo@0 25 #include "config.h"
meillo@0 26
meillo@0 27 /* ugly hack */
meillo@0 28 #ifndef ENABLE_MSERVER
meillo@0 29 #define ENABLE_MSERVER 1
meillo@0 30 #include "mserver.c"
meillo@0 31 #else
meillo@0 32 #include "masqmail.h"
meillo@0 33 #include "readsock.h"
meillo@0 34 #include "mserver.h"
meillo@10 35 #endif /* ENABLE_MSERVER */
meillo@0 36
meillo@10 37 void
meillo@10 38 logwrite(int pri, const char *fmt, ...)
meillo@0 39 {
meillo@10 40 va_list args;
meillo@10 41 va_start(args, fmt);
meillo@0 42
meillo@10 43 vfprintf(stdout, fmt, args);
meillo@0 44
meillo@10 45 va_end(args);
meillo@0 46 }
meillo@0 47
meillo@10 48 void
meillo@10 49 debugf(const char *fmt, ...)
meillo@0 50 {
meillo@10 51 va_list args;
meillo@10 52 va_start(args, fmt);
meillo@0 53
meillo@10 54 vfprintf(stdout, fmt, args);
meillo@0 55
meillo@10 56 va_end(args);
meillo@0 57 }
meillo@0 58
meillo@10 59 int
meillo@10 60 main(int argc, char *argv[])
meillo@0 61 {
meillo@10 62 if (argc == 3) {
meillo@10 63 interface iface;
meillo@10 64 gchar *name;
meillo@0 65
meillo@10 66 iface.address = g_strdup(argv[1]);
meillo@10 67 iface.port = atoi(argv[2]);
meillo@0 68
meillo@10 69 name = mserver_detect_online(&iface);
meillo@0 70
meillo@10 71 printf("%s\n", name);
meillo@0 72
meillo@10 73 exit(EXIT_SUCCESS);
meillo@10 74 } else {
meillo@10 75 fprintf(stderr, "usage %s <host> <port>\n", argv[0]);
meillo@10 76 exit(EXIT_FAILURE);
meillo@10 77 }
meillo@0 78 }