trigname.c 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  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 <ian@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 <http://www.gnu.org/licenses/>.
  20. */
  21. #include <config.h>
  22. #include <compat.h>
  23. #include <dpkg/i18n.h>
  24. #include <dpkg/triglib.h>
  25. const char *
  26. trig_name_is_illegal(const char *p)
  27. {
  28. int c;
  29. if (!*p)
  30. return _("empty trigger names are not permitted");
  31. while ((c = *p++)) {
  32. if (c <= ' ' || c >= 0177)
  33. return _("trigger name contains invalid character");
  34. }
  35. return NULL;
  36. }