| 204 |
|
goto fmterr; |
| 205 |
|
fclose(fp); |
| 206 |
|
if (astat.pid != 0) { /* thinks it's still running */ |
| 207 |
< |
gethostname(buf, sizeof(buf)); |
| 208 |
< |
if (strcmp(buf, astat.host)) { |
| 207 |
> |
if (strcmp(myhostname(), astat.host)) { |
| 208 |
|
fprintf(stderr, |
| 209 |
|
"%s: process %d may still be running on host %s\n", |
| 210 |
|
progname, astat.pid, astat.host); |
| 223 |
|
return(-1); |
| 224 |
|
} |
| 225 |
|
setours: /* set our values */ |
| 226 |
< |
gethostname(astat.host, sizeof(astat.host)); |
| 226 |
> |
strcpy(astat.host, myhostname()); |
| 227 |
|
astat.pid = getpid(); |
| 228 |
|
strcpy(astat.cfname, cfname); |
| 229 |
|
return(0); |
| 945 |
|
quit(1); |
| 946 |
|
} |
| 947 |
|
} else if (n < viewnum) { /* rewind file */ |
| 948 |
+ |
if (viewnum == 1 && feof(viewfp)) |
| 949 |
+ |
return(&curview); /* just one view */ |
| 950 |
|
if (fseek(viewfp, 0L, 0) == EOF) { |
| 951 |
|
perror(vval(VIEWFILE)); |
| 952 |
|
quit(1); |
| 956 |
|
} |
| 957 |
|
while (n > viewnum) { /* scan to desired view */ |
| 958 |
|
if (fgets(linebuf, sizeof(linebuf), viewfp) == NULL) |
| 959 |
< |
return(NULL); |
| 959 |
> |
return(viewnum==1 ? &curview : NULL); |
| 960 |
|
if (isview(linebuf) && sscanview(&curview, linebuf) > 0) |
| 961 |
|
viewnum++; |
| 962 |
|
} |