- 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
This commit is contained in:
Diane Bruce 2006-07-29 14:45:51 +00:00
parent b55d068325
commit 824cc1586e

View File

@ -68,7 +68,6 @@ int lp_ptt (int fd, int onoff);
#include <string.h> #include <string.h>
/* parport functions */ /* parport functions */
char *get_dev_name(char *fname);
int dev_is_parport(int fd); int dev_is_parport(int fd);
int ptt_parallel(int fd, int *ntx, int *iptt); int ptt_parallel(int fd, int *ntx, int *iptt);
int ptt_serial(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); return(0);
} }
/* Get ptt_name back or ptt_name with "/dev/" prepended */ if ((fd = open(ptt_port, O_RDWR|O_NONBLOCK)) < 0) {
ptt_port = get_dev_name(ptt_port);
if ((fd = open(ptt_port, O_RDWR | O_NDELAY)) < 0) {
fprintf(stderr, "Can't open %s.\n", ptt_port); fprintf(stderr, "Can't open %s.\n", ptt_port);
return (1); return (1);
} }
@ -179,28 +176,6 @@ ptt_serial(int fd, int *ntx, int *iptt)
/* parport functions */ /* 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): * dev_is_parport(fd):
* *
@ -291,7 +266,7 @@ parport_control (int fd, unsigned char controlbits, int values)
} }
#endif #endif
/* open port and setup ppdev */ /* Initialise a parallel port, given open fd */
int int
lp_init (int fd) lp_init (int fd)
{ {