[hackers] [scc] [driver] write files to PWD instead of source directory || Quentin Rameau

From: <git_AT_suckless.org>
Date: Fri, 3 Jun 2016 18:12:46 +0200 (CEST)

commit 3cc47a8255956803a30439bb661d42d2f32bebad
Author: Quentin Rameau <quinq_AT_fifth.space>
AuthorDate: Fri Jun 3 16:54:10 2016 +0200
Commit: Quentin Rameau <quinq_AT_fifth.space>
CommitDate: Fri Jun 3 18:10:23 2016 +0200

    [driver] write files to PWD instead of source directory

diff --git a/driver/posix/scc.c b/driver/posix/scc.c
index 469662c..eedd0b5 100644
--- a/driver/posix/scc.c
+++ b/driver/posix/scc.c
_AT_@ -113,12 +113,19 @@ inittool(int tool)
 }
 
 static char *
-newfileext(char *name, char *ext)
+outfilename(char *path, char *ext)
 {
- char *new, *dot;
- size_t newsz, nameln = strlen(name);
+ char *new, *name, *dot;
+ size_t newsz, nameln;
         int n;
 
+ if (!(name = strrchr(path, '/')))
+ name = path;
+ else
+ ++name;
+
+ nameln = strlen(name);
+
         if (!(dot = strrchr(name, '.')))
                 dot = &name[nameln];
 
_AT_@ -144,7 +151,7 @@ settool(int tool, char *input, int output)
 
         switch (tool) {
         case AS:
- outfiles[output] = newfileext(input, "o");
+ outfiles[output] = outfilename(input, "o");
                 t->args[t->nargs] = outfiles[output];
                 t->args[3] = NULL;
                 break;
_AT_@ -160,7 +167,7 @@ settool(int tool, char *input, int output)
                 case AS:
                         ext = "as"; break;
                 }
- outfiles[output] = newfileext(input, ext);
+ outfiles[output] = outfilename(input, ext);
                 t->args[1] = outfiles[output];
                 break;
         default:
Received on Fri Jun 03 2016 - 18:12:46 CEST

This archive was generated by hypermail 2.3.0 : Fri Jun 03 2016 - 18:24:20 CEST