X-Git-Url: http://git.vrable.net/?a=blobdiff_plain;f=util.h;h=5922a425f101e66dcbdaa19e4763c2cf9e6680ed;hb=dd553bb0b2ac2fe7a1904d2f2670f37e3bb25ae6;hp=7cb9bf48e4bcad09e9405c764d2d0ba33417d63c;hpb=4bda3653b0b3a270acdf643cf4918a97dbf147c5;p=cumulus.git diff --git a/util.h b/util.h index 7cb9bf4..5922a42 100644 --- a/util.h +++ b/util.h @@ -1,10 +1,26 @@ -/* LBS: An LFS-inspired filesystem backup system - * Copyright (C) 2006 Michael Vrable +/* Cumulus: Smart Filesystem Backup to Dumb Servers * - * Utility functions for converting various datatypes to text format (and - * later, for parsing them back, perhaps). + * Copyright (C) 2007 The Regents of the University of California + * Written by Michael Vrable + * + * 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., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ +/* Utility functions for converting various datatypes to text format (and + * later, for parsing them back, perhaps). */ + #ifndef _LBS_FORMAT_H #define _LBS_FORMAT_H @@ -14,9 +30,11 @@ std::string uri_encode(const std::string &in); std::string uri_decode(const std::string &in); -std::string encode_int(long long n); -void dict_output(std::ostream &o, std::map dict); +std::string encode_int(long long n, int base=10); long long parse_int(const std::string &s); +void cloexec(int fd); + +void fatal(std::string msg); #endif // _LBS_TARSTORE_H