Help on bash script?

2005-08-11 Thread Xu Qiang
Hi, all: 

I don't know if this is the right list to ask this question. But since I didn't 
find a bash script mail list and you guys are always so helpful, then...

Here are an excerpt of a bash script: 

---

#!/bin/bash
# saveLogs.sh - Bourne Again Shell script
...
#
# FindAndSaveCoreFiles()
#   Search the entire filesystem for corefiles, saving each in
#   $SAVE_DIR. On Linux, we only need to search in ESS_LOG_DIR.
#
CollectCoreFiles()
{
local NEWNAME=
local NCOREFILES=0

local OS=`uname`
if [ $OS == Linux ]; then
...
else
#
# find each corefile, record in $CORELOG, and move to a uniquely
# named file in $SAVE_DIR
#
# Look for files named core (Lynx default)
#
find / -type f -name core -print | while read COREFILE ; do
NCOREFILES=$[ $NCOREFILES + 1 ] # a bit strange - xq
echo $NCOREFILES # xq

NEWNAME=${HOSTNAME}esscore${NCOREFILES}_${TIMESTAMP}
# record mapping so people can go back and figure out
# where they came from
echo -e $NEWNAME was `ls -l $COREFILE`  
$SAVE_DIR/$CORELOG
mv $COREFILE $SAVE_DIR/$NEWNAME

echo There are $NCOREFILES core files. # xq
done

fi

# What confused me most is the value $NCOREFILES outside 
# the do-while loop (but still in this function) reverted 
# back to its initial value, which seems contradictory to 
# our concept of local variables. - xq
#echo $NCOREFILES 

return 0
}

---

The purpose of this script is to find the core files in the system and move 
them to elsewhere for later analysis. 

I am confused about the following issues: 

1. The way of incrementing the variable NCOREFILES. Why does it use the formula 
of NCOREFILES=$[ $NCOREFILES + 1 ], 
and not the direct way of NCOREFILES=$NCOREFILES+1?

2. What confused me most is the value of the variable NCOREFILES ($NCOREFILES). 
Say there is just 1 core file, then because the initial value of NCOREFILES is 
0, it will be incremented to 1. Yes, this is the value in the do-while loop. 
But outside the loop and if-block, the value of NCOREFILES is reverted back to 
0 - its initial value. 

It is a local variable, so any modification to it should be valid as long as we 
are still in the scope of the function, right? I am really lossed at this 
phenomenon. 

Looking forward to any possible help, 

thanks, 
Xu Qiang


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


RE: Help on bash script?

2005-08-11 Thread Xu Qiang
dpk wrote:
 On Fri, 12 Aug 2005, Xu Qiang wrote:
 As soon as you used the pipe, to the while, you entered a sub-shell.
 There's no way (that I'm aware of anyways) to get the sub-shell's
 variables sent back up to the parent.

Thanks for your detailed analysis and a solution. Yes, I didn't notice the 
pipe's effect. 
Btw, can we export a value in the sub-shell back to the parent?

thanks,
Xu Qiang


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


RE: Help on bash script?

2005-08-11 Thread Xu Qiang
Giorgos Keramidas wrote:
 On 2005-08-12 10:16, Xu Qiang [EMAIL PROTECTED] wrote:
 Btw, can we export a value in the sub-shell back to the parent?
 
 Only through `backquote subtitution', as the child process cannot
 affect the environment of the parent process.
 
   value=`shell command`
   value=$(shell command)

Ah, yes, I mistakened it. The export mechanism is to preserve the value from 
the parent to the child, not the other direction, as described in the book The 
Unix Programming Environment by Brian Kernighan and Rob Pike. 

Thanks,
Xu Qiang


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


RE: Help on bash script?

2005-08-11 Thread Xu Qiang
dpk wrote:
 On Fri, 12 Aug 2005, Xu Qiang wrote:
 1. The way of incrementing the variable NCOREFILES. Why does it use
 the formula of NCOREFILES=$[ $NCOREFILES + 1 ], and not the direct
 way of NCOREFILES=$NCOREFILES+1?
 
 If that was done, NCOREFILES would end up looking like:
 
 +1+1+1+1+1+1+1
 
 as bash does not automatically differentiate between numeric and
 string variables. What the funky looking construct does is convince
 bash to treat it as a numeric/arithmetic expression.

Strangely, there is no mention of this assignment usage in the book Learning 
the bash shell, 2nd ed by O'Reilly at my hand. :(

And man bash didn't talk of it either. However, it mentioned for arithmetic 
evaluation, we can use 
 id++ id--
  variable post-increment and post-decrement
   ++id --id
  variable pre-increment and pre-decrement

If it is correct, then I can also increment NCOREFILES by: 
++NCOREFILES. 

But I doubt it...

Regards,
Xu Qiang


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


RE: Help on bash script?

2005-08-11 Thread Xu Qiang
This is my test script: 

-
#!/bin/bash

var=0
var=$[3]

vari=0
++vari

echo $var
echo $vari
-

The result is: 
./test.sh: ++vari: command not found
3
0

So the manual of bash is incorrect? 

Regards,
Xu Qiang


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


RE: Help on bash script?

2005-08-11 Thread Xu Qiang
dpk wrote:
 It will work with either 'let' or within an 'arithmetic expansion':
 
 $[++var]
 let ++var
 
 By the way, there is another syntax, from the man page, that seems to
 operate identically:
 
 $((++var)) and $((var+1))

With let ++var, the result is still 0, it isn't incremented. With $[++var], 
the result is 0: command not found.
$((++var)) is to the same effect as let ++var. 

$((var+1)) works. But the value of var can't be incremented. 

thanks, 
Xu Qiang


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


Gnome install in FreeBSD?

2005-08-08 Thread Xu Qiang
Hi, all:

Up to now, nearly all my system is compiled and installed manully by myself. 

I installed the mini 5.3 iso, and then downloaded and compiled src for every 
other software, such as X Window, GTK+, XEmacs, Apache Web Server, etc. 

But when my eyes turns to Gnome, I am really scared by its components and 
dependencies. At this point, I am willing to install it from ports. 

However, there is a problem: all my previous softwares were installed manually, 
could ports check it out to avoid install some dependencies (like GTK+) twice?

Regards,
Xu Qiang


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


groupadd/useradd in FreeBSD?

2005-07-28 Thread Xu Qiang
Hi, all: 

I am installing MySQL 4.1.13 into my machine. It has finished successfully. But 
before or after that, I need create some user account rather than root by the 
command groupadd mysql and useradd -g mysql mysql. 

However, these commands are not found in my FreeBSD 5.3 system. 

Any help on this issue?

thanks, 

Regards,
Xu Qiang

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


RE: groupadd/useradd in FreeBSD?

2005-07-28 Thread Xu Qiang
Jörg Reisenweber wrote:
 
 pw groupadd mysql ; pw useradd mysql -g mysql

Thanks for providing the correct usage of pw useradd. 

At first sight, I thought your pw useradd mysql -g mysql is a typo, which 
misplaced the first mysql and -g option, so I used pw useradd -g mysql 
mysql, but got an error saying pw: user name or id required

Then I man pw, and found the usage of (pw) user add is a little different 
from the standard ones: 
pw [-V etcdir] useradd [name|uid] [-C config] [-q] [-n name] [-u uid]
   [-c comment] [-d dir] [-e date] [-p date] [-g group] [-G grouplist]
   [-m] [-k dir] [-w method] [-s shell] [-o] [-L class] [-h fd | -H fd]
   [-N] [-P] [-Y]

In FreeBSD, it should be pw useradd username -g groupname, and not pw 
useradd -g groupname username. 

Last but not least, thanks for everyone who helped me in this thread. 

Regards,
Xu Qiang


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


RE: groupadd/useradd in FreeBSD?

2005-07-28 Thread Xu Qiang
Btw, Just think of this problem: 

Although I have added the user mysql to my machine, I didn't set its 
password. When does this newly added user get his/her password and change it?

thanks, 

Regards,
Xu Qiang

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


RE: groupadd/useradd in FreeBSD?

2005-07-28 Thread Xu Qiang
Dan Nelson wrote:
 No-one usually logs in as the mysql user, so you don't need to set
 one. Mysqld will automatically setuid() itself to the mysql user
 when it starts up.

Suppose it is a general scenario, not restricted to MySQL setup. How to set up 
a user's password after creating his/her uid/username?

thanks, 

Regards,
Xu Qiang

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


RE: groupadd/useradd in FreeBSD?

2005-07-28 Thread Xu Qiang
Maybe it is an off-topic question.

I cd /usr/local/mysql/sql-bench and perl run_all_tests, just to get the 
following error: 
-
Got error: 'Access denied for user 'root'@'localhost' (using password: NO)' 
when connecting to DBI:mysql:database=test;host=localhost with user: '' 
password: ''
-

By the way, before doing the bench test, I did this operation: 
/usr/local/mysql/bin/mysqladmin -u root password 'new-password'
/usr/local/mysql/bin/mysqladmin -u root -h gso_dev_2.workgroup password 
'new-password'

Is this the cause? 

Dan, I remember you said that mysqld will automatically setuid() itself to the 
mysql user when it
starts up. 

How to let the bench test run?

Thanks in advance, 

Regards,
Xu Qiang

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


RE: groupadd/useradd in FreeBSD?

2005-07-28 Thread Xu Qiang
Dan Nelson wrote:
 You set a password on mysql's root user, and probably didn't tell
 sql-bench about it.  Take a look at the the sql-bench documentation or
 look at the run_all_tests script to find out how to tell it what the
 password is.

Sorry I didn't read the file README in the sql-bench directory before asking 
the question. 
Now I run the test with perl run-all_tests --user=mysql, and it can run now. 

Thanks for pointing our that. :)

Regards,
Xu Qiang


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


DNS settings in FreeBSD?

2005-07-27 Thread Xu Qiang
Hi, all: 

Last time I asked you that why the machine can map the hostname to ip address 
without setting DNS Server in /etc/rc.conf. 

Now I remember that I have provided DNS ip address in the initial installing 
stage, where the installation wizard asked for me about the settings step by 
step, in which I set the machine's hostname, ip address, domain, gateway, 
subnet mask, and DNS server ip address. 

Now, when I open the file /etc/rc.conf, I found the machine's hostname, ip 
address, subnet mask, domain, and gateway/router are all in it. 

Yet, where is the DNS setting? If not in this file, which file does this 
setting reside in?

P.S.: In solaris, I can use dos2unix to transfer txt file from DOS/Windows 
format to Unix format, what is the corresponding command in FreeBSD?


Thanks, 
Xu Qiang


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


RE: DNS settings in FreeBSD?

2005-07-27 Thread Xu Qiang
Glenn Dawson wrote:
 At 01:46 AM 7/27/2005, Xu Qiang wrote:
 Hi, all:
 
 Last time I asked you that why the machine can map the hostname to ip
 address without setting DNS Server in /etc/rc.conf.
 
 Now I remember that I have provided DNS ip address in the initial
 installing stage, where the installation wizard asked for me about
 the settings step by step, in which I set the machine's hostname, ip
 address, domain, gateway, subnet mask, and DNS server ip address.
 
 Now, when I open the file /etc/rc.conf, I found the machine's
 hostname, ip address, subnet mask, domain, and gateway/router are
 all in it. 
 
 Yet, where is the DNS setting? If not in this file, which file does
 this setting reside in?
 
 /etc/resolv.conf
 
 
 P.S.: In solaris, I can use dos2unix to transfer txt file from
 DOS/Windows format to Unix format, what is the corresponding command
 in FreeBSD? 
 
 Install the dosunix port,  It's in /usr/ports/converters/dosunix
 
 -Glenn

Got it, thank you!

Regards,
Xu Qiang

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


RE: undelete in FreeBSD?

2005-07-26 Thread Xu Qiang
Ross Kendall Axe wrote:
 Yes.  MS-Windows doesn't have anything Unix doesn't in this regard.  I
 take it you're not familiar with the DOS/Windows 'del' command...

Hehe, this is a good analog I didn't think of. :)

 If he's worried about accidentally deleting files, he should use KDE
 or Gnome.  They both have a trash can/wastebasket/recycle bin.

Now I just have X Window in my machine. Not as good-looking as Gnome desktop.
Can I install gnome without using ports? I want to install everything manually. 

thanks, 

Regards,
Xu Qiang


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


RE: undelete in FreeBSD?

2005-07-25 Thread Xu Qiang
Glenn Sieb wrote:

 Nelis Lamprecht said the following on 7/21/2005 5:13 AM:
 There isn't a way to restore unless you have a backup. However, most
 of the binary files in /usr/local/bin are from packages/ports you
 have installed on your system. So you may be able to get away with
 using portupgrade(/usr/ports/sysutils/portupgrade) to re-install
 those packages and therefore restoring some if not all of
 /usr/local/bin. Do a portupgrade -f -a which forces portupgrade to
 re-install all packages/ports you have currently installed.

 Nelis,
 
 First I think he might have to go re-install portupgrade.
 
 Xu--as root, perform the following steps:
 
 cd /tmp
 tar cvf etc.tar /usr/local/etc/
 cd /usr/ports/sysutils/portupgrade
 make install  make clean
 portupgrade -farRx bsdpan-
 
 This will force reinstallation of all your ports. This will take
 *forever*. 
 
 And, just in case, we've tarred up your /usr/local/etc directory so
 you have a backup in /tmp!

Thanks for all who helped. 

I am just wondering the only shortcoming of Unix clone, such as FreeBSD, in 
contrast to M$ Windows, is the lack of a cyclin bin, from which you can restore 
anything you have mis-deleted before. 

Or, am I mis-informed on this issue?

Regards,
Xu Qiang


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


undelete in FreeBSD?

2005-07-21 Thread Xu Qiang
Hi, all: 

I mis-deleted /usr/local/bin directory in my FreeBSD. How can I restore it?

Looking for your help urgently, 

thanks, 
Xu Qiang

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


RE: undelete in FreeBSD?

2005-07-21 Thread Xu Qiang
Hornet wrote:
 On 7/21/05, Xu Qiang [EMAIL PROTECTED] wrote:
 Hi, all:
 
 I mis-deleted /usr/local/bin directory in my FreeBSD. How can I
 restore it? 
 
 Looking for your help urgently,
 
 thanks,
 Xu Qiang
 
 
 Use your backups, you do make backups dont you?

Never backup /usr/local/bin directory. :(
And I don't have backup for the whole system. :(((

Regards,
Xu Qiang


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


1 byte more?

2005-07-19 Thread Xu Qiang
Hi, all: 

I just met a strange problem. 

In FreeBSD 5.3, I want to create a new txt file with vi, and type a single 
digit into it, and save it for future use.

My steps are: 
1 vi count.txt
2 type i (for insert mode)
3 type 0
4 Esc
5 :wq

Then by ls -l, I found the file's size is 2 bytes, intead of 1 byte as I 
expected. 

Then I did a similar thing in MS Windows, to create a txt file with only 1 
digit in it. The behavior is expected, the file is 1 byte long. And when I 
ftp'ed that file to FreeBSD, the size is still correct. 

Why does vi in FreeBSD add 1 invisible character to the txt file? 

Looking forward to any possible help, 

Regards,
Xu Qiang


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


RE: 1 byte more?

2005-07-19 Thread Xu Qiang
Dan Nelson wrote:
 vi probably put a newline character after the one you typed.  You can
 use
 
   echo -n 0  count.txt
 
 or a text editor that doesn't force a newline as the last character in
 a file (joe for example).

Yes, You hit the point again. 

I used xemacs to hex edit that file, to find a newline character (0x0a) is 
added to the txt file, even though I didn't touch the Enter key in my 
keyboard. Maybe vi is too aggressively helpful. :)

Your echo -n is a solution. And xemacs is also a better choice without this 
annoying problem. 

Thank you, 

Regards,
Xu Qiang


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


Apache 1.3.33 auto start in FreeBSD 5.3?

2005-06-28 Thread Xu Qiang
Hi, all: 

I compiled Apache 1.3.33 from src in my FreeBSD 5.3 machine. It works well. 
However, I want to let it run at the start-up time of the system. 

I added the line apache_enable=YES into /etc/rc.conf, and copied 
/usr/ports/www/apache13/files/apache.sh into /usr/local/etc/rc.d, and modified 
the line command=%%PREFIX%%/sbin/httpd to 
command=%%PREFIX%%/apache/bin/httpd. 

But it still doesn't work. 

Any help?

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

RE: Apache 1.3.33 auto start in FreeBSD 5.3?

2005-06-28 Thread Xu Qiang
Xu Qiang wrote:
 I compiled Apache 1.3.33 from src in my FreeBSD 5.3 machine. It works
 well. However, I want to let it run at the start-up time of the
 system.  
 
 I added the line apache_enable=YES into /etc/rc.conf as
 /usr/ports/www/apache13/pkg-message said, and copied
 /usr/ports/www/apache13/files/apache.sh into /usr/local/etc/rc.d, and
 modified the line command=%%PREFIX%%/sbin/httpd to
 command=%%PREFIX%%/apache/bin/httpd.
 
 But it still doesn't work.

When I manually go to /usr/etc/rc.d, and run the script by ./apache.sh, it 
told me: 
.: Can't open %%RC_SUBR%%: No such file or directory

Btw, I can't find the command load_rc_config and run_rc_command in my 
machine. :(

looking forward to help, 

Regards,
Xu Qiang


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


RE: DNS and Gateway in FreeBSD?

2005-06-08 Thread Xu Qiang
Jonathan Chen wrote:
 /etc/rc.conf, output of netstat -rn, ifconfig -a would help.

The output of ifconfig -a is: 
---
gso_dev_2# ifconfig -a
xl0: flags=8843UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST mtu 1500
options=9RXCSUM,VLAN_MTU
inet 13.198.33.131 netmask 0xfc00 broadcast 13.198.35.255
inet6 fe80::2b0:d0ff:fe44:403c%xl0 prefixlen 64 scopeid 0x1 
ether 00:b0:d0:44:40:3c
media: Ethernet autoselect (10baseT/UTP)
status: active
plip0: flags=108810POINTOPOINT,SIMPLEX,MULTICAST mtu 1500
lo0: flags=8049UP,LOOPBACK,RUNNING,MULTICAST mtu 16384
inet 127.0.0.1 netmask 0xff00 
inet6 ::1 prefixlen 128 
inet6 fe80::1%lo0 prefixlen 64 scopeid 0x3 
---


The content of /etc/rc.conf: 
---
# -- sysinstall generated deltas -- # Tue Apr 12 23:53:44 2005
# Created: Tue Apr 12 23:53:44 2005
# Enable network daemons for user convenience.
# Please make all changes to this file, not to /etc/defaults/rc.conf.
# This file now contains just the overrides from /etc/defaults/rc.conf.
defaultrouter=13.198.32.1
hostname=gso_dev_2.workgroup
ifconfig_xl0=inet 13.198.33.131  netmask 255.255.252.0
linux_enable=YES
moused_enable=YES
usbd_enable=YES
---

I didn't remember I have added the gateway 13.198.32.1. I manually added the 
ip address (13.198.33.131) and netmask (255.255.252.0), so I wonder how the 
gateway was added into this file.

And I didn't have any DNS setting here. Yet it can ping www.yahoo.com 
successfully. Quite strange. :(

Regards,
Xu Qiang


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


RE: DNS and Gateway in FreeBSD?

2005-06-07 Thread Xu Qiang
Lowell wrote:
 We don't either.  We do not have enough information.
 Showing us your configuration files might help.

What configuration file do you need?

thanks, 

Regards,
Xu Qiang


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


RE: DNS and Gateway in FreeBSD?

2005-06-06 Thread Xu Qiang
? ? wrote:
 Xu Qiang wrote:
 
 Hi, all:
 
 In setting up my FreeBSD machine in my LAN, I only assigned it an ip
 address and a netmask, just as the handbook said
 (http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/config-network-setup.html).
 
 But after that, it can identify the proxy server's name even i
 didn't give it an explicit DNS server ip address. (It can ping
 proxy.abc.com) And I found the gateway is also found automatically
 by the machine. (It is automatically added into the line beginnin
 with defaultrouter=)
 
 Is it designed behavior? I can't understand that. :(
 
 Regards,
 Xu Qiang
 
 
 May be, you have dhcp client runned on this machine ?


No, I didn't have dhcp installed. :(

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

RE: DNS and Gateway in FreeBSD?

2005-06-06 Thread Xu Qiang
Lowell wrote:
 Yes, you do.  A dhcp client is part of the base system.

But I assigned my machine a static ip address and netmask, and they never 
changed. I don't know how the machine detect the gateway ip address and DNS 
server ip address which i never assigned to it. :(


Regards,
Xu Qiang


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


DNS and Gateway in FreeBSD?

2005-05-31 Thread Xu Qiang
Hi, all: 

In setting up my FreeBSD machine in my LAN, I only assigned it an ip address 
and a netmask, just as the handbook said 
(http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/config-network-setup.html).
 

But after that, it can identify the proxy server's name even i didn't give it 
an explicit DNS server ip address. (It can ping proxy.abc.com) And I found the 
gateway is also found automatically by the machine. (It is automatically added 
into the line beginnin with defaultrouter=)

Is it designed behavior? I can't understand that. :(

Regards,
Xu Qiang


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


RE: jdk 1.3.1 in FreeBSD

2005-05-30 Thread Xu Qiang
Vizion wrote:
 I will try and find out for you if someone else with a better memory
 than I gets there first

After some research, I found that i need to install ports/misc/compat4x, either 
through ports, or pkg_add -r. The problem is: my FreeBSD machine cannot 
connect to outside. 

In this case, is there a compiled libc.so.4 file in any FreeBSD repository that 
can be visited by web browser?

thanks, 

Regards,
Xu Qiang


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


RE: jdk 1.3.1 in FreeBSD

2005-05-30 Thread Xu Qiang
Vizion wrote:
 I have the sources - I could email them to you

Hi, David: 

I will be grateful if you can send them to me through email. 

thanks,

Regards,
Xu Qiang

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


RE: jdk 1.3.1 in FreeBSD

2005-05-30 Thread Xu Qiang
Vizion wrote:
 I have the sources - I could email them to you

I have found compat4x-i386-5.3.tbz in FreeBSD 5.3 Disc 1. I tar jxvf the 
library files into /lib/compat4x. And make some symbolic links: 
ln -s compat4x/libc.so.4
ln -s compat4x/libm.so.2 (This one is also required by the package 
diablo-jdk-1.3.1.0.tgz)

After that, I run java -version again, but it throwed out a segmentation 
fault and dumped core. :(
-
# java -version
Segmentation fault (core dumped)
-

And when I use gdb to trace the core file, it can't recognize the file format:
-
# gdb java java.core
GNU gdb 6.1.1 [FreeBSD]
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type show copying to see the conditions.
There is absolutely no warranty for GDB.  Type show warranty for details.
This GDB was configured as 
i386-marcel-freebsd.../usr/local/diablo-jdk1.3.1/bin/java: not in 
executable format: File format not recognized

Core was generated by `java'.
Program terminated with signal 11, Segmentation fault.
#0  0x280ee35a in ?? ()
(gdb) 
-

Any help?

Regards,
Xu Qiang


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


RE: jdk 1.3.1 in FreeBSD

2005-05-29 Thread Xu Qiang
Vizion wrote:
 I think you need
 /usr/ports/gnutls

I found gnutls is a tool for Transport Layer Security, which can hardly relate 
to the java sdk issue, right?

Regards,
Xu Qiang


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


RE: jdk 1.3.1 in FreeBSD

2005-05-29 Thread Xu Qiang
Vizion wrote:
 I think you are right -- I am sure it is a gnu package -- which
 includes some version of libc -- I cannot remember what it is
 
 I will try and find out for you if someone else with a better memory
 than I gets there first

I just sadly found out such a line in the Makefile in ports collection: 
IGNORE= does not run on FreeBSD = 5.x

So maybe for my FreeBSD 5.3, it is a mission impossible. 

Anyway, is there a similar jdk binary which can be used directly in FreeBSD 
5.3? I can't find any more link on 
http://www.freebsdfoundation.org/downloads/java.shtml

thanks, 

Regards,
Xu Qiang

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


jdk 1.3.1 in FreeBSD

2005-05-27 Thread Xu Qiang
Hi, all: 

I have downloaded diablo-jdk-1.3.1.0.tgz, and extracted it into /usr/local, but 
when i test it by running /usr/local/diablo-jdk1.3.1/bin/java -version, it 
told me: 
---
/usr/libexec/ld-elf.so.1: Shared object libc.so.4 not found, required by 
java
---

Any help?

Regards,
Xu Qiang


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


RE: The availability of socketbits.h?

2005-05-22 Thread Xu Qiang
Alex wrote:
 info gcc
 
 Move down the screen using the arrow key to the line * Invoking
 GCC:: 
 and press return.

The problem is: I can't find the line * Invoking GCC:: after moving the 
curson down the info gcc screen with the arrow key. :(

Sorry for my newbieness.
 
 Move down the screen using the arrow key to the line * C Dialect
 Options:: and press return.
 
 Move down the screen with arrow key or Page Down and there it is.
 
 Typing h at any point gives you help, but that's very long winded.
 
 Typing ? shows key bindings in a split window.  Finish with this
 window 
 by typing ^X0 (control-X then a 0 (zero)).
 
 There's also an emacs mode.  I don't know if there is a proper X
 interface of any kind.


Regards,
Xu Qiang

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


RE: The availability of socketbits.h?

2005-05-19 Thread Xu Qiang
Alex Zbyslaw wrote:
 Xu Qiang wrote:
 
 Giorgos Keramidas wrote:
 
 
 The manpage of gcc is severely out of date.  The GNU folks prefer
 Texinfo for their documentation since a long time ago.  Just ignore
 the manpage of gcc(1).  IMHO, it provides absolutely no useful
 information anymore :-( 
 
 
 
 So, would you point me to the place of GCC usage of the option -std?
 Even google failed to find it. :( 
 
 
 info gcc then down to invoking, command line and C dialect options.
 Whether it really is up-to-date and accurate, I cannot say. 
 
 --Alex

Still didn't find it in info gcc, :(

Regards,
Xu Qiang


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


RE: The availability of socketbits.h?

2005-05-18 Thread Xu Qiang
Ted Mittelstaedt wrote:
 Would you post a diff of the files you had to change to the list once
 you get it running?

If you follow this thread, it would be quite easy. Anyway, it is my pleasure to 
do a summary here. But I don't know how to put the diff result into a more 
readable format (like the old line is prefixed with a -, and the newline is 
prefixed with a +) than this: 

gso_dev_2# diff configure.org configure
5234,5235c5234,5235
   GGO_SOME_WARNINGS='-Wall -W -Wpointer-arith -Wbad-function-cast -Wcast-qual 
-Wcast-align -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes 
-Wmissing-declarations -Wp,-lang-c89'
   GGO_ALL_WARNINGS='-Wall -W -Wshadow -Wpointer-arith -Wbad-function-cast 
-Wcast-qual -Wcast-align -Wwrite-strings -Wstrict-prototypes 
-Wmissing-prototypes -Wmissing-declarations -Wp,-lang-c89'
---
   GGO_SOME_WARNINGS='-Wall -W -Wpointer-arith -Wbad-function-cast -Wcast-qual 
 -Wcast-align -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes 
 -Wmissing-declarations -Wp,-std=c89'
   GGO_ALL_WARNINGS='-Wall -W -Wshadow -Wpointer-arith -Wbad-function-cast 
 -Wcast-qual -Wcast-align -Wwrite-strings -Wstrict-prototypes 
 -Wmissing-prototypes -Wmissing-declarations -Wp,-std=c89'

It is quite unreadable. Actually, all I have done to this file is: 
sed -i -e s/-lang-c89/-std=c89/g configure

If you can tell me how to do it in a -, + format, I will post a complete 
revision to the list. 

thanks, 

Regards,
Xu Qiang


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


RE: The availability of socketbits.h?

2005-05-18 Thread Xu Qiang
Giorgos Keramidas wrote:
 If you refer to the addition of a zero-filled entry at the end of the
 array, it's not a fix.  Just a description of what the buggy loop
 seems to expect.  The rest of the program works differently, so it
 definitely won't work as a fix.

Even it is not a fix, your analysis helped me a lot in solving this problem. 
Thank you!

 Obviously, no.  They should be hit hard on the head with a copy of
 Extreme Programming Explained :P

Haha, good idea!

Regards,
Xu Qiang


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


RE: The availability of socketbits.h?

2005-05-18 Thread Xu Qiang
Giorgos Keramidas wrote:
 That should be easy.  You'll need two directory hierarchies:
 
   * One with the unchanged, vendor version of the code, i.e. an
 extracted copy of the tarballs you got from sourceforge.
 
   * One with the fixed version that builds and runs fine on your
 system. 
 
 Assuming that you have the tarballs of mlrate-1.1.0 and nngs-1.1.14
 that you got from sourceforge under /tmp/nngs/vendor/mlrate-1.1.0 and
 /tmp/nngs/vendor/nngs-1.1.14 respectively, you can copy these
 directories recursively to /tmp/nngs/local:
 
   # mkdir -p /tmp/nngs/local
   # cd /tmp/nngs/vendor
   # cp -Rp mlrate-1.10 nngs-1.1.14 /tmp/nngs/local
 
 Then you can make all the changes you need to /tmp/nngs/local and see
 all the changes of mlrate or nngs in one patchfile with:
 
   # cd /tmp/nngs
   # diff -ruN vendor/mlrate* local/mlrate*  /tmp/nngs/mlrate.patch
   # less /tmp/nngs/mlrate.patch
 
   # cd /tmp/nngs
   # diff -ruN vendor/nngs* local/nngs*  /tmp/nngs/nngs.patch
   # less /tmp/nngs/nngs.patch

Thanks for the direction. I will try to do a summary of changes needed into a 
number of .patch files. 

Regards,
Xu Qiang


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


RE: The availability of socketbits.h?

2005-05-18 Thread Xu Qiang
Ted Mittelstaedt wrote:
 Would you post a diff of the files you had to change to the list once
 you get it running?

With the help of Giorgos, I finally got all the diff into separate patch files. 

Explanatory notes: 

1. I am using mlrate-1.1.0.tar.gz and nngs-1.1.14.tar.gz (coz it is more stable 
and reliable than 1.1.16 version), and only nngs-1.1.14.tar.gz need to be 
patched. 

2. configure.patch must be applied in order to compile nngs src in FreeBSD 5.3 
(for i386) with gcc 3.4.2; the patch is hinted by this bug reported in 
sourceforge: 
http://sourceforge.net/tracker/index.php?func=detailaid=1201565group_id=59572atid=491424

For your convenience, the gist is listed here: 
---
-lang-c89 deprecated  
quote from man gcc (3.3.5-20050130)
Note: Previous versions of cpp accepted a -lang option
which selected both the language and the
standards conformance level. This option has been
removed, because it conflicts with the -l option.
just use -std=c89 (not sure but seem to works)
---

P.S.: Although this can work, I can't find the option -std in man gcc, 
quite strange. Any hints?

3. Up to now, the compilation can be done successfully with GNU make, but if 
the following patch(es) is/are not applied, the compiled binary (nngssrv) will 
throw a run-time error and dump core. The patches are credited to Dan Nelson 
and Giorgos Keramidas. Either one set of the patches is enough to avoid the 
run-time error. Which one to choose is up to your own.

i) The patch of Dan Nelson involves only one file - command.c, and the patch 
file is command.c.patch.DanNelson
ii) The patch of Giorgos involves two files - command.c and command_list.h, the 
patch files are command.c.patch.GiorgosKeramidas and 
command_list.h.patch.GiorgosKeramidas

If you meet any other problem in the process of setting up the server, pls let 
us know.

P.S.: After using Giorgos' method to create the diff patches, I don't know how 
to apply the patches back to the original file(s). Can Giorgos help me once 
more? (Actually, I am quite a newbie in FreeBSD world.)

4. Final word: when configure nngs src, it is best to enable adminlevels 
options, it is done by:
./configure --prefix=your_install_dir --enable-adminlevels

Hope this open-source software can be integrated into ports system of FreeBSD.

Thank you, all.

Regards,
Xu Qiang


command.c.patch.DanNelson
Description: Binary data


command.c.patch.GiorgosKeramidas
Description: Binary data


command_list.h.patch.GiorgosKeramidas
Description: Binary data


configure.patch
Description: Binary data
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


RE: The availability of socketbits.h?

2005-05-18 Thread Xu Qiang
Giorgos Keramidas wrote:
 One patch file for the entire source tree of each package would be
 even better, but anyway...

Yes, but to this software, there are two kind of patches (of you, and Dan 
Nelson, respectively) that both works independently, so...  :)
 
 The manpage of gcc is severely out of date.  The GNU folks prefer
 Texinfo for their documentation since a long time ago.  Just ignore
 the manpage of gcc(1).  IMHO, it provides absolutely no useful
 information anymore :-(

So, would you point me to the place of GCC usage of the option -std? Even 
google failed to find it. :(

 My patch is incorrect.  Use Dan's changes :-)

Dan's sure is correct. But your fix also works well, after I changed the 
command.c file. It would not work if we only patch the command_list.h hearder. 

 An example could be:
 
   # cd /tmp/nngs/directory/of/file/
   # patch -p0  /tmp/dan_nelson.diff

Thanks for this detailed explanation and example, hoho, the example is better 
for such a lazy bone as I. :)

A side note: 

After the server is running, I used Jago (http://www.rene-grothmann.de/jago/) 
as a client tool to connect to the server. The experiment shows that the 
server-client interaction works fine. Strongly recommend this go client 
software by Rene Grothmann, which is also an open-source software (But not GNU).

Regards,
Xu Qiang


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


RE: The availability of socketbits.h?

2005-05-17 Thread Xu Qiang
Xu Qiang wrote:
 
 cc1: error: unrecognized command line option
 -lang-c89
 gmake[2]: *** [command.o] Error 1
 gmake[2]: Leaving directory
 `/usr/games/nngs_sourceforge/nngs-1.1.16/nrat' 
 

Just found out this: 

http://sourceforge.net/tracker/index.php?func=detailaid=1201565group_id=59572atid=491424:
 

-lang-c89 deprecated  
quote from man gcc (3.3.5-20050130)
Note: Previous versions of cpp accepted a -lang option
which selected both the language and the
standards conformance level. This option has been
removed, because it conflicts with the -l option.
just use -std=c89 (not sure but seem to works)

Then I did the modification in the file ./configure, and it can go on. 


But another error appears: 


In file included from comproc.c:44:
../missing.h:30: error: conflicting types for 'ftruncate'
/usr/include/stdio.h:367: error: previous declaration of 'ftruncate' was here
../missing.h:30: error: conflicting types for 'ftruncate' 


It is strange that while 1.1.16 version has this problem, 1.1.14 doesn't. 

Regards,
Xu Qiang


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


RE: The availability of socketbits.h?

2005-05-17 Thread Xu Qiang
Dan Nelson wrote:
 It looks like missing.h was added in 1.1.15, but the author didn't run
 all the necessary autoconf commands afterwards.  Try running
 autoheader253 (you will see that a HAVE_FTRUNCATE placeholder gets
 added to config.h.in), and rerun configure and make.
 
 It looks like there have been some autoconf changes make in CVS after
 1.1.16 was released.  You might want to check out the current source
 to see if some of these issues have been fixed already.

Thanks for your suggestions. Yes, this error is overcome after running 
autoheader. But now another error of the same type appears: 
-
mink.c:22: error: conflicting types for 'random'
/usr/include/stdlib.h:200: error: previous declaration of 'random' was here
mink.c:22: error: conflicting types for 'random'
-

This file is in nngs-1.1.16/src directory, and when I run autoheader in this 
directory: 
-
autoheader: `configure.ac' or `configure.in' is required
-

What shall I do now?

Thanks a lot, 

Regards,
Xu Qiang


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


RE: The availability of socketbits.h?

2005-05-17 Thread Xu Qiang
Xu Qiang wrote:
 Thanks for your suggestions. Yes, this error is overcome after
 running autoheader. But now another error of the same type appears:
 - 
 mink.c:22: error: conflicting types for 'random'
 /usr/include/stdlib.h:200: error: previous declaration of 'random'
 was here 
 mink.c:22: error: conflicting types for 'random'
 -
 
 This file is in nngs-1.1.16/src directory, and when I run
 autoheader in this directory:
 - 
 autoheader: `configure.ac' or `configure.in' is required
 -

Btw, I just found there is a line #undef HAVE_RANDOM in config.h.in, so is it 
due to the src file (mink.c) is not in the same directory as config.h.in? (It 
is one level below: config.h.in is in nngs-1.1.16, while mink.c is in 
nngs-1.1.16/src)

Strange, 

Looking forward to your help, 

Regards,
Xu Qiang


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


RE: The availability of socketbits.h?

2005-05-17 Thread Xu Qiang
Dan Nelson wrote:
 That's because after including the header that provides a declaration
 for random (stdlib.h), the author decided to include another of his
 own for some reason, but he used the wrong return type so gcc
 complained. Just remove like 22 of mink.c.

Thank you again. It can roll forward when the declaration of the random 
function function is removed. It seems 1.1.16 version is full of bugs, like 
stated above. The 1.1.14 version is much better in compiling. 

However, both versions give me an error when I run the compiled application 
after gmake, gmake install. I go to bin directory and type ./nngssrv, it told 
me: 
Bus error (core dumped)

GDB trace is here: 
---
gso_dev_2# gdb nngssrv nngssrv.core 
GNU gdb 6.1.1 [FreeBSD]
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type show copying to see the conditions.
There is absolutely no warranty for GDB.  Type show warranty for details.
This GDB was configured as i386-marcel-freebsd...
Core was generated by `nngssrv'.
Program terminated with signal 10, Bus error.
Reading symbols from /lib/libcrypt.so.2...done.
Loaded symbols for /lib/libcrypt.so.2
Reading symbols from /lib/libm.so.3...done.
Loaded symbols for /lib/libm.so.3
Reading symbols from /lib/libc.so.5...done.
Loaded symbols for /lib/libc.so.5
Reading symbols from /libexec/ld-elf.so.1...done.
Loaded symbols for /libexec/ld-elf.so.1
#0  0x2818bbc5 in __vfprintf () from /lib/libc.so.5
(gdb) bt
#0  0x2818bbc5 in __vfprintf () from /lib/libc.so.5
#1  0x2818a513 in vfprintf () from /lib/libc.so.5
#2  0x28177352 in fprintf () from /lib/libc.so.5
#3  0x0805f98c in commands_init () at command.c:1149
#4  0x0805aeab in main (argc=1116382465, argv=0x807e702) at nngsmain.c:162
---

What is a Bus error? 

Any hints to overcome this last barrier?

thanks a lot, 

Regards,
Xu Qiang


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


RE: The availability of socketbits.h?

2005-05-17 Thread Xu Qiang
Giorgos Keramidas wrote:
 A bug in the program.  The relevant code seems to be this part of
 nngs-1.1.14/nrat/command.c:
 
1131 void commands_init()
1132 {
1133   FILE *fp, *afp;
1134   int i = 0;
1135
1136   fp = xyfopen(FILENAME_CMDS, w);
1137   if (!fp) {
1138 return;
1139   }
1140   afp = xyfopen(FILENAME_ACMDS, w);
1141   if (!afp) {
1142 fclose(fp);
1143 return;
1144   }
1145   for (i = 0; command_list[i].comm_name; i++) {
1146 if (command_list[i].adminLevel = ADMIN_ADMIN) {
1147   fprintf(afp, %s\n, command_list[i].comm_name);
1148 } else {
1149   fprintf(fp, %s\n, command_list[i].comm_name);
1150 }
1151   }
1152   fclose(fp);
1153   fclose(afp);
1154 }
 
 If we put for a while the horrible style aside, the bug seems to be
 that the for loop doesn't properly check the bounds of the
 command_list[] array.  This would probably be ok if the command_list
 array was declared to have a trailing element set to an all zeroes
 value: 
 
   struct command_type command_list[] = {
 {accept,n,com_accept, ADMIN_USER },
 {actitle,   dS,   com_actitle,ADMIN_ADMIN },
 {0,   0,  0,  0 },
   };
 
 but it's not (look in nngs-1.1.14/nrat/command_list.h):
 
/* NameOptions Functions   Security */
   struct command_type command_list[] = {
 {accept,n,com_accept, ADMIN_USER },
 {actitle,   dS,   com_actitle,ADMIN_ADMIN },
 [...]
 /* by Syncanph */
 {shownote,  , com_shownote,   ADMIN_USER },
   };
 
 and this is *EXACTLY* where this particular bug lies.

Thank you, Giorgos. You hit the cause I didn't see. 

But after compile, there is a new segmentation fault, here is the GDB trace: 
gso_dev_2# gdb nngssrv nngssrv.core 
GNU gdb 6.1.1 [FreeBSD]
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type show copying to see the conditions.
There is absolutely no warranty for GDB.  Type show warranty for details.
This GDB was configured as i386-marcel-freebsd...
Core was generated by `nngssrv'.
Program terminated with signal 11, Segmentation fault.
Reading symbols from /lib/libcrypt.so.2...done.
Loaded symbols for /lib/libcrypt.so.2
Reading symbols from /lib/libm.so.3...done.
Loaded symbols for /lib/libm.so.3
Reading symbols from /lib/libc.so.5...done.
Loaded symbols for /lib/libc.so.5
Reading symbols from /libexec/ld-elf.so.1...done.
Loaded symbols for /libexec/ld-elf.so.1
#0  0x281803d2 in strcmp () from /lib/libc.so.5
(gdb) bt
#0  0x281803d2 in strcmp () from /lib/libc.so.5
#1  0x2817f125 in qsort () from /lib/libc.so.5
#2  0x0805d740 in command_init () at command.c:212
#3  0x0805ae95 in main (argc=1116386171, argv=0xbfbfe958) at nngsmain.c:158

It seems still related to the array of command_list. 

Any further suggestions?

thanks, 

Regards,
Xu Qiang


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


RE: The availability of socketbits.h?

2005-05-17 Thread Xu Qiang
Dan Nelson wrote:
 It's usually caused by an incorrect pointer, or a stack overflow,
 where the program tries to read a memory address not available to it.
 In fact, I can see the problem right away.  command_list is a
 statically-initilized array (defined at command_list.h:55).  Note that
 there is no special end-of-list value at the end of the array.  The
 loop at command.c:1149 loops until command_list[i].comm_name is NULL,
 but since there's no explicit NULL entry at the end, the loop falls
 off the end of the array, where it eventually hits an unmapped page of
 memory and gets a bus error.
 
 That for loop should really read:
 
   for(i=0; icommand_count; i++) {
 
 , since command_count should already be set to COUNTOF(command_list)
 by a previous call to command_init().

Thank you, Dan. Your fix works!

Still, I wonder why the fix of Giorgos doesn't work, because it seems quite 
right to me, too.

(Btw, I can't understand why this software has so many bugs to be fixed before 
it can be compiled and run successfully. The developers don't check their 
product before shipping out? I have compiled and installed quite a number of 
GNU softwares, never saw such a buggy one. Yet, I am a go game lover, and want 
to set up a local NNGS server. And this is the only available open source go 
server software in the world. Alas!)

Regards,
Xu Qiang


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


RE: The availability of socketbits.h?

2005-05-17 Thread Xu Qiang
Dan Nelson wrote:
 The rest of the code in command.c makes use of the command_count value
 and assumes that all the array elements are fully populated.  The
 qsort routime tried to compare a NULL comm_name value and seg
 faulted.  His fix would have worked if the rest of the program used
 the same code loop as the one at command.c:1149, but it doesn't.

Yeah, you hit the point again! 

Just found the variable noofcomms (= COUNTOF(command_list)) is used in the 
function qsort() 
-
qsort((command_list),noofcomms,sizeof command_list[0],command_cmp);
-

No wonder trailing NULL element at the end of the array command_list[] is used 
in qsort(), and the segmentation fault.

Since the number of actual non-NULL elements in the array is one less than the 
array's size, I changed the calculation of noofcomms as: 
-
noofcomms = COUNTOF(command_list) - 1;
-

Now the program can work properly. :)

 The author may not have tested it on many systems, and since the
 source is so old (relatively speaking), standards have changed.  It's
 no longer acceptable to provide your own prototypes for system
 functions, for example (which was the cause of your first few compile
 errors). 

I am very lucky to have you and Giorgos around to help me in compiling this 
software. Thank you two so much for your help and patience!

with my best wishes,
Xu Qiang


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


The availability of socketbits.h?

2005-05-16 Thread Xu Qiang
Hi, all: 

I am compiling NNGS (No Name Go Server) code in my FreeBSD 5.3 machine. Yet, I 
came across the following error: 
-
gcc -traditional-cpp -Wall -DFREEBSD -c network.c
network.c:23: socketbits.h: No such file or directory
gmake: *** [network.o] Error 1
-

I have searched for this file in my system, but can't find it. 

To have it present, which software must I install?

Regards,
Xu Qiang


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


RE: The availability of socketbits.h?

2005-05-16 Thread Xu Qiang
Dan Nelson wrote:
 That is a Linux internal header that programs should not be including
 directly.  What version of nngs are you trying to compile?  I
 downloaded nngs-1.1.16 from http://sourceforge.net/projects/nngs/ and
 line 23 of src/network.c is a blank line:
 
20 #ifdef HAVE_CONFIG_H
21 #include config.h
22 #endif
23
24 #include stdio.h
25 #include stdlib.h
26 #include assert.h

Great that another pal has compiled this stuff. :)

Hmmm, I was compiling the original NNGS source code from 
http://nngs.cosmic.org/src/. 

Just found this new sourceforge page related to NNGS. Let me try this out. 

thank you and be prepared for my foolish questions, :P

Regards,
Xu Qiang


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


RE: The availability of socketbits.h?

2005-05-16 Thread Xu Qiang
Dan Nelson wrote:
 That is a Linux internal header that programs should not be including
 directly.  What version of nngs are you trying to compile?  I
 downloaded nngs-1.1.16 from http://sourceforge.net/projects/nngs/ and
 line 23 of src/network.c is a blank line:
 
20 #ifdef HAVE_CONFIG_H
21 #include config.h
22 #endif
23
24 #include stdio.h
25 #include stdlib.h
26 #include assert.h

By the way, is there a similar sourceforge page for mlrate? I understand that 
it is necesary for nngs to compile. 

Regards,
Xu Qiang


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


RE: The availability of socketbits.h?

2005-05-16 Thread Xu Qiang
Dan Nelson wrote:
 That is a Linux internal header that programs should not be including
 directly.  What version of nngs are you trying to compile?  I
 downloaded nngs-1.1.16 from http://sourceforge.net/projects/nngs/ and
 line 23 of src/network.c is a blank line:
 
20 #ifdef HAVE_CONFIG_H
21 #include config.h
22 #endif
23
24 #include stdio.h
25 #include stdlib.h
26 #include assert.h

I downloaded mlrate-1.1.0.tar.gz and nngs-1.1.16.tar.gz, and did as the 
following: 
1 tar xvzf mlrate-1.1.0.tar.gz
2 cd mlrate-1.1.0
3 ./configure
4 gmake

(Should I do gmake install thereafter?)

5 tar xvzf nngs-1.1.16.tar.gz
6 cd nngs-1.1.16
7 ln -s ../mlrate-1.1.0 mlrate (Why this step?)
8 gmake

But I met an error: 


gso_dev_2# gmake
gmake  all-recursive
gmake[1]: Entering directory `/usr/games/nngs_sourceforge/nngs-1.1.16'
Making all in nrat
gmake[2]: Entering directory `/usr/games/nngs_sourceforge/nngs-1.1.16/nrat'
source='command.c' object='command.o' libtool=no \
depfile='.deps/command.Po' tmpdepfile='.deps/command.TPo' \
depmode=gcc3 /bin/sh ../depcomp \
gcc -DHAVE_CONFIG_H -I. -I. -I.. -I../src -I../mlrate/src-g -O2 -Wall -W 
-Wshadow -Wpointer-arith -Wbad-function-cast -Wcast-qual -Wcast-align 
-Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations 
-Wp,-lang-c89 -c `test -f 'command.c' || echo './'`command.c
cc1: error: unrecognized command line option -lang-c89
gmake[2]: *** [command.o] Error 1
gmake[2]: Leaving directory `/usr/games/nngs_sourceforge/nngs-1.1.16/nrat'
gmake[1]: *** [all-recursive] Error 1
gmake[1]: Leaving directory `/usr/games/nngs_sourceforge/nngs-1.1.16'
gmake: *** [all] Error 2


Any help?

thanks, 

Regards,
Xu Qiang


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


RE: Ports proxy configuration?

2005-05-11 Thread Xu Qiang
Kris Kennaway wrote:
 The ports collection just uses fetch(1), so that's where the relevant
 documentation is.

I man fetch, but didn't find any info related to proxy setting. 

thanks anyway for your suggestion, 

Regards,
Xu Qiang


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


RE: Ports proxy configuration?

2005-05-11 Thread Xu Qiang

Thank you very much, 

Regards,
Xu Qiang


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


Ports proxy configuration?

2005-05-10 Thread Xu Qiang
Hi, guys: 

I want to install some softwares from FreeBSD Ports collection. But without 
configuration of proxy, it can't connect out to fetch the src tar balls, and 
compile/install. 

I searched the handbook but didn't find any useful info about setting of proxy 
for Ports. 

Any suggestions?

thanks, 

Regards,
Xu Qiang

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