From 60b87557e57ca4e23126bf8c25b1cb978e380dfd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timo=20Ter=C3=A4s?= Date: Fri, 14 Feb 2020 13:49:41 +0200 Subject: rename all applets sources to app_*.c --- src/stats.c | 64 ------------------------------------------------------------- 1 file changed, 64 deletions(-) delete mode 100644 src/stats.c (limited to 'src/stats.c') diff --git a/src/stats.c b/src/stats.c deleted file mode 100644 index 33a3285..0000000 --- a/src/stats.c +++ /dev/null @@ -1,64 +0,0 @@ -/* stats.c - Alpine Package Keeper (APK) - * - * Copyright (C) 2013 Timo Teräs - * All rights reserved. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 as published - * by the Free Software Foundation. See http://www.gnu.org/ for details. - */ - -#include -#include "apk_defines.h" -#include "apk_applet.h" -#include "apk_database.h" - -static int list_count(struct list_head *h) -{ - struct list_head *n; - int c = 0; - - list_for_each(n, h) - c++; - - return c; -} - -static int stats_main(void *ctx, struct apk_database *db, struct apk_string_array *args) -{ - extern struct apk_hash atom_hash; - - printf( - "installed:\n" - " packages: %d\n" - " dirs: %d\n" - " files: %d\n" - " bytes: %zu\n" - " triggers: %d\n" - "available:\n" - " names: %d\n" - " packages: %d\n" - "atoms:\n" - " num: %d\n" - , - db->installed.stats.packages, - db->installed.stats.dirs, - db->installed.stats.files, - db->installed.stats.bytes, - list_count(&db->installed.triggers), - db->available.names.num_items, - db->available.packages.num_items, - atom_hash.num_items - ); - return 0; -} - -static struct apk_applet stats_applet = { - .name = "stats", - .open_flags = APK_OPENF_READ, - .main = stats_main, -}; - -APK_DEFINE_APPLET(stats_applet); - - -- cgit v1.2.3