2020-07-07 12:09:53 +00:00
|
|
|
#!/usr/bin/env python2
|
2020-08-22 12:40:53 +00:00
|
|
|
#
|
|
|
|
# s3fs - FUSE-based file system backed by Amazon S3
|
|
|
|
#
|
|
|
|
# Copyright 2007-2008 Randy Rizun <rrizun@gmail.com>
|
|
|
|
#
|
|
|
|
# This program is free software; you can redistribute it and/or
|
|
|
|
# modify it under the terms of the GNU General Public License
|
|
|
|
# as published by the Free Software Foundation; either version 2
|
|
|
|
# of the License, or (at your option) any later version.
|
|
|
|
#
|
|
|
|
# This program is distributed in the hope that it will be useful,
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
# GNU General Public License for more details.
|
|
|
|
#
|
|
|
|
# You should have received a copy of the GNU General Public License
|
|
|
|
# along with this program; if not, write to the Free Software
|
|
|
|
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
|
|
#
|
2019-09-26 02:21:22 +00:00
|
|
|
|
|
|
|
import os
|
|
|
|
import sys
|
|
|
|
|
2020-03-01 08:41:45 +00:00
|
|
|
if len(sys.argv) < 4 or len(sys.argv) % 2 != 0:
|
|
|
|
sys.exit("Usage: %s OUTFILE OFFSET_1 SIZE_1 [OFFSET_N SIZE_N]...")
|
|
|
|
|
2019-09-26 02:21:22 +00:00
|
|
|
filename = sys.argv[1]
|
|
|
|
|
|
|
|
fd = os.open(filename, os.O_CREAT | os.O_TRUNC | os.O_WRONLY)
|
|
|
|
try:
|
2020-03-01 08:41:45 +00:00
|
|
|
for i in range(2, len(sys.argv), 2):
|
2020-07-07 12:09:53 +00:00
|
|
|
data = "a" * int(sys.argv[i+1])
|
|
|
|
os.lseek(fd, int(sys.argv[i]), os.SEEK_SET)
|
|
|
|
os.write(fd, data)
|
2019-09-26 02:21:22 +00:00
|
|
|
finally:
|
|
|
|
os.close(fd)
|
2020-08-22 12:40:53 +00:00
|
|
|
|
|
|
|
#
|
|
|
|
# Local variables:
|
|
|
|
# tab-width: 4
|
|
|
|
# c-basic-offset: 4
|
|
|
|
# End:
|
|
|
|
# vim600: noet sw=4 ts=4 fdm=marker
|
|
|
|
# vim<600: noet sw=4 ts=4
|
|
|
|
#
|