Re: readdir after rewinddir not working in 20060128 snapshot

2006-02-04 Thread Yitzchak Scott-Thoennes
On Mon, Jan 30, 2006 at 11:39:48AM +0100, Corinna Vinschen wrote:
> On Jan 30 00:29, Yitzchak Scott-Thoennes wrote:
> > After a rewinddir, readdir seems to return as many empty entries as there
> > were actual entries left to read, followed by . and ..
> 
> Thanks for the testcase!  Since the underlying NT call NtQueryDirectoryInfo
> is able to return more than one directory entry in one call, I thought it
> might be a good idea to implement readdir caching.  Unfortunately I forgot
> to reset the cache in case of rewinddir.  I've applied a fix now.

Thanks, but..

With 20060202, that testcase now works, but if you read all the way to
the end, then rewind, you only get . and .. thereafter.

$ cat rewdir.c
#include 
#include 
#include 
#include 

void readentries(DIR *dh, int limit) {
  struct dirent *de;
  int count;

  for (count = 0; count < limit; ++count) {
errno = 0;
if ((de = readdir(dh)) == NULL) {
  if (errno != 0) printf ("read error: %s\n", strerror (errno));
  break;
}
printf ("got: %s\n", de->d_name);
  }
}

int main(int argc, char **argv)
{
  DIR *dh;
  int i;

  if (argc != 2) return 1;

  if ( (dh = opendir (argv[1])) == NULL ) {
fprintf (stderr, "couldn't open '%s': %s\n", argv[1], strerror (errno));
return 1;
  }

  for (i = 0; i < 3; ++i) {
readentries (dh, );

printf ("rewinding.\n");
errno = 0;
rewinddir (dh);
if (errno != 0) printf ("unexpected errno: %d\n", errno);
  }

  return 0;
}

$ rm -rf foo; mkdir foo; touch foo/{bar,baz,quux,quuux,qx}

$ gcc -Wall rewdir.c -o rewdir && ./rewdir foo
got: .
got: ..
got: bar
got: baz
got: qx
got: quuux
got: quux
rewinding.
got: .
got: ..
rewinding.
got: .
got: ..
rewinding.

--
Unsubscribe info:  http://cygwin.com/ml/#unsubscribe-simple
Problem reports:   http://cygwin.com/problems.html
Documentation: http://cygwin.com/docs.html
FAQ:   http://cygwin.com/faq/



Re: Chinese file names are displayed as '??' when 'ls'

2006-02-04 Thread Joshua Daniel Franklin
On 2/3/06, LiuYan wrote:
> Hi all:
>
> When I using 'ls' to list the files in a directory, the chinese file names are
> becomes '??'.

Do the hints in the Cygwin FAQ about Unicode help?

http://cygwin.com/faq/faq.using.html#faq.using.unicode

--
Unsubscribe info:  http://cygwin.com/ml/#unsubscribe-simple
Problem reports:   http://cygwin.com/problems.html
Documentation: http://cygwin.com/docs.html
FAQ:   http://cygwin.com/faq/



Re: shutdown

2006-02-04 Thread René Berber
Christian Lanconelli (servizio) wrote:

> Hello world!,
> I need to shutdown my win 2000 O.S. at a specified time or "now".
> I'd like to use the command shutdown --force now but the system answer is
> that I don't have the necessary priviledge. How can I do? Have I to activate
> some service with cygrunsrv.exe for exemple? I'm working in an Antarctic
> base without internet connection, so I cannot access the web information.
> thak you for your help!!

Perhaps this will help, from the version announcement:

"I've just updated the version of shutdown to 1.7-1.

This version adds the -x/--exitex option, which allows to use the
ExitWindowsEx function on Windows NT.  This is important if shutdown is
supposed to poweroff on Windows 2000, since the InitiateSystemShutdown
implementation on Windows 2000 unfortunately misses to do this."

Regards.
-- 
René Berber


--
Unsubscribe info:  http://cygwin.com/ml/#unsubscribe-simple
Problem reports:   http://cygwin.com/problems.html
Documentation: http://cygwin.com/docs.html
FAQ:   http://cygwin.com/faq/



shutdown

2006-02-04 Thread Christian Lanconelli \(servizio\)
Hello world!,
I need to shutdown my win 2000 O.S. at a specified time or "now".
I'd like to use the command shutdown --force now but the system answer is
that I don't have the necessary priviledge. How can I do? Have I to activate
some service with cygrunsrv.exe for exemple? I'm working in an Antarctic
base without internet connection, so I cannot access the web information.
thak you for your help!!
Bye
Christian

=
SESSION:
[EMAIL PROTECTED] ~
$ shutdown --suspend now
WARNING!!! System is going down NOW
shutdown: Couldn't suspend: Il privilegio richiesto non appartiene al
client.
=
Christian Lanconelli - PhD sudent
[EMAIL PROTECTED]
XXI Spedizione Italiana in Antartide
www.pnra.it
www.italiantartide.it




--
Unsubscribe info:  http://cygwin.com/ml/#unsubscribe-simple
Problem reports:   http://cygwin.com/problems.html
Documentation: http://cygwin.com/docs.html
FAQ:   http://cygwin.com/faq/



Re: Problems with sshd under Windows XP

2006-02-04 Thread Fabian Pauly
My problems are solved now. So here a short report what my problem was:

I encountered two kind of problems:

1) First somewhere in the cygwin-Archive it was mentioned, that one can
change the user name simply by editing /etc/passwd. As my windows name was
"first name"\ "lastname" I changed it to my usual login name, let's say
"pauly". However Windows than does not know about a password for pauly when
a login to the Windows computer is taking place because user pauly does not
exist. A real change of a user name in WindowsXP Home does not seem easy as
a change of the user name does not change the user's directory name (in
Windows XP Home). So I accepted "first name"\ "lastname" as my login name.
After a new installation of cygwin I could than install sshd even with
"privilege separation yes". (/etc/passwd should have the same entries as
mkpasswd -l).

2) The second problem was purely ssh-related. I have linux and Windows on my
machine. For linux I have a sshd running for a long time. And the host keys
newly generated during the installation of sshd under Windows was of course
different to the linux host keys. So the client recognized that the host
keys were different and stopped the login progess. This problem can simply
be solved by copying the linux hostkeys to windows.

Cygwin is really fantastic! The xserver and the running sshd I find really
impressive! Great job! Fabian.

P.S.: Of course I also read the cygwin-doc. However I find the links
actually contain better understandable instructions than the
'/usr/share/doc/Cygwin/openssh.README' file, which adresses newly included
features and seems somewhat inconsistent -- at least without clear, simple
instructions. Anyway it works now.


> --- Ursprüngliche Nachricht ---
> Von: "Larry Hall (Cygwin)" <[EMAIL PROTECTED]>
> An: cygwin@cygwin.com
> Betreff: Re: Problems with sshd under Windows XP
> Datum: Wed, 01 Feb 2006 23:00:24 -0500
> 
> Fabian Pauly wrote:
> > I tried to use sshd under Windows XP. Proceeding in the way described in
> > http://pigtail.net/LRP/printsrv/cygwin-sshd.html
> > or 
> > http://www.wintotal.de/Artikel/ftpserver/ftpserver2.php.
> > 
> 
> If you use configuration instructions which come from sites other than
> Cygwin's, you should address your questions to those sites.  If you
> install
> Cygwin's ssh using the instructions in
> '/usr/share/doc/Cygwin/openssh.README'
> and have problems, this would be the proper list to consult.  Also, please
> read and follow the problem reporting guidelines at
>  whenever you have an inquiry concerning
> your installation.
> 
> -- 
> Larry Hall  http://www.rfk.com
> RFK Partners, Inc.  (508) 893-9779 - RFK Office
> 838 Washington Street   (508) 893-9889 - FAX
> Holliston, MA 01746
> 
> --
> Unsubscribe info:  http://cygwin.com/ml/#unsubscribe-simple
> Problem reports:   http://cygwin.com/problems.html
> Documentation: http://cygwin.com/docs.html
> FAQ:   http://cygwin.com/faq/
> 

-- 
10 GB Mailbox, 100 FreeSMS/Monat http://www.gmx.net/de/go/topmail
+++ GMX - die erste Adresse für Mail, Message, More +++

--
Unsubscribe info:  http://cygwin.com/ml/#unsubscribe-simple
Problem reports:   http://cygwin.com/problems.html
Documentation: http://cygwin.com/docs.html
FAQ:   http://cygwin.com/faq/



sed

2006-02-04 Thread Rokas Masiulis
Hi,

i can't force to work sed in true binary mode:

this is test case:

$ echo -en '\r\n' | sed -e '' | od -t x1
000 0a
001

but expected result is:
$ echo -en '\r\n' | od -t x1
000 0d 0a
002


on linux this thing works: 
[EMAIL PROTECTED] $ echo -en '\r\n' | sed -e '' | od -t x1
000 0d 0a
002


some info:

$ mount
C:\cygwin\bin on /usr/bin type system (binmode)
C:\cygwin\lib on /usr/lib type system (binmode)
C:\cygwin on / type system (binmode)
c: on /cygdrive/c type system (binmode,noumount)
e: on /cygdrive/e type system (binmode,noumount)
f: on /cygdrive/f type system (binmode,noumount)
g: on /cygdrive/g type system (binmode,noumount)

$ echo "$CYGWIN"x
x

roma1390

--
Unsubscribe info:  http://cygwin.com/ml/#unsubscribe-simple
Problem reports:   http://cygwin.com/problems.html
Documentation: http://cygwin.com/docs.html
FAQ:   http://cygwin.com/faq/



Re: cvs is broken/cygwin-bug in mkdir()?

2006-02-04 Thread Sven Köhler
> I just checked in a fix to make cygwin return the correct error
> when trying to create a file with a trailing dot.
> 
> It will be in the next snapshot.

Thank you!


--
Unsubscribe info:  http://cygwin.com/ml/#unsubscribe-simple
Problem reports:   http://cygwin.com/problems.html
Documentation: http://cygwin.com/docs.html
FAQ:   http://cygwin.com/faq/



Re: cvs is broken/cygwin-bug in mkdir()?

2006-02-04 Thread Igor Peshansky
On Sat, 4 Feb 2006, Christopher Faylor wrote:

> On Fri, Feb 03, 2006 at 11:44:22PM -0500, Igor Peshansky wrote:
> >Yes.  Looks like Cygwin is too hasty in assigning the error number: Linux
> >only returns ENOENT if the directory doesn't already exist, but Cygwin
> >will always return it for a trailing dot argument.  The same with rmdir,
> >where it would always return EINVAL, even if the directory doesn't exist
> >(in which case Linux returns ENOENT).  FWIW, POSIX only specifies an
> >action for rmdir() on a trailing dot (EINVAL).
>
> rmdir doesn't always return EINVAL.
>
>   bash-3.00$ ./rmdir qwer
>   -1 = rmdir ("qwer")
>   rmdir: No such file or directory
>   bash-3.00$ ./rmdir qwer/.
>   -1 = rmdir ("qwer/.")
>   rmdir: Invalid argument

I meant in the case of a trailing dot.  On Linux, if directory FOO doesn't
exist, "rmdir FOO/." returns ENOENT.

The fix is pretty much the same as what you did for mkdir, except that
EEXIST is replaced by EINVAL...
Igor
-- 
http://cs.nyu.edu/~pechtcha/
  |\  _,,,---,,_[EMAIL PROTECTED] | [EMAIL PROTECTED]
ZZZzz /,`.-'`'-.  ;-;;,_Igor Peshansky, Ph.D. (name changed!)
 |,4-  ) )-,_. ,\ (  `'-'   old name: Igor Pechtchanski
'---''(_/--'  `-'\_) fL a.k.a JaguaR-R-R-r-r-r-.-.-.  Meow!

"Las! je suis sot... -Mais non, tu ne l'es pas, puisque tu t'en rends compte."
"But no -- you are no fool; you call yourself a fool, there's proof enough in
that!" -- Rostand, "Cyrano de Bergerac"

--
Unsubscribe info:  http://cygwin.com/ml/#unsubscribe-simple
Problem reports:   http://cygwin.com/problems.html
Documentation: http://cygwin.com/docs.html
FAQ:   http://cygwin.com/faq/