对的,不过至少也要先看看吧。
我的问题也一样,主机无响应。
我的问题也一样,主机无响应。
#include "main.h" #define CONFIG_VERSION "1.0" #ifdef WIN32 #define CONFIG_SYSTEM "win32" #else #define CONFIG_SYSTEM "unix" #endif const char *soft_version = " " \ CONFIG_VERSION "." CONFIG_SYSTEM " " \ __DATE__ " " __TIME__; int soft_pid = -1; int soft_debug = 0; const char *soft_prog = "3apple translate"; const char *soft_conf_dir = "/etc/"; static void version(void) { printf("%s: %s\n", soft_prog, soft_version); printf("Copyright (C) 2008 funny soft.\n"); exit(0); } static void usage(int status) { FILE *output = status?stderr:stdout; fprintf(output, "Usage: %s [-f conf_dir] [-h] [-v]\n", soft_prog); fprintf(output, "Options:\n"); fprintf(output, " -f conf_dir Set main conf directory.\n"); fprintf(output, " -h Print this help message.\n"); fprintf(output, " -v Print server version information.\n"); exit(status); } static int soft_argcv(int argc, char **argv) { int argval; /* process the options */ while ((argval = getopt(argc, argv, "f:dvh")) != EOF) { switch (argval) { case 'f': soft_conf_dir = optarg; break; case 'd': soft_debug = 1; break; case 'h': usage(0); break; case 'v': version(); break; default: usage(1); break; } } /* get our PID */ soft_pid = getpid(); return 0; } static int __init soft_startup(void) { apple_main_init(); return 0; } static void __exit soft_cleanup(void) { apple_main_exit(); } #if 1 int main(int argc, char **argv) { soft_argcv(argc, argv); if (soft_startup()) exit(1); /* main loop begins here */ apple_main_start(); apple_main_stop(); soft_cleanup(); return 0; } #else /* delete test code */ #endif