Git-Url: 
http://git.frugalware.org/gitweb/gitweb.cgi?p=yaxmenu.git;a=commitdiff;h=1b1deed308391cfc23a5c152745a43594f8e7c4a

commit 1b1deed308391cfc23a5c152745a43594f8e7c4a
Author: James Buren <r...@frugalware.org>
Date:   Fri Dec 4 13:44:27 2009 -0600

start over

diff --git a/src/autostring.h b/src/autostring.h
deleted file mode 100644
index a6e2cda..0000000
--- a/src/autostring.h
+++ /dev/null
@@ -1,75 +0,0 @@
-#ifndef _autostring_header_
-#define _autostring_header_
-#include "utility.h"
-
-#define AUTOSTRING_INITIAL_LENGTH 64U
-
-typedef struct {
-  char *s;  // String pointer array
-  size_t p; // Current position
-  size_t m; // Maximum position
-} as_t;
-
-static inline void as_init(as_t *as);
-static inline void as_putc(as_t *as,char c);
-static inline void as_puts(as_t *as,const char *s);
-static inline void as_reset(as_t *as);
-static inline void as_compact(as_t *as);
-static inline char *as_gets(const as_t *as);
-static inline void as_free(const as_t *as);
-
-static inline void as_init(as_t *as) {
-  assert(as);
-
-  as->s = xnew(char,as->m = AUTOSTRING_INITIAL_LENGTH);
-
-  as_reset(as);
-
-  as_putc(as,'\0');
-}
-
-static inline void as_putc(as_t *as,char c) {
-  assert(as);
-
-  if(as->p == as->m)
-    as->s = xrenew(as->s,char,as->m *= 2);
-
-  as->s[as->p++] = c;
-}
-
-static inline void as_puts(as_t *as,const char *s) {
-  assert(as && s);
-
-  if(!as->s[as->p-1])
-    --as->p;
-
-  while(*s)
-    as_putc(as,*s++);
-
-  as_putc(as,'\0');
-}
-
-static inline void as_reset(as_t *as) {
-  assert(as);
-
-  as->p = 0;
-}
-
-static inline void as_compact(as_t *as) {
-  assert(as && as->p);
-
-  as->s = xrenew(as->s,char,as->m = as->p);
-}
-
-static inline char *as_gets(const as_t *as) {
-  assert(as);
-
-  return as->s;
-}
-
-static inline void as_free(const as_t *as) {
-  assert(as);
-
-  free(as->s);
-}
-#endif
diff --git a/src/includes.h b/src/includes.h
deleted file mode 100644
index 2a474a7..0000000
--- a/src/includes.h
+++ /dev/null
@@ -1,9 +0,0 @@
-#ifndef _includes_header_
-#define _includes_header_
-#include <stdlib.h>
-#include <string.h>
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stdio.h>
-#include <assert.h>
-#endif
diff --git a/src/main.c b/src/main.c
deleted file mode 100644
index 2e82361..0000000
--- a/src/main.c
+++ /dev/null
@@ -1,10 +0,0 @@
-#include "xdg.h"
-
-int main(int argc,char **argv) {
-  xdg_t xdg;
-
-  if(!xdg_init(&xdg))
-    return EXIT_FAILURE;
-
-  return EXIT_SUCCESS;
-}
diff --git a/src/utility.c b/src/utility.c
deleted file mode 100644
index 2d44cbd..0000000
--- a/src/utility.c
+++ /dev/null
@@ -1,31 +0,0 @@
-#include "utility.h"
-
-void *xmalloc(size_t size) {
-  void *ptr;
-
-  assert(size);
-
-  ptr = malloc(size);
-
-  if(!ptr) {
-    eprintf("Failed to allocate %u bytes of memory.\n",size);
-    abort();
-  }
-
-  return ptr;
-}
-
-void *xrealloc(void *optr,size_t size) {
-  void *nptr;
-
-  assert(optr && size);
-
-  nptr = realloc(optr,size);
-
-  if(!nptr) {
-    eprintf("Failed to reallocate %u bytes of memory.\n",size);
-    abort();
-  }
-
-  return nptr;
-}
diff --git a/src/utility.h b/src/utility.h
deleted file mode 100644
index 4934f92..0000000
--- a/src/utility.h
+++ /dev/null
@@ -1,11 +0,0 @@
-#ifndef _utility_header_
-#define _utility_header_
-#include "includes.h"
-
-#define eprintf(...)  fprintf(stderr,__VA_ARGS__)
-#define xnew(T,N)     (T*)xmalloc(sizeof(T)*(N))
-#define xrenew(P,T,N) (T*)xrealloc(P,sizeof(T)*(N))
-
-void *xmalloc(size_t);
-void *xrealloc(void *,size_t);
-#endif
diff --git a/src/xdg.c b/src/xdg.c
deleted file mode 100644
index d57c25f..0000000
--- a/src/xdg.c
+++ /dev/null
@@ -1,106 +0,0 @@
-#include "autostring.h"
-#include "xdg.h"
-
-#define HOME_ENV                "HOME"
-#define MODE_CONFIG             true
-#define MODE_DATA               false
-#define XDG_CONFIG_HOME_DEFAULT "/.config"
-#define XDG_CONFIG_HOME_ENV     "XDG_CONFIG_HOME"
-#define XDG_CONFIG_DIRS_DEFAULT "/etc/xdg"
-#define XDG_CONFIG_DIRS_ENV     "XDG_CONFIG_DIRS"
-#define XDG_DATA_HOME_DEFAULT   "/.local/share"
-#define XDG_DATA_HOME_ENV       "XDG_DATA_HOME"
-#define XDG_DATA_DIRS_DEFAULT   "/usr/local/share:/usr/share"
-#define XDG_DATA_DIRS_ENV       "XDG_DATA_DIRS"
-#define PROGRAM_DIRECTORY       "/yaxmenu"
-
-// Designed for XDG Base Directory Specification Version 0.6
-// Url: http://standards.freedesktop.org/basedir-spec/basedir-spec-latest.html
-
-static inline void _xdg_build_dirs(const char *home,as_t *dirs,bool mode) {
-  const char *home_env, *dirs_env, *home_default, *dirs_default, *env;
-
-  assert(home && dirs);
-
-  home_env = (mode) ? XDG_CONFIG_HOME_ENV : XDG_DATA_HOME_ENV;
-
-  dirs_env = (mode) ? XDG_CONFIG_DIRS_ENV : XDG_DATA_DIRS_ENV;
-
-  home_default = (mode) ? XDG_CONFIG_HOME_DEFAULT : XDG_DATA_HOME_DEFAULT;
-
-  dirs_default = (mode) ? XDG_CONFIG_DIRS_DEFAULT : XDG_DATA_DIRS_DEFAULT;
-
-  env = getenv(home_env);
-
-  if(env && *env)
-    as_puts(dirs,env);
-  else {
-    as_puts(dirs,home);
-    as_puts(dirs,home_default);
-  }
-
-  as_puts(dirs,":");
-
-  env = getenv(dirs_env);
-
-  if(env && *env)
-    as_puts(dirs,env);
-  else
-    as_puts(dirs,dirs_default);
-}
-
-static inline char **_xdg_build_program_dirs(const char *odirs) {
-  const char *s;
-  size_t i;
-  as_t buf;
-  char **ndirs;
-  char *tmp;
-
-  assert(odirs);
-
-  for( s = odirs, i = 0 ; *s ; ++s )
-    if(*s == ':')
-      ++i;
-
-  if(!i)
-    return NULL;
-
-  as_init(&buf);
-
-  for( s = odirs ; *s ; ++s ) {
-    if(*s == ':')
-      as_puts(&buf,PROGRAM_DIRECTORY);
-    as_putc(&buf,*s);
-  }
-
-  as_compact(&buf);
-
-  ndirs = xnew(char *,i + 1);
-
-  ndirs[i = 0] = as_gets(&buf);
-
-  ndirs[++i] = strtok_r(*ndirs,":",&tmp);
-
-  while((ndirs[i++] = strtok_r(NULL,":",&tmp)))
-    ;
-
-  return ndirs;
-}
-
-bool xdg_init(xdg_t *xdg) {
-  return true;
-}
-
-void xdg_free(xdg_t *xdg) {
-  assert(xdg);
-
-  if(xdg->cfgdirs) {
-    free(*xdg->cfgdirs);
-    free(xdg->cfgdirs);
-  }
-
-  if(xdg->datadirs) {
-    free(*xdg->datadirs);
-    free(xdg->datadirs);
-  }
-}
diff --git a/src/xdg.h b/src/xdg.h
deleted file mode 100644
index 99dc67f..0000000
--- a/src/xdg.h
+++ /dev/null
@@ -1,12 +0,0 @@
-#ifndef _xdg_header_
-#define _xdg_header_
-#include "includes.h"
-
-typedef struct {
-  char **cfgdirs;
-  char **datadirs;
-} xdg_t;
-
-bool xdg_init(xdg_t *);
-void xdg_free(xdg_t *);
-#endif
_______________________________________________
Frugalware-git mailing list
Frugalware-git@frugalware.org
http://frugalware.org/mailman/listinfo/frugalware-git

Reply via email to