fixed
This commit is contained in:
parent
0cbd2c4ed0
commit
6cd972dc73
|
@ -0,0 +1,3 @@
|
|||
#!/bin/sh
|
||||
project_dir=$(pwd)
|
||||
echo ./*.c $CFLAGS -o $OUTPUT$(basename $project_dir) | xargs $CC
|
|
@ -0,0 +1,19 @@
|
|||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <errno.h>
|
||||
#include <unistd.h>
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
if (argv[1] == NULL) {
|
||||
printf("setsid [cmd] [arg1 arg2...]\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
pid_t pid;
|
||||
if ((pid = fork()) != 0)
|
||||
return 0;
|
||||
|
||||
setsid();
|
||||
execvp(argv[1], argv + 1);
|
||||
}
|
|
@ -12,7 +12,7 @@ int main(int argc, char **argv) {
|
|||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
c
|
||||
argc -= optind;
|
||||
argv += optind;
|
||||
return 0;
|
||||
|
|
|
@ -44,8 +44,8 @@ int main(void) {
|
|||
|
||||
sigset_t set;
|
||||
sigemptyset(&set);
|
||||
sigaddset(&set, SIGUSR2);
|
||||
sigaddset(&set, SIGUSR1);
|
||||
sigaddset(&set, SIGUSR2);
|
||||
|
||||
/* Start main service */
|
||||
sigprocmask(SIG_BLOCK, &set, NULL);
|
||||
|
|
|
@ -1,31 +1,18 @@
|
|||
#include <stdio.h>
|
||||
#include <signal.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <sys/socket.h>
|
||||
#include <arpa/inet.h>
|
||||
#include "unused.h"
|
||||
|
||||
int connect_or_die(
|
||||
int main(int argc, char **argv) {
|
||||
int family = AF_UNSPEC;
|
||||
int port = 33137;
|
||||
unsigned int l_flag;
|
||||
|
||||
UNUSED(port);
|
||||
UNUSED(l_flag);
|
||||
UNUSED(family);
|
||||
|
||||
int opt;
|
||||
while ((opt = getopt(argc, argv, "46vp:nl")) != 1) {
|
||||
while ((opt = getopt(argc, argv, "p:nl")) != 1) {
|
||||
switch (opt) {
|
||||
case '4':
|
||||
family = AF_INET;
|
||||
break;
|
||||
|
||||
case '6':
|
||||
family = AF_INET6;
|
||||
break;
|
||||
|
||||
case 'l':
|
||||
l_flag = 1;
|
||||
break;
|
||||
|
@ -35,7 +22,7 @@ int main(int argc, char **argv) {
|
|||
break;
|
||||
|
||||
default:
|
||||
printf("nc\n\t[-4 Use ipv4] [-6 Use ipv6]\n\t[-v Verbose] [-p Port Listen port]\n\t[-u Udp mode] [-l Listen]\n\t[-n Don't do DNS resolution]\n");
|
||||
printf("nc\n\t[-p PORT Listen port]\n\t[-u Udp mode] [-l Listen]\n\t[-n Don't do DNS resolution]\n");
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
@ -43,7 +30,5 @@ int main(int argc, char **argv) {
|
|||
argv += optind;
|
||||
argc -= optind;
|
||||
|
||||
signal(SIGPIPE, SIG_IGN);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -33,7 +33,7 @@ int main(void) {
|
|||
if (days > 0)
|
||||
printf(" %d days", days);
|
||||
|
||||
if (hours > 0)
|
||||
else if (hours > 0)
|
||||
printf(" %d hours", hours);
|
||||
|
||||
printf(" %d mins", mins);
|
||||
|
|
Loading…
Reference in New Issue