aboutsummaryrefslogtreecommitdiff
path: root/main.c
diff options
context:
space:
mode:
Diffstat (limited to 'main.c')
-rw-r--r--main.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/main.c b/main.c
index f590126..dadc455 100644
--- a/main.c
+++ b/main.c
@@ -116,7 +116,12 @@ void reloc_replace(RelocMatch *match, const char *rstr) {
int main(int argc, char *argv[]) {
- const char *program = strrchr(argv[0], DIRSEP) + 1;
+ char *program = argv[0];
+ char *program_relative = strrchr(program, DIRSEP);
+ if (program_relative) {
+ program = program_relative + 1;
+ }
+
if (argc < 5) {
printf("%s <str1> <str2> <input_file> <output_file>\n"
"\n"