1293
1253
SetCommMask( index->hComm, index->event_flag );
1294
1254
index->tx_happened = 1;
1296
/***** output mode flags (c_oflag) *****/
1297
/* FIXME: OPOST: enable ONLCR, OXTABS & ONOEOT */
1298
/* FIXME: ONLCR: convert newline char to CR & LF */
1299
/* FIXME: OXTABS: convert tabs to spaces */
1300
/* FIXME: ONOEOT: discard ^D (004) */
1302
#ifdef DEBUG_VERBOSE
1303
/* warning Roy Rogers! */
1304
sprintf( message, "===== trying to write %s\n", Str );
1306
#endif /* DEBUG_VERBOSE */
1308
index->tx_happened = 1;
1256
index->wol.Offset = index->wol.OffsetHigh = 0;
1257
ResetEvent( index->wol.hEvent );
1310
1258
if ( !WriteFile( index->hComm, Str, length, &nBytes, &index->wol ) )
1312
/* this causes problems just do it async
1313
1260
WaitForSingleObject( index->wol.hEvent,100 );
1315
1261
if ( GetLastError() != ERROR_IO_PENDING )
1317
ClearErrors( index, &Stat );
1263
/* ClearErrors( index, &Stat ); */
1319
1264
report( "serial_write error\n" );
1265
/* report("Condition 1 Detected in write()\n"); */
1271
/* This is breaking on Win2K, WinXP for some reason */
1272
else while( !GetOverlappedResult( index->hComm, &index->wol,
1325
while( !GetOverlappedResult( index->hComm, &index->wol,
1275
if ( GetLastError() != ERROR_IO_INCOMPLETE )
1328
if ( GetLastError() != ERROR_IO_INCOMPLETE )
1330
ClearErrors( index, &Stat );
1277
/* report("Condition 2 Detected in write()\n"); */
1282
/* ClearErrors( index, &Stat ); */
1340
ClearErrors( index, &Stat );
1345
report( "serial_write bailing!\n" );
1288
/* Write finished synchronously. That is ok!
1289
* I have seen this with USB to Serial
1290
* devices like TI's.
1350
/* yaya... This really does help */
1351
1294
/* FlushFileBuffers( index->hComm ); */
1353
1295
index->event_flag |= EV_TXEMPTY;
1296
/* ClearErrors( index, &Stat ); */
1354
1297
SetCommMask( index->hComm, index->event_flag );
1298
/* ClearErrors( index, &Stat ); */
1355
1299
index->event_flag = old_flag;
1356
1300
index->tx_happened = 1;
1359
sprintf( message, "serial_write: returning %i\n", (int) nBytes );
1361
1301
LEAVE( "serial_write" );
1542
1478
return( total );
1546
LEAVE( "serial_read" );
1481
LEAVE( "serial_read" );
1486
int serial_read( int fd, void *vb, int size )
1489
unsigned long nBytes = 0, total = 0, error;
1490
/* unsigned long waiting = 0; */
1492
struct termios_list *index;
1496
unsigned char *dest = vb;
1498
start = GetTickCount();
1499
ENTER( "serial_read" );
1506
index = find_port( fd );
1509
LEAVE( "serial_read 7" );
1515
/* FIXME: CREAD: without this, data cannot be read
1516
FIXME: PARMRK: mark framing & parity errors
1517
FIXME: IGNCR: ignore \r
1518
FIXME: ICRNL: convert \r to \n
1519
FIXME: INLCR: convert \n to \r
1522
ClearErrors( index, &Stat );
1523
if ( index->open_flags & O_NONBLOCK )
1527
/* pull mucho-cpu here? */
1529
#ifdef DEBUG_VERBOSE
1530
report( "vmin=0\n" );
1531
#endif /* DEBUG_VERBOSE */
1532
ret = ClearErrors( index, &Stat);
1537
/* we should use -1 instead of 0 for disabled timeout */
1538
now = GetTickCount();
1539
if ( index->ttyset->c_cc[VTIME] &&
1540
now-start >= (index->ttyset->c_cc[VTIME]*100)) {
1542
sprintf( message, "now = %i start = %i time = %i total =%i\n", now, start, index->ttyset->c_cc[VTIME]*100, total);
1547
return -1; /* read timeout */
1549
} while( Stat.cbInQue < size && size > 1 );
1553
/* VTIME is in units of 0.1 seconds */
1555
#ifdef DEBUG_VERBOSE
1556
report( "vmin!=0\n" );
1557
#endif /* DEBUG_VERBOSE */
1558
vmin = index->ttyset->c_cc[VMIN];
1560
c = clock() + index->ttyset->c_cc[VTIME] * CLOCKS_PER_SEC / 10;
1562
error = ClearErrors( index, &Stat);
1564
} while ( c > clock() );
1572
/* ret = ClearErrors( index, &Stat); */
1574
index->rol.Offset = index->rol.OffsetHigh = 0;
1575
ResetEvent( index->rol.hEvent );
1577
err = ReadFile( index->hComm, dest + total, size, &nBytes, &index->rol );
1578
#ifdef DEBUG_VERBOSE
1579
/* warning Roy Rogers! */
1580
sprintf(message, " ========== ReadFile = %i %s\n",
1581
( int ) nBytes, (char *) dest + total );
1583
#endif /* DEBUG_VERBOSE */
1589
switch ( GetLastError() )
1591
case ERROR_BROKEN_PIPE:
1592
report( "ERROR_BROKEN_PIPE\n ");
1595
case ERROR_MORE_DATA:
1599
report( "ERROR_MORE_DATA\n" );
1601
case ERROR_IO_PENDING:
1602
while( ! GetOverlappedResult(
1608
if( GetLastError() !=
1609
ERROR_IO_INCOMPLETE )
1621
now = GetTickCount();
1622
sprintf(message, "size > 0: spent=%ld have=%d\n", now-start, index->ttyset->c_cc[VTIME]*100);
1624
/* we should use -1 for disabled
1626
if ( index->ttyset->c_cc[VTIME] && now-start >= (index->ttyset->c_cc[VTIME]*100)) {
1633
sprintf(message, "end nBytes=%ld] ", nBytes);
1638
report( "ERROR_IO_PENDING\n" );
1655
ClearErrors( index, &Stat);
1660
LEAVE( "serial_read" );
1661
ClearErrors( index, &Stat);
1551
1666
/*----------------------------------------------------------
1654
1769
/*----------------------------------------------------------
1663
----------------------------------------------------------*/
1665
int TermiosToDCB( struct termios *s_termios, DCB *dcb )
1667
ENTER( "TermiosToDCB" );
1668
s_termios->c_ispeed = s_termios->c_cflag & CBAUD;
1669
s_termios->c_ospeed = s_termios->c_ispeed;
1770
serial_struct_to_DCB()
1778
----------------------------------------------------------*/
1779
int serial_struct_to_DCB( struct serial_struct *sstruct, DCB *dcb )
1783
sstruct.custom_divisor = ( sstruct.baud_base/cspeed );
1788
/*----------------------------------------------------------
1797
----------------------------------------------------------*/
1798
int termios_to_DCB( struct termios *s_termios, DCB *dcb )
1800
ENTER( "termios_to_DCB" );
1801
s_termios->c_ispeed = s_termios->c_ospeed = s_termios->c_cflag & CBAUD;
1670
1802
dcb->BaudRate = B_to_CBR( s_termios->c_ispeed );
1671
LEAVE( "TermiosToDCB" );
1803
dcb->ByteSize = termios_to_bytesize( s_termios->c_cflag );
1805
if ( s_termios->c_cflag & PARENB )
1807
if ( s_termios->c_cflag & PARODD
1808
&& s_termios->c_cflag & CMSPAR )
1810
dcb->Parity = MARKPARITY;
1812
else if ( s_termios->c_cflag & PARODD )
1814
dcb->Parity = ODDPARITY;
1816
else if ( s_termios->c_cflag & CMSPAR )
1818
dcb->Parity = SPACEPARITY;
1822
dcb->Parity = EVENPARITY;
1827
dcb->Parity = NOPARITY;
1830
if ( s_termios->c_cflag & CSTOPB ) dcb->StopBits = TWOSTOPBITS;
1831
else dcb->StopBits = ONESTOPBIT;
1833
if ( s_termios->c_cflag & HARDWARE_FLOW_CONTROL )
1835
dcb->fRtsControl = RTS_CONTROL_HANDSHAKE;
1836
dcb->fOutxCtsFlow = TRUE;
1840
dcb->fRtsControl = RTS_CONTROL_DISABLE;
1841
dcb->fOutxCtsFlow = FALSE;
1844
LEAVE( "termios_to_DCB" );
1675
1848
/*----------------------------------------------------------
1684
----------------------------------------------------------*/
1686
void DCBToTermios( DCB *dcb, struct termios *s_termios )
1688
ENTER( "DCBToTermios" );
1849
DCB_to_serial_struct()
1857
----------------------------------------------------------*/
1858
int DCB_to_serial_struct( DCB *dcb, struct serial_struct *sstruct )
1862
/*----------------------------------------------------------
1871
----------------------------------------------------------*/
1872
void DCB_to_termios( DCB *dcb, struct termios *s_termios )
1874
ENTER( "DCB_to_termios" );
1689
1875
s_termios->c_ispeed = CBR_to_B( dcb->BaudRate );
1690
1876
s_termios->c_ospeed = s_termios->c_ispeed;
1691
1877
s_termios->c_cflag |= s_termios->c_ispeed & CBAUD;
1692
LEAVE( "DCBToTermios" );
1878
LEAVE( "DCB_to_termios" );
1695
1881
/*----------------------------------------------------------
2585
2819
if( EscapeCommFunction( index->hComm,
2586
2820
( *arg & TIOCM_RTS ) ? SETRTS : CLRRTS ) )
2587
report("EscapeCommFunction: True\n");
2589
report("EscapeCommFunction: False\n");
2591
if ( *arg & TIOCM_DTR )
2593
index->MSR |= TIOCM_DTR;
2597
index->MSR &= ~TIOCM_DTR;
2599
if ( *arg & TIOCM_RTS )
2601
index->MSR |= TIOCM_RTS;
2606
index->MSR &= ~TIOCM_RTS;
2609
if( EscapeCommFunction( index->hComm,
2610
( *arg & TIOCM_RTS ) ? SETRTS : CLRRTS ) )
2611
report("EscapeCommFunction: True\n");
2613
report("EscapeCommFunction: False\n");
2614
if ( EscapeCommFunction( index->hComm,
2615
( *arg & TIOCM_DTR ) ? SETDTR : CLRDTR ) )
2616
report("EscapeCommFunction: True\n");
2618
report("EscapeCommFunction: False\n");
2621
if ( ! (*arg & TIOCM_DTR) != (index->MSR & TIOCM_DTR))
2623
report("Changing DTR\n");
2624
EscapeCommFunction( index->hComm,
2625
( *arg & TIOCM_DTR ) ? SETDTR : CLRDTR );
2626
if ( *arg & TIOCM_DTR )
2628
index->MSR |= TIOCM_DTR;
2632
index->MSR &= ~TIOCM_DTR;
2636
report("not changing DTR\n");
2637
if ( ! (*arg & TIOCM_RTS) != (index->MSR & TIOCM_RTS))
2639
report("Changing RTS\n");
2640
EscapeCommFunction( index->hComm,
2641
( *arg & TIOCM_RTS ) ? SETRTS : CLRRTS );
2642
if ( *arg & TIOCM_RTS )
2644
index->MSR |= TIOCM_RTS;
2648
index->MSR &= ~TIOCM_RTS;
2652
report("not changing RTS\n");
2821
report( "EscapeCommFunction: True\n" );
2823
report( "EscapeCommFunction: False\n" );
2655
/* get the serial struct info from the underlying API
2656
* TIOCGSERIAL is not used on win32. Its commented out
2659
2826
#ifdef TIOCGSERIAL
2660
2827
case TIOCGSERIAL:
2828
report( "TIOCGSERIAL\n" );
2830
dcb = malloc( sizeof( DCB ) );
2836
memset( dcb, 0, sizeof( DCB ) );
2837
GetCommState( index->hComm, dcb );
2661
2839
sstruct = va_arg( ap, struct serial_struct * );
2662
sstruct = index->sstruct;
2840
if ( DCB_to_serial_struct( dcb, sstruct ) < 0 )
2845
index->sstruct = sstruct;
2663
2847
report( "TIOCGSERIAL\n" );
2666
2851
#endif /* TIOCGSERIAL */
2667
/* set the serial struct info from the underlying API
2668
* this is not implemented. TIOCSSERIAL is commented out
2671
2852
#ifdef TIOCSSERIAL
2672
2853
case TIOCSSERIAL:
2673
2854
report( "TIOCSSERIAL\n" );
2674
index->sstruct = sstruct;
2675
arg = va_arg( ap, int * );
2856
dcb = malloc( sizeof( DCB ) );
2862
memset( dcb, 0, sizeof( DCB ) );
2863
GetCommState( index->hComm, dcb );
2865
index->sstruct = va_arg( ap, struct serial_struct * );
2866
if ( serial_struct_to_DCB( index->sstruct, dcb ) < 0 )
2872
report( "TIOCSSERIAL\n" );
2678
2876
#endif /* TIOCSSERIAL */
2679
2877
case TIOCSERCONFIG:
2680
2878
case TIOCSERGETLSR:
2682
2879
arg = va_arg( ap, int * );
3161
3407
: "a" (val), "d" (index)
3167
#define PORT_SERIAL 1
3169
NT Port Enumeration.
3171
The basic idea is to open a port and try to read a byte from it.
3172
The The read should time out and return 0.
3174
The hardware setup is:
3181
If only COM3 is opened a valid reference for the port is obtained.
3182
read times out. The port looks valid.
3184
if COM1 is opened the open on COM3 fails but the open on COM4 works.
3185
if COM2 is opened the open on COM4 fails but the open on COM3 works.
3187
The registry would be another approach. The registry on NT shows
3188
COM1-4 in the above configuration.
3193
int main( int argc, char *argv[] )
3195
struct termios ttyset;
3196
int fd =open( "COM1" , O_RDONLY | CLOCAL);
3197
int cspeed = translate_speed( env, speed );
3200
fprintf( stderr, "Invalid Speed Selected\n");
3203
if( tcgetattr( fd, &ttyset ) < 0 )
3205
fprintf( stderr, "Cannot Get Serial Port Settings\n");
3208
printf( "Set: %i\n", ttyset.c_cflag);
3210
if( !translate_data_bits( env, &( ttyset.c_cflag), dataBits ) )
3212
fprintf( stderr, "Invalid Data Bits Selected\n");
3215
if( !translate_stop_bits( env, &( ttyset.c_cflag), stopBits ) )
3217
fprintf( stderr, "Invalid Stop Bits Selected\n");
3220
if( !translate_parity( env, &( ttyset.c_cflag), parity ) )
3222
fprintf( stderr, "Invalid Parity Selected\n");
3226
if( cfsetspeed( &ttyset, cspeed ) < 0 )
3228
fprintf( stderr, "Cannot Set Speed\n");
3232
if( cfsetispeed( &ttyset, cspeed ) < 0 )
3234
fprintf( stderr, "Cannot Set Input Speed\n");
3237
if( cfsetospeed( &ttyset, cspeed ) < 0 )
3239
fprintf( stderr, "Cannot Set Output Speed\n");
3242
#endif /* __FreeBSD__ */
3243
if( tcsetattr( fd, TCSANOW, &ttyset ) < 0 )
3245
fprintf( stderr, "Cannot Set Serial Port Parameters.\n");
3251
throw_java_exception( env, UNSUPPORTED_COMM_OPERATION,
3252
"nativeSetSerialPortParams", strerror( errno ) );
3256
int main( int argc, char *argv[] )
3258
struct termios ttyset;
3262
char *name = "COM3";
3267
/* CLOCAL eliminates open blocking on modem status lines */
3268
printf("trying testRead()\n");
3269
if ((fd[3] = open("COM1" , O_RDONLY | CLOCAL)) < 0) {
3274
if ((fd[1] = open("COM2", O_RDONLY | CLOCAL)) < 0) {
3278
if ((fd[3] = open("COM4", O_RDONLY | CLOCAL)) < 0) {
3282
ret = write(fd[3],"test",4);
3288
ret = read(fd[3],name,1);
3294
ret = read(fd[3],name,4);
3300
if ((fd[2] = open("COM3", O_RDONLY | CLOCAL)) < 0) {
3306
if ( port_type == PORT_SERIAL )
3309
struct termios saved_termios;
3311
if (tcgetattr(fd[3], &ttyset) < 0) {
3316
/* save, restore later */
3317
if ((saved_flags = fcntl(fd[3], F_GETFL)) < 0) {
3322
memcpy(&saved_termios, &ttyset, sizeof(struct termios));
3324
if (fcntl(fd[3], F_SETFL, O_NONBLOCK) < 0) {
3330
ttyset.c_cc[VMIN] = ttyset.c_cc[VTIME] = 0;
3332
if (tcsetattr(fd[3], TCSANOW, &ttyset) < 0) {
3334
tcsetattr(fd[3], TCSANOW, &saved_termios);
3337
if (tcgetattr(fd[3], &ttyset) < 0) {
3341
if (tcsetattr(fd[3], TCSANOW, &ttyset) < 0) {
3343
tcsetattr(fd[3], TCSANOW, &saved_termios);
3346
if (tcgetattr(fd[3], &ttyset) < 0) {
3350
if (read(fd[3], &c, 1) < 0)
3353
if ( errno != EWOULDBLOCK )
3359
#endif /* EWOULDBLOCK */
3362
/* dont walk over unlocked open devices */
3363
tcsetattr(fd[3], TCSANOW, &saved_termios);
3364
fcntl(fd[3], F_SETFL, saved_flags);
3372
int main( int argc, char *argv[] )
3374
struct termios ttyset;
3375
int fd = open("COM1", 1);
3377
int cspeed = translate_speed( env, speed );
3382
if( !cspeed ) return;
3383
if( tcgetattr( fd, &ttyset ) < 0 ) goto fail;
3384
ttyset.c_cflag &= ~CSIZE;
3385
ttyset.c_cflag |= CS8;
3386
ttyset.c_cflag |= PARENB;
3387
ttyset.c_cflag &= ~CSTOPB;
3389
if( cfsetspeed( &ttyset, cspeed ) < 0 ) goto fail;
3391
if( cfsetispeed( &ttyset, cspeed ) < 0 ) goto fail;
3392
if( cfsetospeed( &ttyset, cspeed ) < 0 ) goto fail;
3393
#endif /* __FreeBSD__ */
3394
if( tcsetattr( fd, TCSANOW, &ttyset ) < 0 ) goto fail;
3401
int main( int argc, char *argv[] )
3403
int fd[4] = { 0,0,0,0 };
3405
char file[8], vb[80];
3411
struct timeval *timeout;
3412
int Fd, ret, change;
3414
struct timeval tv_sleep;
3415
unsigned int mflags, omflags;
3416
#undef TIOCSERGETLSR
3417
#if defined TIOCSERGETLSR
3418
struct stat fstatbuf;
3419
#endif /* TIOCSERGETLSR */
3421
#if defined(TIOCGICOUNT)
3422
struct serial_icounter_struct sis, osis;
3423
/* JK00: flag if this can be used on this port */
3424
int has_tiocgicount = 1;
3425
#endif /* TIOCGICOUNT */
3427
#if defined(TIOCSERGETLSR)
3428
int has_tiocsergetlsr = 1;
3429
#endif /* TIOCSERGETLSR */
3432
Fd = open( "COM1", 1 );
3433
#if defined(TIOCGICOUNT)
3434
/* Some multiport serial cards do not implement TIOCGICOUNT ... */
3435
/* So use the 'dumb' mode to enable using them after all! JK00 */
3436
if( ioctl( Fd, TIOCGICOUNT, &osis ) < 0 )
3438
report("Port does not support TIOCGICOUNT events\n" );
3439
has_tiocgicount = 0;
3441
#endif /* TIOCGICOUNT */
3443
#if defined(TIOCSERGETLSR)
3444
/* JK00: work around for multiport cards without TIOCSERGETLSR */
3445
/* Cyclades is one of those :-( */
3446
if( ioctl( Fd, TIOCSERGETLSR, &change ) )
3448
report("Port does not support TIOCSERGETLSR\n" );
3449
has_tiocsergetlsr = 0;
3451
#endif /* TIOCSERGETLSR */
3453
if( ioctl( Fd, TIOCMGET, &omflags) <0 )
3455
report("Port does not support events\n" );
3463
FD_SET( Fd, &rfds );
3464
tv_sleep.tv_sec = 0;
3465
tv_sleep.tv_usec = 100000;
3467
ret=serial_select( Fd + 1, &rfds, NULL, NULL, &tv_sleep );
3468
} while (ret < 0 && errno==EINTR);
3469
if( ret < 0 ) break;
3471
#if defined TIOCSERGETLSR
3472
/* JK00: work around for Multi IO cards without TIOCSERGETLSR */
3473
if( has_tiocsergetlsr )
3475
if (fstat(Fd, &fstatbuf)) break;
3476
if( ioctl( Fd, TIOCSERGETLSR, &change ) ) break;
3479
send_event( env, jobj, SPE_OUTPUT_BUFFER_EMPTY,
3483
#endif /* TIOCSERGETLSR */
3484
#if defined(TIOCGICOUNT)
3485
/* wait for RNG, DSR, CD or CTS but not DataAvailable
3486
* The drawback here is it never times out so if someone
3487
* reads there will be no chance to try again.
3488
* This may make sense if the program does not want to
3489
* be notified of data available or errors.
3490
* ret=ioctl(Fd,TIOCMIWAIT);
3492
/* JK00: only use it if supported by this port */
3493
if (has_tiocgicount)
3495
if( ioctl( Fd, TIOCGICOUNT, &sis ) ) break;
3496
while( sis.frame != osis.frame )
3498
send_event( env, jobj, SPE_FE, 1);
3501
while( sis.overrun != osis.overrun )
3503
send_event( env, jobj, SPE_OE, 1);
3506
while( sis.parity != osis.parity )
3508
send_event( env, jobj, SPE_PE, 1);
3511
while( sis.brk != osis.brk )
3513
send_event( env, jobj, SPE_BI, 1);
3518
#endif /* TIOCGICOUNT */
3519
/* A Portable implementation */
3521
if( ioctl( Fd, TIOCMGET, &mflags ) ) break;
3523
change = (mflags&TIOCM_CTS) - (omflags&TIOCM_CTS);
3524
if( change ) send_event( env, jobj, SPE_CTS, change );
3526
change = (mflags&TIOCM_DSR) - (omflags&TIOCM_DSR);
3527
if( change ) send_event( env, jobj, SPE_DSR, change );
3529
change = (mflags&TIOCM_RNG) - (omflags&TIOCM_RNG);
3530
if( change ) send_event( env, jobj, SPE_RI, change );
3532
change = (mflags&TIOCM_CD) - (omflags&TIOCM_CD);
3533
if( change ) send_event( env, jobj, SPE_CD, change );
3537
ioctl( Fd, FIONREAD, &change );
3540
if(!send_event( env, jobj, SPE_DATA_AVAILABLE, 1 ))
3543
usleep(100000); select wont block
3551
res = open( "COM1", 1 );
3552
seed = open( "COM2", 1 );
3558
if( foo%100 == 0 ) printf("%i\n", foo);
3559
serial_select(res + 1, readfds, writefds, exceptfds, timeout);
3560
serial_select(seed + 1, readfds, writefds, exceptfds, timeout);
3561
serial_write(res, vb, 4);
3562
serial_write(seed, vb, 4);
3567
res = open( "COM1", 1 );
3568
seed = open( "COM2", 1 );
3574
if( foo%100 == 0 ) printf("%i\n", foo);
3575
serial_write(seed, vb, 4);
3576
serial_read(res, file, 4);
3584
if( foo%100 == 0 ) printf("%i\n", foo);
3585
serial_write(seed, vb, 4);
3586
serial_read(res, file, 4);
3593
res = open( "COM1", 1 );
3596
printf("Open Failed\n");
3600
serial_read(res, vb, 1);
3603
printf("close Failed\n");
3605
res = open( "COM2", 1 );
3608
printf("Open Failed\n");
3612
serial_read(res, vb, 1);
3615
printf("close Failed\n");
3617
res = open( "COM3", 1 );
3620
printf("Open Failed\n");
3624
serial_read(res, vb, 1);
3627
printf("close Failed\n");
3629
res = open( "COM4", 1 );
3632
printf("Open Failed\n");
3636
serial_read(res, vb, 1);
3639
printf("close Failed\n");
3648
seed = (int) (4.0*rand()/RAND_MAX + 1.0);
3649
foo = (int) (2*rand()/RAND_MAX + 1.0);
3654
if ( fd[ seed - 1] == 0 )
3656
sprintf(file, "COM%i",
3658
res = open( file, 1 );
3661
fd[ seed - 1] = res;
3665
serial_read(res, vb, 1);
3672
if ( fd[ seed - 1] != 0 )
3674
res = close ( fd[ seed - 1 ] );
3683
printf("\n%5i %5i %5i %5i",fd[0],fd[1],fd[2],fd[3] );
3410
#endif /* PLAYING_AROUND */