On Nov 29, 2007 12:23 AM, Charles E Campbell Jr <[EMAIL PROTECTED]> wrote: > > Hello! > > I don't see any way to encrypt/decrypt strings in the vim function > library, but there is a way to encrypt a file buffer. Netrw tries to > make use of ftp, etc and its associated passwords simpler by retaining > the password in a variable (which is not normally saved). Thus one > reads a file via ftp, say, provides the password to do so, and writing > is done without requiring another entry of the password. I thought > about making a temporary "password" automatically using localtime() at > first invocation of netrw and the process's pid. Any good way to get > the vim process's pid? How about under Windows?
On unixes that have /proc, you can get pid of vim examining /proc/self. On another note, if all you need is some pseudorandom number, you can try extract all digits from tempname(). Supposed to be relatively unique. In my linux, :echo libcallnr("libc.so.6", "getpid", "") prints pid of vim. Surprisingly, libcallnr("libc.so", "getpid", "") doesn't. On some older linux, that would be libc.so.5 etc. Doing small loop for N and checking existance of /usr/lib/libc.so.N might help. On some other unixes, libcallnr("libc.so", "getpid", "") would actually work; to make it work for may unixes, you could trap the error and resort /usr/lib/libc.so.N. On windows, somebody should know name of the library and name of the function for correct libcallnr() call. However, if you need several unique/random bytes, the best way on unix is to read /dev/urandom if it exists. Yakov --~--~---------~--~----~------------~-------~--~----~ You received this message from the "vim_dev" maillist. For more information, visit http://www.vim.org/maillist.php -~----------~----~----~----~------~----~------~--~---