16b384f39SPeter Avalos /*- 26b384f39SPeter Avalos * Copyright (c) 2014, Mike Kazantsev 36b384f39SPeter Avalos * All rights reserved. 46b384f39SPeter Avalos * 56b384f39SPeter Avalos * Redistribution and use in source and binary forms, with or without 66b384f39SPeter Avalos * modification, are permitted provided that the following conditions 76b384f39SPeter Avalos * are met: 86b384f39SPeter Avalos * 1. Redistributions of source code must retain the above copyright 96b384f39SPeter Avalos * notice, this list of conditions and the following disclaimer. 106b384f39SPeter Avalos * 2. Redistributions in binary form must reproduce the above copyright 116b384f39SPeter Avalos * notice, this list of conditions and the following disclaimer in the 126b384f39SPeter Avalos * documentation and/or other materials provided with the distribution. 136b384f39SPeter Avalos * 146b384f39SPeter Avalos * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR 156b384f39SPeter Avalos * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 166b384f39SPeter Avalos * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 176b384f39SPeter Avalos * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT, 186b384f39SPeter Avalos * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 196b384f39SPeter Avalos * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 206b384f39SPeter Avalos * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 216b384f39SPeter Avalos * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 226b384f39SPeter Avalos * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 236b384f39SPeter Avalos * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 246b384f39SPeter Avalos */ 256b384f39SPeter Avalos 26*085658deSDaniel Fojt #ifndef BSDCAT_H_INCLUDED 27*085658deSDaniel Fojt #define BSDCAT_H_INCLUDED 28*085658deSDaniel Fojt 296b384f39SPeter Avalos #if defined(PLATFORM_CONFIG_H) 306b384f39SPeter Avalos /* Use hand-built config.h in environments that need it. */ 316b384f39SPeter Avalos #include PLATFORM_CONFIG_H 326b384f39SPeter Avalos #else 336b384f39SPeter Avalos /* Not having a config.h of some sort is a serious problem. */ 346b384f39SPeter Avalos #include "config.h" 356b384f39SPeter Avalos #endif 366b384f39SPeter Avalos 376b384f39SPeter Avalos #include <archive.h> 386b384f39SPeter Avalos #include <archive_entry.h> 396b384f39SPeter Avalos 406b384f39SPeter Avalos struct bsdcat { 416b384f39SPeter Avalos /* Option parser state */ 426b384f39SPeter Avalos int getopt_state; 436b384f39SPeter Avalos char *getopt_word; 446b384f39SPeter Avalos 456b384f39SPeter Avalos /* Miscellaneous state information */ 466b384f39SPeter Avalos int argc; 476b384f39SPeter Avalos char **argv; 486b384f39SPeter Avalos const char *argument; 496b384f39SPeter Avalos }; 506b384f39SPeter Avalos 516b384f39SPeter Avalos enum { 526b384f39SPeter Avalos OPTION_VERSION 536b384f39SPeter Avalos }; 546b384f39SPeter Avalos 556b384f39SPeter Avalos int bsdcat_getopt(struct bsdcat *); 566b384f39SPeter Avalos void usage(FILE *stream, int eval); 576b384f39SPeter Avalos void bsdcat_next(void); 586b384f39SPeter Avalos void bsdcat_print_error(void); 59e95abc47Szrj void bsdcat_read_to_stdout(const char* filename); 60*085658deSDaniel Fojt 61*085658deSDaniel Fojt #endif 62