Skip to content

Commit

Permalink
basename cmd
Browse files Browse the repository at this point in the history
  • Loading branch information
txthinking committed Jul 7, 2021
1 parent 27de74f commit 6700f7d
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions joker.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <libgen.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/stat.h>
Expand Down
2 changes: 1 addition & 1 deletion main.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ int main(int argc, char *argv[])
return 0;
}
if(argc == 2 && (strcmp(argv[1], "version") == 0 || strcmp(argv[1], "--version") == 0 || strcmp(argv[1], "-v") == 0)){
printf("v20210701\n");
printf("v20210707\n");
return 0;
}

Expand Down
2 changes: 1 addition & 1 deletion run.c
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ void run(int argc, char *argv[])
free(s1);

char *s = (char *) malloc(strlen(pw->pw_dir) + 9*100 + 7*100+ strlen(argv[1]));
sprintf(s, "%s/.joker/%d.%s", pw->pw_dir, pid, argv[1]);
sprintf(s, "%s/.joker/%d.%s", pw->pw_dir, pid, basename(argv[1]));
FILE *f = fopen(s, "w");
if(!f) {
perror("can not open log file");
Expand Down

0 comments on commit 6700f7d

Please sign in to comment.