MCPcopy Create free account
hub / github.com/Hamlib/Hamlib / add_port

Function add_port

lib/termios.c:1184–1283  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1182----------------------------------------------------------*/
1183
1184static struct termios_list *add_port(const char *filename)
1185{
1186 struct termios_list *index = first_tl;
1187 struct termios_list *port;
1188
1189 ENTER("add_port");
1190
1191 port = calloc(1, sizeof(struct termios_list));
1192
1193 if (!port)
1194 {
1195 goto fail;
1196 }
1197
1198 memset(port, 0, sizeof(struct termios_list));
1199
1200 port->ttyset = calloc(1, sizeof(struct termios));
1201
1202 if (! port->ttyset)
1203 {
1204 goto fail;
1205 }
1206
1207 memset(port->ttyset, 0, sizeof(struct termios));
1208
1209 port->sstruct = calloc(1, sizeof(struct serial_struct));
1210
1211 if (! port->sstruct)
1212 {
1213 goto fail;
1214 }
1215
1216 memset(port->sstruct, 0, sizeof(struct serial_struct));
1217 port->sis = calloc(1, sizeof(struct serial_icounter_struct));
1218
1219 if (! port->sis)
1220 {
1221 goto fail;
1222 }
1223
1224 memset(port->sis, 0, sizeof(struct serial_icounter_struct));
1225
1226 /* FIXME the async_struct is being defined by mingw32 headers?
1227 port->astruct = calloc(1, sizeof( struct async_struct ) );
1228 if( ! port->astruct )
1229 goto fail;
1230 memset( port->astruct, 0, sizeof( struct async_struct ) );
1231 */
1232 port->MSR = 0;
1233
1234 strncpy(port->filename, filename, sizeof(port->filename) - 1);
1235
1236 port->fd = get_free_fd();
1237
1238
1239 if (!first_tl)
1240 {
1241 port->prev = NULL;

Callers 1

win32_serial_openFunction · 0.85

Calls 1

get_free_fdFunction · 0.85

Tested by

no test coverage detected