Branch data Line data Source code
1 : : /* 2 : : * libdpkg - Debian packaging suite library routines 3 : : * trigname.c - trigger name handling 4 : : * 5 : : * Copyright © 2007 Canonical Ltd 6 : : * Written by Ian Jackson <ijackson@chiark.greenend.org.uk> 7 : : * 8 : : * This is free software; you can redistribute it and/or modify 9 : : * it under the terms of the GNU General Public License as published by 10 : : * the Free Software Foundation; either version 2 of the License, or 11 : : * (at your option) any later version. 12 : : * 13 : : * This is distributed in the hope that it will be useful, 14 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 : : * GNU General Public License for more details. 17 : : * 18 : : * You should have received a copy of the GNU General Public License 19 : : * along with this program. If not, see <https://www.gnu.org/licenses/>. 20 : : */ 21 : : 22 : : #include <config.h> 23 : : #include <compat.h> 24 : : 25 : : #include <dpkg/i18n.h> 26 : : #include <dpkg/triglib.h> 27 : : 28 : : const char * 29 : 9 : trig_name_is_illegal(const char *p) 30 : : { 31 : : int c; 32 : : 33 [ + + ]: 9 : if (!*p) 34 : 1 : return _("empty trigger names are not permitted"); 35 : : 36 [ + + ]: 52 : while ((c = *p++)) { 37 [ + + - + ]: 48 : if (c <= ' ' || c >= 0177) 38 : 4 : return _("trigger name contains invalid character"); 39 : : } 40 : : 41 : 4 : return NULL; 42 : : }