
*** to conform to clang-format’s LLVM style. This kind of mass change has *** two obvious implications: Firstly, merging this particular commit into a downstream fork may be a huge effort. Alternatively, it may be worth merging all changes up to this commit, performing the same reformatting operation locally, and then discarding the merge for this particular commit. The commands used to accomplish this reformatting were as follows (with current working directory as the root of the repository): find . \( -iname "*.c" -or -iname "*.cpp" -or -iname "*.h" -or -iname "*.mm" \) -exec clang-format -i {} + find . -iname "*.py" -exec autopep8 --in-place --aggressive --aggressive {} + ; The version of clang-format used was 3.9.0, and autopep8 was 1.2.4. Secondly, “blame” style tools will generally point to this commit instead of a meaningful prior commit. There are alternatives available that will attempt to look through this change and find the appropriate prior commit. YMMV. llvm-svn: 280751
48 lines
1.6 KiB
Python
48 lines
1.6 KiB
Python
#!/usr/bin/env python
|
|
|
|
"""This demonstrates an FTP "bookmark". This connects to an ftp site; does a
|
|
few ftp stuff; and then gives the user interactive control over the session. In
|
|
this case the "bookmark" is to a directory on the OpenBSD ftp server. It puts
|
|
you in the i386 packages directory. You can easily modify this for other sites.
|
|
"""
|
|
|
|
import pexpect
|
|
import sys
|
|
|
|
child = pexpect.spawn('ftp ftp.openbsd.org')
|
|
child.expect('(?i)name .*: ')
|
|
child.sendline('anonymous')
|
|
child.expect('(?i)password')
|
|
child.sendline('pexpect@sourceforge.net')
|
|
child.expect('ftp> ')
|
|
child.sendline('cd /pub/OpenBSD/3.7/packages/i386')
|
|
child.expect('ftp> ')
|
|
child.sendline('bin')
|
|
child.expect('ftp> ')
|
|
child.sendline('prompt')
|
|
child.expect('ftp> ')
|
|
child.sendline('pwd')
|
|
child.expect('ftp> ')
|
|
print("Escape character is '^]'.\n")
|
|
sys.stdout.write(child.after)
|
|
sys.stdout.flush()
|
|
child.interact() # Escape character defaults to ^]
|
|
# At this point this script blocks until the user presses the escape character
|
|
# or until the child exits. The human user and the child should be talking
|
|
# to each other now.
|
|
|
|
# At this point the script is running again.
|
|
print 'Left interactve mode.'
|
|
|
|
# The rest is not strictly necessary. This just demonstrates a few functions.
|
|
# This makes sure the child is dead; although it would be killed when
|
|
# Python exits.
|
|
if child.isalive():
|
|
child.sendline('bye') # Try to ask ftp child to exit.
|
|
child.close()
|
|
# Print the final state of the child. Normally isalive() should be FALSE.
|
|
if child.isalive():
|
|
print 'Child did not exit gracefully.'
|
|
else:
|
|
print 'Child exited gracefully.'
|