From 8ed7fb1c9d061f768e4c977667d5192407507c47 Mon Sep 17 00:00:00 2001 From: Josh Coalson Date: Wed, 6 Jun 2001 18:41:13 +0000 Subject: [PATCH] initial import --- src/flac/file.c | 37 +++++++++++++++++++++++++++++++++++++ src/flac/file.h | 24 ++++++++++++++++++++++++ 2 files changed, 61 insertions(+) create mode 100644 src/flac/file.c create mode 100644 src/flac/file.h diff --git a/src/flac/file.c b/src/flac/file.c new file mode 100644 index 0000000..bf23bd3 --- /dev/null +++ b/src/flac/file.c @@ -0,0 +1,37 @@ +/* flac - Command-line FLAC encoder/decoder + * Copyright (C) 2001 Josh Coalson + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#include /* for chown() */ +#include /* for utime() */ +#include /* for stat() */ +#include "file.h" + +void flac__file_copy_metadata(const char *srcpath, const char *destpath) +{ + struct stat srcstat; + struct utimbuf srctime; + + if(0 == stat(srcpath, &srcstat)) { + srctime.actime = srcstat.st_atime; + srctime.modtime = srcstat.st_mtime; + (void)chmod(destpath, srcstat.st_mode); + (void)utime(destpath, &srctime); + (void)chown(destpath, srcstat.st_uid, -1); + (void)chown(destpath, -1, srcstat.st_gid); + } +} diff --git a/src/flac/file.h b/src/flac/file.h new file mode 100644 index 0000000..6171ef6 --- /dev/null +++ b/src/flac/file.h @@ -0,0 +1,24 @@ +/* flac - Command-line FLAC encoder/decoder + * Copyright (C) 2001 Josh Coalson + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#ifndef flac__file_h +#define flac__file_h + +void flac__file_copy_metadata(const char *srcpath, const char *destpath); + +#endif -- 2.7.4