FreeCalypso > hg > tcs211-patches
comparison tool/patchhook.c @ 6:87e9f30f5f86
ti-libpatch: patching implemented
author | Space Falcon <falcon@ivan.Harhan.ORG> |
---|---|
date | Sat, 06 Jun 2015 04:51:15 +0000 |
parents | |
children | 04fd47d382c7 |
comparison
equal
deleted
inserted
replaced
5:5ba13fd0e737 | 6:87e9f30f5f86 |
---|---|
1 /* | |
2 * This module implements the "patch hook" that checks if an archive member | |
3 * needs to be patched and invokes all necessary patch processing. | |
4 */ | |
5 | |
6 #include <sys/types.h> | |
7 #include <stdio.h> | |
8 #include <stdlib.h> | |
9 #include <string.h> | |
10 #include <strings.h> | |
11 #include <time.h> | |
12 #include "ar.h" | |
13 #include "globals.h" | |
14 #include "patchinfo.h" | |
15 | |
16 extern struct ar_hdr ar_hdr; | |
17 | |
18 update_ar_timestamp() | |
19 { | |
20 time_t curtime; | |
21 | |
22 time(&curtime); | |
23 sprintf(ar_hdr.ar_date, "%-12lu", (u_long) curtime); | |
24 } | |
25 | |
26 patch_hook() | |
27 { | |
28 struct patch_module_desc *pmd; | |
29 struct patch_desc *patch; | |
30 | |
31 for (pmd = patch_module_list; pmd; pmd = pmd->next) | |
32 if (!strcmp(pmd->member_name, member_name)) | |
33 break; | |
34 if (!pmd) | |
35 return(0); | |
36 /* yes, we need to patch it: start digging into it */ | |
37 parse_coff_hdr(); | |
38 for (patch = pmd->patches; patch; patch = patch->next) | |
39 apply_patch(patch); | |
40 update_ar_timestamp(); | |
41 return(1); | |
42 } |