home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Usenet 1994 October
/
usenetsourcesnewsgroupsinfomagicoctober1994disk2.iso
/
unix
/
volume4
/
bm1.2
/
PrintLine.c
< prev
next >
Wrap
C/C++ Source or Header
|
1986-11-30
|
856b
|
36 lines
#include <stdio.h>
#include <string.h>
#include "Extern.h"
PrintLine(OffSet,LineStart,LineEnd)
int OffSet; /* offset of LineStart from beginning of file */
char *LineStart,
*LineEnd;
{
char OffStr[80];
if (lFlag) {
if (strlen(FileName) > 76) {
fprintf(stderr,"bm: filename too long\n");
exit(2);
} /* if */
if (strlen(FileName)) {
sprintf(OffStr,"%s\n",FileName);
write(1,OffStr,strlen(OffStr));
} /* if */
return;
} /* if */
if (FileName && !hFlag) {
if (strlen(FileName) > 76) {
fprintf(stderr,"bm: filename too long\n");
exit(2);
} /* if */
sprintf(OffStr,"%s:",FileName);
write(1,OffStr,strlen(OffStr));
} /* if */
if (nFlag) {
sprintf(OffStr,"%d: ",OffSet);
write(1,OffStr,strlen(OffStr));
} /* if */
write(1,LineStart,LineEnd-LineStart+1);
if (*LineEnd != '\n') write (1,"\n",1);
} /* PrintLine */