mirror of
https://github.com/sheumann/hush.git
synced 2024-08-21 11:28:57 +00:00
Remove == TRUE' tests and convert
!= TRUE' and `== FALSE' tests to use !.
This commit is contained in:
parent
31c73af656
commit
1f0c43668a
@ -626,7 +626,7 @@ int BZ2_decompress(DState *s)
|
||||
switch (switch_val) {
|
||||
case BZ_X_MAGIC_1:
|
||||
s->state = BZ_X_MAGIC_1;
|
||||
if (get_bits(s, &uc, 8) == FALSE) {
|
||||
if (! get_bits(s, &uc, 8)) {
|
||||
retVal = BZ_OK;
|
||||
goto save_state_and_return;
|
||||
}
|
||||
@ -637,7 +637,7 @@ int BZ2_decompress(DState *s)
|
||||
|
||||
case BZ_X_MAGIC_2:
|
||||
s->state = BZ_X_MAGIC_2;
|
||||
if (get_bits(s, &uc, 8) == FALSE) {
|
||||
if (! get_bits(s, &uc, 8)) {
|
||||
retVal = BZ_OK;
|
||||
goto save_state_and_return;
|
||||
}
|
||||
@ -648,7 +648,7 @@ int BZ2_decompress(DState *s)
|
||||
|
||||
case BZ_X_MAGIC_3:
|
||||
s->state = BZ_X_MAGIC_3;
|
||||
if (get_bits(s, &uc, 8) == FALSE) {
|
||||
if (! get_bits(s, &uc, 8)) {
|
||||
retVal = BZ_OK;
|
||||
goto save_state_and_return;
|
||||
}
|
||||
@ -659,7 +659,7 @@ int BZ2_decompress(DState *s)
|
||||
|
||||
case BZ_X_MAGIC_4:
|
||||
s->state = BZ_X_MAGIC_4;
|
||||
if (get_bits(s, &s->blockSize100k, 8) == FALSE) {
|
||||
if (! get_bits(s, &s->blockSize100k, 8)) {
|
||||
retVal = BZ_OK;
|
||||
goto save_state_and_return;
|
||||
}
|
||||
@ -687,7 +687,7 @@ int BZ2_decompress(DState *s)
|
||||
|
||||
case BZ_X_BLKHDR_1:
|
||||
s->state = BZ_X_BLKHDR_1;
|
||||
if (get_bits(s, &uc, 8) == FALSE) {
|
||||
if (! get_bits(s, &uc, 8)) {
|
||||
retVal = BZ_OK;
|
||||
goto save_state_and_return;
|
||||
}
|
||||
@ -702,7 +702,7 @@ int BZ2_decompress(DState *s)
|
||||
|
||||
case BZ_X_BLKHDR_2:
|
||||
s->state = BZ_X_BLKHDR_2;
|
||||
if (get_bits(s, &uc, 8) == FALSE) {
|
||||
if (! get_bits(s, &uc, 8)) {
|
||||
retVal = BZ_OK;
|
||||
goto save_state_and_return;
|
||||
}
|
||||
@ -713,7 +713,7 @@ int BZ2_decompress(DState *s)
|
||||
|
||||
case BZ_X_BLKHDR_3:
|
||||
s->state = BZ_X_BLKHDR_3;
|
||||
if (get_bits(s, &uc, 8) == FALSE) {
|
||||
if (! get_bits(s, &uc, 8)) {
|
||||
retVal = BZ_OK;
|
||||
goto save_state_and_return;
|
||||
}
|
||||
@ -724,7 +724,7 @@ int BZ2_decompress(DState *s)
|
||||
|
||||
case BZ_X_BLKHDR_4:
|
||||
s->state = BZ_X_BLKHDR_4;
|
||||
if (get_bits(s, &uc, 8) == FALSE) {
|
||||
if (! get_bits(s, &uc, 8)) {
|
||||
retVal = BZ_OK;
|
||||
goto save_state_and_return;
|
||||
}
|
||||
@ -735,7 +735,7 @@ int BZ2_decompress(DState *s)
|
||||
|
||||
case BZ_X_BLKHDR_5:
|
||||
s->state = BZ_X_BLKHDR_5;
|
||||
if (get_bits(s, &uc, 8) == FALSE) {
|
||||
if (! get_bits(s, &uc, 8)) {
|
||||
retVal = BZ_OK;
|
||||
goto save_state_and_return;
|
||||
}
|
||||
@ -746,7 +746,7 @@ int BZ2_decompress(DState *s)
|
||||
|
||||
case BZ_X_BLKHDR_6:
|
||||
s->state = BZ_X_BLKHDR_6;
|
||||
if (get_bits(s, &uc, 8) == FALSE) {
|
||||
if (! get_bits(s, &uc, 8)) {
|
||||
retVal = BZ_OK;
|
||||
goto save_state_and_return;
|
||||
}
|
||||
@ -763,7 +763,7 @@ int BZ2_decompress(DState *s)
|
||||
|
||||
case BZ_X_BCRC_1:
|
||||
s->state = BZ_X_BCRC_1;
|
||||
if (get_bits(s, &uc, 8) == FALSE) {
|
||||
if (! get_bits(s, &uc, 8)) {
|
||||
retVal = BZ_OK;
|
||||
goto save_state_and_return;
|
||||
}
|
||||
@ -771,7 +771,7 @@ int BZ2_decompress(DState *s)
|
||||
|
||||
case BZ_X_BCRC_2:
|
||||
s->state = BZ_X_BCRC_2;
|
||||
if (get_bits(s, &uc, 8) == FALSE) {
|
||||
if (! get_bits(s, &uc, 8)) {
|
||||
retVal = BZ_OK;
|
||||
goto save_state_and_return;
|
||||
}
|
||||
@ -779,7 +779,7 @@ int BZ2_decompress(DState *s)
|
||||
|
||||
case BZ_X_BCRC_3:
|
||||
s->state = BZ_X_BCRC_3;
|
||||
if (get_bits(s, &uc, 8) == FALSE) {
|
||||
if (! get_bits(s, &uc, 8)) {
|
||||
retVal = BZ_OK;
|
||||
goto save_state_and_return;
|
||||
}
|
||||
@ -787,7 +787,7 @@ int BZ2_decompress(DState *s)
|
||||
|
||||
case BZ_X_BCRC_4:
|
||||
s->state = BZ_X_BCRC_4;
|
||||
if (get_bits(s, &uc, 8) == FALSE) {
|
||||
if (! get_bits(s, &uc, 8)) {
|
||||
retVal = BZ_OK;
|
||||
goto save_state_and_return;
|
||||
}
|
||||
@ -799,7 +799,7 @@ int BZ2_decompress(DState *s)
|
||||
int tmp = s->blockRandomised;
|
||||
const int ret = get_bits(s, &tmp, 1);
|
||||
s->blockRandomised = tmp;
|
||||
if (ret == FALSE) {
|
||||
if (! ret) {
|
||||
retVal = BZ_OK;
|
||||
goto save_state_and_return;
|
||||
}
|
||||
@ -809,7 +809,7 @@ int BZ2_decompress(DState *s)
|
||||
|
||||
case BZ_X_ORIGPTR_1:
|
||||
s->state = BZ_X_ORIGPTR_1;
|
||||
if (get_bits(s, &uc, 8) == FALSE) {
|
||||
if (! get_bits(s, &uc, 8)) {
|
||||
retVal = BZ_OK;
|
||||
goto save_state_and_return;
|
||||
}
|
||||
@ -817,7 +817,7 @@ int BZ2_decompress(DState *s)
|
||||
|
||||
case BZ_X_ORIGPTR_2:
|
||||
s->state = BZ_X_ORIGPTR_2;
|
||||
if (get_bits(s, &uc, 8) == FALSE) {
|
||||
if (! get_bits(s, &uc, 8)) {
|
||||
retVal = BZ_OK;
|
||||
goto save_state_and_return;
|
||||
}
|
||||
@ -825,7 +825,7 @@ int BZ2_decompress(DState *s)
|
||||
|
||||
case BZ_X_ORIGPTR_3:
|
||||
s->state = BZ_X_ORIGPTR_3;
|
||||
if (get_bits(s, &uc, 8) == FALSE) {
|
||||
if (! get_bits(s, &uc, 8)) {
|
||||
retVal = BZ_OK;
|
||||
goto save_state_and_return;
|
||||
}
|
||||
@ -844,7 +844,7 @@ int BZ2_decompress(DState *s)
|
||||
case BZ_X_MAPPING_1:
|
||||
for (i = 0; i < 16; i++) {
|
||||
s->state = BZ_X_MAPPING_1;
|
||||
if (get_bits(s, &uc, 1) == FALSE) {
|
||||
if (! get_bits(s, &uc, 1)) {
|
||||
retVal = BZ_OK;
|
||||
goto save_state_and_return;
|
||||
}
|
||||
@ -864,7 +864,7 @@ int BZ2_decompress(DState *s)
|
||||
for (j = 0; j < 16; j++) {
|
||||
case BZ_X_MAPPING_2:
|
||||
s->state = BZ_X_MAPPING_2;
|
||||
if (get_bits(s, &uc, 1) == FALSE) {
|
||||
if (! get_bits(s, &uc, 1)) {
|
||||
retVal = BZ_OK;
|
||||
goto save_state_and_return;
|
||||
}
|
||||
@ -891,7 +891,7 @@ int BZ2_decompress(DState *s)
|
||||
/*--- Now the selectors ---*/
|
||||
case BZ_X_SELECTOR_1:
|
||||
s->state = BZ_X_SELECTOR_1;
|
||||
if (get_bits(s, &nGroups, 3) == FALSE) {
|
||||
if (! get_bits(s, &nGroups, 3)) {
|
||||
retVal = BZ_OK;
|
||||
goto save_state_and_return;
|
||||
}
|
||||
@ -902,7 +902,7 @@ int BZ2_decompress(DState *s)
|
||||
|
||||
case BZ_X_SELECTOR_2:
|
||||
s->state = BZ_X_SELECTOR_2;
|
||||
if (get_bits(s, &nSelectors, 15) == FALSE) {
|
||||
if (! get_bits(s, &nSelectors, 15)) {
|
||||
retVal = BZ_OK;
|
||||
goto save_state_and_return;
|
||||
}
|
||||
@ -918,7 +918,7 @@ int BZ2_decompress(DState *s)
|
||||
while (1) {
|
||||
case BZ_X_SELECTOR_3:
|
||||
s->state = BZ_X_SELECTOR_3;
|
||||
if (get_bits(s, &uc, 1) == FALSE) {
|
||||
if (! get_bits(s, &uc, 1)) {
|
||||
retVal = BZ_OK;
|
||||
goto save_state_and_return;
|
||||
}
|
||||
@ -956,7 +956,7 @@ int BZ2_decompress(DState *s)
|
||||
for (t = 0; t < nGroups; t++) {
|
||||
case BZ_X_CODING_1:
|
||||
s->state = BZ_X_CODING_1;
|
||||
if (get_bits(s, &curr, 5) == FALSE) {
|
||||
if (! get_bits(s, &curr, 5)) {
|
||||
retVal = BZ_OK;
|
||||
goto save_state_and_return;
|
||||
}
|
||||
@ -969,7 +969,7 @@ int BZ2_decompress(DState *s)
|
||||
|
||||
case BZ_X_CODING_2:
|
||||
s->state = BZ_X_CODING_2;
|
||||
if (get_bits(s, &uc, 1) == FALSE) {
|
||||
if (! get_bits(s, &uc, 1)) {
|
||||
retVal = BZ_OK;
|
||||
goto save_state_and_return;
|
||||
}
|
||||
@ -979,7 +979,7 @@ int BZ2_decompress(DState *s)
|
||||
|
||||
case BZ_X_CODING_3:
|
||||
s->state = BZ_X_CODING_3;
|
||||
if (get_bits(s, &uc, 1) == FALSE) {
|
||||
if (! get_bits(s, &uc, 1)) {
|
||||
retVal = BZ_OK;
|
||||
goto save_state_and_return;
|
||||
}
|
||||
@ -1044,12 +1044,12 @@ int BZ2_decompress(DState *s)
|
||||
|
||||
nblock = 0;
|
||||
|
||||
if (get_mtf_val_init() == FALSE) {
|
||||
if (! get_mtf_val_init()) {
|
||||
goto save_state_and_return;
|
||||
}
|
||||
case BZ_X_MTF_1:
|
||||
s->state = BZ_X_MTF_1;
|
||||
if (get_bits(s, &zvec, zn) == FALSE) {
|
||||
if (! get_bits(s, &zvec, zn)) {
|
||||
retVal = BZ_OK;
|
||||
goto save_state_and_return;
|
||||
}
|
||||
@ -1065,7 +1065,7 @@ int BZ2_decompress(DState *s)
|
||||
|
||||
case BZ_X_MTF_2:
|
||||
s->state = BZ_X_MTF_2;
|
||||
if (get_bits(s, &zj, 1) == FALSE) {
|
||||
if (! get_bits(s, &zj, 1)) {
|
||||
retVal = BZ_OK;
|
||||
goto save_state_and_return;
|
||||
}
|
||||
@ -1094,12 +1094,12 @@ int BZ2_decompress(DState *s)
|
||||
}
|
||||
}
|
||||
N = N * 2;
|
||||
if (get_mtf_val_init() == FALSE) {
|
||||
if (! get_mtf_val_init()) {
|
||||
goto save_state_and_return;
|
||||
}
|
||||
case BZ_X_MTF_3:
|
||||
s->state = BZ_X_MTF_3;
|
||||
if (get_bits(s, &zvec, zn) == FALSE) {
|
||||
if (! get_bits(s, &zvec, zn)) {
|
||||
retVal = BZ_OK;
|
||||
goto save_state_and_return;
|
||||
}
|
||||
@ -1115,7 +1115,7 @@ int BZ2_decompress(DState *s)
|
||||
|
||||
case BZ_X_MTF_4:
|
||||
s->state = BZ_X_MTF_4;
|
||||
if (get_bits(s, &zj, 1) == FALSE) {
|
||||
if (! get_bits(s, &zj, 1)) {
|
||||
retVal = BZ_OK;
|
||||
goto save_state_and_return;
|
||||
}
|
||||
@ -1223,12 +1223,12 @@ int BZ2_decompress(DState *s)
|
||||
}
|
||||
nblock++;
|
||||
|
||||
if (get_mtf_val_init() == FALSE) {
|
||||
if (! get_mtf_val_init()) {
|
||||
goto save_state_and_return;
|
||||
}
|
||||
case BZ_X_MTF_5:
|
||||
s->state = BZ_X_MTF_5;
|
||||
if (get_bits(s, &zvec, zn) == FALSE) {
|
||||
if (! get_bits(s, &zvec, zn)) {
|
||||
retVal = BZ_OK;
|
||||
goto save_state_and_return;
|
||||
}
|
||||
@ -1244,7 +1244,7 @@ int BZ2_decompress(DState *s)
|
||||
|
||||
case BZ_X_MTF_6:
|
||||
s->state = BZ_X_MTF_6;
|
||||
if (get_bits(s, &zj, 1) == FALSE) {
|
||||
if (! get_bits(s, &zj, 1)) {
|
||||
retVal = BZ_OK;
|
||||
goto save_state_and_return;
|
||||
}
|
||||
@ -1366,7 +1366,7 @@ int BZ2_decompress(DState *s)
|
||||
endhdr_2:
|
||||
case BZ_X_ENDHDR_2:
|
||||
s->state = BZ_X_ENDHDR_2;
|
||||
if (get_bits(s, &uc, 8) == FALSE) {
|
||||
if (! get_bits(s, &uc, 8)) {
|
||||
retVal = BZ_OK;
|
||||
goto save_state_and_return;
|
||||
}
|
||||
@ -1377,7 +1377,7 @@ endhdr_2:
|
||||
|
||||
case BZ_X_ENDHDR_3:
|
||||
s->state = BZ_X_ENDHDR_3;
|
||||
if (get_bits(s, &uc, 8) == FALSE) {
|
||||
if (! get_bits(s, &uc, 8)) {
|
||||
retVal = BZ_OK;
|
||||
goto save_state_and_return;
|
||||
}
|
||||
@ -1388,7 +1388,7 @@ endhdr_2:
|
||||
|
||||
case BZ_X_ENDHDR_4:
|
||||
s->state = BZ_X_ENDHDR_4;
|
||||
if (get_bits(s, &uc, 8) == FALSE) {
|
||||
if (! get_bits(s, &uc, 8)) {
|
||||
retVal = BZ_OK;
|
||||
goto save_state_and_return;
|
||||
}
|
||||
@ -1399,7 +1399,7 @@ endhdr_2:
|
||||
|
||||
case BZ_X_ENDHDR_5:
|
||||
s->state = BZ_X_ENDHDR_5;
|
||||
if (get_bits(s, &uc, 8) == FALSE) {
|
||||
if (! get_bits(s, &uc, 8)) {
|
||||
retVal = BZ_OK;
|
||||
goto save_state_and_return;
|
||||
}
|
||||
@ -1410,7 +1410,7 @@ endhdr_2:
|
||||
|
||||
case BZ_X_ENDHDR_6:
|
||||
s->state = BZ_X_ENDHDR_6;
|
||||
if (get_bits(s, &uc, 8) == FALSE) {
|
||||
if (! get_bits(s, &uc, 8)) {
|
||||
retVal = BZ_OK;
|
||||
goto save_state_and_return;
|
||||
}
|
||||
@ -1422,14 +1422,14 @@ endhdr_2:
|
||||
|
||||
case BZ_X_CCRC_1:
|
||||
s->state = BZ_X_CCRC_1;
|
||||
if (get_bits(s, &uc, 8) == FALSE) {
|
||||
if (! get_bits(s, &uc, 8)) {
|
||||
retVal = BZ_OK;
|
||||
goto save_state_and_return;
|
||||
}
|
||||
s->storedCombinedCRC = (s->storedCombinedCRC << 8) | ((unsigned int)uc);
|
||||
case BZ_X_CCRC_2:
|
||||
s->state = BZ_X_CCRC_2;
|
||||
if (get_bits(s, &uc, 8) == FALSE) {
|
||||
if (! get_bits(s, &uc, 8)) {
|
||||
retVal = BZ_OK;
|
||||
goto save_state_and_return;
|
||||
}
|
||||
@ -1437,7 +1437,7 @@ endhdr_2:
|
||||
|
||||
case BZ_X_CCRC_3:
|
||||
s->state = BZ_X_CCRC_3;
|
||||
if (get_bits(s, &uc, 8) == FALSE) {
|
||||
if (! get_bits(s, &uc, 8)) {
|
||||
retVal = BZ_OK;
|
||||
goto save_state_and_return;
|
||||
}
|
||||
@ -1445,7 +1445,7 @@ endhdr_2:
|
||||
|
||||
case BZ_X_CCRC_4:
|
||||
s->state = BZ_X_CCRC_4;
|
||||
if (get_bits(s, &uc, 8) == FALSE) {
|
||||
if (! get_bits(s, &uc, 8)) {
|
||||
retVal = BZ_OK;
|
||||
goto save_state_and_return;
|
||||
}
|
||||
|
@ -858,7 +858,7 @@ void write_status_file(deb_file_t **deb_file)
|
||||
}
|
||||
}
|
||||
/* If the package from the status file wasnt handle above, do it now*/
|
||||
if (write_flag == FALSE) {
|
||||
if (! write_flag) {
|
||||
fprintf(new_status_file, "%s\n\n", control_buffer);
|
||||
}
|
||||
|
||||
@ -1206,7 +1206,7 @@ void remove_package(const unsigned int package_num)
|
||||
exclude_files = create_list(conffile_name);
|
||||
|
||||
/* Some directories cant be removed straight away, so do multiple passes */
|
||||
while (remove_file_array(remove_files, exclude_files) == TRUE);
|
||||
while (remove_file_array(remove_files, exclude_files));
|
||||
|
||||
/* Create a list of all /var/lib/dpkg/info/<package> files */
|
||||
remove_files = xmalloc(sizeof(char *) * 11);
|
||||
@ -1250,7 +1250,7 @@ void purge_package(const unsigned int package_num)
|
||||
exclude_files[0] = NULL;
|
||||
|
||||
/* Some directories cant be removed straight away, so do multiple passes */
|
||||
while (remove_file_array(remove_files, exclude_files) == TRUE);
|
||||
while (remove_file_array(remove_files, exclude_files));
|
||||
|
||||
/* Create a list of all /var/lib/dpkg/info/<package> files */
|
||||
remove_files = xmalloc(sizeof(char *) * 11);
|
||||
|
@ -171,7 +171,7 @@ extern int gunzip_main(int argc, char **argv)
|
||||
fclose(out_file);
|
||||
fclose(in_file);
|
||||
|
||||
if (delete_old_file == TRUE) {
|
||||
if (delete_old_file) {
|
||||
if (unlink(delete_file_name) < 0) {
|
||||
error_msg_and_die("Couldnt remove %s", delete_file_name);
|
||||
}
|
||||
|
@ -227,7 +227,7 @@ char *unarchive(FILE *src_stream, FILE *out_stream, file_header_t *(*get_headers
|
||||
}
|
||||
}
|
||||
|
||||
if (extract_flag == TRUE) {
|
||||
if (extract_flag) {
|
||||
buffer = extract_archive(src_stream, out_stream, file_entry, extract_function, prefix);
|
||||
} else {
|
||||
/* seek past the data entry */
|
||||
@ -238,4 +238,4 @@ char *unarchive(FILE *src_stream, FILE *out_stream, file_header_t *(*get_headers
|
||||
free(file_entry);
|
||||
}
|
||||
return(buffer);
|
||||
}
|
||||
}
|
||||
|
@ -476,9 +476,9 @@ static int writeTarFile(const char* tarName, int verboseFlag, char **argv,
|
||||
|
||||
/* Read the directory/files and iterate over them one at a time */
|
||||
while (*argv != NULL) {
|
||||
if (recursive_action(*argv++, TRUE, FALSE, FALSE,
|
||||
if (! recursive_action(*argv++, TRUE, FALSE, FALSE,
|
||||
writeFileToTarball, writeFileToTarball,
|
||||
(void*) &tbInfo) == FALSE) {
|
||||
(void*) &tbInfo)) {
|
||||
errorFlag = TRUE;
|
||||
}
|
||||
}
|
||||
@ -494,7 +494,7 @@ static int writeTarFile(const char* tarName, int verboseFlag, char **argv,
|
||||
|
||||
/* Hang up the tools, close up shop, head home */
|
||||
close(tarFd);
|
||||
if (errorFlag == TRUE) {
|
||||
if (errorFlag) {
|
||||
error_msg("Error exit delayed from previous errors");
|
||||
freeHardLinkInfo(&tbInfo.hlInfoHead);
|
||||
return(FALSE);
|
||||
@ -556,7 +556,7 @@ char **list_and_not_list(char **include_list, char **exclude_list)
|
||||
exclude_count++;
|
||||
}
|
||||
|
||||
if (found == FALSE) {
|
||||
if (! found) {
|
||||
new_include_list = realloc(new_include_list, sizeof(char *) * (include_count + 2));
|
||||
new_include_list[new_include_count] = include_list[include_count];
|
||||
new_include_count++;
|
||||
|
@ -37,7 +37,7 @@ extern int cat_main(int argc, char **argv)
|
||||
while (--argc > 0) {
|
||||
if(!(strcmp(*++argv, "-"))) {
|
||||
print_file(stdin);
|
||||
} else if (print_file_by_name(*argv) == FALSE) {
|
||||
} else if (! print_file_by_name(*argv)) {
|
||||
status = EXIT_FAILURE;
|
||||
}
|
||||
}
|
||||
|
@ -72,8 +72,8 @@ int chgrp_main(int argc, char **argv)
|
||||
|
||||
/* Ok, ready to do the deed now */
|
||||
while (++optind < argc) {
|
||||
if (recursive_action (argv[optind], recursiveFlag, FALSE, FALSE,
|
||||
fileAction, fileAction, NULL) == FALSE) {
|
||||
if (! recursive_action (argv[optind], recursiveFlag, FALSE, FALSE,
|
||||
fileAction, fileAction, NULL)) {
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
}
|
||||
|
@ -58,7 +58,7 @@ int chmod_main(int argc, char **argv)
|
||||
if (argc > optind && argc > 2 && argv[optind]) {
|
||||
/* Parse the specified mode */
|
||||
mode_t mode;
|
||||
if (parse_mode(argv[optind], &mode) == FALSE) {
|
||||
if (! parse_mode(argv[optind], &mode)) {
|
||||
error_msg_and_die( "unknown mode: %s", argv[optind]);
|
||||
}
|
||||
} else {
|
||||
@ -67,8 +67,8 @@ int chmod_main(int argc, char **argv)
|
||||
|
||||
/* Ok, ready to do the deed now */
|
||||
for (i = optind + 1; i < argc; i++) {
|
||||
if (recursive_action (argv[i], recursiveFlag, FALSE, FALSE, fileAction,
|
||||
fileAction, argv[optind]) == FALSE) {
|
||||
if (! recursive_action (argv[i], recursiveFlag, FALSE, FALSE, fileAction,
|
||||
fileAction, argv[optind])) {
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
}
|
||||
|
@ -94,8 +94,8 @@ int chown_main(int argc, char **argv)
|
||||
|
||||
/* Ok, ready to do the deed now */
|
||||
while (++optind < argc) {
|
||||
if (recursive_action (argv[optind], recursiveFlag, FALSE, FALSE,
|
||||
fileAction, fileAction, NULL) == FALSE) {
|
||||
if (! recursive_action (argv[optind], recursiveFlag, FALSE, FALSE,
|
||||
fileAction, fileAction, NULL)) {
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
}
|
||||
|
@ -193,7 +193,7 @@ static unsigned long ls_disp_hr = 0;
|
||||
static int my_stat(struct dnode *cur)
|
||||
{
|
||||
#ifdef CONFIG_FEATURE_LS_FOLLOWLINKS
|
||||
if (follow_links == TRUE) {
|
||||
if (follow_links) {
|
||||
if (stat(cur->fullname, &cur->dstat)) {
|
||||
perror_msg("%s", cur->fullname);
|
||||
status = EXIT_FAILURE;
|
||||
|
@ -53,10 +53,10 @@ extern int touch_main(int argc, char **argv)
|
||||
}
|
||||
|
||||
while (argc > 0) {
|
||||
fd = open(*argv, (create == FALSE) ? O_RDWR : O_RDWR | O_CREAT,
|
||||
fd = open(*argv, create ? O_RDWR | O_CREAT : O_RDWR,
|
||||
S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH);
|
||||
if (fd < 0) {
|
||||
if (create == FALSE && errno == ENOENT) {
|
||||
if (! create && errno == ENOENT) {
|
||||
argc--;
|
||||
argv++;
|
||||
continue;
|
||||
|
40
editors/vi.c
40
editors/vi.c
@ -19,7 +19,7 @@
|
||||
*/
|
||||
|
||||
static const char vi_Version[] =
|
||||
"$Id: vi.c,v 1.19 2001/11/17 07:14:06 andersen Exp $";
|
||||
"$Id: vi.c,v 1.20 2001/12/20 23:12:47 kraai Exp $";
|
||||
|
||||
/*
|
||||
* To compile for standalone use:
|
||||
@ -1219,7 +1219,7 @@ key_cmd_mode:
|
||||
break;
|
||||
if (strncasecmp((char *) p, "quit", cnt) == 0 ||
|
||||
strncasecmp((char *) p, "q!", cnt) == 0) { // delete lines
|
||||
if (file_modified == TRUE && p[1] != '!') {
|
||||
if (file_modified && p[1] != '!') {
|
||||
psbs("No write since last change (:quit! overrides)");
|
||||
} else {
|
||||
editing = 0;
|
||||
@ -1410,10 +1410,10 @@ key_cmd_mode:
|
||||
indicate_error(c);
|
||||
break;
|
||||
}
|
||||
if (file_modified == TRUE
|
||||
if (file_modified
|
||||
#ifdef CONFIG_FEATURE_VI_READONLY
|
||||
&& vi_readonly == FALSE
|
||||
&& readonly == FALSE
|
||||
&& ! vi_readonly
|
||||
&& ! readonly
|
||||
#endif /* CONFIG_FEATURE_VI_READONLY */
|
||||
) {
|
||||
cnt = file_write(cfn, text, end - 1);
|
||||
@ -1829,7 +1829,7 @@ static void colon(Byte * buf)
|
||||
int sr;
|
||||
sr= 0;
|
||||
// don't edit, if the current file has been modified
|
||||
if (file_modified == TRUE && useforce != TRUE) {
|
||||
if (file_modified && ! useforce) {
|
||||
psbs("No write since last change (:edit! overrides)");
|
||||
goto vc1;
|
||||
}
|
||||
@ -1908,7 +1908,7 @@ static void colon(Byte * buf)
|
||||
" %dL, %dC", cfn,
|
||||
(sr < 0 ? " [New file]" : ""),
|
||||
#ifdef CONFIG_FEATURE_VI_READONLY
|
||||
((vi_readonly == TRUE || readonly == TRUE) ? " [Read only]" : ""),
|
||||
((vi_readonly || readonly) ? " [Read only]" : ""),
|
||||
#endif /* CONFIG_FEATURE_VI_READONLY */
|
||||
li, ch);
|
||||
} else if (strncasecmp((char *) cmd, "file", i) == 0) { // what File is this
|
||||
@ -1961,7 +1961,7 @@ static void colon(Byte * buf)
|
||||
Hit_Return();
|
||||
} else if ((strncasecmp((char *) cmd, "quit", i) == 0) || // Quit
|
||||
(strncasecmp((char *) cmd, "next", i) == 0)) { // edit next file
|
||||
if (useforce == TRUE) {
|
||||
if (useforce) {
|
||||
// force end of argv list
|
||||
if (*cmd == 'q') {
|
||||
optind = save_argc;
|
||||
@ -1970,7 +1970,7 @@ static void colon(Byte * buf)
|
||||
goto vc1;
|
||||
}
|
||||
// don't exit if the file been modified
|
||||
if (file_modified == TRUE) {
|
||||
if (file_modified) {
|
||||
psbs("No write since last change (:%s! overrides)",
|
||||
(*cmd == 'q' ? "quit" : "next"));
|
||||
goto vc1;
|
||||
@ -2014,7 +2014,7 @@ static void colon(Byte * buf)
|
||||
#endif /* CONFIG_FEATURE_VI_READONLY */
|
||||
" %dL, %dC", fn,
|
||||
#ifdef CONFIG_FEATURE_VI_READONLY
|
||||
((vi_readonly == TRUE || readonly == TRUE) ? " [Read only]" : ""),
|
||||
((vi_readonly || readonly) ? " [Read only]" : ""),
|
||||
#endif /* CONFIG_FEATURE_VI_READONLY */
|
||||
li, ch);
|
||||
if (ch > 0) {
|
||||
@ -2024,7 +2024,7 @@ static void colon(Byte * buf)
|
||||
file_modified = TRUE;
|
||||
}
|
||||
} else if (strncasecmp((char *) cmd, "rewind", i) == 0) { // rewind cmd line args
|
||||
if (file_modified == TRUE && useforce != TRUE) {
|
||||
if (file_modified && ! useforce) {
|
||||
psbs("No write since last change (:rewind! overrides)");
|
||||
} else {
|
||||
// reset the filenames to edit
|
||||
@ -2140,7 +2140,7 @@ static void colon(Byte * buf)
|
||||
fn = args;
|
||||
}
|
||||
#ifdef CONFIG_FEATURE_VI_READONLY
|
||||
if ((vi_readonly == TRUE || readonly == TRUE) && useforce == FALSE) {
|
||||
if ((vi_readonly || readonly) && ! useforce) {
|
||||
psbs("\"%s\" File is read only", fn);
|
||||
goto vc3;
|
||||
}
|
||||
@ -2149,14 +2149,14 @@ static void colon(Byte * buf)
|
||||
li = count_lines(q, r);
|
||||
ch = r - q + 1;
|
||||
// see if file exists- if not, its just a new file request
|
||||
if (useforce == TRUE) {
|
||||
if (useforce) {
|
||||
// if "fn" is not write-able, chmod u+w
|
||||
// sprintf(syscmd, "chmod u+w %s", fn);
|
||||
// system(syscmd);
|
||||
forced = TRUE;
|
||||
}
|
||||
l = file_write(fn, q, r);
|
||||
if (useforce == TRUE && forced == TRUE) {
|
||||
if (useforce && forced) {
|
||||
// chmod u-w
|
||||
// sprintf(syscmd, "chmod u-w %s", fn);
|
||||
// system(syscmd);
|
||||
@ -3527,7 +3527,7 @@ static int file_insert(Byte * fn, Byte * p, int size)
|
||||
|
||||
// see if we can open the file
|
||||
#ifdef CONFIG_FEATURE_VI_READONLY
|
||||
if (vi_readonly == TRUE) goto fi1; // do not try write-mode
|
||||
if (vi_readonly) goto fi1; // do not try write-mode
|
||||
#endif
|
||||
fd = open((char *) fn, O_RDWR); // assume read & write
|
||||
if (fd < 0) {
|
||||
@ -3623,7 +3623,7 @@ static void place_cursor(int row, int col, int opti)
|
||||
//----- 1. Try the standard terminal ESC sequence
|
||||
sprintf((char *) cm1, CMrc, row + 1, col + 1);
|
||||
cm= cm1;
|
||||
if (opti == FALSE) goto pc0;
|
||||
if (! opti) goto pc0;
|
||||
|
||||
#ifdef CONFIG_FEATURE_VI_OPTIMIZE_CURSOR
|
||||
//----- find the minimum # of chars to move cursor -------------
|
||||
@ -3798,9 +3798,9 @@ static void edit_status(void) // show file status on status line
|
||||
"%s line %d of %d --%d%%--",
|
||||
(cfn != 0 ? (char *) cfn : "No file"),
|
||||
#ifdef CONFIG_FEATURE_VI_READONLY
|
||||
((vi_readonly == TRUE || readonly == TRUE) ? " [Read only]" : ""),
|
||||
((vi_readonly || readonly) ? " [Read only]" : ""),
|
||||
#endif /* CONFIG_FEATURE_VI_READONLY */
|
||||
(file_modified == TRUE ? " [modified]" : ""),
|
||||
(file_modified ? " [modified]" : ""),
|
||||
cur, tot, percent);
|
||||
}
|
||||
|
||||
@ -3888,7 +3888,7 @@ static void refresh(int full_screen)
|
||||
cs= 0;
|
||||
ce= columns-1;
|
||||
sp = &screen[li * columns]; // start of screen line
|
||||
if (full_screen == TRUE) {
|
||||
if (full_screen) {
|
||||
// force re-draw of every single column from 0 - columns-1
|
||||
goto re0;
|
||||
}
|
||||
@ -3921,7 +3921,7 @@ static void refresh(int full_screen)
|
||||
if (ce > columns-1) ce= columns-1;
|
||||
if (cs > ce) { cs= 0; ce= columns-1; }
|
||||
// is there a change between vitual screen and buf
|
||||
if (changed == TRUE) {
|
||||
if (changed) {
|
||||
// copy changed part of buffer to virtual screen
|
||||
memmove(sp+cs, buf+(cs+offset), ce-cs+1);
|
||||
|
||||
|
@ -185,13 +185,13 @@ int find_main(int argc, char **argv)
|
||||
}
|
||||
|
||||
if (firstopt == 1) {
|
||||
if (recursive_action(".", TRUE, dereference, FALSE, fileAction,
|
||||
fileAction, NULL) == FALSE)
|
||||
if (! recursive_action(".", TRUE, dereference, FALSE, fileAction,
|
||||
fileAction, NULL))
|
||||
status = EXIT_FAILURE;
|
||||
} else {
|
||||
for (i = 1; i < firstopt; i++) {
|
||||
if (recursive_action(argv[i], TRUE, dereference, FALSE, fileAction,
|
||||
fileAction, NULL) == FALSE)
|
||||
if (! recursive_action(argv[i], TRUE, dereference, FALSE, fileAction,
|
||||
fileAction, NULL))
|
||||
status = EXIT_FAILURE;
|
||||
}
|
||||
}
|
||||
|
@ -547,7 +547,7 @@ static pid_t run(char *command, char *terminal, int get_enter)
|
||||
}
|
||||
}
|
||||
|
||||
if (get_enter == TRUE) {
|
||||
if (get_enter) {
|
||||
/*
|
||||
* Save memory by not exec-ing anything large (like a shell)
|
||||
* before the user wants it. This is critical if swap is not
|
||||
@ -942,7 +942,7 @@ static void parse_inittab(void)
|
||||
}
|
||||
a++;
|
||||
}
|
||||
if (foundIt == TRUE)
|
||||
if (foundIt)
|
||||
continue;
|
||||
else {
|
||||
/* Choke on an unknown action */
|
||||
|
@ -39,7 +39,7 @@ int is_directory(const char *fileName, const int followLinks, struct stat *statB
|
||||
++didMalloc;
|
||||
}
|
||||
|
||||
if (followLinks == TRUE)
|
||||
if (followLinks)
|
||||
status = stat(fileName, statBuf);
|
||||
else
|
||||
status = lstat(fileName, statBuf);
|
||||
|
@ -77,7 +77,7 @@ int read_package_field(const char *package_buffer, char **field_name, char **fie
|
||||
}
|
||||
break;
|
||||
}
|
||||
if (exit_flag == TRUE) {
|
||||
if (exit_flag) {
|
||||
/* Check that the names are valid */
|
||||
offset_value_end = offset;
|
||||
name_length = offset_name_end - offset_name_start;
|
||||
|
@ -53,7 +53,7 @@ int recursive_action(const char *fileName,
|
||||
struct stat statbuf;
|
||||
struct dirent *next;
|
||||
|
||||
if (followLinks == TRUE)
|
||||
if (followLinks)
|
||||
status = stat(fileName, &statbuf);
|
||||
else
|
||||
status = lstat(fileName, &statbuf);
|
||||
@ -68,14 +68,14 @@ int recursive_action(const char *fileName,
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if ((followLinks == FALSE) && (S_ISLNK(statbuf.st_mode))) {
|
||||
if (! followLinks && (S_ISLNK(statbuf.st_mode))) {
|
||||
if (fileAction == NULL)
|
||||
return TRUE;
|
||||
else
|
||||
return fileAction(fileName, &statbuf, userData);
|
||||
}
|
||||
|
||||
if (recurse == FALSE) {
|
||||
if (! recurse) {
|
||||
if (S_ISDIR(statbuf.st_mode)) {
|
||||
if (dirAction != NULL)
|
||||
return (dirAction(fileName, &statbuf, userData));
|
||||
@ -87,9 +87,9 @@ int recursive_action(const char *fileName,
|
||||
if (S_ISDIR(statbuf.st_mode)) {
|
||||
DIR *dir;
|
||||
|
||||
if (dirAction != NULL && depthFirst == FALSE) {
|
||||
if (dirAction != NULL && ! depthFirst) {
|
||||
status = dirAction(fileName, &statbuf, userData);
|
||||
if (status == FALSE) {
|
||||
if (! status) {
|
||||
perror_msg("%s", fileName);
|
||||
return FALSE;
|
||||
} else if (status == SKIP)
|
||||
@ -109,20 +109,20 @@ int recursive_action(const char *fileName,
|
||||
continue;
|
||||
}
|
||||
nextFile = concat_path_file(fileName, next->d_name);
|
||||
if (recursive_action(nextFile, TRUE, followLinks, depthFirst,
|
||||
fileAction, dirAction, userData) == FALSE) {
|
||||
if (! recursive_action(nextFile, TRUE, followLinks, depthFirst,
|
||||
fileAction, dirAction, userData)) {
|
||||
status = FALSE;
|
||||
}
|
||||
free(nextFile);
|
||||
}
|
||||
closedir(dir);
|
||||
if (dirAction != NULL && depthFirst == TRUE) {
|
||||
if (dirAction(fileName, &statbuf, userData) == FALSE) {
|
||||
if (dirAction != NULL && depthFirst) {
|
||||
if (! dirAction(fileName, &statbuf, userData)) {
|
||||
perror_msg("%s", fileName);
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
if (status == FALSE)
|
||||
if (! status)
|
||||
return FALSE;
|
||||
} else {
|
||||
if (fileAction == NULL)
|
||||
|
@ -133,7 +133,7 @@
|
||||
#ifndef MODUTILS_MODULE_H
|
||||
static const int MODUTILS_MODULE_H = 1;
|
||||
|
||||
#ident "$Id: insmod.c,v 1.76 2001/12/14 16:08:17 kraai Exp $"
|
||||
#ident "$Id: insmod.c,v 1.77 2001/12/20 23:13:08 kraai Exp $"
|
||||
|
||||
/* This file contains the structures used by the 2.0 and 2.1 kernels.
|
||||
We do not use the kernel headers directly because we do not wish
|
||||
@ -350,7 +350,7 @@ int delete_module(const char *);
|
||||
#ifndef MODUTILS_OBJ_H
|
||||
static const int MODUTILS_OBJ_H = 1;
|
||||
|
||||
#ident "$Id: insmod.c,v 1.76 2001/12/14 16:08:17 kraai Exp $"
|
||||
#ident "$Id: insmod.c,v 1.77 2001/12/20 23:13:08 kraai Exp $"
|
||||
|
||||
/* The relocatable object is manipulated using elfin types. */
|
||||
|
||||
@ -3314,8 +3314,8 @@ extern int insmod_main( int argc, char **argv)
|
||||
strcpy(module_dir, _PATH_MODULES);
|
||||
/* No module found under /lib/modules/`uname -r`, this
|
||||
* time cast the net a bit wider. Search /lib/modules/ */
|
||||
if (recursive_action(module_dir, TRUE, FALSE, FALSE,
|
||||
check_module_name_match, 0, m_fullName) == FALSE)
|
||||
if (! recursive_action(module_dir, TRUE, FALSE, FALSE,
|
||||
check_module_name_match, 0, m_fullName))
|
||||
{
|
||||
if (m_filename[0] == '\0'
|
||||
|| ((fp = fopen(m_filename, "r")) == NULL))
|
||||
|
@ -278,7 +278,7 @@ static void handlenetinput(int len)
|
||||
break;
|
||||
case TS_SUB1: /* Subnegotiation */
|
||||
case TS_SUB2: /* Subnegotiation */
|
||||
if (subneg(c) == TRUE)
|
||||
if (subneg(c))
|
||||
G.telstate = TS_0;
|
||||
break;
|
||||
}
|
||||
|
@ -133,7 +133,7 @@ extern int kill_main(int argc, char **argv)
|
||||
* upon exit, so we can save a byte or two */
|
||||
argv++;
|
||||
}
|
||||
if (all_found == FALSE)
|
||||
if (! all_found)
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
#endif
|
||||
|
@ -8172,7 +8172,7 @@ umaskcmd(int argc, char **argv)
|
||||
umask(mask);
|
||||
} else {
|
||||
mask = ~mask & 0777;
|
||||
if (parse_mode(ap, &mask) == FALSE) {
|
||||
if (! parse_mode(ap, &mask)) {
|
||||
error("Illegal mode: %s", ap);
|
||||
}
|
||||
umask(~mask & 0777);
|
||||
@ -12481,7 +12481,7 @@ findvar(struct var **vpp, const char *name)
|
||||
/*
|
||||
* Copyright (c) 1999 Herbert Xu <herbert@debian.org>
|
||||
* This file contains code for the times builtin.
|
||||
* $Id: ash.c,v 1.37 2001/12/06 03:37:38 aaronl Exp $
|
||||
* $Id: ash.c,v 1.38 2001/12/20 23:13:19 kraai Exp $
|
||||
*/
|
||||
static int timescmd (int argc, char **argv)
|
||||
{
|
||||
|
@ -769,7 +769,7 @@ static char **exe_n_cwd_tab_completion(char *command, int *num_matches,
|
||||
goto cont;
|
||||
str_found = add_quote_for_spec_chars(found);
|
||||
if (type == FIND_FILE_ONLY ||
|
||||
(type == FIND_EXE_ONLY && is_execute(&st) == TRUE))
|
||||
(type == FIND_EXE_ONLY && is_execute(&st)))
|
||||
strcat(str_found, " ");
|
||||
}
|
||||
/* Add it to the list */
|
||||
@ -980,7 +980,7 @@ static void input_tab(int *lastWasTab)
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (*lastWasTab == FALSE) {
|
||||
if (! *lastWasTab) {
|
||||
|
||||
char *tmp;
|
||||
int len_found;
|
||||
|
@ -1437,7 +1437,7 @@ static int busy_loop(FILE * input)
|
||||
next_command = command;
|
||||
}
|
||||
|
||||
if (expand_arguments(next_command) == FALSE) {
|
||||
if (! expand_arguments(next_command)) {
|
||||
free(command);
|
||||
command = (char *) xcalloc(BUFSIZ, sizeof(char));
|
||||
next_command = NULL;
|
||||
|
@ -135,7 +135,7 @@ extern int klogd_main(int argc, char **argv)
|
||||
}
|
||||
}
|
||||
|
||||
if (doFork == TRUE) {
|
||||
if (doFork) {
|
||||
#if !defined(__UCLIBC__) || defined(__UCLIBC_HAS_MMU__)
|
||||
if (daemon(0, 1) < 0)
|
||||
perror_msg_and_die("daemon");
|
||||
|
@ -276,7 +276,7 @@ static void message (char *fmt, ...)
|
||||
fl.l_len = 1;
|
||||
|
||||
#ifdef CONFIG_FEATURE_IPC_SYSLOG
|
||||
if ((circular_logging == TRUE) && (buf != NULL)){
|
||||
if ((circular_logging) && (buf != NULL)){
|
||||
char b[1024];
|
||||
va_start (arguments, fmt);
|
||||
vsprintf (b, fmt, arguments);
|
||||
@ -366,7 +366,7 @@ static const int IOV_COUNT = 2;
|
||||
"%s:%d",RemoteHost,RemotePort);
|
||||
}
|
||||
}
|
||||
if (local_logging == TRUE)
|
||||
if (local_logging)
|
||||
#endif
|
||||
/* now spew out the message to wherever it is supposed to go */
|
||||
message("%s %s %s %s\n", timestamp, LocalHostName, res, msg);
|
||||
@ -519,13 +519,13 @@ static void doSyslogd (void)
|
||||
FD_SET (sock_fd, &fds);
|
||||
|
||||
#ifdef CONFIG_FEATURE_IPC_SYSLOG
|
||||
if (circular_logging == TRUE ){
|
||||
if (circular_logging ){
|
||||
ipcsyslog_init();
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_FEATURE_REMOTE_LOG
|
||||
if (doRemoteLog == TRUE){
|
||||
if (doRemoteLog){
|
||||
init_RemoteLog();
|
||||
}
|
||||
#endif
|
||||
@ -616,7 +616,7 @@ extern int syslogd_main(int argc, char **argv)
|
||||
|
||||
#ifdef CONFIG_FEATURE_REMOTE_LOG
|
||||
/* If they have not specified remote logging, then log locally */
|
||||
if (doRemoteLog == FALSE)
|
||||
if (! doRemoteLog)
|
||||
local_logging = TRUE;
|
||||
#endif
|
||||
|
||||
@ -629,7 +629,7 @@ extern int syslogd_main(int argc, char **argv)
|
||||
|
||||
umask(0);
|
||||
|
||||
if (doFork == TRUE) {
|
||||
if (doFork) {
|
||||
#if !defined(__UCLIBC__) || defined(__UCLIBC_HAS_MMU__)
|
||||
if (daemon(0, 1) < 0)
|
||||
perror_msg_and_die("daemon");
|
||||
|
@ -127,7 +127,7 @@ do_mount(char *specialfile, char *dir, char *filesystemtype,
|
||||
char *lofile = NULL;
|
||||
#endif
|
||||
|
||||
if (fakeIt == FALSE)
|
||||
if (! fakeIt)
|
||||
{
|
||||
#if defined CONFIG_FEATURE_MOUNT_LOOP
|
||||
if (use_loop==TRUE) {
|
||||
@ -163,7 +163,7 @@ do_mount(char *specialfile, char *dir, char *filesystemtype,
|
||||
if (status == 0 || fakeIt==TRUE) {
|
||||
|
||||
#if defined CONFIG_FEATURE_MTAB_SUPPORT
|
||||
if (useMtab == TRUE) {
|
||||
if (useMtab) {
|
||||
erase_mtab(specialfile); // Clean any stale entries
|
||||
write_mtab(specialfile, dir, filesystemtype, flags, mtab_opts);
|
||||
}
|
||||
@ -210,19 +210,19 @@ parse_mount_options(char *options, int *flags, char *strflags)
|
||||
f++;
|
||||
}
|
||||
#if defined CONFIG_FEATURE_MOUNT_LOOP
|
||||
if (gotone == FALSE && !strcasecmp("loop", options)) { /* loop device support */
|
||||
if (! gotone && !strcasecmp("loop", options)) { /* loop device support */
|
||||
use_loop = TRUE;
|
||||
gotone = TRUE;
|
||||
}
|
||||
#endif
|
||||
if (*strflags && strflags != '\0' && gotone == FALSE) {
|
||||
if (*strflags && strflags != '\0' && ! gotone) {
|
||||
char *temp = strflags;
|
||||
|
||||
temp += strlen(strflags);
|
||||
*temp++ = ',';
|
||||
*temp++ = '\0';
|
||||
}
|
||||
if (gotone == FALSE)
|
||||
if (! gotone)
|
||||
strcat(strflags, options);
|
||||
if (comma) {
|
||||
*comma = ',';
|
||||
@ -261,7 +261,7 @@ mount_one(char *blockDevice, char *directory, char *filesystemType,
|
||||
status = do_mount(blockDevice, directory, filesystemType,
|
||||
flags | MS_MGC_VAL, string_flags,
|
||||
useMtab, fakeIt, mtab_opts, mount_all);
|
||||
if (status == TRUE)
|
||||
if (status)
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -286,7 +286,7 @@ mount_one(char *blockDevice, char *directory, char *filesystemType,
|
||||
status = do_mount(blockDevice, directory, filesystemType,
|
||||
flags | MS_MGC_VAL, string_flags,
|
||||
useMtab, fakeIt, mtab_opts, mount_all);
|
||||
if (status == TRUE)
|
||||
if (status)
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -299,8 +299,8 @@ mount_one(char *blockDevice, char *directory, char *filesystemType,
|
||||
fakeIt, mtab_opts, mount_all);
|
||||
}
|
||||
|
||||
if (status == FALSE) {
|
||||
if (whineOnErrors == TRUE) {
|
||||
if (! status) {
|
||||
if (whineOnErrors) {
|
||||
perror_msg("Mounting %s on %s failed", blockDevice, directory);
|
||||
}
|
||||
return (FALSE);
|
||||
@ -433,7 +433,7 @@ extern int mount_main(int argc, char **argv)
|
||||
if (optind + 1 < argc)
|
||||
directory = simplify_path(argv[optind + 1]);
|
||||
|
||||
if (all == TRUE || optind + 1 == argc) {
|
||||
if (all || optind + 1 == argc) {
|
||||
struct mntent *m = NULL;
|
||||
FILE *f = setmntent("/etc/fstab", "r");
|
||||
fstabmount = TRUE;
|
||||
@ -442,20 +442,20 @@ extern int mount_main(int argc, char **argv)
|
||||
perror_msg_and_die( "\nCannot read /etc/fstab");
|
||||
|
||||
while ((m = getmntent(f)) != NULL) {
|
||||
if (all == FALSE && optind + 1 == argc && (
|
||||
if (! all && optind + 1 == argc && (
|
||||
(strcmp(device, m->mnt_fsname) != 0) &&
|
||||
(strcmp(device, m->mnt_dir) != 0) ) ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (all == TRUE && ( // If we're mounting 'all'
|
||||
if (all && ( // If we're mounting 'all'
|
||||
(strstr(m->mnt_opts, "noauto")) || // and the file system isn't noauto,
|
||||
(strstr(m->mnt_type, "swap")) || // and isn't swap or nfs, then mount it
|
||||
(strstr(m->mnt_type, "nfs")) ) ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (all == TRUE || flags == 0) { // Allow single mount to override fstab flags
|
||||
if (all || flags == 0) { // Allow single mount to override fstab flags
|
||||
flags = 0;
|
||||
string_flags = string_flags_buf;
|
||||
*string_flags = '\0';
|
||||
@ -483,13 +483,13 @@ singlemount:
|
||||
string_flags, useMtab, fakeIt, extra_opts, TRUE, all))
|
||||
rc = EXIT_FAILURE;
|
||||
|
||||
if (all == FALSE)
|
||||
if (! all)
|
||||
break;
|
||||
}
|
||||
if (fstabmount == TRUE)
|
||||
if (fstabmount)
|
||||
endmntent(f);
|
||||
|
||||
if (all == FALSE && fstabmount == TRUE && m == NULL)
|
||||
if (! all && fstabmount && m == NULL)
|
||||
fprintf(stderr, "Can't find %s in /etc/fstab\n", device);
|
||||
|
||||
return rc;
|
||||
|
@ -179,19 +179,19 @@ static int do_umount(const char *name)
|
||||
status = umount(name);
|
||||
|
||||
#if defined CONFIG_FEATURE_MOUNT_LOOP
|
||||
if (freeLoop == TRUE && blockDevice != NULL && !strncmp("/dev/loop", blockDevice, 9))
|
||||
if (freeLoop && blockDevice != NULL && !strncmp("/dev/loop", blockDevice, 9))
|
||||
/* this was a loop device, delete it */
|
||||
del_loop(blockDevice);
|
||||
#endif
|
||||
#if defined CONFIG_FEATURE_MOUNT_FORCE
|
||||
if (status != 0 && doForce == TRUE) {
|
||||
if (status != 0 && doForce) {
|
||||
status = umount2(blockDevice, MNT_FORCE);
|
||||
if (status != 0) {
|
||||
error_msg_and_die("forced umount of %s failed!", blockDevice);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
if (status != 0 && doRemount == TRUE && errno == EBUSY) {
|
||||
if (status != 0 && doRemount && errno == EBUSY) {
|
||||
status = mount(blockDevice, name, NULL,
|
||||
MS_MGC_VAL | MS_REMOUNT | MS_RDONLY, NULL);
|
||||
if (status == 0) {
|
||||
@ -202,7 +202,7 @@ static int do_umount(const char *name)
|
||||
}
|
||||
if (status == 0) {
|
||||
#if defined CONFIG_FEATURE_MTAB_SUPPORT
|
||||
if (useMtab == TRUE)
|
||||
if (useMtab)
|
||||
erase_mtab(name);
|
||||
#endif
|
||||
return (TRUE);
|
||||
@ -282,15 +282,15 @@ extern int umount_main(int argc, char **argv)
|
||||
}
|
||||
|
||||
mtab_read();
|
||||
if (umountAll == TRUE) {
|
||||
if (umount_all() == TRUE)
|
||||
if (umountAll) {
|
||||
if (umount_all())
|
||||
return EXIT_SUCCESS;
|
||||
else
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
if (realpath(*argv, path) == NULL)
|
||||
perror_msg_and_die("%s", path);
|
||||
if (do_umount(path) == TRUE)
|
||||
if (do_umount(path))
|
||||
return EXIT_SUCCESS;
|
||||
perror_msg_and_die("%s", *argv);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user