19 const char * proto_raw,
24 char *
p, *ptail, *pc, *pe;
27 if( proto_raw ==
NULL )
30 if( lpt_proto_out ==
NULL )
33 *lpt_proto_out = calloc(
sizeof(
DEV_LPT_PROTOCOL ) + proto_raw_len + 2, 1 );
34 lpt_proto = *lpt_proto_out;
36 if( lpt_proto ==
NULL )
39 strncpy( lpt_proto->
raw, proto_raw, proto_raw_len );
40 lpt_proto->
raw[proto_raw_len] =
'\0';
43 ptail = p + strlen( lpt_proto->
raw );
49 lpt_proto->
emu = ptail;
53 if( strcasecmp( p,
"PRN:" ) == 0)
65 if( strncasecmp( p,
"LPT", 3) != 0)
68 pc = strchr( p,
':' );
77 while( ( *pc >=
'0' ) && ( *pc <=
'9' ))
80 lpt_proto->
iPort = atoi( pc );
86 if( isspace( *p ) || ( *p ==
',' ))
107 while( isspace( *pt )) *pt-- =
'\0';
111 while( isspace( *pe )) *pe++ =
'\0';
113 if( strcasecmp( p,
"EMU" ) == 0)
117 else if( strcasecmp( p,
"TITLE" ) == 0)
119 lpt_proto->
title = pe;
125 pt = pc ? pc : ptail;
127 while( isspace( *pt )) *pt-- =
'\0';