Mercurial > emacs
annotate src/unexencap.c @ 31383:860d7ac182e3
(vc-rcs-show-log-entry): New function.
(vc-rcs-checkin, vc-rcs-checkout): Don't set all properties.
(vc-rcs-register): If there is no RCS subdir, ask the
user whether to create one.
(vc-rcs-state-heuristic): Use
file-ownership-preserved-p.
(vc-rcs-checkout): Remove the error-handling for missing-rcs.
(vc-rcs-state-heuristic): Don't use file-writable-p.
(vc-rcs-print-log): Insert in the current buffer.
(vc-rcs-diff): Insert in the current buffer and remove unused arg
CMP.
(vc-rcs-workfile-unchanged-p): Use vc-do-command
instead of vc-simple-command.
(vc-rcs-fetch-master-state): Removed check for unlocked-changes to
avoid doing a diff when opening a file.
(vc-rcs-state): Added check for unlocked-changes.
(vc-rcs-header): Escape Id.
(vc-rcs-workfile-unchanged-p): Remove optional arg VERSION.
(vc-rcs-state): Call vc-workfile-unchanged-p, not the RCS-specific
version.
(vc-rcs-state-heuristic): Use file-writable-p instead
of comparing userids.
(vc-rcs-fetch-master-state): Handle the case where rcs is missing.
Simplify the logic by eliminating unreachable code.
(vc-rcs-diff): Only pass `2' to vc-do-command if necessary and
just do a recursive call if we need to retry.
(vc-rcs-checkout): Handle the case where rcs is missing by making
the buffer read-write if requested and re-signalling the error.
(vc-rcs-find-most-recent-rev): New function. The code
derives from the old vc-parse-buffer but uses the revision number
rather than the date (much easier to compare robustly).
(vc-rcs-fetch-master-state): Use `with-temp-buffer'. Adapt to the
new vc-parse-buffer (and vc-rcs-find-most-recent-rev). Find the
locking-user more directly. Check strict locking and set
checkout-model appropriately.
(vc-rcs-parse-locks): Remove.
(vc-rcs-latest-on-branch-p): Use with-temp-buffer and adapt to the
new vc-parse-buffer (and vc-rcs-find-most-recent-rev).
(vc-rcs-system-release): Use with-current-buffer and
vc-parse-buffer.
(vc-rcs-register, vc-rcs-checkout): Use with-current-buffer.
Merge in code
from vc-rcs-hooks.el. Don't require 'vc anymore.
(vc-rcs-responsible-p): Use expand-file-name instead of concat and
file-directory-p instead of file-exists-p.
(vc-rcs-exists): Remove.
(vc-rcs-header): New var.
Update Copyright.
(vc-rcs-rename-file): New function.
(vc-rcs-diff): Remove unused `backend' variable.
(vc-rcs-clear-headers): New function; code moved here
from vc-clear-headers in vc.el.
(tail): Provide vc-rcs and remove vc-rcs-logentry-check.
(vc-rcs-register): Parse command output to find master
file name and workfile version.
(vc-rcs-checkout): Removed call to vc-file-clear-masterprops.
Require vc and vc-rcs-hooks.
(vc-rcs-trunk-p, vc-rcs-branch-part): Move to vc-rcs-hooks.
(vc-rcs-backend-release-p): Remove (use vc-rcs-release-p).
(vc-release-greater-or-equal-p): Move from vc.
(vc-rcs-trunk-p, vc-rcs-branch-p, vc-rcs-branch-part,
vc-rcs-minor-part, vc-rcs-previous-version): Remove duplicates.
(vc-rcs-checkout): Add a missing `new-version' argument in the
call to vc-rcs-latest-on-branch-p. Hopefully that was the right
one.
(vc-rcs-steal-lock): Renamed from `vc-rcs-steal'.
Updated everything to use `vc-checkout-model'.
(vc-rcs-backend-release-p): function added. other
stuff updated to reference this function instead of the old
`vc-backend-release-p'.
(vc-rcs-logentry-check): Function added.
(vc-rcs-checkin, vc-rcs-previous-version)
(vc-rcs-checkout): Name space cleaned up. No more revision number
crunching function names that are not prefixed with vc-rcs.
(vc-rcs-checkout-model): Function added. References to
`vc-checkout-model' replaced.
(vc-rcs-admin): Added the query-only option as
required by the vc.el file.
(vc-rcs-exists): Function added.
(vc-*-checkout):
Use with-temp-file instead of /bin/sh. Merged from mainline
(vc-rcs-latest-on-branch-p): Moved to vc-rcs-hooks.el.
(vc-rcs-latest-on-branch-p, vc-rcs-trunk-p)
(vc-rcs-branch-p, vc-rcs-branch-part, vc-rcs-minor-part)
(vc-rcs-previous-version): Functions added.
(vc-rcs-diff): Function added.
(vc-rcs-checkout) Bug (typo) found and fixed.
(vc-rcs-register-switches) Variable `vc-rcs-register-switches' added.
Require vc when compiling.
(vc-rcs-print-log, vc-rcs-assign-name, vc-rcs-merge)
(vc-rcs-check-headers, vc-rcs-steal, vc-rcs-uncheck, vc-rcs-revert)
(vc-rcs-checkin): New functions (code from vc.el).
(vc-rcs-previous-version, vc-rcs-system-release, vc-rcs-checkout):
Doc fix.
(vc-rcs-release): Deleted. (Duplicated vc-rcs-system-release).
(vc-rcs-trunk-p, vc-rcs-branch-p, vc-rcs-branch-part)
(vc-rcs-minor-part, vc-rcs-previous-version, vc-rcs-release)
(vc-rcs-release-p, vc-rcs-admin, vc-rcs-checkout): New functions
from vc.el.
(vc-rcs-system-release):
Renamed from vc-rcs-backend-release.
author | Gerd Moellmann <gerd@gnu.org> |
---|---|
date | Mon, 04 Sep 2000 19:47:43 +0000 |
parents | 80cdb2387043 |
children |
rev | line source |
---|---|
486 | 1 /* Waiting for papers! */ |
2 | |
3 /* | |
4 * Do an unexec() for coff encapsulation. Uses the approach I took | |
5 * for AKCL, so don't be surprised if it doesn't look too much like | |
6 * the other unexec() routines. Assumes NO_REMAP. Should be easy to | |
7 * adapt to the emacs style unexec() if that is desired, but this works | |
8 * just fine for me with GCC/GAS/GLD under System V. - Jordan | |
9 */ | |
10 | |
11 #include <sys/types.h> | |
12 #include <sys/fcntl.h> | |
13 #include <sys/file.h> | |
14 #include <stdio.h> | |
15 #include "/usr/gnu/lib/gcc/gcc-include/a.out.h" | |
16 | |
17 filecpy(to, from, n) | |
18 FILE *to, *from; | |
19 register int n; | |
20 { | |
21 char buffer[BUFSIZ]; | |
22 | |
23 for (;;) | |
24 if (n > BUFSIZ) { | |
25 fread(buffer, BUFSIZ, 1, from); | |
26 fwrite(buffer, BUFSIZ, 1, to); | |
27 n -= BUFSIZ; | |
28 } else if (n > 0) { | |
29 fread(buffer, 1, n, from); | |
30 fwrite(buffer, 1, n, to); | |
31 break; | |
32 } else | |
33 break; | |
34 } | |
35 /* **************************************************************** | |
36 * unexec | |
37 * | |
38 * driving logic. | |
39 * ****************************************************************/ | |
40 unexec (new_name, a_name, data_start, bss_start, entry_address) | |
41 char *new_name, *a_name; | |
42 unsigned data_start, bss_start, entry_address; | |
43 { | |
44 struct coffheader header1; | |
45 struct coffscn *tp, *dp, *bp; | |
46 struct exec header; | |
47 int stsize; | |
48 char *original_file = a_name; | |
49 char *save_file = new_name; | |
50 | |
51 char *data_begin, *data_end; | |
52 int original_data; | |
53 FILE *original, *save; | |
54 register int n; | |
55 register char *p; | |
56 extern char *sbrk(); | |
57 char stdin_buf[BUFSIZ], stdout_buf[BUFSIZ]; | |
58 | |
59 | |
60 fclose(stdin); | |
61 original = fopen(original_file, "r"); | |
62 if (stdin != original || original->_file != 0) { | |
63 fprintf(stderr, "unexec: Can't open the original file.\n"); | |
64 exit(1); | |
65 } | |
66 setbuf(original, stdin_buf); | |
67 fclose(stdout); | |
68 unlink(save_file); | |
69 n = open(save_file, O_CREAT|O_WRONLY, 0777); | |
70 if (n != 1 || (save = fdopen(n, "w")) != stdout) { | |
71 fprintf(stderr, "unexec: Can't open the save file.\n"); | |
72 exit(1); | |
73 } | |
74 setbuf(save, stdout_buf); | |
75 | |
76 fread(&header1, sizeof(header1), 1, original); | |
77 tp = &header1.scns[0]; | |
78 dp = &header1.scns[1]; | |
79 bp = &header1.scns[2]; | |
80 fread(&header, sizeof(header), 1, original); | |
81 data_begin=(char *)N_DATADDR(header); | |
82 data_end = sbrk(0); | |
83 original_data = header.a_data; | |
84 header.a_data = data_end - data_begin; | |
85 header.a_bss = 0; | |
86 dp->s_size = header.a_data; | |
87 bp->s_paddr = dp->s_vaddr + dp->s_size; | |
88 bp->s_vaddr = bp->s_paddr; | |
89 bp->s_size = 0; | |
90 header1.tsize = tp->s_size; | |
91 header1.dsize = dp->s_size; | |
92 header1.bsize = bp->s_size; | |
93 fwrite(&header1, sizeof(header1), 1, save); | |
94 fwrite(&header, sizeof(header), 1, save); | |
95 | |
96 filecpy(save, original, header.a_text); | |
97 | |
98 for (n = header.a_data, p = data_begin; ; n -= BUFSIZ, p += BUFSIZ) | |
99 if (n > BUFSIZ) | |
100 fwrite(p, BUFSIZ, 1, save); | |
101 else if (n > 0) { | |
102 fwrite(p, 1, n, save); | |
103 break; | |
104 } else | |
105 break; | |
106 | |
107 fseek(original, original_data, 1); | |
108 | |
109 filecpy(save, original, header.a_syms+header.a_trsize+header.a_drsize); | |
110 fread(&stsize, sizeof(stsize), 1, original); | |
111 fwrite(&stsize, sizeof(stsize), 1, save); | |
112 filecpy(save, original, stsize - sizeof(stsize)); | |
113 | |
114 fclose(original); | |
115 fclose(save); | |
116 } |