146 int baudRate = DSPEED;
147 string host =
"127.0.0.1";
148 const char *serialDevice = NULL;
149 unsigned short nverbose = 0;
150 bool autoexit =
false;
151 bool noDSRCheck =
false;
158 int c = getopt_long(argc, argv,
"hdeVb:s:p:v:n",
opts, NULL);
166 cout <<
_(
"ncpd Version ") << VERSION << endl;
172 if (!strcmp(optarg,
"nl"))
174 if (!strcmp(optarg,
"nd"))
176 if (!strcmp(optarg,
"ll"))
178 if (!strcmp(optarg,
"ld"))
180 if (!strcmp(optarg,
"pl"))
182 if (!strcmp(optarg,
"pd"))
184 if (!strcmp(optarg,
"ph"))
186 if (!strcmp(optarg,
"m"))
188 if (!strcmp(optarg,
"all")) {
202 if (!strcmp(optarg,
"auto"))
205 baudRate = atoi(optarg);
208 serialDevice = optarg;
212 cout <<
_(
"Invalid port definition.") << endl;
218 linf <<
"DSR check disabled" << endl;
227 if (serialDevice == NULL)
242 openlog(
"ncpd", LOG_CONS|LOG_PID, LOG_DAEMON);
247 ignore_value(chdir(
"/"));
248 int devnull = open(
"/dev/null", O_RDWR, 0);
250 dup2(devnull, STDIN_FILENO);
251 dup2(devnull, STDOUT_FILENO);
252 dup2(devnull, STDERR_FILENO);
274 lerr <<
"fork: " << strerror(errno) << endl;
279 linf <<
_(
"normal exit") << endl;
static void term_handler(int)
static void int_handler(int)
int main(int argc, char **argv)
static struct option opts[]
static NCPSession * sharedSession