2005-03-14 20:51:43 -05:00
|
|
|
/*
|
|
|
|
* util.h
|
2007-04-26 19:20:46 -04:00
|
|
|
*
|
|
|
|
* Copyright (c) 2002-2007 by Judd Vinet <jvinet@zeroflux.org>
|
|
|
|
*
|
2005-03-14 20:51:43 -05:00
|
|
|
* 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
|
2007-04-26 19:20:46 -04:00
|
|
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
|
2005-03-14 20:51:43 -05:00
|
|
|
* USA.
|
|
|
|
*/
|
|
|
|
#ifndef _PM_UTIL_H
|
|
|
|
#define _PM_UTIL_H
|
|
|
|
|
2007-01-19 04:28:44 -05:00
|
|
|
#include <stdlib.h>
|
2007-06-12 16:09:46 -04:00
|
|
|
#include <stdarg.h>
|
2007-01-19 04:28:44 -05:00
|
|
|
#include <string.h>
|
|
|
|
|
|
|
|
#include <alpm_list.h>
|
2006-03-13 15:34:47 -05:00
|
|
|
|
2007-04-26 19:39:53 -04:00
|
|
|
#ifdef ENABLE_NLS
|
2007-10-23 00:52:55 -04:00
|
|
|
#include <libintl.h> /* here so it doesn't need to be included elsewhere */
|
|
|
|
/* define _() as shortcut for gettext() */
|
2006-05-14 22:19:57 -04:00
|
|
|
#define _(str) gettext(str)
|
2007-04-26 19:39:53 -04:00
|
|
|
#else
|
|
|
|
#define _(str) str
|
|
|
|
#endif
|
2007-04-25 03:15:32 -04:00
|
|
|
|
2007-10-23 00:52:55 -04:00
|
|
|
/* update speed for the fill_progress based functions */
|
|
|
|
#define UPDATE_SPEED_SEC 0.2f
|
|
|
|
|
2007-09-28 00:03:35 -04:00
|
|
|
int needs_transaction();
|
2007-03-13 12:15:38 -04:00
|
|
|
int getcols();
|
2007-05-31 02:51:28 -04:00
|
|
|
int makepath(const char *path);
|
|
|
|
int rmrf(const char *path);
|
2007-03-13 12:15:38 -04:00
|
|
|
void indentprint(const char *str, int indent);
|
2005-03-14 20:51:43 -05:00
|
|
|
char *strtoupper(char *str);
|
2006-03-13 15:34:47 -05:00
|
|
|
char *strtrim(char *str);
|
2007-06-04 12:01:53 -04:00
|
|
|
char *strreplace(const char *str, const char *needle, const char *replace);
|
2007-11-13 19:32:56 -05:00
|
|
|
alpm_list_t *strsplit(const char *str, const char splitchar);
|
2007-06-05 17:34:33 -04:00
|
|
|
void list_display(const char *title, const alpm_list_t *list);
|
2007-10-19 13:17:54 -04:00
|
|
|
void display_targets(const alpm_list_t *syncpkgs, pmdb_t *db_local);
|
2007-04-26 19:20:46 -04:00
|
|
|
int yesno(char *fmt, ...);
|
2007-10-07 16:00:24 -04:00
|
|
|
int pm_printf(pmloglevel_t level, const char *format, ...) __attribute__((format(printf,2,3)));
|
|
|
|
int pm_fprintf(FILE *stream, pmloglevel_t level, const char *format, ...) __attribute__((format(printf,3,4)));
|
|
|
|
int pm_vfprintf(FILE *stream, pmloglevel_t level, const char *format, va_list args) __attribute__((format(printf,3,0)));
|
2005-03-14 20:51:43 -05:00
|
|
|
|
2007-10-24 01:37:50 -04:00
|
|
|
#ifndef HAVE_STRNDUP
|
|
|
|
char *strndup(const char *s, size_t n);
|
|
|
|
#endif
|
|
|
|
|
2005-03-14 20:51:43 -05:00
|
|
|
#endif /* _PM_UTIL_H */
|
|
|
|
|
|
|
|
/* vim: set ts=2 sw=2 noet: */
|