@@ -65,7 +65,7 @@ static bool ignore_remarks_md = false; /* true ==> skip remarks.md check
65
65
* Use the usage() function to print the usage_msg([0-9]?)+ strings.
66
66
*/
67
67
static const char * const usage_msg =
68
- "usage: %s [-h] [-v level] [-J level] [-V] [-q] [-i file] topdir \n"
68
+ "usage: %s [-h] [-v level] [-J level] [-V] [-q] [-i file] submission_dir \n"
69
69
"\n"
70
70
"\t-h\t\tprint help message and exit\n"
71
71
"\t-v level\tset verbosity level (def level: %d)\n"
@@ -174,29 +174,30 @@ usage(int exitcode, char const *prog, char const *str)
174
174
* to know all the possible paths in a submission/entry, in those cases it must
175
175
* be the exact path.
176
176
*
177
- * NOTE: these paths are from UNDER the topdir. So if one has the file:
177
+ * NOTE: these paths are from UNDER the submission directory. So if one has the
178
+ * file:
178
179
*
179
- * topdir /foo/bar/baz
180
+ * submission_dir /foo/bar/baz
180
181
*
181
182
* and they run the command:
182
183
*
183
- * chkentry topdir
184
+ * chkentry submission_dir
184
185
*
185
186
* and want to ignore the path baz they should NOT do:
186
187
*
187
- * chkentry -i topdir /foo/bar/baz topdir
188
+ * chkentry -i submission_dir /foo/bar/baz submission_dir
188
189
*
189
190
* Rather they should do:
190
191
*
191
- * chkentry -i foo/bar/baz topdir
192
+ * chkentry -i foo/bar/baz submission_dir
192
193
*
193
194
* NOTE: this function uses the static char *abbrevs[][2] to find abbreviations.
194
195
* In the case nothing is found then the path will be added to the list as is.
195
196
*
196
197
* NOTE: this function will not add a path to the array more than once so if you
197
198
* were to do:
198
199
*
199
- * chkentry -i foo -i foo topdir
200
+ * chkentry -i foo -i foo submission_dir
200
201
*
201
202
* the ignored list would only have the path 'foo' once.
202
203
*
577
578
main (int argc , char * argv [])
578
579
{
579
580
char const * program = NULL ; /* our name */
580
- char * * topdir = NULL ; /* directory from which files are to be checked */
581
+ char * * submission_dir = NULL ; /* directory from which files are to be checked */
581
582
extern char * optarg ; /* option argument */
582
583
extern int optind ; /* argv index of the next arg */
583
584
char const * auth_filename = "." ; /* .auth.json file to process, or NULL ==> no .auth.json to process */
@@ -694,7 +695,7 @@ main(int argc, char *argv[])
694
695
argv += optind ;
695
696
switch (argc ) {
696
697
case 1 :
697
- topdir = argv ;
698
+ submission_dir = argv ;
698
699
break ;
699
700
case 2 :
700
701
if (!strcmp (argv [0 ], "." ) && !strcmp (argv [1 ], "." )) {
@@ -708,20 +709,20 @@ main(int argc, char *argv[])
708
709
break ;
709
710
}
710
711
711
- if (topdir != NULL && * topdir != NULL ) {
712
+ if (submission_dir != NULL && * submission_dir != NULL ) {
712
713
/*
713
714
* check if we can search / work within the directory
714
715
*/
715
- if (!exists (* topdir )) {
716
- err (56 , __func__ , "directory does not exist: %s" , * topdir );
716
+ if (!exists (* submission_dir )) {
717
+ err (56 , __func__ , "directory does not exist: %s" , * submission_dir );
717
718
not_reached ();
718
719
}
719
- if (!is_dir (* topdir )) {
720
- err (57 , __func__ , "is not a directory: %s" , * topdir );
720
+ if (!is_dir (* submission_dir )) {
721
+ err (57 , __func__ , "is not a directory: %s" , * submission_dir );
721
722
not_reached ();
722
723
}
723
- if (!is_exec (* topdir )) {
724
- err (58 , __func__ , "directory is not searchable: %s" , * topdir );
724
+ if (!is_exec (* submission_dir )) {
725
+ err (58 , __func__ , "directory is not searchable: %s" , * submission_dir );
725
726
not_reached ();
726
727
}
727
728
@@ -743,7 +744,7 @@ main(int argc, char *argv[])
743
744
* make sure .entry.json exists unless -i entry
744
745
*/
745
746
if (!ignore_entry ) {
746
- path = find_path (ENTRY_JSON_FILENAME , * topdir , -1 , & cwd , false, & fts );
747
+ path = find_path (ENTRY_JSON_FILENAME , * submission_dir , -1 , & cwd , false, & fts );
747
748
if (path == NULL ) {
748
749
dbg (DBG_LOW , "file does NOT exist and -w USED and -i entry NOT used: %s" , ENTRY_JSON_FILENAME );
749
750
++ all_extra_err_count ;
@@ -769,7 +770,7 @@ main(int argc, char *argv[])
769
770
* unless -i auth .auth.json must NOT exist
770
771
*/
771
772
if (!ignore_auth ) {
772
- path = find_path (AUTH_JSON_FILENAME , * topdir , -1 , & cwd , false, & fts );
773
+ path = find_path (AUTH_JSON_FILENAME , * submission_dir , -1 , & cwd , false, & fts );
773
774
if (path != NULL ) {
774
775
dbg (DBG_LOW , "file EXISTS and -w USED and -i auth NOT used: %s" , AUTH_JSON_FILENAME );
775
776
++ all_extra_err_count ;
@@ -789,7 +790,7 @@ main(int argc, char *argv[])
789
790
/*
790
791
* .info.json
791
792
*/
792
- path = find_path (INFO_JSON_FILENAME , * topdir , -1 , & cwd , false, & fts );
793
+ path = find_path (INFO_JSON_FILENAME , * submission_dir , -1 , & cwd , false, & fts );
793
794
if (path != NULL ) {
794
795
dbg (DBG_LOW , "file EXISTS and -w USED and -i info NOT used: %s" , INFO_JSON_FILENAME );
795
796
++ all_extra_err_count ;
@@ -809,7 +810,7 @@ main(int argc, char *argv[])
809
810
/*
810
811
* README.md
811
812
*/
812
- path = find_path (README_MD_FILENAME , * topdir , -1 , & cwd , false, & fts );
813
+ path = find_path (README_MD_FILENAME , * submission_dir , -1 , & cwd , false, & fts );
813
814
if (path == NULL ) {
814
815
dbg (DBG_LOW , "file does NOT exist and -w USED and -i README NOT used: %s" , README_MD_FILENAME );
815
816
++ all_extra_err_count ;
@@ -837,7 +838,7 @@ main(int argc, char *argv[])
837
838
/*
838
839
* index.html
839
840
*/
840
- path = find_path (INDEX_HTML_FILENAME , * topdir , -1 , & cwd , false, & fts );
841
+ path = find_path (INDEX_HTML_FILENAME , * submission_dir , -1 , & cwd , false, & fts );
841
842
if (path == NULL ) {
842
843
dbg (DBG_LOW , "file does NOT exist and -w USED and -i index NOT used: %s" , INDEX_HTML_FILENAME );
843
844
++ all_extra_err_count ;
@@ -866,7 +867,7 @@ main(int argc, char *argv[])
866
867
/*
867
868
* Makefile
868
869
*/
869
- path = find_path (MAKEFILE_FILENAME , * topdir , -1 , & cwd , false, & fts );
870
+ path = find_path (MAKEFILE_FILENAME , * submission_dir , -1 , & cwd , false, & fts );
870
871
if (path == NULL ) {
871
872
dbg (DBG_LOW , "%s does not exist and -w used and -i Makefile not used" , MAKEFILE_FILENAME );
872
873
++ all_extra_err_count ;
@@ -894,7 +895,7 @@ main(int argc, char *argv[])
894
895
/*
895
896
* prog.c
896
897
*/
897
- path = find_path (PROG_C_FILENAME , * topdir , -1 , & cwd , false, & fts );
898
+ path = find_path (PROG_C_FILENAME , * submission_dir , -1 , & cwd , false, & fts );
898
899
if (path == NULL ) {
899
900
dbg (DBG_LOW , "%s does not exist and -w used and -i prog.c not used" , PROG_C_FILENAME );
900
901
++ all_extra_err_count ;
@@ -922,7 +923,7 @@ main(int argc, char *argv[])
922
923
/*
923
924
* prog
924
925
*/
925
- path = find_path (PROG_FILENAME , * topdir , -1 , & cwd , false, & fts );
926
+ path = find_path (PROG_FILENAME , * submission_dir , -1 , & cwd , false, & fts );
926
927
if (path != NULL ) {
927
928
dbg (DBG_LOW , "%s exists and -w used and -i prog not used" , PROG_FILENAME );
928
929
++ all_extra_err_count ;
@@ -942,7 +943,7 @@ main(int argc, char *argv[])
942
943
/*
943
944
* remarks.md
944
945
*/
945
- path = find_path (REMARKS_FILENAME , * topdir , -1 , & cwd , false, & fts );
946
+ path = find_path (REMARKS_FILENAME , * submission_dir , -1 , & cwd , false, & fts );
946
947
if (path != NULL ) {
947
948
dbg (DBG_LOW , "%s exists and -w used and -i remarks not used" , REMARKS_FILENAME );
948
949
++ all_extra_err_count ;
@@ -968,7 +969,7 @@ main(int argc, char *argv[])
968
969
* list of paths to ignore is already in the fts->ignore list we
969
970
* don't need to do anything special.
970
971
*/
971
- found = find_paths (paths , * topdir , -1 , & cwd , false, & fts );
972
+ found = find_paths (paths , * submission_dir , -1 , & cwd , false, & fts );
972
973
if (found != NULL ) {
973
974
/*
974
975
* case: files were found, check that they are both allowed and
@@ -1051,7 +1052,7 @@ main(int argc, char *argv[])
1051
1052
* make sure .entry.json does NOT exist unless -i entry
1052
1053
*/
1053
1054
if (!ignore_entry ) {
1054
- path = find_path (ENTRY_JSON_FILENAME , * topdir , -1 , & cwd , false, & fts );
1055
+ path = find_path (ENTRY_JSON_FILENAME , * submission_dir , -1 , & cwd , false, & fts );
1055
1056
if (path != NULL ) {
1056
1057
dbg (DBG_LOW , "%s exists and -w and -i entry not used and " , ENTRY_JSON_FILENAME );
1057
1058
++ all_extra_err_count ;
@@ -1069,7 +1070,7 @@ main(int argc, char *argv[])
1069
1070
* unless -i auth .auth.json MUST exist
1070
1071
*/
1071
1072
if (!ignore_auth ) {
1072
- path = find_path (AUTH_JSON_FILENAME , * topdir , -1 , & cwd , false, & fts );
1073
+ path = find_path (AUTH_JSON_FILENAME , * submission_dir , -1 , & cwd , false, & fts );
1073
1074
if (path == NULL ) {
1074
1075
dbg (DBG_LOW , "%s does not exist and -i auth not used" , AUTH_JSON_FILENAME );
1075
1076
++ all_extra_err_count ;
@@ -1097,7 +1098,7 @@ main(int argc, char *argv[])
1097
1098
/*
1098
1099
* .info.json
1099
1100
*/
1100
- path = find_path (INFO_JSON_FILENAME , * topdir , -1 , & cwd , false, & fts );
1101
+ path = find_path (INFO_JSON_FILENAME , * submission_dir , -1 , & cwd , false, & fts );
1101
1102
if (path == NULL ) {
1102
1103
dbg (DBG_LOW , "%s does not exist and -i info not used" , INFO_JSON_FILENAME );
1103
1104
++ all_extra_err_count ;
@@ -1125,7 +1126,7 @@ main(int argc, char *argv[])
1125
1126
/*
1126
1127
* README.md
1127
1128
*/
1128
- path = find_path (README_MD_FILENAME , * topdir , -1 , & cwd , false, & fts );
1129
+ path = find_path (README_MD_FILENAME , * submission_dir , -1 , & cwd , false, & fts );
1129
1130
if (path != NULL ) {
1130
1131
dbg (DBG_LOW , "%s exists and -i README not used" , README_MD_FILENAME );
1131
1132
++ all_extra_err_count ;
@@ -1145,7 +1146,7 @@ main(int argc, char *argv[])
1145
1146
/*
1146
1147
* index.html
1147
1148
*/
1148
- path = find_path (INDEX_HTML_FILENAME , * topdir , -1 , & cwd , false, & fts );
1149
+ path = find_path (INDEX_HTML_FILENAME , * submission_dir , -1 , & cwd , false, & fts );
1149
1150
if (path != NULL ) {
1150
1151
dbg (DBG_LOW , "%s exists and -i index not used" , INDEX_HTML_FILENAME );
1151
1152
++ all_extra_err_count ;
@@ -1166,7 +1167,7 @@ main(int argc, char *argv[])
1166
1167
/*
1167
1168
* Makefile
1168
1169
*/
1169
- path = find_path (MAKEFILE_FILENAME , * topdir , -1 , & cwd , false, & fts );
1170
+ path = find_path (MAKEFILE_FILENAME , * submission_dir , -1 , & cwd , false, & fts );
1170
1171
if (path == NULL ) {
1171
1172
dbg (DBG_LOW , "%s does not exist and -i Makefile not used" , MAKEFILE_FILENAME );
1172
1173
++ all_extra_err_count ;
@@ -1194,7 +1195,7 @@ main(int argc, char *argv[])
1194
1195
/*
1195
1196
* prog.c
1196
1197
*/
1197
- path = find_path (PROG_C_FILENAME , * topdir , -1 , & cwd , false, & fts );
1198
+ path = find_path (PROG_C_FILENAME , * submission_dir , -1 , & cwd , false, & fts );
1198
1199
if (path == NULL ) {
1199
1200
dbg (DBG_LOW , "%s does not exist and -i prog.c not used" , PROG_C_FILENAME );
1200
1201
++ all_extra_err_count ;
@@ -1222,7 +1223,7 @@ main(int argc, char *argv[])
1222
1223
/*
1223
1224
* prog
1224
1225
*/
1225
- path = find_path (PROG_FILENAME , * topdir , -1 , & cwd , false, & fts );
1226
+ path = find_path (PROG_FILENAME , * submission_dir , -1 , & cwd , false, & fts );
1226
1227
if (path != NULL ) {
1227
1228
dbg (DBG_LOW , "%s exists and -i prog not used" , PROG_FILENAME );
1228
1229
++ all_extra_err_count ;
@@ -1242,7 +1243,7 @@ main(int argc, char *argv[])
1242
1243
/*
1243
1244
* remarks.md
1244
1245
*/
1245
- path = find_path (REMARKS_FILENAME , * topdir , -1 , & cwd , false, & fts );
1246
+ path = find_path (REMARKS_FILENAME , * submission_dir , -1 , & cwd , false, & fts );
1246
1247
if (path == NULL ) {
1247
1248
dbg (DBG_LOW , "%s does not exist and -i remarks not used" , REMARKS_FILENAME );
1248
1249
++ all_extra_err_count ;
@@ -1275,7 +1276,7 @@ main(int argc, char *argv[])
1275
1276
* list of paths to ignore is already in the fts->ignore list we
1276
1277
* don't need to do anything special.
1277
1278
*/
1278
- found = find_paths (paths , * topdir , -1 , & cwd , false, & fts );
1279
+ found = find_paths (paths , * submission_dir , -1 , & cwd , false, & fts );
1279
1280
if (found != NULL ) {
1280
1281
/*
1281
1282
* case: files were found, check that they are both allowed and
@@ -1350,33 +1351,33 @@ main(int argc, char *argv[])
1350
1351
}
1351
1352
1352
1353
/*
1353
- * open the .auth.json file under topdir if !ignore_auth && -w not used
1354
+ * open the .auth.json file under submission_dir if !ignore_auth && -w not used
1354
1355
*/
1355
1356
if (!ignore_auth && !winning_entry_mode ) {
1356
1357
auth_filename = ".auth.json" ;
1357
- auth_stream = open_dir_file (* topdir , auth_filename );
1358
+ auth_stream = open_dir_file (* submission_dir , auth_filename );
1358
1359
if (auth_stream == NULL ) { /* paranoia */
1359
- err (63 , __func__ , "auth_stream = open_dir_file(%s, %s) returned NULL" , * topdir , auth_filename );
1360
+ err (63 , __func__ , "auth_stream = open_dir_file(%s, %s) returned NULL" , * submission_dir , auth_filename );
1360
1361
not_reached ();
1361
1362
}
1362
- auth_path = calloc_path (* topdir , auth_filename );
1363
+ auth_path = calloc_path (* submission_dir , auth_filename );
1363
1364
if (auth_path == NULL ) {
1364
1365
err (64 , __func__ , "auth_path is NULL" );
1365
1366
not_reached ();
1366
1367
}
1367
1368
}
1368
1369
1369
1370
/*
1370
- * open the .info.json file under topdir if !ignore_info and -w not used
1371
+ * open the .info.json file under submission_dir if !ignore_info and -w not used
1371
1372
*/
1372
1373
if (!ignore_info && !winning_entry_mode ) {
1373
1374
info_filename = ".info.json" ;
1374
- info_stream = open_dir_file (* topdir , info_filename );
1375
+ info_stream = open_dir_file (* submission_dir , info_filename );
1375
1376
if (info_stream == NULL ) { /* paranoia */
1376
- err (65 , __func__ , "info_stream = open_dir_file(%s, %s) returned NULL" , * topdir , info_filename );
1377
+ err (65 , __func__ , "info_stream = open_dir_file(%s, %s) returned NULL" , * submission_dir , info_filename );
1377
1378
not_reached ();
1378
1379
}
1379
- info_path = calloc_path (* topdir , info_filename );
1380
+ info_path = calloc_path (* submission_dir , info_filename );
1380
1381
if (info_path == NULL ) {
1381
1382
err (66 , __func__ , "info_path is NULL" );
1382
1383
not_reached ();
@@ -1461,7 +1462,7 @@ main(int argc, char *argv[])
1461
1462
*/
1462
1463
dbg (DBG_HIGH , "about to perform JSON semantic check for .info.json file: %s" , info_path );
1463
1464
info_all_err_count = json_sem_check (info_tree , JSON_DEFAULT_MAX_DEPTH , sem_info ,
1464
- & info_count_err , & info_val_err , * topdir );
1465
+ & info_count_err , & info_val_err , * submission_dir );
1465
1466
1466
1467
/*
1467
1468
* firewall on json_sem_check() results AND count errors for .info.json
0 commit comments