代做CSSE2310 – Semester 2, 2024 Assignment 3帮做R语言

CSSE2310 – Semester 2, 2024

Assignment 3

Introduction

The goal of this assignment is to demonstrate your skills and ability in fundamental process management and communication concepts (pipes and signals), and to further develop your C programming skills with a moderately complex program.

You are to create a program (called uqzip) which allows users to compress a file (or set of files) using any one of a set of external compression programs (zip, gzip, xz or bzip2). This will create a .uqz archive file. The program will also allow decompression of the files that it creates.

The assignment will also test your ability to code to a particular programming style. guide, and to use a revision control system appropriately.

Specification

The uqzip program will allow a user to create a .uqz archive file that will hold a compressed file (or files) that can later be extracted from the archive (decompressed) using uqzip. uqzip won’t actually do the compression itself – it will rely on external programs (such as zip, gzip, xz or bzip2 available on moss) to do the compression and will package up the resulting data into a .uqz archive. The .uqz archive file will also store the method of compression used and the filename for each compressed file stored in the archive.

When used for decompression, uqzip will extract each compressed data stream from the .uqz archive file and pipe it to an external decompression program whose output will be saved to a file in the current directory with the original filename. uqzip is to support both sequential and parallel compression and decompression. Sequential processing means files are compressed (or decompressed) one after the other. Parallel processing means files are compressed (or decompressed) in parallel – each using a separate child process of uqzip (or two child processes per file in the case of parallel decompression).

Command Line Arguments

Your uqzip program is to accept command line arguments as follows when doing file compression, i.e. creating a .uqz archive file:

./uqzip [--nozip|--gz|--zip|--xz|--bzip2] [--parallel] [--output outFilename ] filename ...

and as follows when doing decompression (archive extraction):

./uqzip [--parallel] --extract uqz-file

The square brackets ([]) indicate optional arguments or groups of arguments. The pipe symbol (|) indicates a choice. The italics indicate placeholders for user-supplied value arguments. An ellipsis (. . . ) indicates the previous argument can be repeated. Note that the option arguments (those beginning with “--” and their associated value, if any) can be in any order.

When used for compression, uqzip will accept an optional argument specifying the compression method. When none of --bzip2, --gz, --zip, --xz or --nozip are specified then the program is to act as if --nozip is specified – i.e. no compression is used when creating the archive file.

When used for compression, an optional output file name (outFilename ) can be specified by using the --output option argument. If this argument pair is not specified, then the default filename out.uqz is to be used. It can be assumed that (i.e. we will not test a situation when) the outFilename (or default output filename) is given as a filename argument on the command line.

When used for compression, one or more existing filenames to be compressed into the .uqz archive must also be specified after any option arguments. It can be assumed that the first (or only) file name argument does not start with the characters “--”. (If the user wants to specify a file whose name does start with “--” then they should prefix the name with “./”. Any arguments after the first file name are also assumed to be file names, even if they begin with “--”.)

When used for decompression (with the --extract option argument specified), uqzip expects a filename argument to be present (uqz-file , which must be the last argument). This is the name of the .uqz archive file to be decompressed.

If the --parallel option argument is present, then uqzip is to use child processes running in parallel to do the compression or decompression. If this argument is not present, then uqzip will use child processes running sequentially. Full details of the required functionality are provided later in this document.

Some examples of how the program might be run include the following:

./uqzip /usr/dict/share/words

./uqzip --parallel --bzip2 one.txt two.txt three.txt

./uqzip --zip --output lists.uqz --parallel list1 list2 list3 list4 list5 list6

./uqzip --output archive --xz /usr/share/dict/words local/dictionary

./uqzip --extract archive.abc

./uqzip --parallel --extract out.uqz

More details on the expected behaviour of the program are provided later in this document.

Prior to doing anything else, your program must check the command line arguments for validity. If the program receives an invalid command line then it must print the following (two line) message:

Usage: ./uqzip [--nozip|--gz|--zip|--xz|--bzip2] [--parallel] [--output outFilename] filename ...

Or: ./uqzip [--parallel] --extract uqz-file

to standard error (with a newline at the end of each line), and exit with an exit status of 14. Note that the colon (:) symbols on each line are aligned, i.e. three spaces precede “Or:”.

Invalid command lines include (but may not be limited to) any of the following:

• More than one of the option arguments --bzip2, --gz, --zip, --xz, --nozip or --extract is given on the command line

• Any of the option arguments is listed more than once.

• The --output option argument is given but it is not followed by a filename argument

• No filenames are given on the command line.

• --extract is given on the command line along with --output

• --extract is given on the command line along with more than one filename

• An unexpected argument is present.

• Any argument is the empty string.

Checking whether files exist or can be opened is not part of the usage checking (other than checking that filename values are not empty). This is checked after command line validity as described below.

File Checking

Compression

If uqzip is creating an archive file (i.e. --extract is NOT specified on the command line) then it must attempt to open the output file (the given outFilename from the command line, or, if none is present, then the default output filename – out.uqz) for writing. If the file already exists, it must be truncated and overwitten. If the file is unable to be opened for writing then uqzip must print the message:

uqzip: can’t write to file "filename "

to standard error (with a following newline) where filename is replaced by the name of the file that could not be opened for writing. uqzip must then exit with status 17.

The files to be compressed are not checked for existence.

Decompression

If --extract is specified on the command line and uqzip is unable to open the given archive filename (uqz-file argument) for reading, then your program must print the message:

uqzip: unable to read from file "filename "

to standard error (with a following newline) where filename is replaced by the name of the .uqz archive file from the command line. The double quotes must be present. uqzip must then exit with status 6.

Program Behaviour – Compression (Archive Creation)

If the command line and file checks described above are successful and an archive file is to be created (the argument --extract is NOT specified on the command line) then uqzip is to behave as described below.

First, uqzip must write out the header section for the archive file. (See Table 1 for details of the file format, including the header section.) Placeholders should initially be used for the file record offsets because these aren’t known yet. These will need to updated in the file after the compressed files are added to the archive.







热门主题

课程名

mktg2509 csci 2600 38170 lng302 csse3010 phas3226 77938 arch1162 engn4536/engn6536 acx5903 comp151101 phl245 cse12 comp9312 stat3016/6016 phas0038 comp2140 6qqmb312 xjco3011 rest0005 ematm0051 5qqmn219 lubs5062m eee8155 cege0100 eap033 artd1109 mat246 etc3430 ecmm462 mis102 inft6800 ddes9903 comp6521 comp9517 comp3331/9331 comp4337 comp6008 comp9414 bu.231.790.81 man00150m csb352h math1041 eengm4100 isys1002 08 6057cem mktg3504 mthm036 mtrx1701 mth3241 eeee3086 cmp-7038b cmp-7000a ints4010 econ2151 infs5710 fins5516 fin3309 fins5510 gsoe9340 math2007 math2036 soee5010 mark3088 infs3605 elec9714 comp2271 ma214 comp2211 infs3604 600426 sit254 acct3091 bbt405 msin0116 com107/com113 mark5826 sit120 comp9021 eco2101 eeen40700 cs253 ece3114 ecmm447 chns3000 math377 itd102 comp9444 comp(2041|9044) econ0060 econ7230 mgt001371 ecs-323 cs6250 mgdi60012 mdia2012 comm221001 comm5000 ma1008 engl642 econ241 com333 math367 mis201 nbs-7041x meek16104 econ2003 comm1190 mbas902 comp-1027 dpst1091 comp7315 eppd1033 m06 ee3025 msci231 bb113/bbs1063 fc709 comp3425 comp9417 econ42915 cb9101 math1102e chme0017 fc307 mkt60104 5522usst litr1-uc6201.200 ee1102 cosc2803 math39512 omp9727 int2067/int5051 bsb151 mgt253 fc021 babs2202 mis2002s phya21 18-213 cege0012 mdia1002 math38032 mech5125 07 cisc102 mgx3110 cs240 11175 fin3020s eco3420 ictten622 comp9727 cpt111 de114102d mgm320h5s bafi1019 math21112 efim20036 mn-3503 fins5568 110.807 bcpm000028 info6030 bma0092 bcpm0054 math20212 ce335 cs365 cenv6141 ftec5580 math2010 ec3450 comm1170 ecmt1010 csci-ua.0480-003 econ12-200 ib3960 ectb60h3f cs247—assignment tk3163 ics3u ib3j80 comp20008 comp9334 eppd1063 acct2343 cct109 isys1055/3412 math350-real math2014 eec180 stat141b econ2101 msinm014/msing014/msing014b fit2004 comp643 bu1002 cm2030
联系我们
EMail: 99515681@qq.com
QQ: 99515681
留学生作业帮-留学生的知心伴侣!
工作时间:08:00-21:00
python代写
微信客服:codinghelp
站长地图