1: #include <stdio.h> 2: #include <strings.h> 3: #include "Extern.h" 4: PrintLine(OffSet,LineStart,LineEnd) 5: long OffSet; /* offset of LineStart from beginning of file */ 6: char *LineStart, 7: *LineEnd; 8: { 9: char OffStr[80]; 10: if (lFlag) { 11: if (strlen(FileName) > 76) { 12: fprintf(stderr,"bm: filename too long\n"); 13: exit(2); 14: } /* if */ 15: sprintf(OffStr,"%s\n",FileName); 16: write(1,OffStr,strlen(OffStr)); 17: return; 18: } /* if */ 19: if (FileName && !hFlag) { 20: if (strlen(FileName) > 76) { 21: fprintf(stderr,"bm: filename too long\n"); 22: exit(2); 23: } /* if */ 24: sprintf(OffStr,"%s:",FileName); 25: write(1,OffStr,strlen(OffStr)); 26: } /* if */ 27: if (nFlag) { 28: sprintf(OffStr,"%ld: ",OffSet); 29: write(1,OffStr,strlen(OffStr)); 30: } /* if */ 31: write(1,LineStart,LineEnd-LineStart+1); 32: if (*LineEnd != '\n') write (1,"\n",1); 33: } /* PrintLine */