summaryrefslogtreecommitdiffstats
path: root/daemon/innbbsd/pmain.c
diff options
context:
space:
mode:
authorpiaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2008-03-20 19:33:49 +0800
committerpiaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2008-03-20 19:33:49 +0800
commit6c7b18b32d87c2a835f7e5c48faac4a8ad44668b (patch)
treee88e1b2b1007f4ddcd348a4a1bf1d13c515c4564 /daemon/innbbsd/pmain.c
parentf59699c22c130373cda3cc4cb6fab5bae510bd5a (diff)
downloadpttbbs-piaip.newlayout.tar
pttbbs-piaip.newlayout.tar.gz
pttbbs-piaip.newlayout.tar.bz2
pttbbs-piaip.newlayout.tar.lz
pttbbs-piaip.newlayout.tar.xz
pttbbs-piaip.newlayout.tar.zst
pttbbs-piaip.newlayout.zip
- (internal/exp) first draft of new layoutpiaip.newlayout
git-svn-id: http://opensvn.csie.org/pttbbs/branches/piaip.newlayout@4013 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
Diffstat (limited to 'daemon/innbbsd/pmain.c')
-rw-r--r--daemon/innbbsd/pmain.c64
1 files changed, 64 insertions, 0 deletions
diff --git a/daemon/innbbsd/pmain.c b/daemon/innbbsd/pmain.c
new file mode 100644
index 00000000..1b039c48
--- /dev/null
+++ b/daemon/innbbsd/pmain.c
@@ -0,0 +1,64 @@
+#include "innbbsconf.h"
+#include "daemon.h"
+#include "externs.h"
+
+/* char *AccessFile=ACCESSFILE; */
+#define INNBBSDPORT1 "1904"
+#define INNBBSDPORT2 "1234"
+#define INNBBSDPATH1 ".innbbsd1"
+#define INNBBSDPATH2 ".innbbsd2"
+
+int
+pmain(port)
+ char *port;
+{
+ if (port == NULL) {
+ int rel;
+ /* installbbstalkd(); */
+ fprintf(stderr, "Trying to listen in port %s\n", INNBBSDPORT1);
+ rel = open_listen(INNBBSDPORT1, "tcp", NULL);
+#ifdef DEBUG
+ printf("port fd %d allocated\n", rel);
+#endif
+ if (rel < 0) {
+ fprintf(stderr, "Trying to listen in port %s\n", INNBBSDPORT2);
+ return open_listen(INNBBSDPORT2, "tcp", NULL);
+ }
+ return rel;
+ } else {
+#ifdef DEBUG
+ printf("start to allocate port\n");
+#endif
+ return open_listen(port, "tcp", NULL);
+ }
+}
+
+int
+p_unix_main(path)
+ char *path;
+{
+ if (path == NULL) {
+ int rel;
+ /* installbbstalkd(); */
+ fprintf(stderr, "Trying to listen in port %s\n", INNBBSDPATH1);
+ rel = open_unix_listen(INNBBSDPATH1, "tcp", NULL);
+#ifdef DEBUG
+ printf("port fd %d allocated\n", rel);
+#endif
+ if (rel < 0) {
+ fprintf(stderr, "Trying to listen in port %s\n", INNBBSDPATH2);
+ return open_listen(INNBBSDPATH2, "tcp", NULL);
+ }
+ return rel;
+ } else {
+#ifdef DEBUG
+ printf("start to allocate path %s\n", path);
+#endif
+ int fd = unixclient(path, "tcp");
+ if (fd < 0)
+ unlink(path);
+ else
+ close(fd);
+ return open_unix_listen(path, "tcp", NULL);
+ }
+}