home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
8bitfiles.net/archives
/
archives.tar
/
archives
/
canada-remote-systems
/
cpower
/
globcp.arc
/
GDIRLINE.C
< prev
next >
Wrap
Text File
|
2019-04-13
|
956b
|
44 lines
/*
* ├OPYRIGHT (├) ┴DRIAN ╨EPPER, 1989
*
* ┬UT ╔ (┴DRIAN ╨EPPER) CONSIDER THIS
* MATERIAL TO BE IN THE ╨UBLIC ─OMAIN.
*/
/*
* GDIRLINE.C - READ A LINE FROM A
* DIRECTORY "LOAD" INTO GIVEN BUF
*
* RETURN AS FUNCTION VALUE
* - THE "LINE NUMBER" PART OF BASIC
* STYLE LINE (THAT IS, NUMBER OF
* BLOCKS)
* - ┼╧╞ AT END-OF-FILE
*/
#INCLUDE <STDIO.H>
GDIRLINE(BUF, FID)
CHAR *BUF;
╞╔╠┼ FID;
█
CHAR *B;
UNSIGNED C, N;
FGETC(FID); /* SKIP "LINK" */
FGETC(FID); /* ... */
N = FGETC(FID); /* GET "LINE NUMBER", LOW BYTE */
C = FGETC(FID); /* AND HIGH BYTE */
N += C<<8; /* AND PUT THE TWO TOGETHER */
/* READ REST OF LINE; ENDED NORMALLY BY A ZERO BYTE */
FOR (B = BUF; (C = FGETC(FID)) && C != ┼╧╞; ++B)
*B = C;
*B = '\0'; /* JUST IN CASE DIDN'T END WITH ZERO */
IF (C == ┼╧╞) RETURN ┼╧╞;
RETURN N; /* RETURN "LINE NUMBER" */
/* ASSUME ┼╧╞ IS INVALID LINE NUMBER */
▌