* These procedures manage the source files examined by sdb.
/* Change the current source file to `name'. */
if (fiobuf
.fd
) close(fiobuf
.fd
);
for (p
=fp
; *q
; *p
++ = *q
++) ;
if ((fiobuf
.fd
= open(filework
,0)) == -1) {
if (bread(&fiobuf
,p
,1) <= 0) {
printf("%s: No lines in file\n", name
);
/* Make the next line current. */
if (bread(&fiobuf
,p
,1) <= 0) {
/* Make the previous line current. */
if (bread(&fiobuf
, &c
+1, -1) <= 0) {
if (maxfline
) blseek(&fiobuf
,0L,2);
if (bread(&fiobuf
,&c
,1)<=0)
if (c
== '\n') maxfline
++;
bread(&fiobuf
, &c
, 1); /* eat the '\n' */
if (fline
< 0) fline
= maxfline
- 1;
/* Print the current line. */
error("No lines in file");
while(putchar(*p
++) != '\n')
/* Make line `num' current. */
for (i
=fline
; i
<num
; i
++) {
if (fline
== 1) goto bad
;
for (i
=num
; i
<ofline
; i
++) {
if (maxfline
& num
>maxfline
) goto bad
;
bad
: error("Not that many lines in file");
if (fline
== 1) return(i
);
/* Go forwards n lines. */
error("No lines in file");