#define column_width COLUMN_WIDTH
#endif
+static int status = EXIT_SUCCESS;
+
static void newline(void)
{
if (column > 0) {
dir = opendir(path);
if (dir == NULL) {
errorMsg("%s: %s\n", path, strerror(errno));
+ status = EXIT_FAILURE;
return(NULL); /* could not open the dir */
}
while ((entry = readdir(dir)) != NULL) {
if (follow_links == TRUE) {
if (stat(cur->fullname, &cur->dstat)) {
errorMsg("%s: %s\n", cur->fullname, strerror(errno));
+ status = EXIT_FAILURE;
free(cur->fullname);
free(cur);
continue;
#endif
if (lstat(cur->fullname, &cur->dstat)) { /* get file stat info into node */
errorMsg("%s: %s\n", cur->fullname, strerror(errno));
+ status = EXIT_FAILURE;
free(cur->fullname);
free(cur);
continue;
if (follow_links == TRUE) {
if (stat(av[oi], &cur->dstat)) {
errorMsg("%s: %s\n", av[oi], strerror(errno));
+ status = EXIT_FAILURE;
free(cur->fullname);
free(cur);
continue;
#endif
if (lstat(av[oi], &cur->dstat)) { /* get file info into node */
errorMsg("%s: %s\n", av[oi], strerror(errno));
+ status = EXIT_FAILURE;
free(cur->fullname);
free(cur);
continue;
}
}
- return(0);
+ return(status);
print_usage_message:
usage(ls_usage);
#define column_width COLUMN_WIDTH
#endif
+static int status = EXIT_SUCCESS;
+
static void newline(void)
{
if (column > 0) {
dir = opendir(path);
if (dir == NULL) {
errorMsg("%s: %s\n", path, strerror(errno));
+ status = EXIT_FAILURE;
return(NULL); /* could not open the dir */
}
while ((entry = readdir(dir)) != NULL) {
if (follow_links == TRUE) {
if (stat(cur->fullname, &cur->dstat)) {
errorMsg("%s: %s\n", cur->fullname, strerror(errno));
+ status = EXIT_FAILURE;
free(cur->fullname);
free(cur);
continue;
#endif
if (lstat(cur->fullname, &cur->dstat)) { /* get file stat info into node */
errorMsg("%s: %s\n", cur->fullname, strerror(errno));
+ status = EXIT_FAILURE;
free(cur->fullname);
free(cur);
continue;
if (follow_links == TRUE) {
if (stat(av[oi], &cur->dstat)) {
errorMsg("%s: %s\n", av[oi], strerror(errno));
+ status = EXIT_FAILURE;
free(cur->fullname);
free(cur);
continue;
#endif
if (lstat(av[oi], &cur->dstat)) { /* get file info into node */
errorMsg("%s: %s\n", av[oi], strerror(errno));
+ status = EXIT_FAILURE;
free(cur->fullname);
free(cur);
continue;
}
}
- return(0);
+ return(status);
print_usage_message:
usage(ls_usage);