Delete unnecessary example src/ptmx.c
This commit is contained in:
parent
65bfa95820
commit
36bd5c9a44
2 changed files with 1 additions and 53 deletions
|
@ -14,7 +14,7 @@ HEADERS = kiss.h ax25.h ax25/if.h ax25/macros.h ax25/proto.h \
|
|||
OBJS = kiss.o ax25.o if.o call.o frame.o sock.o route.o server.o \
|
||||
list.o hash.o dict.o
|
||||
|
||||
EXAMPLES = decode ptmx testclient-connect testclient-listen testserver
|
||||
EXAMPLES = testserver testclient-connect testclient-listen decode
|
||||
|
||||
HEADERS_BUILD = $(addprefix $(INCLUDE_PATH)/$(HEADER_SUBDIR)/, $(HEADERS))
|
||||
|
||||
|
|
52
src/ptmx.c
52
src/ptmx.c
|
@ -1,52 +0,0 @@
|
|||
#define _GNU_SOURCE
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <unistd.h>
|
||||
#include <fcntl.h>
|
||||
#include <errno.h>
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
int ptm;
|
||||
char ptsname[64];
|
||||
|
||||
if ((ptm = open("/dev/ptmx", O_RDWR)) < 0) {
|
||||
fprintf(stderr, "%s: %s: %s: %s\n", argv[0], "open()", "/dev/ptmx", strerror(errno));
|
||||
|
||||
goto error_open_ptmx;
|
||||
}
|
||||
|
||||
if (grantpt(ptm) < 0) {
|
||||
fprintf(stderr, "%s: %s: %s\n", argv[0], "grantpt()", strerror(errno));
|
||||
|
||||
goto error_grantpt_ptm;
|
||||
}
|
||||
|
||||
if (unlockpt(ptm) < 0) {
|
||||
fprintf(stderr, "%s: %s: %s\n", argv[0], "unlockpt()", strerror(errno));
|
||||
|
||||
goto error_unlockpt_ptm;
|
||||
}
|
||||
|
||||
if (ptsname_r(ptm, ptsname, sizeof(ptsname)) < 0) {
|
||||
fprintf(stderr, "%s: %s: %s: %s\n", argv[0], "ptsname_r()", "/dev/ptmx", strerror(errno));
|
||||
|
||||
goto error_ptsname_r_ptm;
|
||||
}
|
||||
|
||||
printf("pts %s\n", ptsname);
|
||||
|
||||
close(ptm);
|
||||
|
||||
return 0;
|
||||
|
||||
error_unlockpt_ptm:
|
||||
error_grantpt_ptm:
|
||||
error_ptsname_r_ptm:
|
||||
close(ptm);
|
||||
|
||||
error_open_ptmx:
|
||||
return 127;
|
||||
}
|
Loading…
Add table
Reference in a new issue