Description: This command combines ln and mv into one command. ...

  1. Home
  2. Homework Library
  3. Computer Science
  4. Linux
  5. Description: This command combines ln and mv into one command. ...

QuestionQuestion

Description:

This command combines ln and mv into one command. It allows the user to link/unlink files, move files, and rename files.

Synopsis:

sa [d|l|m|r|u] ARG1 [ARG2]

Options:

d - (rm) deletes a file named ARG
l - (ln) creates a link named ARG1 to file ARG2.
m - (mv) moves a file named ARG1 to ARG2. If ARG2 is a directory, the file is moved into the directory. If ARG2 is a file, it's overwritten.
r - renames a file or directory named ARG1 to ARG2.
u - deletes a link named ARG1

Sample Usages:

sa d sleep deletes file s;eep, if it exists
sa l sleep eage creates a link named sleep to a file named eage
sa m file /tmp moves file to /tmp
sa r foo bar renames foo to bar
sa u spam deletes link named spam
sa displays snopsis

An appropriate error message should be displayed as needed. For example, if the user specifies in invalid directory with the c option or an invalid filename for the l option.

Solution PreviewSolution Preview

These solutions may offer step-by-step problem-solving explanations or good writing examples that include modern styles of formatting and construction of bibliographies out of text citations and references. Students may use these solutions for personal skill-building and practice. Unethical use is strictly forbidden.

#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#define OPTION_LENGTH 1
#define SAMPLE_OPTION_LENGTH 5
#define COMMAND_LENGTH 200
#define ERROR_MESSAGE_LENGTH 1000

enum{
    EMPTY_OPTION = 1,
    NO_ARGUMENT,   
    INVALID_OPTION
};

enum {
    DELETE_FILE = 100,
    LINK,
    MOVE,
    RENAME,
    DELETE_LINK
};

/**
* test input arguments
* @param argc
* @param argv
* @return next state of the program
*/
int preTesting(int argc, char** argv);...

By purchasing this solution you'll be able to access the following files:
Solution.c.

$35.00
for this solution

or FREE if you
register a new account!

PayPal, G Pay, ApplePay, Amazon Pay, and all major credit cards accepted.

Find A Tutor

View available Linux Tutors

Get College Homework Help.

Are you sure you don't want to upload any files?

Fast tutor response requires as much info as possible.

Decision:
Upload a file
Continue without uploading

SUBMIT YOUR HOMEWORK
We couldn't find that subject.
Please select the best match from the list below.

We'll send you an email right away. If it's not in your inbox, check your spam folder.

  • 1
  • 2
  • 3
Live Chats