Re: Clarification needed on Handbook: Tracking for Multiple Machines

2004-02-23 Thread D J Hawkey Jr
On Feb 23, at 09:12 AM, M. Warner Losh wrote:
> 
> In message: <[EMAIL PROTECTED]>
>         D J Hawkey Jr <[EMAIL PROTECTED]> writes:
> : True or False: Setting CPUTYPE to the lowest target CPU ("p2") in
> : a build machine's make.conf will cripple the performance of target
> : machines with higher CPUs ("p3", "p4", "i586", "i686", etc.).
> 
> False.  It might have a minor impact on performance, but not a major
> one.  At least in my experience.  Minor here means < 10% for something
> like the world stone.  Cripple to me implies > 25%.

OK, thanks. Just to satisfy my anal-retentive side, would that ~10%
degradation be a higher level of performance on a PIII (or higher)
with no CPUTYPE specified at all, given the same *FLAGS?

> : If "True", for optimized code across all machines, the code should
> : just be built on each machine, right?
> 
> That would give slightly better performance.  However, it can be more
> pain than it is worth if the number of machine types is high.

Consuming considerably more time and disk space, a shell script to
alter make.conf and rename /usr/obj between the build for each machine
is doable, though pro'lly not worth it. The install at each each box
would just have to mount it's corresponding /usr/obj tree.

Thanks, Warner,
Dave

-- 
  __ __
  \__   \D. J. HAWKEY JR.   /   __/
 \/\ [EMAIL PROTECTED]/\/
  http://www.visi.com/~hawkeyd/

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


Re: Clarification needed on Handbook: Tracking for Multiple Machines

2004-02-22 Thread D J Hawkey Jr
OK, I've cross-posted this message to -hackers, to see if we can get
some sort of definitive [to me] answer. Please forgive if it's considered
bad form.

-hackers: There is a thread in -questions in response to my query as
to building the world and kernels for a variety of Intel CPUs on one
machine. For brevity's sake, I won't reproduce the entire thread here.

OK, I guess my question boils down to these, then:

True or False: Setting CPUTYPE to the lowest target CPU ("p2") in
a build machine's make.conf will cripple the performance of target
machines with higher CPUs ("p3", "p4", "i586", "i686", etc.).

If "True", for optimized code across all machines, the code should
just be built on each machine, right?

Thanks,
Dave

-- 
  __________     __
  \__   \D. J. HAWKEY JR.   /   __/
 \/\ [EMAIL PROTECTED]/\/
  http://www.visi.com/~hawkeyd/

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


Re: Clarification needed on Handbook: Tracking for Multiple Machines

2004-02-22 Thread D J Hawkey Jr
On Feb 23, at 01:05 AM, Tony Frank wrote:
> 
> On Sat, Feb 21, 2004 at 11:23:28AM -0600, D J Hawkey Jr wrote:
> > On Feb 21, at 05:56 PM, Gabriel Ambuehl wrote:
> > > 
> > > DJHJ> Second, two machines are of the same architecture, but they have different
> > > DJHJ> CPUs: One is an Intel PIII, but the other is a PII. Will the world built
> > > DJHJ> on a PIII be correct for a PII? Similarly, will the kernel for the PII
> > > DJHJ> built on a PIII be correct for the PII, given the different variables and
> > > DJHJ> settings in the two kernel configuration files?
> > > 
> > > Just make sure you build for 686. If that doesn't work, make it 586 (I
> > > think the PI qualifies as 686 but I'm not entirely sure). I think the extensions 
> > > such as
> > > SSE etc are detected dynamically and shouldn't cause any problem.
> > > In all my years of messing with builds, I never run into this problem,
> > > so I guess it's pretty safe.
> > Yes, both [my] machines define I686_CPU.
> > 
> > "Dynamically", as in "at runtime"? I think you're right, but I don't
> > know for certain, either. This is exactly what I'm wondering about;
> > the PII has only MMX, for instance, while the PIII has SSE and MMX2.
> > 
> > I assume the world's codebase is CPU-agnostic within an architecture,
> > but I really don't want to assume this; I'd rather know this.
> 
> I have PII, Celeron, PIII and P4 in my environment.
> All these use "I686_CPU" in my kernel configs (I got rid of the other I[345]_CPU 
> types.

In a desktop's kernel config:
machine i386
cpu I686_CPU
ident   SHEOL

In my laptop's kernel config:
machine i386
cpu I686_CPU
ident   CHARON

Getting difficult, isn't it?  ;-,

Boot messages on that desktop from kernel built on that desktop:
CPU: Pentium III/Pentium III Xeon/Celeron (764.35-MHz 686-class CPU)
  Origin = "GenuineIntel"  Id = 0x686  Stepping = 6
  
Features=0x383f9ff

Boot messages on that laptop from kernel built on that laptop:
CPU: Pentium II/Pentium II Xeon/Celeron (233.87-MHz 686-class CPU)
  Origin = "GenuineIntel"  Id = 0x652  Stepping = 2
  
Features=0x183f9ff

> In /etc/make.conf I include "CPUTYPE=p2" as the lowest common denominator if 
> including a CPUTYPE flag.
> The resulting world & kernel run fine on all the systems.
> 
> The higher flags p3 and p4 still just use -march=pentiumpro, however for SSE you
> will need p3 or p4 as MACHINE_CPU does not include SSE for p2 level.
> Check out /usr/share/mk/bsd.cpu.mk for specifics.

If I read things right, the first chunk in bsd.cpu.mk results in
"CPUTYPE = i686"; the conditional-on-CPU_TYPE-defined assignment
sees "cpu I686_CPU" in the kernel configs, right?. The second
chunk in bsd.cpu.mk also results in "CPUTYPE = i686" (fallthrough).
The third chunk results in "_CPUCFLAGS = -march=pentiumpro", as
you state. Finally, the last chunk in bsd.cpu.mk results in
"MACHINE_CPU = i686 i586 i486 i386".

If I specify "CPUTYPE=p2" in make.conf, and I'm still reading
things right, the final result in bsd.cpu.mk would be the same
_CPUCFLAGS, and "MACHINE_CPU = i686 mmx i586 i486 i386".

But based on the boot messages, it would seem that the features of
the chips are detected correctly without specifying a CPUTYPE in
make.conf. So... As things are right now (no CPUTYPE in make.conf),
it would appear that "CPU feature" code is built into the kernels
on the respective machines, and that code correctly detects the
features available. Therefore, I don't see where adding CPUTYPE
in make.conf would get me anything I'm not already getting?

That is, why make things more specific than they have to be?
I don't see where adding "CPUTYPE=p2" on a PIII build machine
would change anything for PII and/or PIII target machines. What
have I missed?

> > > DJHJ> /etc/defaults/make.conf doesn't mention KERNCONF; /usr/src/Makefile.inc1
> > > DJHJ> does. Since /usr/share/mk/sys.mk sucks in /etc/make.conf, that should
> > > DJHJ> propogate KERNCONF to /usr/src/Makefile, right?
> 
> To your original question, yes.
> Just add a KERNCONF= line to /etc/make.conf.
> First entry should be the local machine kernel (to install) and
> any subsequent entries will also be built during 'make buildkernel'
> eg: KERNCONF=   MARVIN RAIDER RAIDERI GENERIC
> make buildkernel builds all four.
> make installkernel installs MARVIN.

Cool. So, the -CURRENT (or is that -STABLE?) Handbook does apply
to 4.5-REL, at least where this stuff is concerned.

Dave

-- 
  __ __
  \__   \D. J. HAWKEY JR.   /   __/
 \/\ [EMAIL PROTECTED]/\/
  http://www.visi.com/~hawkeyd/

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


Re: Clarification needed on Handbook: Tracking for Multiple Machines

2004-02-21 Thread D J Hawkey Jr
On Feb 21, at 05:56 PM, Gabriel Ambuehl wrote:
> 
> DJHJ> Second, two machines are of the same architecture, but they have different
> DJHJ> CPUs: One is an Intel PIII, but the other is a PII. Will the world built
> DJHJ> on a PIII be correct for a PII? Similarly, will the kernel for the PII
> DJHJ> built on a PIII be correct for the PII, given the different variables and
> DJHJ> settings in the two kernel configuration files?
> 
> Just make sure you build for 686. If that doesn't work, make it 586 (I
> think the PI qualifies as 686 but I'm not entirely sure). I think the extensions 
> such as
> SSE etc are detected dynamically and shouldn't cause any problem.
> In all my years of messing with builds, I never run into this problem,
> so I guess it's pretty safe.

Yes, both [my] machines define I686_CPU.

"Dynamically", as in "at runtime"? I think you're right, but I don't
know for certain, either. This is exactly what I'm wondering about;
the PII has only MMX, for instance, while the PIII has SSE and MMX2.

I assume the world's codebase is CPU-agnostic within an architecture,
but I really don't want to assume this; I'd rather know this.

> DJHJ> Finally, after briefly following the makefile chain, it looks as though
> DJHJ> what is written for -CURRENT is backward-compatible to 4.5-RELEASE?
> 
> I don't think it is. 4.5 is OLD. You might not even find 4.9 to be
> backwards compatible to 4.5, much less CURRENT.

Yes, 4.5-REL is old, but I have too much vested in my 4.5-REL systems
to jump anytime soon. I have been maintaining my 4.5-REL systems WRT
post-4.5 security updates (right up to SA-04:02), and for what these
machines are and what they do, 4.5-REL is perfectly suitable.

> DJHJ> /etc/defaults/make.conf doesn't mention KERNCONF; /usr/src/Makefile.inc1
> DJHJ> does. Since /usr/share/mk/sys.mk sucks in /etc/make.conf, that should
> DJHJ> propogate KERNCONF to /usr/src/Makefile, right?
> 
> You can also
> just supply it on the command line when doing your make runs.

Yes, but this means individual commands for each machine's kernel, as
opposed to one command for all machines (think "issue command and go to
bed", or even an `at` command). Are you stating definitively that what
I saw in the makefile chain isn't what is really there?

Dave

-- 
  __ __
  \__   \D. J. HAWKEY JR.   /   __/
 \/\ [EMAIL PROTECTED]/\/
  http://www.visi.com/~hawkeyd/

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


Clarification needed on Handbook: Tracking for Multiple Machines

2004-02-21 Thread D J Hawkey Jr
Hi all.

I recently acquired a laptop whose world and kernel I'd like to have
built by a different machine on my LAN. Chapter 21.5 of the current
Handbook lays things out pretty well, but I do have a couple of questions
before proceeding.

The Handbook states: "Finally[,] make sure that /etc/make.conf on all
the machines in the build set agrees with the build machine. That means
that the build machine must build all the parts of the base system that
any machine in the build set is going to install. Also, each build machine
should have its kernel name set with KERNCONF in /etc/make.conf, and the
build machine should list them all in KERNCONF, listing its own kernel
first. The build machine must have the kernel configuration files for each
machine in /usr/src/sys/arch/conf if it is going to build their kernels."

So, two machines use the same world, except that a laptop doesn't want
profiled libraries or games. Since the install is separate from the build,
the build machine's make.conf must _not_ define NOPROFILE nor NOGAMES,
but the laptop's make.conf _must_ define NOPROFILE and NOGAMES, such that
both are present when `make installworld` is run on the machine that wants
them, but they won't be installed when `make installworld` is run on the
laptop, right?

Second, two machines are of the same architecture, but they have different
CPUs: One is an Intel PIII, but the other is a PII. Will the world built
on a PIII be correct for a PII? Similarly, will the kernel for the PII
built on a PIII be correct for the PII, given the different variables and
settings in the two kernel configuration files?

Finally, after briefly following the makefile chain, it looks as though
what is written for -CURRENT is backward-compatible to 4.5-RELEASE?
/etc/defaults/make.conf doesn't mention KERNCONF; /usr/src/Makefile.inc1
does. Since /usr/share/mk/sys.mk sucks in /etc/make.conf, that should
propogate KERNCONF to /usr/src/Makefile, right?

Thanks,
Dave

-- 
  __ ______
  \__   \D. J. HAWKEY JR.   /   __/
 \/\ [EMAIL PROTECTED]/\/
  http://www.visi.com/~hawkeyd/

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


[hawkeyd@visi.com: Re: Something I should know about 'make buildkernel ...', but I don't.]

2003-09-23 Thread D J Hawkey Jr
Just a little bit ago, I wrote:

- Forwarded message from D J Hawkey Jr <[EMAIL PROTECTED]> -

But you seem to agree that something this trivial shouldn't yield a
broken kernel if /usr/obj/usr/src/sys/... is unchanged from the previous
build, right?

- End forwarded message -

Looking further into the make files, it would appear as though all I
would really have to do is 'rm /usr/obj/usr/src/sys/.../vers.*', and do
the 'make buildkernel KERNCONF=...' just as usual.

This sounds vaguely familiar... From the "old" way... Sorry if I wasted
time and bandwidth.

Dave

-- 
  __ __________
  \__   \D. J. HAWKEY JR.   /   __/
 \/\ [EMAIL PROTECTED]/\/
  http://www.visi.com/~hawkeyd/

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


Re: Something I should know about 'make buildkernel ...', but I don't.

2003-09-23 Thread D J Hawkey Jr
On Sep 23, at 03:45 PM, Matthew Seaman wrote:
> 
> On Tue, Sep 23, 2003 at 09:32:26AM -0500, D J Hawkey Jr wrote:
> > 
> > After applying patches, I bump $BRANCH in /sys/conf/newvers.sh, and would
> > like the running kernel to reflect the current patchlevel, but not at the
> > expense of a complete rebuild. Something this trivial shouldn't get me in
> > any trouble, kernel-wise, should it?
> > 
> > Browsing Makefile.inc1, I see these defines:
> > -DNOCLEANDIR run ${MAKE} clean, instead of ${MAKE} cleandir
> > -DNOCLEAN do not clean at all
> > 
> > Anyway, is it as simple as:
> > make buildkernel -DNOCLEAN KERNCONF=...
> 
> So long as you aren't changing the kernel configuration, then you can
> probably use the 'old' build mechanism:

  [SNIP]

> However, this is only worth doing if you're going to be recompiling
> the kernel a number of times, as the first time through it will
> compile everything. 

Right! Most SAs these days don't effect the kernel. I usually leave
/usr/obj populated from the last build.

> Note that this won't put the object files
> etc. under /usr/obj...

Yeah, that's why I didn't want to do the "old" thang. I don't know
that it'd even work right.

But you seem to agree that something this trivial shouldn't yield a
broken kernel if /usr/obj/usr/src/sys/... is unchanged from the previous
build, right?

Dave

-- 
  __ __
  \__   \D. J. HAWKEY JR.   /   __/
 \/\ [EMAIL PROTECTED]/\/
  http://www.visi.com/~hawkeyd/

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


Something I should know about 'make buildkernel ...', but I don't.

2003-09-23 Thread D J Hawkey Jr
Hi All.

Something's been bugging me about 'make buildkernel ...' (or pro'lly more
precisely, the docs): How do I re-make the kernel without first cleaning
/usr/obj/...?

After applying patches, I bump $BRANCH in /sys/conf/newvers.sh, and would
like the running kernel to reflect the current patchlevel, but not at the
expense of a complete rebuild. Something this trivial shouldn't get me in
any trouble, kernel-wise, should it?

Browsing Makefile.inc1, I see these defines:
-DNOCLEANDIR run ${MAKE} clean, instead of ${MAKE} cleandir
-DNOCLEAN do not clean at all

What does 'cleandir' do that 'clean' doesn't? Remove directory trees?
Anyway, is it as simple as:
make buildkernel -DNOCLEAN KERNCONF=...

Like I said, I should already know this.
Dave

-- 
  __ ______________
  \__   \D. J. HAWKEY JR.   /   __/
 \/\ [EMAIL PROTECTED]/\/
  http://www.visi.com/~hawkeyd/

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


Re: Stupid shell tricks

2003-07-21 Thread D J Hawkey Jr
I got it!

> I'll cut right to it: I'm looking for a technique to do "atomic writes"
> in a shell (sh(1)) script, playing with the trap builtin. It goes something
> like this:
> 
>  1: #!/bin/sh
>  2:
>  3: trapper ()
>  4: {
>  5:rm -f $TMPFILE
>  6:exit
>  7: }
>  8:
>  9: trap trapper HUP PIPE INT QUIT SEGV
> 10:
> 11: ...
> 12:
> 13: while read LINE; do
> 14: trap "" HUP PIPE INT QUIT SEGV
> 15: binary_that_writes $LINE
> 16: ...
> 17: done <$TMPFILE
> 18:
> 19: trapper

I ditched line 14, and changed line 15 to:

sh -c "trap \"\" HUP PIPE INT QUIT SEGV; binary_that_writes $LINE"

The explanation of "-T" in the man page gave me the clue.

Movin' right along,
Dave

-- 
  __ __
  \__   \D. J. HAWKEY JR.   /   __/
 \/\ [EMAIL PROTECTED]/\/
  http://www.visi.com/~hawkeyd/

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


Stupid shell tricks

2003-07-21 Thread D J Hawkey Jr
Hello all.

I'll cut right to it: I'm looking for a technique to do "atomic writes"
in a shell (sh(1)) script, playing with the trap builtin. It goes something
like this:

 1: #!/bin/sh
 2:
 3: trapper ()
 4: {
 5:rm -f $TMPFILE
 6:exit
 7: }
 8:
 9: trap trapper HUP PIPE INT QUIT SEGV
10:
11: ...
12:
13: while read LINE; do
14: trap "" HUP PIPE INT QUIT SEGV
15: binary_that_writes $LINE
16: ...
17: done <$TMPFILE
18:
19: trapper

Line 9 sets up the general-case signal handler to have the script clean
up after itself. Line 11 is stuff where I want the signal handler to do
it's thing. Line 14 sets up the "atomic write" by ignoring the signals.
So far, so good. Line 16 is my problem; this is where I want something
so the script exits _without_ cleaning up when the signal that would
have been seen/caught at line 15 occurs.

The trap at line 14 is inside the loop 'cuz I figure line 16 will be
another trap statement, but I seem to be wrong about this. So far, if
the trap at line 14 is anything else, line 15 gets interrupted. Using
nohup(1) at line 15 (without the trap at line 14) doesn't trap enough
signals.

I've tried quite a few different signal things, but none have produced
what I'm after. Anyone been here and done that? Oh, yeah, it has to be
a portable solution, too.

Thanks,
Dave

-- 
  __             __
  \__   \D. J. HAWKEY JR.   /   __/
 \/\ [EMAIL PROTECTED]/\/
  http://www.visi.com/~hawkeyd/

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


Re: sed(1) regular expression gurus - SOLUTION

2003-07-15 Thread D J Hawkey Jr
First off, thanks to all of you who scratched their heads over this
puzzle. All had the right idea to some extent or another.

Based in part on the replies, and my own work, here's the final result:

FOLDER="$HOME/Mail/spam"

NAME_RE="[[:alnum:]_.-]+"
ADDY_RE="([0-9]{1,3}\.){3}[0-9]{1,3}"

cat $FOLDER \
  |grep -A 5 "^Received:" \
  |egrep "^(Received:|  )" \
  |sed -E \
-e "s/(^Received:|by|from)[[:space:]]+//g" \
-e "s/\([HELO]{4}[[:space:]]+($NAME_RE)\)/\1/" \
-e "s/\(($NAME_RE)[[:space:]]+\[($ADDY_RE)\]\)/\1 \2/g" \
-e "s/(\(\[?|\[)($ADDY_RE)(\]|\]?\))/\2/g" \
-e "s/[[:space:]]*(\(|id|via|with|E?SMTP|;).*//" \
-e "s/(\(envelope-|for|Sun|Mon|Tue|Wed|Thu|Fri|Sat).*//" \
-e "s/[][(){}<>]//g" \

Note that the whitespace in the second pipe is one tab character.

The first two pipes isolate the multi-line headers. The first sed
command strips "keywords" and any following whitespace. The second
sed command returns the name in a parenthetical HELO or EHLO. The
third sed command returns the name and address in a "(... [...]).
The fourth sed command - the one I inquired about - returns the
address in any of "(...)", "([...])", or "[...]". The fifth sed
command strips possible whitespace, "keywords" or an opening
parenthesis (now that it's of no consequence), and anything after
them. The sixth sed command strips more "keywords" and anything
after them (it might be merged into the fifth, what it strips is
often on another line). Finally, the last sed command strips any
errant delimiters; strictly speaking, it's redundant, but when I
ran a spam file (~12.3Mb) through this, some delimiters did leak
through.

Just thought those that replied to my plea might like to see this,
and perhaps somebody else will find it useful. No, I'm not telling
what it's for.  ;-,

Dave

-- 
  __ __
  \__   \D. J. HAWKEY JR.   /   __/
 \/\ [EMAIL PROTECTED]/\/
  http://www.visi.com/~hawkeyd/

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


Re: sed(1) regular expression gurus

2003-07-14 Thread D J Hawkey Jr
On Jul 14, at 11:04 AM, D J Hawkey Jr wrote:
> 
> On Jul 15, at 12:49 AM, Rob wrote:
> > 
> > awk --posix -F'[^0-9A-Za-z.]+' '
> >   $1 ~ /by/ { result = $2
> > for (i=3; i<=NF; i++) {
> >   if ($i ~ /^([0-9]+\.){3}[0-9]+$/) {
> > result = result " " $i
> >   }
> > }
> >   print result
> >   }'
> 
> This is better than anything I've dreamed up with sed or awk, and is
> really close, but it fails on this:
> 
>   by nospam.mc.mpls.visi.com (8.11.6/8.11.6.2) with ESMTP id 3A4E07B03

Another astute fellow offered this:

  sed -E \
-e "s/by[[:space:]]+//" \
-e "s/\(\[?(([0-9]{1,3}\.){3}[0-9]{1,3})\]?\)/\1/" \
-e "s/[[:space:]]*(\(|id|via|with|E?SMTP|;).*//"

The idea being to pull anything that looks like an IP address out of
parentheses first (2nd command), then junk any other parenthetical
stuff with the other cruft on the line (3rd command).

I did learn a new "syntax" from your script, nonetheless. Thanks,

Dave

-- 
  __ __
  \__   \D. J. HAWKEY JR.   /   __/
 \/\ [EMAIL PROTECTED]/\/
  http://www.visi.com/~hawkeyd/

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


Re: sed(1) regular expression gurus

2003-07-14 Thread D J Hawkey Jr
On Jul 15, at 12:49 AM, Rob wrote:
> 
> awk --posix -F'[^0-9A-Za-z.]+' '
>   $1 ~ /by/ { result = $2
> for (i=3; i<=NF; i++) {
>   if ($i ~ /^([0-9]+\.){3}[0-9]+$/) {
> result = result " " $i
>   }
> }
>   print result
>   }'
> 
> There may be 'neater' ways of doing it, but it's the most concise
> example I could come up with.

This is better than anything I've dreamed up with sed or awk, and is
really close, but it fails on this:

  by nospam.mc.mpls.visi.com (8.11.6/8.11.6.2) with ESMTP id 3A4E07B03

The parenthetical is a [hacked] sendmail version. I don't see how the
script fails, though, as you do test for a full/complete "dotted quad",
and even test for a BOL and EOL on either side it. The "8.11.6" shouldn't
match. I changed the '+'es to "{1,3}"s for even better precision in the
"if (...)", but it didn't make any difference (nor should it have).

BTW, why the "one or more" flag in the FS assignment?

> You need to include the --posix option to get the '{3}' notation to work
> (peculiar to GNU awk).

Kinda throws portability out the window, but I'll settle for it.

Dave

-- 
  __ __
  \__   \D. J. HAWKEY JR.   /   __/
 \/\ [EMAIL PROTECTED]/\/
  http://www.visi.com/~hawkeyd/

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


Attn: sed(1) regular expression gurus

2003-07-14 Thread D J Hawkey Jr
Hi all.

I'm getting really frustrated by a seemingly simple problem. I'm doing
this under FreeBSD 4.5.

Given these portions of an e-mail's multi-line Received header as tests:

  by some.host.at.a.com (Postfix) with ESMTP id 3A4E07B03
  by some.host.at.a.com (8.11.6) ESMTP;
  by some.host.at.a.different.com (8.11.6p2/8.11.6) ESMTP;
  by some.host.at.another.com ([123.4.56.789]) id 3A4E07B03
  by some.host.at.yet.another.com (123.4.56.789) id 3A4E07B03

I want to isolate the addresses (one for the 1st through 3rd, two for
the 4th and 5th). Here's the sed(1) command I'm playing with:

  echo "by nospam.mc.mpls.visi.com (Postfix) with ESMTP id 3A4E07B03" \
  |sed -E \
-e "s/by[[:space:]]+//" \
-e "s/(\((\[?([0-9]{1,3}\.){3}[0-9]{1,3}\]?){0}\)|id|with|E?SMTP).*//"

In all cases, the parenthetical word is returned, when only the last
two should return the parenthetical word. The idea behind the first
branch of the second sed(1) command is to match anything that isn't a
"digits.digits.digits.digits" pattern. I've tried simpler expressions
like "\(\[?[^0-9.]+\]?\)", but it fails on the third example.

What the devil am I doing wrong?? Am I exercizing known bugs in GNU's
sed(1)? Can anyone dream up a different solution - please, no Perl, but
awk(1) is fine.

Thanks,
Dave

-- 
  __________     __
  \__   \D. J. HAWKEY JR.   /   __/
 \/\ [EMAIL PROTECTED]/\/
  http://www.visi.com/~hawkeyd/

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


Re: About Patches

2003-06-23 Thread D J Hawkey Jr
In article <[EMAIL PROTECTED]>,
[EMAIL PROTECTED] writes:
> Hi List,
> 
> I need to apply some security patches to my FreeBSD(i386) 4.7-RELEASE 
> box and I am concerned about the possibility that I could actually harm 
> my system while trying to apply this patches. (I am not a Unix guru 
> actually)

Is there any particular reason you don't want to use cvsup(1) against
the "security" or "current" branches? Release 4.7 is still supported by
the Security Team, after all. See the Handbook if you don't know what
this means.

> 1) Do I have to apply the security patches in a specific order?

Sometimes, yes, sometimes, no. It will depend on whether any one source
module has been updated (or not, more to the point) before.

> 2) Is there a chance were a patch requires a previous one? (In my case 
> some patches are not applicable)

Yup; see above, especially where the kernel is concerned. Even if a patch
is for source a module that has never been patched before, it might depend
on function asdf() in another source module being "proper" from it's (the
patch's) own point-of-view.

> 3) What if the code is not in the state that the patch requires? (For 
> instance if I have updated that port)

Um, this is a tricky question. The answer could go either way. The nasty
situation is when a source module isn't current enough for the patch to
apply, but it should have the patch's functionality.

> 4) Are the patches clever enough to protect me from harming my system?

Yes. If you use the patch(1) utility judiciously (correctly?), it can/will
rename the existing file(s) being patched to *.bak.

The script(1) utility is a Good Thing(tm) if you're patching things in an
ad hoc manner; it'll let you "go back" further than the scroll-back of a
console or xterm to see what was actually done.

> 5) Is there a safe way to undo a patch?

Yup; see above. The patch(1) utility also understands "reverse patches",
though I've not used that functionality.

Note: I'm not a developer or committer. I'm just another hack who has some
experience doing this sort of thing. I have a web page for patching EOL'd
kernels against more recent security alerts [and other stuff]. It has a
section that you might find helpful:

http://www.visi.com/~hawkeyd/freebsd-backports.html

You should become familiar with reading a patch file before trying to
patch things in an ad hoc fashion, both the contextual and unified diff
formats. I can almost guarantee that you'll have to dissect something,
somewhere, sometime. Please [re-]evaluate my opening question before
proceeding.

Please CC me when replying to the list; I'm not subscribed. HTH,
Dave

-- 

A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet?

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


Re: Updating FBSD on one slice from another slice

2003-06-23 Thread D J Hawkey Jr
On Jun 23, at 04:29 PM, Matthew Seaman wrote:
> 
> On Mon, Jun 23, 2003 at 08:43:07AM -0500, D J Hawkey Jr wrote:
> > 
> > What I'm stumped with is how to tell 'make [build|install][world|kernel]'
> > to do their thing from the OS in the slice I'm running (the newer), but
> > do the reads and writes on the other, older slice. Same conundrum with
> > 'mergemaster'; how do I tell it to do it's thing on that older slice?
> 
> You'll have to copy /mnt/s2/etc/make.conf temporarily in place of
> /etc/make.conf, if there's any significant difference between the two
> systems.  Then you can just do:
> 
> # cd /mnt/s2/usr/src
> # make installkernel installworld KERNCONF=FOO DESTDIR=/mnt/s2
> # mergemaster -m /mnt/s2/usr/src -D /mnt/s2

All righty, then! You just gotta love these developers.

Many thanks, Matthew.
Dave

-- 
  ______ __
  \__   \D. J. HAWKEY JR.   /   __/
 \/\ [EMAIL PROTECTED]/\/
  http://www.visi.com/~hawkeyd/

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


Updating FBSD on one slice from another slice

2003-06-23 Thread D J Hawkey Jr
Hello all.

I've got two similarly-sized, bootable, FBSD slices on a machine, one with
4.5 and the other with 4.2. My intention was/is to run the newer of the
two, and upgrade the older by 'cvsup' and 'make [build|install][world|kernel]'
_from_ the newer.

So, I'm running the newer installation now, and I want to upgrade the older
installation to 4.8. Doing the 'cvsup' seems straight-forward enough; just
change the "base" and "prefix" defines in my supfile from "/usr" to
"/mnt/s2/usr" (the mountpoint of the older /usr partition), bump the value
of the "tag" define to "RELENG_4_8", and run 'cvsup' as usual. Anything
deleted or downloaded will occur in the mounted path of the other, older
slice, right?

What I'm stumped with is how to tell 'make [build|install][world|kernel]'
to do their thing from the OS in the slice I'm running (the newer), but
do the reads and writes on the other, older slice. Same conundrum with
'mergemaster'; how do I tell it to do it's thing on that older slice?
A mountpoint on the newer slice I'm running, "/mnt/s2", is the older
slice's "/", so the entire other, older slice is visible.

Please CC me on replies to the list, as I'm not subscribed to it. TIA,
Dave

-- 
  __ __
  \__   \D. J. HAWKEY JR.   /   __/
 \/\ [EMAIL PROTECTED]/\/
  http://www.visi.com/~hawkeyd/

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


Re: File manager with thumbnail preview

2003-06-07 Thread D J Hawkey Jr
In article <[EMAIL PROTECTED]>,
[EMAIL PROTECTED] writes:
> Hi All, Can anyone recommend a file manager than can thumbnail preview JPG
> images?

xv.

It's not a file manager per se, but it has nice graphical browser that
thumbnails all kinds of images.

> Cheers
> Rus

Dave

-- 

A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet?

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


New sendmail-8.11.7 and RELENG_4_5

2003-03-31 Thread D J Hawkey Jr
Hi all.

Can the source tree of sendmail-8.11.7 (released in the last 24 hours) be
dropped into /usr/src/contrib of a RELENG_4_5 box and a 'make buildworld'
Just Work(tm)?

I'm not subscribed; please Cc: me on replies. TIA,
Dave

-- 
  __ __
  \__________   \    D. J. HAWKEY JR.   /   __/
 \/\ [EMAIL PROTECTED]/\/
  http://www.visi.com/~hawkeyd/

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


Re: FreeBSD for Mom

2003-03-12 Thread D J Hawkey Jr
On Mar 12, at 12:57 PM, Dan Langille wrote:
> 
> My mom uses FreeBSD.  More precisely, she uses Pine to send/receive 
> email.  At present, she has a DSL connection.  She's soon to change 
> to a dial up account.
> 
> What I'm planning to do is provide her with a shell script which will 
> send/receive email for her.  She'll run it to check for mail and when 
> she's done composing her outgoing mail.
> 
> My initial untested idea is: 
> 
> - ppp --dial HerISP,
> - wait for the connection to come up

I can get you this far.

> - kill the connection

This one, too. See the attached script.

Note that I had to hack some files in /etc/ppp to get things to work right
(auto-dialup when anything WAN-related happens). If you want these too,
I can supply them, but I have to wonder if the list is the right forum?

I used kernel-mode PPP, BTW.

> Cheers
> -- 
> Dan Langille : http://www.langille.org/

Dave

-- 

Windows: "Where do you want to go today?"
Linux: "Where do you want to go tomorrow?"
FreeBSD: "Are you guys coming, or what?"
#!/bin/sh
#
# EZ interface to pppctl. Supports connecting, disconnecting, setting the
# timeout value, showing the bundle, and testing the line (the last returns
# 0 if line up, the others return undefined).

# for cron
PATH=$PATH:/usr/sbin
# defined in /etc/ppp/ppp.conf
COMMCHNL=/var/run/ppp

TIMEOUT=180
NOISY=-v

test_up ()
{
pppctl -v $COMMCHNL quit 2>/dev/null |grep ^PPP >/dev/null
return $?
}

syntax ()
{
echo "usage: "${0##*/}" -c|-d|-s|-v [-t timeout] [-q]"
echo "   -c, -d, and -t always set a timeout (default="$TIMEOUT")"
exit
}

if [ $# -eq 0 ]; then
syntax
fi

while getopts "cdqst:v" OPT; do
case $OPT in
c) FLAG=c;;
d) FLAG=d;;
q) NOISY=;;
s) FLAG=s;;
t) TIME=$OPTARG;;
v) FLAG=v;;
*) syntax;;
esac
done

if [ "$TIME" -o "$FLAG" -a "$FLAG" != "v" -a "$FLAG" != "s" ]; then
if [ "$TIME" ]; then
TIMEOUT=$TIME
fi
pppctl $NOISY $COMMCHNL set timeout $TIMEOUT
fi

case $FLAG in
c) test_up;
   if [ $? -eq 0 ]; then
if [ "$NOISY" ]; then
echo "Line is up"
fi
exit
   fi;
   exec pppctl $NOISY $COMMCHNL dial;;
d) exec pppctl $NOISY $COMMCHNL close;;
s) exec pppctl $NOISY $COMMCHNL show bundle;;
v) test_up;
   RETVAL=$?;
   if [ "$NOISY" ]; then
if [ $RETVAL -eq 0 ]; then
echo "Line is up"
else
echo "Line is down"
fi
   fi;
   exit $RETVAL;;
esac


SA-03:02 (OpenSSL) patches for RELENG_4_6_2: OK for RELENG_4_5?

2003-03-12 Thread D J Hawkey Jr
Hi All.

I posted this to hackers@, but it received no attention (rightfully so,
I suppose). I should have tried here first.

Are there any sharpies that can verify whether OpenSSL under RELENG_4_5
is the same as RELENG_4_6_2?

I have a RELENG_4_5 box that needs the OpenSSL update, and it appears
that only the FreeBSD CVS version numbers keep some half-dozen of the
patches from applying cleanly.

Checking out some files in the RELENG_4_6_2 CVS tree, it looks to me as
though 4.6.2 was released with the same version of OpenSSL as 4.5 was.
Am I correct? And therefore, the RELENG_4_6_2 patches are appropriate for
RELENG_4_5? After applying said patches, does that make my RELENG_4_5
OpenSSL the same as RELENG_4_6_2?

Thanks,
Dave

-- 
  __ __
  \__   \D. J. HAWKEY JR.   /   __/
 \/\ [EMAIL PROTECTED]/\/
  http://www.visi.com/~hawkeyd/

To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-questions" in the body of the message


Re: Ethernet card problem

2002-12-09 Thread D J Hawkey Jr
On Dec 09, at 08:47 PM, Thomas Connolly wrote:
> 
> In another thread, Thomas wrote:
> >  My NIC is a pci card.  Do I still have to mess with my BIOS?

My bad. I thought you wrote it was an ISA card, but that was Kevin,
making an observation: "OK, he's got a Kingston (generally dc driver)
and is trying to do sysinstall and d-load over NIC. IME it doesn't
matter what you pick in the "configuration" section of sysinstall
whatever's first should work, because those are just old nonPNP ISA
NIC drivers."

I inferred that the NIC was ISA, where Kevin wrote that the driver
is ISA.

You might have to, yes. See below.

> Copyright (c) 1992-2002 The FreeBSD Project.
> Copyright (c) 1979, 1980, 1983, 1986, 1988, 1989, 1991, 1992, 1993, 1994
>   The Regents of the University of California. All rights reserved.
> FreeBSD 4.7-RELEASE #0: Wed Oct  9 15:08:34 GMT 2002
> [EMAIL PROTECTED]:/usr/obj/usr/src/sys/GENERIC
> Timecounter "i8254"  frequency 1193182 Hz
> CPU: Pentium II/Pentium II Xeon/Celeron (347.67-MHz 686-class CPU)
>   Origin = "GenuineIntel"  Id = 0x651  Stepping = 1
>   
>Features=0x183f9ff
> real memory  = 134217728 (131072K bytes)
> config> di sn0
> config> di lnc0
> config> di ie0
> config> di fe0
> config> di cs0
> config> di bt0
> config> di aic0
> config> di aha0
> config> di adv0
> config> q

OK, you disabled things with conflicting IRQs and other not-needed-here
stuff. Good.

> avail memory = 125435904 (122496K bytes)
> Preloaded elf kernel "kernel" at 0xc050f000.
> Preloaded userconfig_script "/boot/kernel.conf" at 0xc050f09c.
> Pentium Pro MTRR support enabled
> md0: Malloc disk
> Using $PIR table, 8 entries at 0xc00fdf40
> npx0:  on motherboard
> npx0: INT 16 interface
> pcib0:  on motherboard
> pci0:  on pcib0
> pcib1:  at device 1.0 on pci0
> pci1:  on pcib1
> pci1:  at 0.0 irq 9
> isab0:  at device 4.0 on pci0
> isa0:  on isab0
> atapci0:  port 0xfcf0-0xfcff at device 4.1 on pci0
> ata0: at 0x1f0 irq 14 on atapci0
> ata1: at 0x170 irq 15 on atapci0
> uhci0:  at device 4.2 on pci0
> uhci0: Could not map ports
> device_probe_and_attach: uhci0 attach returned 6
> chip1:  port 0x2180-0x218f at device 4.3 
>on pci0

I'm not sure what this should be, but I've seem "chip1" entries occur
when there's hardware that the kernel isn't prepped for. ICH chipsets come
to mind, for instance.

This shouldn't be "fatal", and probably isn't related to your NIC.

> dc0:  at device 13.0 on pci0
> dc0: couldn't map ports/memory
> device_probe_and_attach: dc0 attach returned 6

There's your dc(4) driver trying to initialize. I don't know what the
"6" return value specifically is, but it can't set up its I/O. This
leads me to believe that yes, you may have to twiddle ISA/PnP settings
in your BIOS.

In BIOS, you should be able to zero in on the PCI bus stuff easily enough.
Within that, several slot options. I can't tell you specifically what to
look for or change though; different BIOSes use different words and phrases
to describe the same things. A shot in the dark: Disable Plug-n-Play.

Best I can offer. G'Luck, and don't give up yet.
Dave

-- 
  __ __
  \__   \D. J. HAWKEY JR.   /   __/
 \/\ [EMAIL PROTECTED]/\/
  http://www.visi.com/~hawkeyd/


To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-questions" in the body of the message



Re: Ethernet card problem

2002-12-09 Thread D J Hawkey Jr
On Dec 09, at 03:28 PM, Thomas Connolly wrote:
> 
> 
> This is exactly my situation, any ideas??
> "If his NIC is *not* there when it's time to configure and start
> the d-load, it's a hardware/BIOS issue, or somebody's broke
> sysinstall(8).or is there another option I'm missing?"

OK, it looks like it shakes out like this:

  - sysinstall(8) is miibus enabled, meaning dc(4) is available.
  - sysinstall(8) should have probed, and found that, dc(4) is
appropriate for your hardware.
  - Because dc(4) wasn't listed in sysinstall(8), and your NIC is
an ISA card, you may have to twiddle your BIOS to enable
"legacy" ISA support, then try it again.
  - No one has confirmed that drivers may be specified within
sysinstall(8) when the probe says otherwise. I don't know
either way, not ever having to try.

I'd try the BIOS twiddling (not too much at a time, you may have to
revert it to existing values), then try sysinstall(8) again. If that
still yields nothing, try here again. I'll be out of my element at
that point, though; I don't know if proceeding anyway, and editing
/etc/rc.conf afterward would get you anywhere, but it could be worth
the try.

Dave

-- 
  ______     __
  \__   \D. J. HAWKEY JR.   /   __/
 \/\ [EMAIL PROTECTED]/\/
  http://www.visi.com/~hawkeyd/

> Tom
> 
> -Original Message-
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED]] On Behalf Of Kevin D. Kinsey,
> DaleCo, S.P.
> Sent: Monday, December 09, 2002 3:05 PM
> To: [EMAIL PROTECTED]; Jack L. Stone
> Cc: [EMAIL PROTECTED]
> Subject: Re: Ethernet card problem
> 
> OK, he's got a Kingston (generally dc driver) and is trying
> to do sysinstall and d-load over NIC.
> 
> IME it doesn't matter what you pick in the "configuration"
> section of sysinstall --- whatever's first should work, because
> those are just old nonPNP ISA NIC drivers.
> 
> After doing "kernel configuration in full-screen visual/CLI/skip"
> then sysinstall does an initial device probe, and when you get
> to "configure interface," it should be there.
> 
> For the record, device miibus is enabled in -GENERIC kernel.
> 
> If his NIC is *not* there when it's time to configure and start
> the d-load, it's a hardware/BIOS issue, or somebody's broke
> sysinstall(8).or is there another option I'm missing?
> 
> Kevin Kinsey
> 
> 
> To Unsubscribe: send mail to [EMAIL PROTECTED]
> with "unsubscribe freebsd-questions" in the body of the message
> 
> 

To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-questions" in the body of the message



Re: Ethernet card problem

2002-12-09 Thread D J Hawkey Jr
On Dec 09, at 03:51 PM, Jack L. Stone wrote:
> 
> At 02:19 PM 12.9.2002 -0700, Thomas Connolly wrote:
> >Thanks for the advice but again, I am very new to all this.  Can you tell me
> >how to check if miibus is enabled and how to enable it if it is not?
> >
> >Thanks in advance,
> >Tom Connolly
> 
> Just edit your kernel config file with this line and recompile:
> device  miibus  # MII bus support

Again, this can only occur _after_ the initial sysinstall(8), right?

> Best regards,
> Jack L. Stone,

Dave

-- 
  __ ______________
  \__   \D. J. HAWKEY JR.   /   __/
 \/\ [EMAIL PROTECTED]/\/
  http://www.visi.com/~hawkeyd/


To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-questions" in the body of the message



Re: Ethernet card problem

2002-12-09 Thread D J Hawkey Jr
On Dec 09, at 03:07 PM, Kevin D. Kinsey, DaleCo, S.P. wrote:
> 
> dc driver uses the miibus code, make sure you have that enabled
> on your kernel.
> 
> There is nothing needed in "sysinstall", a device probe ought to
> catch it IF the miibus is enabled in your kernel config.

Um, he can't "enable" miibus in the kernel from sysinstall(8), can he?
I don't know that miibus is in the distribution kernel or not, if
/modules/miibus.ko is likewise available, nor if you can activate
modules from sysinstall(8).

I don't recall any difficulties with sysinstall(8) when I brought
up this box with Linksys NICs (Realtek chipsets, which also use dc(1)).

Otherwise, you point out that which I'd forgotten. Thanks.

> Sorry, I'm late on this discussion, if I've missed important
> points, please forgiveI just hadn't seen this point
> mentioned.

"Forgive"? Nonsense. You made the effort, that's what counts.

> Kevin Kinsey
> DaleCo, S.P.

Dave

-- 
  __________ __
  \__   \D. J. HAWKEY JR.   /   __/
 \/\ [EMAIL PROTECTED]/\/
  http://www.visi.com/~hawkeyd/


To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-questions" in the body of the message



jailed ftpd behind NAT'ing firewall: ftphosts?

2002-12-09 Thread D J Hawkey Jr
Hi all.

I want to set up a jailed FTP server on a box inside a private LAN,
accessable to the outside. It all looks straight-forward enough, using
a column on DaemonNews (http://ezine.daemonnews.org/200212/ftpjail.html)
as a guildline, except that I want to use FreeBSD's ftpd(8).

Reading the ftpd(8) man page, it seems I need to employ /etc/ftphosts,
but try as I might, I can't find an example of /etc/ftphosts.

The private network is 192.168.16.0/24. The public IP to my LAN is,
say, 208.42.236.15. Do I need /etc/ftphosts to reflect the public IP,
or does jail(8) handle this for me, or what?

Even if I don't need /etc/ftphosts, could someone post an example? I
find the man page sufficiently vague as to the actual contents, the
user field in particular. It seems to me this is something I should
just know.

Thanks,
Dave

-- 
  __ __
  \__________   \    D. J. HAWKEY JR.   /   __/
 \/\ [EMAIL PROTECTED]/\/
  http://www.visi.com/~hawkeyd/


To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-questions" in the body of the message



Re: tool/method to convert DOS line endings to UNIX line endings

2002-12-04 Thread D J Hawkey Jr
On Dec 04, at 10:20 AM, Jerry McAllister wrote:
> 
> > This'll work though:
> > sed -e 's/[[:cntrl:]]$//g'
> > 
> > > > I like the tr(1) conversion too, but I always seem to think in terms of
> > > > sed(1) and awk(1).
> > 
> > And if that sed(1) solution is still "too loose", the tr(1) solution reduces
> > "[[:cntrl:]]" to just the CR character.
> 
> Just to be clear on this issue;  you want to be left with the LF characters
> and get rid of the CR characters not the other way around.  I am not a sed
> person, but your statement is backwards even if your sed works.

No, I meant what I wrote, though you gave me pause to double-check. The
"[[:cntrl:]]" and reference to the CR character ("\r" = carriage-return)
are what's being stripped. I pro'lly should have finished the sentence
with "... for stripping." or somesuch.

> jerry

Dave

-- 
  __ __
  \__   \D. J. HAWKEY JR.   /   __/
 \/\ [EMAIL PROTECTED]/\/
  http://www.visi.com/~hawkeyd/


To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-questions" in the body of the message



Re: tool/method to convert DOS line endings to UNIX line endings

2002-12-04 Thread D J Hawkey Jr
On Dec 04, at 06:05 AM, Warren Block wrote:
> 
> On Tue, 3 Dec 2002, D J Hawkey Jr wrote:
> 
> > In article <[EMAIL PROTECTED]>,
> > [EMAIL PROTECTED] writes:
> > > It's a bit easier if you let Perl do the heavy lifting:
> > > 
> > > perl -pi -e 's/\r//g' file-to-convert
> > 
> > Even easier (and "lighter") if you ditch the perl:
> >sed -e 's/\r//g' input >output
> 
> Unfortunately, that doesn't work because BSD sed doesn't understand \r
> (it should, IMO, but it doesn't).  It can work if you put an actual CR
> in there...

Ack. Looks like you're right, and I agree with you. If "[2addr]l" can output
'\r', "[2addr]s/regex/repl/flags" ought to understand "\r". I have to wonder
how many times I may have been bitten by this mis-feature.  ;-,

This'll work though:
sed -e 's/[[:cntrl:]]$//g'

> > I like the tr(1) conversion too, but I always seem to think in terms of
> > sed(1) and awk(1).

And if that sed(1) solution is still "too loose", the tr(1) solution reduces
"[[:cntrl:]]" to just the CR character.

> I've been making an effort to use Perl for this type of thing, because
> it usually saves me time.  When a shell script turns out later to need
> strong string processing or any of the other stuff that Perl is good at
> but is non-trivial in a shell script, I don't need to rewrite it if it's
> already in Perl.  And many scripts that are trivial in Perl (like the
> one above) can be non-trivial for csh or sh.

Agreed, in principle, but with caveats. Perl isn't available in single-user
mode without mounting /usr (or /usr/local on other OSes), and IIRC, perl
won't be in the base for FreeBSD 5.0 (something about "miniperl"?). Outside
of FreeBSD, perl may not be available at all. I try to use the tools of a
base installation of any OS for these "quick-n-dirty" things, if just to
know that I can.

And I guess there's enough frugalness(?) in me to opt for the lighter weight
tool when it's all that's needed. Nice to have so many options, though!

> -Warren Block * Rapid City, South Dakota USA

See Ya,
Dave

-- 
  __ __
  \__   \D. J. HAWKEY JR.   /   __/
 \/\ [EMAIL PROTECTED]/\/
  http://www.visi.com/~hawkeyd/


To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-questions" in the body of the message



Re: tool/method to convert DOS line endings to UNIX line endings

2002-12-03 Thread D J Hawkey Jr
[Posted and mailed]

In article <[EMAIL PROTECTED]>,
[EMAIL PROTECTED] writes:
> On Tue, 3 Dec 2002, Lee J Carmichael wrote:
> 
>> If you are going from DOS to Unix you could use the following perl script:
> 
> [script snipped] 
> 
> It's a bit easier if you let Perl do the heavy lifting:
> 
> perl -pi -e 's/\r//g' file-to-convert

Even easier (and "lighter") if you ditch the perl:
   sed -e 's/\r//g' input >output

I like the tr(1) conversion too, but I always seem to think in terms of
sed(1) and awk(1).

> -Warren Block * Rapid City, South Dakota USA

:-)
Dave

-- 

Windows: "Where do you want to go today?"
Linux: "Where do you want to go tomorrow?"
FreeBSD: "Are you guys coming, or what?"


To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-questions" in the body of the message



XF86-4.2.0, libfreetype.so.8, and TrueType fonts

2002-12-01 Thread D J Hawkey Jr
Hi all.

Attached is a mail I sent to the author of "XFree86 Font De-uglification"
(http://ldp.kernelnotes.de/HOWTO/mini/FDU/index.html), but have yet to
receive a reply.

A pertinent-to-this-group comment: I built Mozilla 1.1 from the ports,
but the XFree86 package is from XFree86's own binary distribution for
FreeBSD. I therefore hacked mozilla's port Makefile to use the XFree86-
supplied libfreetype.so.8 instead of installing libfreetype.so.9; I don't
want to "clutter" /usr/local with stuff that 1) seems un-necessary and
2) should be in /usr/X11R6 anyway  ;-,

Can anyone here help in lieu of the webpage author's absence?

Thanks,
Dave

-- 
  __ ______
  \__   \D. J. HAWKEY JR.   /   __/
 \/\ [EMAIL PROTECTED]/\/
  http://www.visi.com/~hawkeyd/


>From [EMAIL PROTECTED] Tue Nov 26 17:29:56 2002
Date: Tue, 26 Nov 2002 17:29:56 -0600
From: D J Hawkey Jr <[EMAIL PROTECTED]>
To: [EMAIL PROTECTED]
Subject: Your XF86 De-uglification Howto

--HcAYCG3uE/tztfnV
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

Hi. Hope you don't mind this intrusion.

First off, nice set of pages. I found them straight-forward, and up-to-
date. Even the external hyperlinks aren't stale!

However, I have run into an obstacle that's driving me nuts. Everything
goes well until section 5.2, Xft and Mozilla. However, when I go into
Moz's "Edit -> Preferences -> Appearance -> Fonts", and try to select
TTF fonts, I don't get any that begin with an uppercase letter. They
all are of a foundry-face-iso-digit style listing (like an abbreviated
XFLD), and they are all lowercase.

It doesn't matter what font I select, the same thing always occurs:
Un-antialiased rendition until the fonts get _really_ big, and then only
some fonts, at that. This is Mozilla 1.1, BTW.

A few particulars: I'm running FreeBSD 4.5-REL-p23 and Xfree86 4.2, as
supplied by the XFree86 project (that is, a binary package for FreeBSD
built by by them). /usr/X11R6/include/freetype2/freetype/config/ftoption.h
as supplied by the project has TT_CONFIG_OPTION_BYTECODE_INTERPRETER
defined, and /usr/X11R6/lib has libfreetype.so.8 in it. I'm running a
1024x768, 75-dpi, display on a 15-inch CRT (I do hate how 100-dpi fonts
look, TTF or otherwise). All the requisites of the X server are present
(RENDER, etc.). I've run 'ttmkfdir' in the font directories, and used
that Perl script (which needed a few small changes to run) to create
font.alias files, just in case Moz needs that.

I attach my /etc/X11/XftConfig and $HOME/.mozilla/default/.../user.js
files; can you tell me where I've gone wrong? I can supply more info as
you think you need, of course. Note that much of the TTF stuff in user.js
is commented, but they make no difference when enabled either.

Thanks,
Dave

-- 
  __ __
  \__   \D. J. HAWKEY JR.   /   __/
 \/\ [EMAIL PROTECTED]/\/
  http://www.visi.com/~hawkeyd/

--HcAYCG3uE/tztfnV
Content-Type: text/plain; charset=us-ascii
Content-Description: XftConfig
Content-Disposition: attachment; filename=XftConfig

#
# XftConfig
#
# Use with Type1 and TrueType fonts
#

dir "/usr/X11R6/lib/X11/fonts/Type1"
dir "/usr/X11R6/lib/X11/fonts/TTF"
dir "/usr/X11R6/lib/X11/fonts/truetype"

#
# alias 'fixed' for 'mono'
#
match any family == "fixed" edit family =+ "mono";

#
# Check users config file
#
includeif   "~/.xftconfig"

#
# Substitute TrueType fonts for Type1 versions
#
match any family == "Times" edit family += "Times New Roman";
match any family == "Helvetica" edit family += "Verdana";
match any family == "Courier"   edit family += "Courier New";

#
# Use Luxi fonts for defaults
#
match any family == "serif" edit family += "Luxi Serif";
match any family == "sans"  edit family += "Luxi Sans";
match any family == "mono"  edit family += "Luxi Mono";

#
# Alias between XLFD families and font file family name, prefer local fonts
#
match any family == "Charter"   edit family += "Bitstream Charter";
match any family == "Bitstream Charter" edit family =+ "Charter";
match any family == "Lucidux Serif" edit family += "LuciduxSerif";
match any family == "LuciduxSerif"  edit family =+ "Lucidux Serif";
match any family == "Lucidux Sans"  edi

Looking for opinions: popd vs. popper vs. et.al.

2002-11-11 Thread D J Hawkey Jr
Anyone fooled around with the various POP daemons in the ports?
I'm looking for the one that:
  - is "native" to the BSDs
  - supports SSL, and plays well with fetchmail and MS clients
  - has the smallest footprint and consumes the least resources
  - is suitable for a small, private LAN, but may occasionally
be hit from "the outside"
  - is straight-forward enough in configuration
  - doesn't have a lot of dependancies

I'm leaning toward popd, but that's just based on the pkg-descr.

Thanks,
Dave

-- 
  __ ______
  \__   \D. J. HAWKEY JR.   /   __/
 \/\ [EMAIL PROTECTED]/\/
  http://www.visi.com/~hawkeyd/


To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-questions" in the body of the message



Re: Window/File Manager

2002-11-04 Thread D J Hawkey Jr
In article <[EMAIL PROTECTED]>,
[EMAIL PROTECTED] writes:
> 
>> What are your favorite ultra-light WM's and/or FMs?
>> I'm just looking for
>> something that does the job, looking nice would be
>> an added benefit but
>> I doubt I'll have a high color depth to play with
>> anyway.
> 
> You can't go wrong with Blackbox (or fluxbox, which is
> very similar). It can look as detailed or as simple as
> you want. I use it on my low spec laptop and
> workstations. If you want a nice looking theme, I
> suggest 'AlmostX', but you might want to get rid of
> some of the gradients in it, as rendering them chew
> unnecessary CPU power. It's been quite usable on my
> p120 thinkpad.

With a fairly "rich" configuration, how small is fluxbox's footprint?
I just had a peek at fluxbox's source, and I see that gradient shading is
done with X pixmaps. If they're cached (by color and/or size?), this is
rather memory hungry, no?

I run vtwm with a rather "rich" setup on FreeBSD 4.5-REL-p22, XF86 4.2.0,
TrueColor visual, and top shows the following:
PID USERNAME PRI NICE  SIZERES STATETIME   WCPUCPU COMMAND
  49880 hawkeyd2   0  3092K  2496K select   0:16  0.00%  0.00% vtwm
It does cache pixmaps by size and color, but for the most part they're
small - titlebar buttons. I use sound effects, too, which are cached by
the rplay daemon:
PID USERNAME PRI NICE  SIZERES STATETIME   WCPUCPU COMMAND
174 root   2   0  2000K  1460K select   4:15  0.00%  0.00% rplayd
So, vtwm's total footprint is about 5.1Mb, about 3.9Mb being resident.
How does that fair against fluxbox or blackbox?

As X pixmaps are server-cached, how can one [easily] tell how much memory
is used for them?

> As far as file managers go, I would suggest perhaps
> XFtree from XFce. I've not used every file manager,
> but I have used this in the past, its been good and
> has a small footprint. You can assign file
> associations too.
> 
> I've used these both in the past, in a sort of hybrid
> blackbox-xfce manner, and it served me well.

Midnight Commander in an xterm.  :-)

Dave

-- 

Windows: "Where do you want to go today?"
Linux: "Where do you want to go tomorrow?"
FreeBSD: "Are you guys coming, or what?"


To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-questions" in the body of the message



OT: regex(3) and POSIX collating sequences

2002-10-22 Thread D J Hawkey Jr
Hi.

This is rather off-topic, but as the trouble I'm having is on a FreeBSD
box, I'm hoping you'll excuse me.

What's up with collating sequences and the regcomp(3) function? From the
re_format(7) man page:

 Within a bracket expression, a collating element (a character, a multi-
 character sequence that collates as if it were a single character, or a
 collating-sequence name for either) enclosed in `[.' and `.]' stands for
 the sequence of characters of that collating element.  The sequence is a
 single element of the bracket expression's list.  A bracket expression
 containing a multi-character collating element can thus match more than
 one character, e.g. if the collating sequence includes a `ch' collating
 element, then the RE `[[.ch.]]*c' matches the first five characters of
 `chchcc'.

But darned if I can get it to work:

$ echo "ZXCV asdf qwer" |sed -e "s/[^[.ZXCV.][.1234.]]/zxcv/"
sed: 1: "s/[^[.ZXCV.][.1234.]]/zxcv/
": RE error: invalid collating element

Foolishness, yes, but it illustrates my problem nicely. I've got a program
that uses REs, and it reports this error when I try to use a "[[.phrase.]]"
bracket syntax. Relevant code example:

#include 
#include 

#define REGCOMP_FLAGS(REG_EXTENDED | REG_NOSUB)

regex_t re;
int result;
char *phrase = "[^[.ZXCV.][.1234.]]";
char buffer[256];

if ((result = regcomp(&re, phrase, REGCOMP_FLAGS)) != 0)
{
regerror(result, &re, buffer, sizeof(buffer));
regfree(&re);

fprintf(stderr, "regcomp(\"%s\") error: %s\n", phrase, buffer);
}

This works for everything I've thrown at it except for a "[[.whatever.]]"
bracket expression. regcomp(3) refuses to compile it. The REG_NOSUB is
intentional; I only need to know that a match occurs with regexec(3).

What the devil have I missed? Or, what is an acceptable RE that matches
"anything except "ZXCV" or "1234""?

Please CC: me, I'm not subscribed. Thanks,
Dave

-- 
  __ __
  \__   \D. J. HAWKEY JR.   /   __/
 \/\ [EMAIL PROTECTED]/\/
  http://www.visi.com/~hawkeyd/


To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-questions" in the body of the message



Re: xv not working right?

2002-07-22 Thread D J Hawkey Jr

In article <[EMAIL PROTECTED]>,
[EMAIL PROTECTED] writes:
> Hey all, I'm trying to use xv to get a background pic
> on my laptop and it's not quite working as expected.
> 
> I'm running 4.6 release (everything else works great)
> with xv-3.10a_2.  My desktop is windowmaker.  The
> command I put in my user's .xinitrc is this:
> 
> xv -quit -root /usr/home/twigles/pic.jpg
> 
> and now when I start X the picture flashes for about a
> second then bails.  I suppose I could run xv in the
> background but that seems like a clumsy way to get a
> simple backdrop.

One thing I learned is that 'xv' can't write to TrueColor root windows.
Might this be your problem?

I built the xloadimage port (/usr/ports/x11/xloadimage) and use 'setbg'
for root window decorating. Significantly smaller program, and it works
on TrueColor displays.

HTH,
Dave

-- 

Windows: "Where do you want to go today?"
Linux: "Where do you want to go tomorrow?"
FreeBSD: "Are you guys coming, or what?"


To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-questions" in the body of the message



OT: FreeBSD's periodic(8) vs. OpenBSD's

2002-07-11 Thread D J Hawkey Jr

Hi all. Sorry for the off-topic post, but I'm wagering I'll get a
_courteous_ answer here.  ;-,

I'm working up a little subsystem under FreeBSD, and it's activity is
reported by periodic(8). After browsing OpenBSD's CVS, I see nothing
as robust as FreeBSD's.

So, for this subsystem to work similarly under OpenBSD, the script I
would put in /usr/local/etc/periodic/daily under FreeBSD would actually
have to be integrated into OpenBSD's /etc/daily script? Or would it be
[integrated into an existing] OpenBSD's /etc/daily.local?

For that matter, would NetBSD's equivalent to FreeBSD's periodic(8) be
yet another variation on the theme? I hadn't looked (my bad).

Thanks,
Dave

-- 
  __     __________
  \__   \D. J. HAWKEY JR.   /   __/
 \/\ [EMAIL PROTECTED]/\/
  http://www.visi.com/~hawkeyd/


To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-questions" in the body of the message