scott@sage.uchicago.edu (Scott Deerwester) (05/31/89)
I've been trying to figure out, for the last two weeks or so, why I
can't send out any mail. Turns out that niload, when I load a hosts
file, is taking the *last* entry for hosts that have duplicate
entries, meaning that it's finding a bogus entry for my mailhost. In
other words, it overwrites any entries that it loads in with
subsequent entries for the same host. Blech. A kludge of a solution
is to reverse the lines of the hosts file before you feed it to
niload. A better solution would depend on being able to muck with
niload. Here's a cheap way to reverse the lines in the file. Compile
the code included here into rcat, and then do the following:
# rev /etc/hosts > /tmp/blurfle
# rcat /tmp/blurfle > hosts.rev
# niload hosts . < hosts.rev
# rm blurfle
You could, of course, do the same thing with an awk script, but then
it would have to read the whole thing into memory at the same time.
Of course, niload takes a v e r y l o n g t i m e
to run, so any effiency gained here probably won't matter much...
Here's rcat.c:
----- cut here -----
#include <stdio.h>
#define BufSize 4096
/*
* rcat
*
* Reverses a text file. Can be used in conjunction with rev to
* reverse the lines in a file (the first shall be last...).
*
* Copyright 1989, Scott Deerwester. This code may be freely used,
* hacked, used for kitty litter... provide that this notice
* accompanies all copies (except for copies used for kitty litter :-)
*/
char
buf[BufSize],
rbuf[BufSize];
main (int argc, char *argv[])
{
register i;
FILE *fp;
if (argc == 1)
reverse (stdin);
else for (i = 1; i < argc; i++)
{
if ((fp = fopen (argv[i], "r")) == NULL)
{
fprintf (stderr, "Can't open %s\n", argv[i]);
continue;
}
reverse (fp);
fclose (fp);
}
exit (0);
}
reverse (FILE *fp)
{
register j;
long fsize;
fseek (fp, 0L, 2);
fsize = ftell (fp);
for (j = fsize / BufSize; j >= 0; j--)
{
register n, k;
fseek (fp, (long) j * BufSize, 0);
if ((n = fread (buf, 1, BufSize, fp)) <= 0)
{
fprintf (stderr, "Read error at block %d\n", j);
break;
}
/*
* The last line in the file is a newline. Don't print it.
*/
if (n < BufSize)
n--;
for (k = 0; k < n; k++)
{
rbuf[n - k - 1] = buf[k];
}
fwrite (rbuf, n, 1, stdout);
}
/*
* We *do*, on the other hand, want to end the first line with a
* newline. Tack one on.
*/
putchar ('\n');
}
-------
How might I avoid going through all of this if I can connect to a name
server? I've been hesitant to mess with it, not really understanding
the innards of NetInfo.
-------
Scott Deerwester | Internet: scott@tira.uchicago.edu
C* {for,of,in} Information S* | Phone: 312-702-6948
University of Chicago |
Scott Deerwester | Internet: scott@tira.uchicago.edu
C* {for,of,in} Information S* | Phone: 312-702-6948
University of Chicago |davidp@skat.usc.edu (David Peterson) (08/01/90)
Hello, Does anyone have any idea why a NeXT running as a NetInfo parent server for the past 7 months would suddenly crash then come back up asking for a NetInfo parent server? (The crash wasn't sudden, it does that now and then) Watching in the rom monitor shows when it starts portmap it gets the problem (It pauses for a few seconds after printing out portmap then says it can't find parent NetInfo server; type c to continue without network). The only thing that I can think of thats changed is that we started using a GatorBox to mount the NFS exports on Macs. The exports file was changed, and also the tftp configuration was changed in inetd.conf. Commented out the line pointing to /private/tftpboot and uncommented the "normal" tftp line. I can't think of anything else of consequence that has changed other than adding a few more users. Any help/suggestions would be appreciated. Thanks, -dave. davidp@skat.usc.edu
rwb@vi.ri.cmu.edu (Bob Berger) (03/01/91)
I recently added some machines running 2.0 to my net. The parent netinfo domain is still on a 1.0 machine. The 2.0 machines keep getting an error on the console that says loginwindow: netinfo problem - No such directory Although the 2.0 machines can read the parent domain, new items added to the parent domain don't show up until the client 2.0 machine is rebooted. What's going on here? It might help if I knew what directory the error message was referring to; it's rather uninformative the way it is. rwb@vi.ri.cmu.edu
lacsap@plethora.media.mit.edu (Pascal Chesnais) (03/01/91)
In article <12163@pt.cs.cmu.edu> rwb@vi.ri.cmu.edu (Bob Berger) writes: > The 2.0 machines keep getting an error on the console that says > loginwindow: netinfo problem - No such directory The netinfo problem is because the /keyboard directory is missing. It's benign. Pascal Chesnais, Research Specialist, Electronic Publishing Group Media Laboratory, E15-351, 20 Ames Street, Cambridge, Ma, 02139 (617) 253-0311 email: lacsap@plethora.media.mit.edu (NeXT)
eps@toaster.SFSU.EDU (Eric P. Scott) (03/02/91)
In article <5401@media-lab.MEDIA.MIT.EDU> lacsap@plethora.media.mit.edu writes: >The netinfo problem is because the /keyboard directory is missing. >It's benign. But annoying. niutil -create . /keyboard -=EPS=-