mirror of
https://github.com/Stichting-MINIX-Research-Foundation/pkgsrc-ng.git
synced 2025-09-09 20:40:13 -04:00
79 lines
2.7 KiB
Plaintext
79 lines
2.7 KiB
Plaintext
$NetBSD: patch-aa,v 1.2 2006/01/24 19:08:09 joerg Exp $
|
|
|
|
--- newmail.c.orig 1999-10-14 04:49:42.000000000 +0000
|
|
+++ newmail.c
|
|
@@ -28,6 +28,22 @@
|
|
static void usage();
|
|
static void version();
|
|
|
|
+#ifdef DT_REG
|
|
+#define DIRENT_IS_REG(x) ((x) == DT_REG)
|
|
+#elif defined(DTTOIF)
|
|
+#define DIRENT_IS_REG(x) (S_ISREG(DTTOIF((x))))
|
|
+#else
|
|
+#error "Neither DT_REG nor DTTOIF is defined."
|
|
+#endif
|
|
+
|
|
+#ifdef DT_DIR
|
|
+#define DIRENT_IS_DIR(x) ((x) == DT_DIR)
|
|
+#elif defined(DTTOIF)
|
|
+#define DIRENT_IS_DIR(x) (S_ISDIR(DTTOIF((x))))
|
|
+#else
|
|
+#error "Neither DT_REG nor DTTOIF is defined."
|
|
+#endif
|
|
+
|
|
unsigned char no_mail_message,
|
|
individual_messages,
|
|
use_exit_val;
|
|
@@ -98,7 +114,7 @@ int main(int argc, char *argv[]) {
|
|
continue;
|
|
}
|
|
/* see if its a regular file */
|
|
- if (S_ISREG(DTTOIF(curr_file->d_type))) {
|
|
+ if (DIRENT_IS_REG(curr_file->d_type)) {
|
|
/* stat it for check_mailbox */
|
|
if (stat(curr_file->d_name, &file_info) == -1) {
|
|
err(EX_NOINPUT, "couldn't stat %s/%s", argv[ui], curr_file->d_name);
|
|
@@ -106,7 +122,7 @@ int main(int argc, char *argv[]) {
|
|
check_mailbox(curr_file->d_name, &file_info, &found_mail);
|
|
} else if (warn_non_regular) {
|
|
/* just check its not a directory before warning */
|
|
- if (! S_ISDIR(DTTOIF(curr_file->d_type))) {
|
|
+ if (! DIRENT_IS_DIR(curr_file->d_type)) {
|
|
warnx("Found %s/%s: Not a regular file", argv[ui], curr_file->d_name);
|
|
}
|
|
} /* end of is dirent a regular file */
|
|
@@ -148,19 +164,19 @@ void check_mailbox(const char *const fn,
|
|
|
|
static void usage() {
|
|
|
|
- fprintf(stderr,"usage: newmail [-deirv] directory|file directory|file ...
|
|
-
|
|
-where:
|
|
- d: Prints messages when you do not have new mail
|
|
- e: Exits with 0 on no new mail, 1 on new mail, > 1 on error
|
|
- (normally exits with a value from sysexits(3)). May not be used
|
|
- with -d or -i.
|
|
- i: Prints a message for each mailbox that has new mail (and those
|
|
- that don't if -d is also used)
|
|
- r: Warns if it finds a non regular file
|
|
- v: Print version number and exit
|
|
-
|
|
-directory|file are, respectively, directories to look in for mailboxes
|
|
+ fprintf(stderr,"usage: newmail [-deirv] directory|file directory|file ...\n\
|
|
+\n\
|
|
+where:\n\
|
|
+ d: Prints messages when you do not have new mail\n\
|
|
+ e: Exits with 0 on no new mail, 1 on new mail, > 1 on error\n\
|
|
+ (normally exits with a value from sysexits(3)). May not be used\n\
|
|
+ with -d or -i.\n\
|
|
+ i: Prints a message for each mailbox that has new mail (and those\n\
|
|
+ that don't if -d is also used)\n\
|
|
+ r: Warns if it finds a non regular file\n\
|
|
+ v: Print version number and exit\n\
|
|
+ \n\
|
|
+directory|file are, respectively, directories to look in for mailboxes\n\
|
|
and mailboxes.\n");
|
|
|
|
exit(EX_USAGE);
|