summaryrefslogtreecommitdiffstats
path: root/innbbsd/pmain.c
diff options
context:
space:
mode:
authorin2 <in2@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2002-03-07 23:13:44 +0800
committerin2 <in2@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2002-03-07 23:13:44 +0800
commitae31e19f92e717919ac8e3db9039eb38d2b89aae (patch)
treec70164d6a1852344f44b04a653ae2815043512af /innbbsd/pmain.c
downloadpttbbs-ae31e19f92e717919ac8e3db9039eb38d2b89aae.tar
pttbbs-ae31e19f92e717919ac8e3db9039eb38d2b89aae.tar.gz
pttbbs-ae31e19f92e717919ac8e3db9039eb38d2b89aae.tar.bz2
pttbbs-ae31e19f92e717919ac8e3db9039eb38d2b89aae.tar.lz
pttbbs-ae31e19f92e717919ac8e3db9039eb38d2b89aae.tar.xz
pttbbs-ae31e19f92e717919ac8e3db9039eb38d2b89aae.tar.zst
pttbbs-ae31e19f92e717919ac8e3db9039eb38d2b89aae.zip
Initial revision
git-svn-id: http://opensvn.csie.org/pttbbs/pttbbs/trunk/pttbbs@1 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
Diffstat (limited to 'innbbsd/pmain.c')
-rw-r--r--innbbsd/pmain.c62
1 files changed, 62 insertions, 0 deletions
diff --git a/innbbsd/pmain.c b/innbbsd/pmain.c
new file mode 100644
index 00000000..39ddba22
--- /dev/null
+++ b/innbbsd/pmain.c
@@ -0,0 +1,62 @@
+#include "innbbsconf.h"
+#include "daemon.h"
+
+/*char *AccessFile=ACCESSFILE;*/
+#define INNBBSDPORT1 "1904"
+#define INNBBSDPORT2 "1234"
+#define INNBBSDPATH1 ".innbbsd1"
+#define INNBBSDPATH2 ".innbbsd2"
+
+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);
+ }
+}
+
+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);
+ }
+}
+