FreeCalypso > hg > tcs211-patches
view 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 (2015-06-06) |
parents | |
children | 04fd47d382c7 |
line wrap: on
line source
/* * This module implements the "patch hook" that checks if an archive member * needs to be patched and invokes all necessary patch processing. */ #include <sys/types.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <strings.h> #include <time.h> #include "ar.h" #include "globals.h" #include "patchinfo.h" extern struct ar_hdr ar_hdr; update_ar_timestamp() { time_t curtime; time(&curtime); sprintf(ar_hdr.ar_date, "%-12lu", (u_long) curtime); } patch_hook() { struct patch_module_desc *pmd; struct patch_desc *patch; for (pmd = patch_module_list; pmd; pmd = pmd->next) if (!strcmp(pmd->member_name, member_name)) break; if (!pmd) return(0); /* yes, we need to patch it: start digging into it */ parse_coff_hdr(); for (patch = pmd->patches; patch; patch = patch->next) apply_patch(patch); update_ar_timestamp(); return(1); }