From 824cc1586ecfa10b947471ae227966868e8e58be Mon Sep 17 00:00:00 2001 From: Diane Bruce Date: Sat, 29 Jul 2006 14:45:51 +0000 Subject: [PATCH] - Remove code to handle device names without /dev prepended - use standard open() defines git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/trunk@211 ab8295b8-cf94-4d9e-aec4-7959e3be5d79 --- ptt_unix.c | 29 ++--------------------------- 1 file changed, 2 insertions(+), 27 deletions(-) diff --git a/ptt_unix.c b/ptt_unix.c index 4f4adda3d..98eae45a0 100644 --- a/ptt_unix.c +++ b/ptt_unix.c @@ -68,7 +68,6 @@ int lp_ptt (int fd, int onoff); #include /* parport functions */ -char *get_dev_name(char *fname); int dev_is_parport(int fd); int ptt_parallel(int fd, int *ntx, int *iptt); int ptt_serial(int fd, int *ntx, int *iptt); @@ -120,9 +119,7 @@ ptt_(int *unused, char *ptt_port, int *ntx, int *iptt) return(0); } - /* Get ptt_name back or ptt_name with "/dev/" prepended */ - ptt_port = get_dev_name(ptt_port); - if ((fd = open(ptt_port, O_RDWR | O_NDELAY)) < 0) { + if ((fd = open(ptt_port, O_RDWR|O_NONBLOCK)) < 0) { fprintf(stderr, "Can't open %s.\n", ptt_port); return (1); } @@ -179,28 +176,6 @@ ptt_serial(int fd, int *ntx, int *iptt) /* parport functions */ -/* - * get_dev_name - * - * inputs - device name - * output - pointer to copy or original name or copy of original - * with "/dev/" prepended - * side effects - Uses local storage for result. - */ - -char * -get_dev_name(char *fname) -{ - static char nm[MAXPATHLEN]; - - if (strchr(fname, '/') != NULL) - strncpy(nm, fname, sizeof(nm)); /* Assume already has /dev/ */ - else - snprintf(nm, sizeof(nm), "/dev/%s", fname); - - return(fname); -} - /* * dev_is_parport(fd): * @@ -291,7 +266,7 @@ parport_control (int fd, unsigned char controlbits, int values) } #endif -/* open port and setup ppdev */ +/* Initialise a parallel port, given open fd */ int lp_init (int fd) {