Verified Commit aff33e80 authored by Max Rees's avatar Max Rees

include: *include* missing files...

parent 460c47f0
install-headers-y := $(INSTALLDIR) $(DESTDIR)$(INCDIR)/apk && \
$(INSTALL) -m644 include/apk/*.h $(DESTDIR)$(INCDIR)/apk
install:
$(install-headers-y)
/* apk_blob.h - Alpine Package Keeper (APK)
*
* Copyright (C) 2005-2008 Natanael Copa <n@tanael.org>
* Copyright (C) 2008-2011 Timo Teräs <timo.teras@iki.fi>
* 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.
*/
#ifndef APK_BLOB_H
#define APK_BLOB_H
#include <ctype.h>
#include <string.h>
typedef const unsigned char *apk_spn_match;
typedef unsigned char apk_spn_match_def[256 / 8];
struct apk_blob {
long len;
char *ptr;
};
typedef struct apk_blob apk_blob_t;
extern apk_blob_t apk_null_blob;
#define BLOB_FMT "%.*s"
#define BLOB_PRINTF(b) (int)(b).len, (b).ptr
#define APK_BLOB_IS_NULL(blob) ((blob).ptr == NULL)
#define APK_BLOB_NULL ((apk_blob_t){0, NULL})
#define APK_BLOB_ERROR(err) ((apk_blob_t){err, NULL})
#define APK_BLOB_BUF(buf) ((apk_blob_t){sizeof(buf), (char *)(buf)})
#define APK_BLOB_CSUM(csum) ((apk_blob_t){(csum).type, (char *)(csum).data})
#define APK_BLOB_STRUCT(s) ((apk_blob_t){sizeof(s), (char*)&(s)})
#define APK_BLOB_PTR_LEN(beg,len) ((apk_blob_t){(len), (beg)})
#define APK_BLOB_PTR_PTR(beg,end) APK_BLOB_PTR_LEN((beg),(end)-(beg)+1)
static inline apk_blob_t APK_BLOB_STR(const char *str)
{
if (str == NULL)
return APK_BLOB_NULL;
return ((apk_blob_t){strlen(str), (void *)(str)});
}
static inline apk_blob_t apk_blob_trim(apk_blob_t blob)
{
apk_blob_t b = blob;
while (b.len > 0 && isspace(b.ptr[b.len-1]))
b.len--;
return b;
}
#endif
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
* Copyright (C) 2008-2011 Timo Teräs <timo.teras@iki.fi> * Copyright (C) 2008-2011 Timo Teräs <timo.teras@iki.fi>
* All rights reserved. * All rights reserved.
* *
* This program is free software; you can redistribute it and/or modify it * 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 * 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. * by the Free Software Foundation. See http://www.gnu.org/ for details.
*/ */
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
#ifndef APK_VERSION_H #ifndef APK_VERSION_H
#define APK_VERSION_H #define APK_VERSION_H
#include "apk_blob.h" #include <apk/blob.h>
#define APK_VERSION_UNKNOWN 0 #define APK_VERSION_UNKNOWN 0
#define APK_VERSION_EQUAL 1 #define APK_VERSION_EQUAL 1
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment