Untitled
unknown
plain_text
4 years ago
1.2 kB
7
Indexable
#include <stdlib.h>
#include <unistd.h>
#include <ctype.h>
#include <stdio.h>
#include <string.h>
#include <errno.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <ctype.h>
void printCommandLineRules(void) {
printf("Please use the correct syntax. \n"
"chunk [options] -f filename.txt [-p prefix] [-s suffix] \n"
"chunk [options] [-p prefix] < filename.txt \n"
"[options] refer to either of the 3: -l, -w, -c. they are followed with a number. \n"
"for example, -w 300 (smaller files of 300 words) \n");
}
void printNotSetError(void) {
fprintf(stderr, "Invalid Command line argument - Something was not set...Exiting. \n");
}
void noInputFileError(void) {
fprintf(stderr, "There is no file input. Terminating...\n");
exit(0);
}
void fileAlreadyExistsError(void) {
fprintf(stderr, "The output file already exists. Use another prefix and suffix. Terminating...\n");
exit(0);
}
void printValues(int count, char* prefix, char* suffix, int hasLines, int hasWords,
int hasCharacters) {
printf("Count: %d\n", count);
printf("Prefix: %s\n", prefix);
printf("Suffix: %s\n", suffix);
printf("hasLines: %i\n", hasLines);
printf("hasWords: %i\n", hasWords);
printf("hasCharacters: %i\n", hasCharacters);
}
Editor is loading...