- 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 6ff6159461
commit 47d59acb8f

View File

@ -68,7 +68,6 @@ int lp_ptt (int fd, int onoff);
#include <string.h>
/* 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)
{