diff options
author | Matt Wilson <msw@redhat.com> | 2000-02-16 19:27:30 +0000 |
---|---|---|
committer | Matt Wilson <msw@redhat.com> | 2000-02-16 19:27:30 +0000 |
commit | 0c5c762dee2b22c934fca9d07b7a290de9ecbea6 (patch) | |
tree | afc6e9078c765df4cd63ad271c12f4aa8ee27c42 /utils/mapshdr.c | |
parent | 727740949fdf353f8b5a45b355fe9c2a57be39d2 (diff) | |
download | anaconda-0c5c762dee2b22c934fca9d07b7a290de9ecbea6.tar.gz anaconda-0c5c762dee2b22c934fca9d07b7a290de9ecbea6.tar.xz anaconda-0c5c762dee2b22c934fca9d07b7a290de9ecbea6.zip |
added
Diffstat (limited to 'utils/mapshdr.c')
-rw-r--r-- | utils/mapshdr.c | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/utils/mapshdr.c b/utils/mapshdr.c new file mode 100644 index 000000000..e5524a57b --- /dev/null +++ b/utils/mapshdr.c @@ -0,0 +1,39 @@ +#include <errno.h> +#include <stdio.h> +#include <string.h> +#include <sys/stat.h> +#include <unistd.h> + +#include "../loader/lang.h" + +int main(int argc, char ** argv) { + struct kmapHeader h; + struct kmapInfo info; + int i; + struct stat sb; + char * chptr; + + h.magic = KMAP_MAGIC; + h.numEntries = argc - 1; + write(1, &h, sizeof(h)); + + for (i = 1; i < argc; i++) { + if (stat(argv[i], &sb)) { + fprintf(stderr, "stat error for %s: %s\n", argv[i], + strerror(errno)); + exit(1); + } + + memset(info.name, 0, KMAP_NAMELEN); + strncpy(info.name, argv[i], KMAP_NAMELEN - 1); + + chptr = info.name + strlen(info.name) - 1; + while (*chptr != '.') *chptr-- = '\0'; + *chptr = '\0'; + + info.size = sb.st_size; + write(1, &info, sizeof(info)); + } + + return 0; +} |