Skip to content

Commit

Permalink
Add showpenalty option
Browse files Browse the repository at this point in the history
  • Loading branch information
PaulWalther authored Oct 18, 2024
1 parent 0f5be60 commit d907833
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions src/turnin.c
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ int maxturnins = 10;
int binary = 0;
int daypenalty = 10;
int weekendpenalty = 5;

int showpenalty = 1;
int penalty = 0;

time_t duedate = 0;
Expand Down Expand Up @@ -168,7 +168,8 @@ void version() {
"Copyright 2010-2014 Bryce Boe <[email protected]>\n"
"Copyright 2014 Foivos S. Zakkak <[email protected]> and\n"
" Antonios Chariton<[email protected]>\n"
"Copyright 2015-2022 Foivos S. Zakkak <[email protected]>\n\n"
"Copyright 2015-2022 Foivos S. Zakkak <[email protected]>\n"
"Copyright 2024 Paul Walther <[email protected]>\n\n"
"License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>.\n"
"This is free software: you are free to change and redistribute it.\n"
"There is NO WARRANTY, to the extent permitted by law.\n\n"
Expand Down Expand Up @@ -634,6 +635,13 @@ void setup(char *arg) {
exit(1);
}
weekendpenalty = n;
} else if (strcasecmp(keyword, "showpenalty") == 0) {
if ((n != 0) || (n != 1)) {
fprintf(stderr, "turnin: showpenalty must be either 0 or 1\n"
" Please notify the Instructor or a TA.\n");
exit(1);
}
showpenalty = n;
} else if (strcasecmp(keyword, "duedate") == 0) {
if (sscanf(buf, "%s %14c", keyword, str_date) != 2) {
warn = 1;
Expand Down Expand Up @@ -1385,7 +1393,9 @@ void checkdue() {
fprintf(stderr, "******************************************\n");
(void)fclose(fd);
}
fprintf(stderr, "\n*** This turn in will get %d%% penalty, due to late turn in, on the final grade ***\n", penalty);
if ((penalty > 0) && showpenalty) {
fprintf(stderr, "\n*** This turn in will get %d%% penalty, due to late turn in, on the final grade ***\n", penalty);
}
wanttocontinue();
}

Expand Down

0 comments on commit d907833

Please sign in to comment.