[mew-dist 25724] Re: Mew 4.2 に向けて

Yasunari Momoi momo at example.com
2004年 12月 9日 (木) 14:03:11 JST


From: Kazu Yamamoto (山本和彦) <kazu at example.com>
Subject: [mew-dist 25723] Re: Mew 4.2 に向けて
Date: Thu, 09 Dec 2004 13:35:15 +0900 (JST)

> > %oで8進数限定のほうがいいです。
> 
> いや、僕が「10進数でお願い」と momo ちゃんに言いました。

はい.10進数も必要ってことでこうなりました.

> #8進数対応なんて考えてなくて、早く出せと...

"%i"なら8進,16進もいけます.

で,前のパッチには不要な変数があったので,こっちにしてくださ
い(_ _).

-- momo

Index: bin/incm.1
===================================================================
RCS file: /cvsmew/mew/bin/incm.1,v
retrieving revision 1.14
diff -u -r1.14 incm.1
--- bin/incm.1	10 Aug 2004 05:21:02 -0000	1.14
+++ bin/incm.1	9 Dec 2004 05:00:05 -0000
@@ -78,6 +78,9 @@
 .B \-f
 Preserve Unix From (Envelope Sender) line in mbox case.
 .TP 8
+.B \-p " mode"
+Specify file mode that creates in mbox case.
+.Tp 8
 .B \-h
 Display this help message.
 .TP 8
Index: bin/incm.c
===================================================================
RCS file: /cvsmew/mew/bin/incm.c,v
retrieving revision 1.21
diff -u -r1.21 incm.c
--- bin/incm.c	26 Nov 2004 06:43:05 -0000	1.21
+++ bin/incm.c	9 Dec 2004 05:00:05 -0000
@@ -76,6 +76,7 @@
 private int	UseCL;
 private int	PreserveUnixFrom;
 private int	CreateMTime = TRUE;
+private int	FileMode = S_IRUSR | S_IWUSR;
 private int	Exit = 0;
 
 /****************************************************************
@@ -225,6 +226,7 @@
 	"    -c            Use Content-Length: field. (for mbox)",
 	"    -u            Don't create inboxdir/.mew-mtime file.",
 	"    -f            Preserve Unix From (Envelope Sender). (for mbox)",
+	"    -p <fmode>    Specify file permission. (for mbox)",
 	NULL
 };
 
@@ -508,8 +510,6 @@
 {
 	char num[PATH_MAX];
 	int flag = O_EXCL | O_CREAT | O_WRONLY;
-	int mode = S_IRUSR | S_IRGRP | S_IROTH |
-		   S_IWUSR | S_IWGRP | S_IWOTH;
 	int fd;
 	FILE *fp = NULL;
 
@@ -518,7 +518,7 @@
 		if (strlen(InboxDir) + strlen(num) + 2 > PATH_MAX)
 			error("pathname too long (%s/%s)", InboxDir, num);
 		sprintf(inboxfile, "%s/%s", InboxDir, num);
-		if ((fd = open(inboxfile, flag, mode)) >= 0 ||
+		if ((fd = open(inboxfile, flag, FileMode)) >= 0 ||
 		    errno != EEXIST)
 			break;
 		usleep(rand() % 199);
@@ -876,7 +876,7 @@
 	warn_prog = progname;
 	init_env(argc, argv);
 
-	while ((ch = Getopt(argc, argv, "abcd:fhi:m:suvp")) != EOF) {
+	while ((ch = Getopt(argc, argv, "abcd:fhi:m:p:suv")) != EOF) {
 		switch (ch) {
 		case 'a':
 			GetCur = TRUE;
@@ -901,10 +901,9 @@
 				error("pathname too long (%s)", Optarg);
 			sprintf(InboxDir, "%s", Optarg);
 			break;
-		case 'p':	/* for debug */
-			printf("InboxDir: %s\n", InboxDir);
-			printf("Mbox: %s\n", Mbox);
-			exit(EXIT_SUCCESS);
+		case 'p':
+			sscanf(Optarg, "%i", &FileMode);
+			break;
 		case 's':
 			MboxType = T_STDIN;
 			break;



Mew-dist メーリングリストの案内