Mercurial > gftp.yaz
view docs/parse-netrc.pl @ 367:d5409bf03ff1
2003-1-18 Brian Masney <masneyb@gftp.org>
* lib/protocols.c (gftp_parse_url) - if the URL is the local filesystem, skip over the whitespace at the beginning.
* lib/rfc959.c (rfc959_syst) - allow the string MVS and OS/MVS for the
MVS directory listings.
* src/gtk/gtkui_transfer.c src/gtk/transfer.c src/gtk/gftpui.c -
started to move the transfer functionality into the uicommon directory.
Added the text and GTK+ UI specific transfer functions.
* src/gtk/Makefile.am po/POTFILES.in - added gtkui_transfer.c
* src/gtk/dnd.c src/gtk/gtkui_transfer.c src/gtk/view_dialog.c -
s/add_file_transfer/gtkui_common_add_file_transfer/
* src/gtk/gftp-gtk.c src/gtk/gftp-gtk.h - removed transfer_mutex
* src/gtk/gtkui.c src/text/textui.c - added
gftpui_add_file_to_transfer()
* src/uicommon/gftpui_callbacks.c src/uicommon/gftpui.c - in all of the
thread callback functions, don't alter the return value in the function. Return it as is.
author | masneyb |
---|---|
date | Sun, 18 Jan 2004 20:09:28 +0000 |
parents | 8b1883341c6f |
children |
line wrap: on
line source
#!/usr/bin/perl -w # Brian Masney <masneyb@gftp.org> my ($host, $user, $pass, $account, $descr, %bmhash); use strict; open NRC, "<.netrc" or die "Can't open .netrc: $!\n"; open BM, "+>>.gftp/bookmarks" or die "Can't open .gftp/bookmarks: $!\nTry running gFTP once to create a default bookmarks file\n"; seek (BM, 0, 0); while (<BM>) { ($descr) = /\[(.*?)\]/; next if !defined ($descr); $bmhash{$descr} = 1; } seek (BM, 0, 2); while (<NRC>) { if (/machine /) { print_bookmark (); ($host) = /machine (.*?)\s+/; } if (/login /) { ($user) = /login (.*?)\s+/; } if (/password /) { ($pass) = /password (.*?)\s+/; } if (/account /) { ($account) = /account (.*?)\s+/; } } print_bookmark (); close NRC; close BM; print "The contents of your .netrc file should now be stored in .gftp/bookmarks\n"; sub print_bookmark { my $i; return if !defined ($host); if (!defined ($bmhash{$host})) { $descr = $host; } else { for ($i=0; ; $i++) { $descr = "$host ($i)"; last if !defined ($bmhash{$descr}); } } print BM "[$descr]\n"; print BM "hostname=$host\n"; print BM "port=21\n"; print BM "protocol=FTP\n"; print BM "remote directory=\n"; print BM "local directory=\n"; if (!defined ($user)) { $user = "anonymous"; } print BM "username=$user\n"; if ($user eq "anonymous" || !defined ($pass)) { $pass = "\@EMAIL\@"; } print BM "password=$pass\n"; if (!defined ($account)) { $account = ""; } print BM "account=$account\n\n"; print "Added $descr = $user\@$host\n"; undef ($host); undef ($user); undef ($pass); undef ($account); }