UNIX System Programming


University of Technology Sydney
Faculty of Engineering and Information Technology

UNIX Systems Programming

Description

This assignment is an individual programming assignment using Perl. It addresses objectives 2 and 3 as listed in the Subject Outline document.

No limits apply to the number of lines of code of the program.

Assignments are to be completed individually (this might be checked with the use of anti-plagiarism tools such as Turnitin). You should not receive help in the preparation of this assignment, nor ask anyone else to prepare it on your behalf in any way.


Title: locale with Perl

In this assignment, you will write a Perl program inspired by Unix command locale. Your Perl program will parse a file containing information about local language environments and character maps and will generate output depending on the command line.

These are the specifications for your Perl program:

1.           It must be named locale.pl

2.           It must be invoked as:

locale.pl option locale_info_file

The program must check that the locale_info_file argument exists, is a file and is readable. If not, it must print an error message to the standard output and exit. The values for the option argument are described below.

3.       File locale_info_file can have any arbitrary name. It must be a file of text with the following format:

a. The file consists of an arbitrary number of lines (including, possibly, zero lines).

b.    Each line must contain four fields separated by commas.

c.     The four fields are: type, language, filename, size in bytes.

d. The type field can only have as value the strings locale or charmap.

e.   The language and filename fields are each a string of characters of arbitrary (yet reasonably limited) length. Acceptable characters include: lower and upper case letters, digits, underscore, dot.

f.      The size in bytes field is a positive integer number.

The following is an example of file locale_info_file:

locale,English,en_AU,6251
locale,French,fr_BE,25477
charmap,English,EN,5423
locale,English,en_US,100000
charmap,Chinese,GBK,75443


Very important note: your program is not expected to verify that file locale_info_file complies with the above specifications. It will only be tested with compliant files.

4.          Your program can be invoked with option: -a. In this case, it must print the following:

Available locales:

<filename of first locale in appearance order> <filename of second locale in appearance order>

<filename of last locale in appearance order>



Example with the example locale_info_file given above:

Command line:

locale.pl -a locale_info_file

Available locales:
en_AU

fr_BE
en_US

In the case in which file locale_info_file is empty or no available locales exist, your program must instead only print:

No locales available

5.          Your program can be invoked with option: -m. In this case, it must print the following:

Available charmaps:

<filename of first charmap in appearance order> <filename of second charmap in appearance order>

<filename of last charmap in appearance order>

Example with the example locale_info_file given above:

Command line:

locale.pl -m locale_info_file

Available charmaps:

EN GBK

In the case in which file locale_info_file is empty or no available charmaps exist, your program must instead only print:

No charmaps available

6.         Your program can be invoked with option: -s. In this case, it must only print the following string:

Total size in bytes of all locales: <total size in bytes of all locales>

Example with the example locale_info_file given above:

Command line:

locale.pl –s locale_info_file

Output:

Total size in bytes of all locales: 131728


In the case in which file locale_info_file is empty or no available locales exist, your program must print:

Total size in bytes of all locales: 0

7.    Your program can be invoked with option: -l <language>. Argument <language> follows the same rules as the language field. In this case, it must print:

Language <name>:

Total number of locales: <total number of locales in that language (possibly 0)>

Total number of charmaps: <total number of charmaps in that language (possibly 0)>

Example with the example locale_info_file given above:

Command line:

locale.pl –l English locale_info_file

Output:

Language English:
Total number of locales: 2
Total number of charmaps: 1

Another example with the example locale_info_file given above:

Command line:

locale.pl –l Chinese locale_info_file

Output:

Language Chinese:
Total number of locales: 0
Total number of charmaps: 1

In the case in which language <language> is not present at all in locale_info_file, your program must print:

No locales or charmaps in this language

8.        Your program can be invoked with option: -v. In this case, it must only print your name, surname and student ID in a format of your choice.

9.          No options can be used simultaneously. This means that your program can only be invoked with one of the options at a time.

10.   If your program is invoked with a valid file argument, but any other syntax than what specified above, it must only print the following string to the standard output:

Invalid command syntax


Example:

Command line:

locale.pl -Z locale_info_file

Output:

Invalid command syntax

11. Zip your file locale.pl into a file named USP_<yourSurname>_<yourStudentID>.zip and submit it with the modalities specified above. Several free zip utilities are available on the WWW.


Please be reminded that:


   This assignment must be your own work and you should not be helped by anyone to prepare it in any way; your assignment may be tested by anti-plagiarism software that detects superficial changes such as changing variable names, swapping lines of code and the like.

 Understanding the assignment specifications is part of the assignment itself and no further instructions will be provided; on the other hand, whatever is not constrained you can implement it according to your own best judgment.


To get solution visit our website www.sourceessay.com











































Comments

Popular posts from this blog

Assignment Help: Add Valuable Factors In Your Learning Skills

The Helpful Essay Writing Guide: Structure, Outline, Tips And Format

Language Techniques Every Student Must Know