summaryrefslogtreecommitdiffstats
path: root/src/utils
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2009-06-04 23:19:48 +0200
committerLennart Poettering <lennart@poettering.net>2009-06-04 23:19:48 +0200
commit4d874753f5ba838b015c69f281e991c7a42381eb (patch)
treeb76970d4388c227425ece37046b3f3037c2dc495 /src/utils
parent8bada7496c4d12a033ba54fed98ba796239a1776 (diff)
utils: use pa_path_get_filename() where applicable
Diffstat (limited to 'src/utils')
-rw-r--r--src/utils/pactl.c14
-rw-r--r--src/utils/pasuspender.c5
2 files changed, 3 insertions, 16 deletions
diff --git a/src/utils/pactl.c b/src/utils/pactl.c
index 53c67666..6608c01e 100644
--- a/src/utils/pactl.c
+++ b/src/utils/pactl.c
@@ -802,7 +802,6 @@ enum {
int main(int argc, char *argv[]) {
pa_mainloop* m = NULL;
- char tmp[PATH_MAX];
int ret = 1, c;
char *server = NULL, *bn;
@@ -882,17 +881,8 @@ int main(int argc, char *argv[]) {
if (optind+2 < argc)
sample_name = pa_xstrdup(argv[optind+2]);
else {
- char *f = strrchr(argv[optind+1], '/');
- size_t n;
- if (f)
- f++;
- else
- f = argv[optind];
-
- n = strcspn(f, ".");
- strncpy(tmp, f, n);
- tmp[n] = 0;
- sample_name = pa_xstrdup(tmp);
+ char *f = pa_path_get_filename(argv[optind+1]);
+ sample_name = pa_xstrndup(f, strcspn(f, "."));
}
pa_zero(sfi);
diff --git a/src/utils/pasuspender.c b/src/utils/pasuspender.c
index b4bccd56..c327ee41 100644
--- a/src/utils/pasuspender.c
+++ b/src/utils/pasuspender.c
@@ -235,10 +235,7 @@ int main(int argc, char *argv[]) {
setlocale(LC_ALL, "");
bindtextdomain(GETTEXT_PACKAGE, PULSE_LOCALEDIR);
- if (!(bn = strrchr(argv[0], '/')))
- bn = argv[0];
- else
- bn++;
+ bn = pa_path_get_filename(argv[0]);
while ((c = getopt_long(argc, argv, "s:h", long_options, NULL)) != -1) {
switch (c) {