ithewei před 7 roky
rodič
revize
6dd8aa7563
3 změnil soubory, kde provedl 11 přidání a 4 odebrání
  1. 2 0
      Makefile
  2. 2 0
      hdef.h
  3. 7 4
      main.cpp.tmpl

+ 2 - 0
Makefile

@@ -72,6 +72,8 @@ install:
 uninstall:
 
 dist:
+	$(MKDIR) $(DISTDIR)
+	$(CP) $(BINDIR) $(LIBDIR) $(DISTDIR)
 
 .PHONY: default all prepare clean install uninstall dist
 

+ 2 - 0
hdef.h

@@ -20,6 +20,8 @@ typedef unsigned char       BYTE;
 typedef unsigned short      WORD;
 typedef int                 BOOL;
 
+typedef void*               handle;
+
 typedef int (*method_t)(void* userdata);
 typedef void (*procedure_t)(void* userdata);
 

+ 7 - 4
main.cpp.tmpl

@@ -69,7 +69,7 @@ bool parse_command_line(int argc, char** argv) {
             }
             break;
             default: {
-                printf("Unrecognized option!");
+                puts("Unrecognized option!");
                 pexit(-10);
             }
             break;
@@ -100,12 +100,15 @@ int main(int argc, char** argv) {
     int iRet = ini.LoadFromFile(g_arg.confile.c_str());
     if (iRet != 0) {
         printf("Load confile [%s] failed: %d\n", g_arg.confile.c_str(), iRet);
-        return iRet;
+        pexit(-20);
     }
 
     if (g_arg.port == 0) {
-        printf("Please config port!\n");
-        pexit(-30);
+        g_arg.port = atoi(ini.GetValue("port").c_str());
+        if (g_arg.port == 0) {
+            puts("Please config listen port!");
+            pexit(-30);
+        }
     }
 
 #ifdef __unix__