Subversion Repositories

?revision_form?Rev ?revision_input??revision_submit??revision_endform?

Rev 2 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 2 Rev 11
Line 4... Line 4...
4
## DP: Adds -s parameter to pmksetup, which outputs config to standard
4
## DP: Adds -s parameter to pmksetup, which outputs config to standard
5
## DP: output, as well as -g, which forces data gathering to take place
5
## DP: output, as well as -g, which forces data gathering to take place
6
## DP: immediately.
6
## DP: immediately.
7
7
8
@DPATCH@
8
@DPATCH@
9
-
 
10
--- pmk-0.10.1.orig/pmksetup.h
9
diff -urNad trunk~/pmksetup.c trunk/pmksetup.c
11
+++ pmk-0.10.1/pmksetup.h
-
 
12
@@ -85,7 +85,7 @@
-
 
13
 #define	ECHO_NL		"\\n"
-
 
14
 #define	ECHO_HT		"\\t"
-
 
15
 
-
 
16
-#define PMKSTP_OPT_STR	"hr:u:vV"	/* "a:hr:u:vV" */
10
--- trunk~/pmksetup.c	2006-10-15 00:31:11.000000000 +0200
17
+#define PMKSTP_OPT_STR	"ghr:su:vV"	/* "a:hr:u:vV" */
-
 
18
 
-
 
19
 #define EMSG_PRIV_FMT	"Failed to change privilege (%s)"
11
+++ trunk/pmksetup.c	2007-08-05 15:17:25.000000000 +0200
20
 
-
 
21
--- pmk-0.10.1.orig/pmksetup.c
-
 
22
+++ pmk-0.10.1/pmksetup.c
-
 
23
@@ -66,6 +66,7 @@
12
@@ -66,6 +66,7 @@
24
 extern int	 optind;
13
 extern int	 optind;
25
 
14
 
26
 FILE		*sfp;			/* scratch file pointer */
15
 FILE		*sfp;			/* scratch file pointer */
27
+bool		 tostdout = false;
16
+bool		 tostdout = false;
Line 131... Line 120...
131
-		printf("==> Saving configuration file: %s\n",
120
-		printf("==> Saving configuration file: %s\n",
132
+		fprintf(stderr, "==> Saving configuration file: %s\n",
121
+		fprintf(stderr, "==> Saving configuration file: %s\n",
133
 						PREMAKE_CONFIG_PATH);
122
 						PREMAKE_CONFIG_PATH);
134
 		if (fcopy(sfn, PREMAKE_CONFIG_PATH,
123
 		if (fcopy(sfn, PREMAKE_CONFIG_PATH,
135
 					PREMAKE_CONFIG_MODE) == false) {
124
 					PREMAKE_CONFIG_MODE) == false) {
-
 
125
@@ -1129,15 +1141,17 @@
-
 
126
 	}
-
 
127
 #endif
-
 
128
 
-
 
129
+	if (!tostdout) {
-
 
130
 #ifdef PMKSETUP_DEBUG
-
 
131
-	debugf("%s has not been deleted!", sfn);
-
 
132
+		debugf("%s has not been deleted!", sfn);
-
 
133
 #else
-
 
134
-	if (unlink(sfn) == -1) {
-
 
135
-		errorf("cannot remove temporary file: '%s' : %s.",
-
 
136
-					sfn, strerror(errno));
-
 
137
-		error = true;
-
 
138
-	}
-
 
139
+		if (unlink(sfn) == -1) {
-
 
140
+			errorf("cannot remove temporary file: '%s' : %s.",
-
 
141
+						sfn, strerror(errno));
-
 
142
+			error = true;
-
 
143
+		}
-
 
144
 #endif	/* PMKSETUP_DEBUG */
-
 
145
+	}
-
 
146
 
-
 
147
 #ifndef WITHOUT_FORK
-
 
148
 	if (status != 0) {
136
@@ -1165,7 +1177,7 @@
149
@@ -1165,7 +1179,7 @@
137
  ***********************************************************************/
150
  ***********************************************************************/
138
 
151
 
139
 void usage(void) {
152
 void usage(void) {
140
-	fprintf(stderr, "usage: pmksetup [-hVv] "
153
-	fprintf(stderr, "usage: pmksetup [-hVv] "
141
+	fprintf(stderr, "usage: pmksetup [-hsVv] "
154
+	fprintf(stderr, "usage: pmksetup [-hsVv] "
142
 		"[-r variable] [-u variable=value]\n");
155
 		"[-r variable] [-u variable=value]\n");
143
 	exit(EXIT_FAILURE);
156
 	exit(EXIT_FAILURE);
144
 }
157
 }
145
@@ -1188,6 +1200,7 @@
158
@@ -1188,6 +1202,7 @@
146
 	optind = 1;
159
 	optind = 1;
147
 	while ((ch = getopt(argc, argv, PMKSTP_OPT_STR)) != -1) {
160
 	while ((ch = getopt(argc, argv, PMKSTP_OPT_STR)) != -1) {
148
 		switch(ch) {
161
 		switch(ch) {
149
+			case 'g' :
162
+			case 'g' :
150
 			case 'r' :
163
 			case 'r' :
151
 			case 'u' :
164
 			case 'u' :
152
 				/*
165
 				/*
153
@@ -1206,6 +1219,10 @@
166
@@ -1206,6 +1221,10 @@
154
 					verbose_flag = 1;
167
 					verbose_flag = 1;
155
 				break;
168
 				break;
156
 
169
 
157
+			case 's':
170
+			case 's':
158
+				tostdout = true;
171
+				tostdout = true;
159
+				break;
172
+				break;
160
+
173
+
161
 			case '?' :
174
 			case '?' :
162
 			default :
175
 			default :
163
 				usage();
176
 				usage();
164
@@ -1213,7 +1230,6 @@
177
@@ -1213,7 +1232,6 @@
165
 		}
178
 		}
166
 	}
179
 	}
167
 
180
 
168
-
181
-
169
 	if (getuid() == 0) {
182
 	if (getuid() == 0) {
170
 #ifdef PMKSETUP_DEBUG
183
 #ifdef PMKSETUP_DEBUG
171
 		debugf("PRIVSEP_USER = '%s'", PRIVSEP_USER);
184
 		debugf("PRIVSEP_USER = '%s'", PRIVSEP_USER);
172
@@ -1227,22 +1243,27 @@
185
@@ -1227,22 +1245,27 @@
173
 		gid = pw->pw_gid;
186
 		gid = pw->pw_gid;
174
 	}
187
 	}
175
 
188
 
176
-	/* check if syconfdir exists */
189
-	/* check if syconfdir exists */
177
-	if (access(CONFDIR, F_OK) != 0) { /* no race condition, just mkdir() */
190
-	if (access(CONFDIR, F_OK) != 0) { /* no race condition, just mkdir() */
Line 209... Line 222...
209
+			exit(EXIT_FAILURE);
222
+			exit(EXIT_FAILURE);
210
+		}
223
+		}
211
 	}
224
 	}
212
 
225
 
213
 #ifndef WITHOUT_FORK
226
 #ifndef WITHOUT_FORK
-
 
227
diff -urNad trunk~/pmksetup.h trunk/pmksetup.h
-
 
228
--- trunk~/pmksetup.h	2005-05-14 13:37:38.000000000 +0200
-
 
229
+++ trunk/pmksetup.h	2007-08-05 15:09:51.000000000 +0200
-
 
230
@@ -85,7 +85,7 @@
-
 
231
 #define	ECHO_NL		"\\n"
-
 
232
 #define	ECHO_HT		"\\t"
-
 
233
 
-
 
234
-#define PMKSTP_OPT_STR	"hr:u:vV"	/* "a:hr:u:vV" */
-
 
235
+#define PMKSTP_OPT_STR	"ghr:su:vV"	/* "a:hr:u:vV" */
-
 
236
 
-
 
237
 #define EMSG_PRIV_FMT	"Failed to change privilege (%s)"
-
 
238