=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/tmux/paste.c,v retrieving revision 1.34 retrieving revision 1.35 diff -u -r1.34 -r1.35 --- src/usr.bin/tmux/paste.c 2016/01/19 15:59:12 1.34 +++ src/usr.bin/tmux/paste.c 2016/10/05 12:34:05 1.35 @@ -1,4 +1,4 @@ -/* $OpenBSD: paste.c,v 1.34 2016/01/19 15:59:12 nicm Exp $ */ +/* $OpenBSD: paste.c,v 1.35 2016/10/05 12:34:05 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott @@ -35,6 +35,7 @@ size_t size; char *name; + time_t created; int automatic; u_int order; @@ -79,6 +80,20 @@ return (pb->name); } +/* Get paste buffer order. */ +u_int +paste_buffer_order(struct paste_buffer *pb) +{ + return (pb->order); +} + +/* Get paste buffer created. */ +time_t +paste_buffer_created(struct paste_buffer *pb) +{ + return (pb->created); +} + /* Get paste buffer data. */ const char * paste_buffer_data(struct paste_buffer *pb, size_t *size) @@ -88,7 +103,7 @@ return (pb->data); } -/* Walk paste buffers by name. */ +/* Walk paste buffers by time. */ struct paste_buffer * paste_walk(struct paste_buffer *pb) { @@ -174,6 +189,8 @@ pb->automatic = 1; paste_num_automatic++; + pb->created = time(NULL); + pb->order = paste_next_order++; RB_INSERT(paste_name_tree, &paste_by_name, pb); RB_INSERT(paste_time_tree, &paste_by_time, pb); @@ -263,6 +280,8 @@ pb->automatic = 0; pb->order = paste_next_order++; + + pb->created = time(NULL); if ((old = paste_get_name(name)) != NULL) paste_free(old);