]> git.tuebingen.mpg.de Git - paraslash.git/blobdiff - aft.c
fade: Avoid a gcc warning.
[paraslash.git] / aft.c
diff --git a/aft.c b/aft.c
index 995c7552129512c6e2dc6228c165779c9e7979a0..5fb0480707e094327688c5aad7adeddec35879a8 100644 (file)
--- a/aft.c
+++ b/aft.c
@@ -74,6 +74,8 @@ enum ls_flags {
        LS_FLAG_ADMISSIBLE_ONLY = 2,
        /** -r */
        LS_FLAG_REVERSE = 4,
+       /** -d */
+       LS_FLAG_UNIXDATE = 8,
 };
 
 /**
@@ -800,10 +802,15 @@ static int print_list_item(struct ls_data *d, struct ls_options *opts,
                goto out;
        }
        get_attribute_bitmap(&afsi->attributes, att_buf);
-       ret = get_local_time(&afsi->last_played, last_played_time,
-               sizeof(last_played_time), current_time, opts->mode);
-       if (ret < 0)
-               goto out;
+       if (opts->flags & LS_FLAG_UNIXDATE)
+               sprintf(last_played_time, "%llu",
+                       (long long unsigned)afsi->last_played);
+       else {
+               ret = get_local_time(&afsi->last_played, last_played_time,
+                       sizeof(last_played_time), current_time, opts->mode);
+               if (ret < 0)
+                       goto out;
+       }
        get_duration_buf(afhi->seconds_total, duration_buf, opts);
        if (have_score) {
                if (opts->mode == LS_MODE_LONG)
@@ -1009,7 +1016,7 @@ static int fixup_info_string(char *info_string)
        if (!t2)
                return -ERRNO_TO_PARA_ERROR(EINVAL);
 
-       end = t2 + strlen(t2) + 1;
+       end = t2 + strlen(t2);
        fixup_taginfo(info_string + 16, t1);
        fixup_taginfo(t1 + 10, t2);
        fixup_taginfo(t2 + 10, end);
@@ -1458,6 +1465,10 @@ int com_ls(int fd, int argc, char * const * const argv)
                        flags |= LS_FLAG_REVERSE;
                        continue;
                }
+               if (!strcmp(arg, "-d")) {
+                       flags |= LS_FLAG_UNIXDATE;
+                       continue;
+               }
                if (!strncmp(arg, "-s", 2)) {
                        if (!*(arg + 2) || *(arg + 3))
                                return -E_AFT_SYNTAX;
@@ -2608,7 +2619,6 @@ static int aft_event_handler(enum afs_events event, struct para_buffer *pb,
 
 void aft_init(struct afs_table *t)
 {
-       t->name = audio_file_table_desc.name;
        t->open = aft_open;
        t->close = aft_close;
        t->create = aft_create;