Explorar o código

Add new cisspace function

Ian Jackson %!s(int64=18) %!d(string=hai) anos
pai
achega
c91dc9f7e9
Modificáronse 3 ficheiros con 12 adicións e 0 borrados
  1. 5 0
      ChangeLog
  2. 1 0
      lib/dpkg.h
  3. 6 0
      lib/utils.c

+ 5 - 0
ChangeLog

@@ -1,3 +1,8 @@
+2008-03-20  Ian Jackson  <ian@davenant.greenend.org.uk>
+
+	* lib/dpkg.h (cisspace): New prototype.
+	* lib/utils.c (cisspace): New function definition.
+
 2008-03-20  Ian Jackson  <ian@davenant.greenend.org.uk>
 
 	* src/main.h (pkgadminfile): Move prototype to ...

+ 1 - 0
lib/dpkg.h

@@ -362,6 +362,7 @@ extern volatile int onerr_abort;
 
 int cisdigit(int c);
 int cisalpha(int c);
+int cisspace(int c);
 
 int fgets_checked(char *buf, size_t bufsz, FILE *f, const char *fn);
 int fgets_must(char *buf, size_t bufsz, FILE *f, const char *fn);

+ 6 - 0
lib/utils.c

@@ -34,6 +34,12 @@ int cisalpha(int c) {
 	return ((c>='a') && (c<='z')) || ((c>='A') && (c<='Z'));
 }
 
+int
+cisspace(int c)
+{
+	return (c == '\n' || c == '\t' || c == ' ');
+}
+
 int
 fgets_checked(char *buf, size_t bufsz, FILE *f, const char *fn)
 {