[darwinbuild-changes] [121] trunk/darwinxref/plugins/edit.c
source_changes at macosforge.org
source_changes at macosforge.org
Wed Oct 4 01:48:22 PDT 2006
Revision: 121
http://trac.macosforge.org/projects/darwinbuild/changeset/121
Author: kevin
Date: 2006-10-04 01:48:22 -0700 (Wed, 04 Oct 2006)
Log Message:
-----------
- make the build number an actual argument to edit
- show which build/project is being edited in a comment
Modified Paths:
--------------
trunk/darwinxref/plugins/edit.c
Modified: trunk/darwinxref/plugins/edit.c
===================================================================
--- trunk/darwinxref/plugins/edit.c 2005-07-29 20:31:45 UTC (rev 120)
+++ trunk/darwinxref/plugins/edit.c 2006-10-04 08:48:22 UTC (rev 121)
@@ -35,22 +35,22 @@
#include <sys/wait.h>
#include <unistd.h>
-int editPlist(CFStringRef project);
+int editPlist(CFStringRef build, CFStringRef project);
static int execEditor(const char* tmpfile);
static int run(CFArrayRef argv) {
+ CFStringRef build = DBGetCurrentBuild();
CFStringRef project = NULL;
CFIndex count = CFArrayGetCount(argv);
- if (count > 1) return -1;
- if (count == 1) {
- project = CFArrayGetValueAtIndex(argv, 0);
- }
- int res = editPlist(project);
+ if (count > 2) return -1;
+ if (count >= 1) build = CFArrayGetValueAtIndex(argv, 0);
+ if (count >= 2) project = CFArrayGetValueAtIndex(argv, 1);
+ int res = editPlist(build, project);
return res;
}
static CFStringRef usage() {
- return CFRetain(CFSTR("[<project>]"));
+ return CFRetain(CFSTR("[<build> [<project>]]"));
}
int initialize(int version) {
@@ -68,8 +68,7 @@
}
-int editPlist(CFStringRef project) {
- CFStringRef build = DBGetCurrentBuild();
+int editPlist(CFStringRef build, CFStringRef project) {
struct stat before, after;
CFDictionaryRef p = NULL;
if (project) {
@@ -85,6 +84,11 @@
strcpy(tmpfile, "/tmp/darwinxref.project.XXXXXX");
int fd = mkstemp(tmpfile);
FILE* f = fdopen(fd, "w");
+ if (project) {
+ cfprintf(f, "// Project %@ for build %@\n", project, build);
+ } else {
+ cfprintf(f, "// All projects for build %@\n", build);
+ }
writePlist(f, p, 0);
CFRelease(p);
fclose(f);
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.macosforge.org/pipermail/darwinbuild-changes/attachments/20061004/31af248f/attachment-0001.html
More information about the darwinbuild-changes
mailing list