aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEuAndreh <eu@euandre.org>2021-06-27 12:22:01 -0300
committerEuAndreh <eu@euandre.org>2021-06-27 12:22:01 -0300
commit0834873702fc73a2a17f7854a42d1908bc652683 (patch)
tree0e67362217d5388e5d81cb146c1b4610a6c74d56
parentefe35e99b870dee4dcbc1a738f7d173822fb5460 (diff)
downloadremembering-0834873702fc73a2a17f7854a42d1908bc652683.tar.gz
src/remembering-c.c: Provide more precise location of errors for perror()
-rw-r--r--src/remembering-c.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/remembering-c.c b/src/remembering-c.c
index a6bd8c2..4484816 100644
--- a/src/remembering-c.c
+++ b/src/remembering-c.c
@@ -19,7 +19,7 @@ const int EXIT_USAGE = 2;
int usage(FILE *stream) {
const char *const msg = "Usage: remembering -p PROFILE -c COMMAND\n";
if (fprintf(stream, msg) < 0) {
- perror("usage()");
+ perror("usage() - fprintf()");
return -1;
}
return 0;
@@ -34,7 +34,7 @@ static int help(FILE *stream) {
" -V, --version print the version number\n"
"\nSee \"man remembering\" for more information\n";
if (fprintf(stream, msg) < 0) {
- perror("help()");
+ perror("help() - fprint()");
return -1;
}
return 0;
@@ -43,7 +43,7 @@ static int help(FILE *stream) {
static int version(FILE *stream) {
const char *const msg = "remembering-" VERSION " " DATE "\n";
if (fprintf(stream, msg) < 0) {
- perror("version()");
+ perror("version() - fprintf()");
return -1;
}
return 0;
@@ -52,7 +52,7 @@ static int version(FILE *stream) {
static int missing(FILE *stream, const char *const argument) {
const char *const msg = "Missing option: %s\n";
if (fprintf(stream, msg, argument) < 0) {
- perror("missing()");
+ perror("missing() - fprintf()");
return -1;
}
return 0;
@@ -72,7 +72,7 @@ static char *get_profile_file(const char *const profile, FILE *stream) {
sizeof(char);
char *const home_with_suffix = malloc(home_suffix_size);
if (!home_with_suffix) {
- perror("get_profile_file() - home_with_suffix");
+ perror("get_profile_file() - malloc() - home_with_suffix");
return NULL;
}
strcat(home_with_suffix, home);
@@ -92,7 +92,7 @@ static char *get_profile_file(const char *const profile, FILE *stream) {
sizeof(char);
char *const profile_file = malloc(size);
if (!profile_file) {
- perror("get_profile_file() - profile_file");
+ perror("get_profile_file() - malloc() - profile_file");
free(home);
return NULL;
}