Re: killpower(UPS inverter shutdown)

2004-04-14 Thread Julian H. Stacey
Gregory Edigarov wrote:
> Hello,
> 
> If anyone have the working sources to killpower an USB UPS under
> FreeBSD please enlight me. I have APC RS 500, but an example for any 
> other should also be ok. Thanks a lot in advance.

Tip:
Also try mail lists & web of the UPS ports on FreeBSD (4 when I counted,
a couple of year back,) inc. my favourite: /usr/ports/sysutils/nut
  --
  This is a developing project to monitor a large assortment of UPS hardware.
  Network communications are used so that multiple systems can monitor a
  single physical UPS and shut down together if necessary without any
  special "sharing hardware" on the UPS itself. CGI scripts provided
  to monitor UPS status via WEB browser.
  --

-
Julian Stacey.  Unix C & Net Services Consultant - Munich.  http://berklix.com
  Mail me in Ascii text/plain:   Html is dumped as Spam.
  Schnupftabak probieren:  Ihr Rauchen = mein allergischer Kopfschmerz !
Surplus hardwarehttp://berklix.com/surplus/
___
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "[EMAIL PROTECTED]"


Re: Invalid realloc size of 0 when installing on an AMD athlonXP barton poweredmachine

2004-04-14 Thread Baldur Gislason
Turned out to be a bug in sysinstall when booting from a floppy and installing 
over a network, I had no problems when I just wrote the ISO but I prefer 
network install since it takes me about an hour to download the ISO, and by 
that time I could have the machine up and running if I used network install.

Baldur

On Tuesday 13 April 2004 21:55, jason wrote:
> Baldur Gislason wrote:
> >I'm trying to install 5.2.1-rel from FTP with an intel 100Mb network card
> > on an AMD AthlonXP barton 2500+ with an Aopen AK77-8XN motherboard and
> > 1GB ram. When at 65% through extracting base, sysinstall crashes with the
> > message: Fatal error: Invalid realloc size of 0! - PRESS ANY KEY TO
> > REBOOT I know this is a very common problem these days, has any solution
> > been found? I'd rather sell this machine than using some other operating
> > system on it.
> >
> >Baldur
> >
> >___
> >[EMAIL PROTECTED] mailing list
> >http://lists.freebsd.org/mailman/listinfo/freebsd-hardware
> >To unsubscribe, send any mail to
> > "[EMAIL PROTECTED]"
>
> I have an athlon barton core on an epox 8rda3i.  I have never seen this
> problem and I cvsup every few weeks on current.  I have not done a clean
> install since last year.  Is that a local ftp or the net?  Can you make
> a cd from the iso, or do you not want to?  I have done both in the past
> and the cd is much faster, even if you hae broad band.  Maybe not if you
> have a t3 or better, but not all ftp servers will be fast all the time.
> ___
> [EMAIL PROTECTED] mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-hardware
> To unsubscribe, send any mail to "[EMAIL PROTECTED]"

___
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "[EMAIL PROTECTED]"


C code for parsing rc.conf?

2004-04-14 Thread Craig Rodrigues
Hi,

Is there a C library that comes with FreeBSD which
can be used to parse, append to, and validate
rc.conf?

I'd like to customize some of the settings in /etc/rc.conf
with my own GUI-based program.  It's not too hard
to write something on my own, but I was wondering
if a reusable library existed in FreeBSD 4.x or 5.x for doing this.

Thanks.

-- 
Craig Rodrigues
http://crodrigues.org
[EMAIL PROTECTED]
___
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "[EMAIL PROTECTED]"


Re: C code for parsing rc.conf?

2004-04-14 Thread Nguyen Tam Chinh
On Wed, 14 Apr 2004, Craig Rodrigues wrote:

> Hi,
>
> Is there a C library that comes with FreeBSD which
> can be used to parse, append to, and validate
> rc.conf?
>
> I'd like to customize some of the settings in /etc/rc.conf
> with my own GUI-based program.  It's not too hard
> to write something on my own, but I was wondering
> if a reusable library existed in FreeBSD 4.x or 5.x for doing this.
>

rc.conf is parsed/executed by scripts in /etc/rc*. With your GUI program,
simply take and change these scripts.

-
With best regards,  |   The Power to Serve
Nguyen Tam Chinh|   http://www.FreeBSD.org
___
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "[EMAIL PROTECTED]"


Re: C code for parsing rc.conf?

2004-04-14 Thread Dan Nelson
In the last episode (Apr 15), Nguyen Tam Chinh said:
> On Wed, 14 Apr 2004, Craig Rodrigues wrote:
> > Is there a C library that comes with FreeBSD which can be used to
> > parse, append to, and validate rc.conf?
> >
> > I'd like to customize some of the settings in /etc/rc.conf with my
> > own GUI-based program.  It's not too hard to write something on my
> > own, but I was wondering if a reusable library existed in FreeBSD
> > 4.x or 5.x for doing this.
> 
> rc.conf is parsed/executed by scripts in /etc/rc*. With your GUI
> program, simply take and change these scripts.

.. and be aware that although most lines will be in the standard
name="value" format, admins are free to put any shell syntax or
commands they like in there.  So make sure your gui tool preserves
unchanged lines when saving (instead of regenerating the entire file
from a parsed array, for example).  That will let an admin use shell
tricks to generate ifconfig_XX0_aliasXX variables, for example, and
still allow using your tool to change moused flags.

-- 
Dan Nelson
[EMAIL PROTECTED]
___
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "[EMAIL PROTECTED]"


Re: C code for parsing rc.conf?

2004-04-14 Thread Brandon Erhart
Not that I know of, but it should be a breeze to write a simple parsing engine.
Just ignore all lines starting with a '#', and break at the '=' sign. The 
first part would be your variable name, the last part your value for it.
Then just display variables and their names, and maybe parse the variable 
names so you can assign meaningful help information to them.

I didn't compile this, not sure if it'll work, but it'll give you a good 
idea as to what your code may look like ..

int main(int argc, char **argv)
{
FILE *rc;
char buf[512];
if ( (rc=fopen("/etc/rc.conf", "r")) == NULL)
{
perror("fopen()");
exit(EXIT_FAILURE);
}
while (fgets(buf, sizeof(buf), rc) != NULL)
{
char *eq_ptr, var_name[256], var_value[256];
some_function_to_strip_trailing_and_pre_whitespace(buf); 
/* this function will just strip pre- and trailing whitespace from the line */

if (!strlen(buf))   continue;/* blank line */

if (buf[0] == '#')  continue;   /* comment line */

if ( (eq_ptr = index(buf, '=')) == NULL)   continue;   /* no equal 
sign */

*eq_ptr = '\0';

memset(var_name, 0, 256);
memset(var_value, 0, 256);
if (!strlen(buf) || !strlen(eq_ptr+1))   continue;/* either 
the variable name or the value was empty */

strncpy(var_name, buf, 255);
strncpy(var_value, eq_ptr+1, 255);
printf("%s=%s\n", var_name, var_value);
}
exit(EXIT_SUCCESS);
}
At 03:56 PM 4/14/2004, you wrote:
Hi,

Is there a C library that comes with FreeBSD which
can be used to parse, append to, and validate
rc.conf?
I'd like to customize some of the settings in /etc/rc.conf
with my own GUI-based program.  It's not too hard
to write something on my own, but I was wondering
if a reusable library existed in FreeBSD 4.x or 5.x for doing this.
Thanks.

--
Craig Rodrigues
http://crodrigues.org
[EMAIL PROTECTED]
___
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "[EMAIL PROTECTED]"
___
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "[EMAIL PROTECTED]"


Re: C code for parsing rc.conf?

2004-04-14 Thread Brian O'Shea
--- Brandon Erhart <[EMAIL PROTECTED]> wrote:
> Not that I know of, but it should be a breeze to write a simple parsing
> engine.
> Just ignore all lines starting with a '#', and break at the '=' sign. The 
> first part would be your variable name, the last part your value for it.

Don't forget to deal with quotes:

some_variable="Double-quoted value"

 - or -

some_other_variable='Single-quoted value'

Not to mention lines with trailing comments:

some_variable="Some Value" # Set some variable to some value.

And, as somebody else pointed out, some other embedded shell syntax (which
might contain an equal sign, so just blindly splitting lines on equal signs
won't work):

if [ "$some_variable" = "NO" ]; then
# do something here...
fi

Remember that /etc/rc.conf is just a shell script, and so it is parsed by
the shell interpreter (/bin/sh).  You might end up writing a shell parser
if you want to cover all possibilities! (in other words, re-inventing the
wheel.)  Be careful.

-brian

> Then just display variables and their names, and maybe parse the variable 
> names so you can assign meaningful help information to them.
> 
> I didn't compile this, not sure if it'll work, but it'll give you a good 
> idea as to what your code may look like ..
> 
[...]





__
Do you Yahoo!?
Yahoo! Tax Center - File online by April 15th
http://taxes.yahoo.com/filing.html
___
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "[EMAIL PROTECTED]"


Re: C code for parsing rc.conf?

2004-04-14 Thread Brandon Erhart
Ah yes, I was just being crude .. giving some lame example :-P

Parsing the rc.conf would take considerably more work than that

"Tha whistles go WOO!"   - Bubb Rubb

Brandon

At 04:59 PM 4/14/2004, you wrote:
--- Brandon Erhart <[EMAIL PROTECTED]> wrote:
> Not that I know of, but it should be a breeze to write a simple parsing
> engine.
> Just ignore all lines starting with a '#', and break at the '=' sign. The
> first part would be your variable name, the last part your value for it.
Don't forget to deal with quotes:

some_variable="Double-quoted value"

 - or -

some_other_variable='Single-quoted value'

Not to mention lines with trailing comments:

some_variable="Some Value" # Set some variable to some value.

And, as somebody else pointed out, some other embedded shell syntax (which
might contain an equal sign, so just blindly splitting lines on equal signs
won't work):
if [ "$some_variable" = "NO" ]; then
# do something here...
fi
Remember that /etc/rc.conf is just a shell script, and so it is parsed by
the shell interpreter (/bin/sh).  You might end up writing a shell parser
if you want to cover all possibilities! (in other words, re-inventing the
wheel.)  Be careful.
-brian

> Then just display variables and their names, and maybe parse the variable
> names so you can assign meaningful help information to them.
>
> I didn't compile this, not sure if it'll work, but it'll give you a good
> idea as to what your code may look like ..
>
[...]




__
Do you Yahoo!?
Yahoo! Tax Center - File online by April 15th
http://taxes.yahoo.com/filing.html
___
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "[EMAIL PROTECTED]"


Re: C code for parsing rc.conf?

2004-04-14 Thread Tim Kientzle
Craig Rodrigues wrote:
Is there a C library that comes with FreeBSD which
can be used to parse, append to, and validate
rc.conf?
I'd like to customize some of the settings in /etc/rc.conf
with my own GUI-based program.  It's not too hard
to write something on my own, but I was wondering
if a reusable library existed in FreeBSD 4.x or 5.x for doing this.
There was a detailed discussion of this topic about a year
ago.  Here is how to obtain the current settings from rc.conf
from within a C program:
 * Clear the current environment

 * popen() a shell command that sources rc.conf, then
   runs printenv
 * read and parse the output of printenv

The basic idea is to just let the shell do
the work for you.
You can make this process a bit more predictable
by using a modified printenv that dumps variable
names and values in hex or something similar.
(Or, submit a patch to the existing printenv.)
To update rc.conf, just append new statements
to the end of the file.  Don't try to edit it
in place.  Later variable settings will override
earlier ones, so this will have the expected
result without possibly trashing someone's custom
shell scripting.
I may have overlooked a few details, but this
should be enough to get you started.
Tim Kientzle

___
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "[EMAIL PROTECTED]"


Re: C code for parsing rc.conf?

2004-04-14 Thread Greg Shenaut
On Apr 14, 2004, at 5:14 PM, Tim Kientzle wrote:

Craig Rodrigues wrote:
Is there a C library that comes with FreeBSD which
can be used to parse, append to, and validate
rc.conf?
I'd like to customize some of the settings in /etc/rc.conf
with my own GUI-based program.  It's not too hard
to write something on my own, but I was wondering
if a reusable library existed in FreeBSD 4.x or 5.x for doing this.
There was a detailed discussion of this topic about a year
ago.  Here is how to obtain the current settings from rc.conf
from within a C program:
 * Clear the current environment

 * popen() a shell command that sources rc.conf, then
   runs printenv
 * read and parse the output of printenv

The basic idea is to just let the shell do
the work for you.
It's a little more awkward, but another way to do this is to use a 
shell shim
along the lines of

#!/bin/sh
. /etc/whatever
exec /your/program
The shell's environment will be exported to your program's environment.

Greg Shenaut

___
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "[EMAIL PROTECTED]"