summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitignore19
-rw-r--r--AUTHORS1
-rw-r--r--COPYING0
-rw-r--r--ChangeLog0
-rw-r--r--INSTALL0
-rw-r--r--Makefile817
-rw-r--r--Makefile.am2
-rw-r--r--NEWS0
l---------README1
-rw-r--r--configure.ac9
-rw-r--r--src/Makefile.am8
-rw-r--r--src/include/cache.h10
-rw-r--r--src/include/draw.h18
-rw-r--r--src/include/entry.h28
-rw-r--r--src/include/group.h40
-rw-r--r--src/include/read_cfg.h23
-rw-r--r--src/unix/cache.c35
-rw-r--r--src/unix/draw.c14
-rw-r--r--src/unix/read_cfg.c234
-rw-r--r--src/windows/cache.c30
-rw-r--r--src/windows/draw.c44
-rw-r--r--src/windows/read_cfg.c232
22 files changed, 747 insertions, 818 deletions
diff --git a/.gitignore b/.gitignore
index d49da0f..016f3fb 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,8 +1,25 @@
*
!.gitignore
+
+!AUTHORS
+!ChangeLog
+!COPYING
+!INSTALL
+!Makefile.am
+!NEWS
+!README
+
+!configure.ac
!docs
!docs/*
!icon
!icon/icon*
!src
-!src/*
+!src/Makefile.am
+!src/*.c
+!src/include
+!src/include/*.h
+!src/unix/
+!src/unix/*.c
+!src/windows
+!src/windows/*.c
diff --git a/AUTHORS b/AUTHORS
new file mode 100644
index 0000000..ca9cbd4
--- /dev/null
+++ b/AUTHORS
@@ -0,0 +1 @@
+Louie Shprung
diff --git a/COPYING b/COPYING
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/COPYING
diff --git a/ChangeLog b/ChangeLog
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/ChangeLog
diff --git a/INSTALL b/INSTALL
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/INSTALL
diff --git a/Makefile b/Makefile
deleted file mode 100644
index 3a3510f..0000000
--- a/Makefile
+++ /dev/null
@@ -1,817 +0,0 @@
-# Makefile.in generated by automake 1.16.3 from Makefile.am.
-# Makefile. Generated from Makefile.in by configure.
-
-# Copyright (C) 1994-2020 Free Software Foundation, Inc.
-
-# This Makefile.in is free software; the Free Software Foundation
-# gives unlimited permission to copy and/or distribute it,
-# with or without modifications, as long as this notice is preserved.
-
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
-# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
-# PARTICULAR PURPOSE.
-
-
-
-
-am__is_gnu_make = { \
- if test -z '$(MAKELEVEL)'; then \
- false; \
- elif test -n '$(MAKE_HOST)'; then \
- true; \
- elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \
- true; \
- else \
- false; \
- fi; \
-}
-am__make_running_with_option = \
- case $${target_option-} in \
- ?) ;; \
- *) echo "am__make_running_with_option: internal error: invalid" \
- "target option '$${target_option-}' specified" >&2; \
- exit 1;; \
- esac; \
- has_opt=no; \
- sane_makeflags=$$MAKEFLAGS; \
- if $(am__is_gnu_make); then \
- sane_makeflags=$$MFLAGS; \
- else \
- case $$MAKEFLAGS in \
- *\\[\ \ ]*) \
- bs=\\; \
- sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \
- | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \
- esac; \
- fi; \
- skip_next=no; \
- strip_trailopt () \
- { \
- flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \
- }; \
- for flg in $$sane_makeflags; do \
- test $$skip_next = yes && { skip_next=no; continue; }; \
- case $$flg in \
- *=*|--*) continue;; \
- -*I) strip_trailopt 'I'; skip_next=yes;; \
- -*I?*) strip_trailopt 'I';; \
- -*O) strip_trailopt 'O'; skip_next=yes;; \
- -*O?*) strip_trailopt 'O';; \
- -*l) strip_trailopt 'l'; skip_next=yes;; \
- -*l?*) strip_trailopt 'l';; \
- -[dEDm]) skip_next=yes;; \
- -[JT]) skip_next=yes;; \
- esac; \
- case $$flg in \
- *$$target_option*) has_opt=yes; break;; \
- esac; \
- done; \
- test $$has_opt = yes
-am__make_dryrun = (target_option=n; $(am__make_running_with_option))
-am__make_keepgoing = (target_option=k; $(am__make_running_with_option))
-pkgdatadir = $(datadir)/terminal-media-launcher
-pkgincludedir = $(includedir)/terminal-media-launcher
-pkglibdir = $(libdir)/terminal-media-launcher
-pkglibexecdir = $(libexecdir)/terminal-media-launcher
-am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
-install_sh_DATA = $(install_sh) -c -m 644
-install_sh_PROGRAM = $(install_sh) -c
-install_sh_SCRIPT = $(install_sh) -c
-INSTALL_HEADER = $(INSTALL_DATA)
-transform = $(program_transform_name)
-NORMAL_INSTALL = :
-PRE_INSTALL = :
-POST_INSTALL = :
-NORMAL_UNINSTALL = :
-PRE_UNINSTALL = :
-POST_UNINSTALL = :
-subdir = .
-ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/configure.ac
-am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
- $(ACLOCAL_M4)
-DIST_COMMON = $(srcdir)/Makefile.am $(top_srcdir)/configure \
- $(am__configure_deps) $(dist_doc_DATA) $(am__DIST_COMMON)
-am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \
- configure.lineno config.status.lineno
-mkinstalldirs = $(install_sh) -d
-CONFIG_CLEAN_FILES =
-CONFIG_CLEAN_VPATH_FILES =
-AM_V_P = $(am__v_P_$(V))
-am__v_P_ = $(am__v_P_$(AM_DEFAULT_VERBOSITY))
-am__v_P_0 = false
-am__v_P_1 = :
-AM_V_GEN = $(am__v_GEN_$(V))
-am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY))
-am__v_GEN_0 = @echo " GEN " $@;
-am__v_GEN_1 =
-AM_V_at = $(am__v_at_$(V))
-am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY))
-am__v_at_0 = @
-am__v_at_1 =
-SOURCES =
-DIST_SOURCES =
-RECURSIVE_TARGETS = all-recursive check-recursive cscopelist-recursive \
- ctags-recursive dvi-recursive html-recursive info-recursive \
- install-data-recursive install-dvi-recursive \
- install-exec-recursive install-html-recursive \
- install-info-recursive install-pdf-recursive \
- install-ps-recursive install-recursive installcheck-recursive \
- installdirs-recursive pdf-recursive ps-recursive \
- tags-recursive uninstall-recursive
-am__can_run_installinfo = \
- case $$AM_UPDATE_INFO_DIR in \
- n|no|NO) false;; \
- *) (install-info --version) >/dev/null 2>&1;; \
- esac
-am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
-am__vpath_adj = case $$p in \
- $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
- *) f=$$p;; \
- esac;
-am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`;
-am__install_max = 40
-am__nobase_strip_setup = \
- srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`
-am__nobase_strip = \
- for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||"
-am__nobase_list = $(am__nobase_strip_setup); \
- for p in $$list; do echo "$$p $$p"; done | \
- sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \
- $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \
- if (++n[$$2] == $(am__install_max)) \
- { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \
- END { for (dir in files) print dir, files[dir] }'
-am__base_list = \
- sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
- sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
-am__uninstall_files_from_dir = { \
- test -z "$$files" \
- || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \
- || { echo " ( cd '$$dir' && rm -f" $$files ")"; \
- $(am__cd) "$$dir" && rm -f $$files; }; \
- }
-am__installdirs = "$(DESTDIR)$(docdir)"
-DATA = $(dist_doc_DATA)
-RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \
- distclean-recursive maintainer-clean-recursive
-am__recursive_targets = \
- $(RECURSIVE_TARGETS) \
- $(RECURSIVE_CLEAN_TARGETS) \
- $(am__extra_recursive_targets)
-AM_RECURSIVE_TARGETS = $(am__recursive_targets:-recursive=) TAGS CTAGS \
- cscope distdir distdir-am dist dist-all distcheck
-am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
-# Read a list of newline-separated strings from the standard input,
-# and print each of them once, without duplicates. Input order is
-# *not* preserved.
-am__uniquify_input = $(AWK) '\
- BEGIN { nonempty = 0; } \
- { items[$$0] = 1; nonempty = 1; } \
- END { if (nonempty) { for (i in items) print i; }; } \
-'
-# Make sure the list of sources is unique. This is necessary because,
-# e.g., the same source file might be shared among _SOURCES variables
-# for different programs/libraries.
-am__define_uniq_tagged_files = \
- list='$(am__tagged_files)'; \
- unique=`for i in $$list; do \
- if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
- done | $(am__uniquify_input)`
-ETAGS = etags
-CTAGS = ctags
-CSCOPE = cscope
-DIST_SUBDIRS = $(SUBDIRS)
-am__DIST_COMMON = $(srcdir)/Makefile.in AUTHORS COPYING ChangeLog \
- INSTALL NEWS README compile depcomp install-sh missing
-DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
-distdir = $(PACKAGE)-$(VERSION)
-top_distdir = $(distdir)
-am__remove_distdir = \
- if test -d "$(distdir)"; then \
- find "$(distdir)" -type d ! -perm -200 -exec chmod u+w {} ';' \
- && rm -rf "$(distdir)" \
- || { sleep 5 && rm -rf "$(distdir)"; }; \
- else :; fi
-am__post_remove_distdir = $(am__remove_distdir)
-am__relativize = \
- dir0=`pwd`; \
- sed_first='s,^\([^/]*\)/.*$$,\1,'; \
- sed_rest='s,^[^/]*/*,,'; \
- sed_last='s,^.*/\([^/]*\)$$,\1,'; \
- sed_butlast='s,/*[^/]*$$,,'; \
- while test -n "$$dir1"; do \
- first=`echo "$$dir1" | sed -e "$$sed_first"`; \
- if test "$$first" != "."; then \
- if test "$$first" = ".."; then \
- dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \
- dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \
- else \
- first2=`echo "$$dir2" | sed -e "$$sed_first"`; \
- if test "$$first2" = "$$first"; then \
- dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \
- else \
- dir2="../$$dir2"; \
- fi; \
- dir0="$$dir0"/"$$first"; \
- fi; \
- fi; \
- dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \
- done; \
- reldir="$$dir2"
-DIST_ARCHIVES = $(distdir).tar.gz
-GZIP_ENV = --best
-DIST_TARGETS = dist-gzip
-# Exists only to be overridden by the user if desired.
-AM_DISTCHECK_DVI_TARGET = dvi
-distuninstallcheck_listfiles = find . -type f -print
-am__distuninstallcheck_listfiles = $(distuninstallcheck_listfiles) \
- | sed 's|^\./|$(prefix)/|' | grep -v '$(infodir)/dir$$'
-distcleancheck_listfiles = find . -type f -print
-ACLOCAL = ${SHELL} '/home/louie/Documents/code/terminal-media-launcher/missing' aclocal-1.16
-AMTAR = $${TAR-tar}
-AM_DEFAULT_VERBOSITY = 1
-AUTOCONF = ${SHELL} '/home/louie/Documents/code/terminal-media-launcher/missing' autoconf
-AUTOHEADER = ${SHELL} '/home/louie/Documents/code/terminal-media-launcher/missing' autoheader
-AUTOMAKE = ${SHELL} '/home/louie/Documents/code/terminal-media-launcher/missing' automake-1.16
-AWK = gawk
-CC = gcc
-CCDEPMODE = depmode=gcc3
-CFLAGS = -g -O2
-CPPFLAGS =
-CYGPATH_W = echo
-DEFS = -DPACKAGE_NAME=\"terminal-media-launcher\" -DPACKAGE_TARNAME=\"terminal-media-launcher\" -DPACKAGE_VERSION=\"0.1\" -DPACKAGE_STRING=\"terminal-media-launcher\ 0.1\" -DPACKAGE_BUGREPORT=\"lshprung@example.com\" -DPACKAGE_URL=\"\" -DPACKAGE=\"terminal-media-launcher\" -DVERSION=\"0.1\"
-DEPDIR = .deps
-ECHO_C =
-ECHO_N = -n
-ECHO_T =
-EXEEXT =
-INSTALL = /usr/bin/install -c
-INSTALL_DATA = ${INSTALL} -m 644
-INSTALL_PROGRAM = ${INSTALL}
-INSTALL_SCRIPT = ${INSTALL}
-INSTALL_STRIP_PROGRAM = $(install_sh) -c -s
-LDFLAGS =
-LIBOBJS =
-LIBS =
-LTLIBOBJS =
-MAKEINFO = ${SHELL} '/home/louie/Documents/code/terminal-media-launcher/missing' makeinfo
-MKDIR_P = /usr/bin/mkdir -p
-OBJEXT = o
-PACKAGE = terminal-media-launcher
-PACKAGE_BUGREPORT = lshprung@example.com
-PACKAGE_NAME = terminal-media-launcher
-PACKAGE_STRING = terminal-media-launcher 0.1
-PACKAGE_TARNAME = terminal-media-launcher
-PACKAGE_URL =
-PACKAGE_VERSION = 0.1
-PATH_SEPARATOR = :
-SET_MAKE =
-SHELL = /bin/bash
-STRIP =
-VERSION = 0.1
-abs_builddir = /home/louie/Documents/code/terminal-media-launcher
-abs_srcdir = /home/louie/Documents/code/terminal-media-launcher
-abs_top_builddir = /home/louie/Documents/code/terminal-media-launcher
-abs_top_srcdir = /home/louie/Documents/code/terminal-media-launcher
-ac_ct_CC = gcc
-am__include = include
-am__leading_dot = .
-am__quote =
-am__tar = $${TAR-tar} chof - "$$tardir"
-am__untar = $${TAR-tar} xf -
-bindir = ${exec_prefix}/bin
-build_alias =
-builddir = .
-datadir = ${datarootdir}
-datarootdir = ${prefix}/share
-docdir = ${datarootdir}/doc/${PACKAGE_TARNAME}
-dvidir = ${docdir}
-exec_prefix = ${prefix}
-host_alias =
-htmldir = ${docdir}
-includedir = ${prefix}/include
-infodir = ${datarootdir}/info
-install_sh = ${SHELL} /home/louie/Documents/code/terminal-media-launcher/install-sh
-libdir = ${exec_prefix}/lib
-libexecdir = ${exec_prefix}/libexec
-localedir = ${datarootdir}/locale
-localstatedir = ${prefix}/var
-mandir = ${datarootdir}/man
-mkdir_p = $(MKDIR_P)
-oldincludedir = /usr/include
-pdfdir = ${docdir}
-prefix = /usr/local
-program_transform_name = s,x,x,
-psdir = ${docdir}
-runstatedir = ${localstatedir}/run
-sbindir = ${exec_prefix}/sbin
-sharedstatedir = ${prefix}/com
-srcdir = .
-sysconfdir = ${prefix}/etc
-target_alias =
-top_build_prefix =
-top_builddir = .
-top_srcdir = .
-SUBDIRS = src
-dist_doc_DATA = docs/README.md
-all: all-recursive
-
-.SUFFIXES:
-am--refresh: Makefile
- @:
-$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
- @for dep in $?; do \
- case '$(am__configure_deps)' in \
- *$$dep*) \
- echo ' cd $(srcdir) && $(AUTOMAKE) --gnu'; \
- $(am__cd) $(srcdir) && $(AUTOMAKE) --gnu \
- && exit 0; \
- exit 1;; \
- esac; \
- done; \
- echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu Makefile'; \
- $(am__cd) $(top_srcdir) && \
- $(AUTOMAKE) --gnu Makefile
-Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
- @case '$?' in \
- *config.status*) \
- echo ' $(SHELL) ./config.status'; \
- $(SHELL) ./config.status;; \
- *) \
- echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__maybe_remake_depfiles)'; \
- cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__maybe_remake_depfiles);; \
- esac;
-
-$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
- $(SHELL) ./config.status --recheck
-
-$(top_srcdir)/configure: $(am__configure_deps)
- $(am__cd) $(srcdir) && $(AUTOCONF)
-$(ACLOCAL_M4): $(am__aclocal_m4_deps)
- $(am__cd) $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS)
-$(am__aclocal_m4_deps):
-install-dist_docDATA: $(dist_doc_DATA)
- @$(NORMAL_INSTALL)
- @list='$(dist_doc_DATA)'; test -n "$(docdir)" || list=; \
- if test -n "$$list"; then \
- echo " $(MKDIR_P) '$(DESTDIR)$(docdir)'"; \
- $(MKDIR_P) "$(DESTDIR)$(docdir)" || exit 1; \
- fi; \
- for p in $$list; do \
- if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
- echo "$$d$$p"; \
- done | $(am__base_list) | \
- while read files; do \
- echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(docdir)'"; \
- $(INSTALL_DATA) $$files "$(DESTDIR)$(docdir)" || exit $$?; \
- done
-
-uninstall-dist_docDATA:
- @$(NORMAL_UNINSTALL)
- @list='$(dist_doc_DATA)'; test -n "$(docdir)" || list=; \
- files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
- dir='$(DESTDIR)$(docdir)'; $(am__uninstall_files_from_dir)
-
-# This directory's subdirectories are mostly independent; you can cd
-# into them and run 'make' without going through this Makefile.
-# To change the values of 'make' variables: instead of editing Makefiles,
-# (1) if the variable is set in 'config.status', edit 'config.status'
-# (which will cause the Makefiles to be regenerated when you run 'make');
-# (2) otherwise, pass the desired values on the 'make' command line.
-$(am__recursive_targets):
- @fail=; \
- if $(am__make_keepgoing); then \
- failcom='fail=yes'; \
- else \
- failcom='exit 1'; \
- fi; \
- dot_seen=no; \
- target=`echo $@ | sed s/-recursive//`; \
- case "$@" in \
- distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
- *) list='$(SUBDIRS)' ;; \
- esac; \
- for subdir in $$list; do \
- echo "Making $$target in $$subdir"; \
- if test "$$subdir" = "."; then \
- dot_seen=yes; \
- local_target="$$target-am"; \
- else \
- local_target="$$target"; \
- fi; \
- ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
- || eval $$failcom; \
- done; \
- if test "$$dot_seen" = "no"; then \
- $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
- fi; test -z "$$fail"
-
-ID: $(am__tagged_files)
- $(am__define_uniq_tagged_files); mkid -fID $$unique
-tags: tags-recursive
-TAGS: tags
-
-tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
- set x; \
- here=`pwd`; \
- if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \
- include_option=--etags-include; \
- empty_fix=.; \
- else \
- include_option=--include; \
- empty_fix=; \
- fi; \
- list='$(SUBDIRS)'; for subdir in $$list; do \
- if test "$$subdir" = .; then :; else \
- test ! -f $$subdir/TAGS || \
- set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \
- fi; \
- done; \
- $(am__define_uniq_tagged_files); \
- shift; \
- if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
- test -n "$$unique" || unique=$$empty_fix; \
- if test $$# -gt 0; then \
- $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
- "$$@" $$unique; \
- else \
- $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
- $$unique; \
- fi; \
- fi
-ctags: ctags-recursive
-
-CTAGS: ctags
-ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
- $(am__define_uniq_tagged_files); \
- test -z "$(CTAGS_ARGS)$$unique" \
- || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
- $$unique
-
-GTAGS:
- here=`$(am__cd) $(top_builddir) && pwd` \
- && $(am__cd) $(top_srcdir) \
- && gtags -i $(GTAGS_ARGS) "$$here"
-cscope: cscope.files
- test ! -s cscope.files \
- || $(CSCOPE) -b -q $(AM_CSCOPEFLAGS) $(CSCOPEFLAGS) -i cscope.files $(CSCOPE_ARGS)
-clean-cscope:
- -rm -f cscope.files
-cscope.files: clean-cscope cscopelist
-cscopelist: cscopelist-recursive
-
-cscopelist-am: $(am__tagged_files)
- list='$(am__tagged_files)'; \
- case "$(srcdir)" in \
- [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \
- *) sdir=$(subdir)/$(srcdir) ;; \
- esac; \
- for i in $$list; do \
- if test -f "$$i"; then \
- echo "$(subdir)/$$i"; \
- else \
- echo "$$sdir/$$i"; \
- fi; \
- done >> $(top_builddir)/cscope.files
-
-distclean-tags:
- -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
- -rm -f cscope.out cscope.in.out cscope.po.out cscope.files
-
-distdir: $(BUILT_SOURCES)
- $(MAKE) $(AM_MAKEFLAGS) distdir-am
-
-distdir-am: $(DISTFILES)
- $(am__remove_distdir)
- test -d "$(distdir)" || mkdir "$(distdir)"
- @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
- topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
- list='$(DISTFILES)'; \
- dist_files=`for file in $$list; do echo $$file; done | \
- sed -e "s|^$$srcdirstrip/||;t" \
- -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
- case $$dist_files in \
- */*) $(MKDIR_P) `echo "$$dist_files" | \
- sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
- sort -u` ;; \
- esac; \
- for file in $$dist_files; do \
- if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
- if test -d $$d/$$file; then \
- dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
- if test -d "$(distdir)/$$file"; then \
- find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
- fi; \
- if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
- cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
- find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
- fi; \
- cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
- else \
- test -f "$(distdir)/$$file" \
- || cp -p $$d/$$file "$(distdir)/$$file" \
- || exit 1; \
- fi; \
- done
- @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
- if test "$$subdir" = .; then :; else \
- $(am__make_dryrun) \
- || test -d "$(distdir)/$$subdir" \
- || $(MKDIR_P) "$(distdir)/$$subdir" \
- || exit 1; \
- dir1=$$subdir; dir2="$(distdir)/$$subdir"; \
- $(am__relativize); \
- new_distdir=$$reldir; \
- dir1=$$subdir; dir2="$(top_distdir)"; \
- $(am__relativize); \
- new_top_distdir=$$reldir; \
- echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \
- echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \
- ($(am__cd) $$subdir && \
- $(MAKE) $(AM_MAKEFLAGS) \
- top_distdir="$$new_top_distdir" \
- distdir="$$new_distdir" \
- am__remove_distdir=: \
- am__skip_length_check=: \
- am__skip_mode_fix=: \
- distdir) \
- || exit 1; \
- fi; \
- done
- -test -n "$(am__skip_mode_fix)" \
- || find "$(distdir)" -type d ! -perm -755 \
- -exec chmod u+rwx,go+rx {} \; -o \
- ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \
- ! -type d ! -perm -400 -exec chmod a+r {} \; -o \
- ! -type d ! -perm -444 -exec $(install_sh) -c -m a+r {} {} \; \
- || chmod -R a+r "$(distdir)"
-dist-gzip: distdir
- tardir=$(distdir) && $(am__tar) | eval GZIP= gzip $(GZIP_ENV) -c >$(distdir).tar.gz
- $(am__post_remove_distdir)
-
-dist-bzip2: distdir
- tardir=$(distdir) && $(am__tar) | BZIP2=$${BZIP2--9} bzip2 -c >$(distdir).tar.bz2
- $(am__post_remove_distdir)
-
-dist-lzip: distdir
- tardir=$(distdir) && $(am__tar) | lzip -c $${LZIP_OPT--9} >$(distdir).tar.lz
- $(am__post_remove_distdir)
-
-dist-xz: distdir
- tardir=$(distdir) && $(am__tar) | XZ_OPT=$${XZ_OPT--e} xz -c >$(distdir).tar.xz
- $(am__post_remove_distdir)
-
-dist-zstd: distdir
- tardir=$(distdir) && $(am__tar) | zstd -c $${ZSTD_CLEVEL-$${ZSTD_OPT--19}} >$(distdir).tar.zst
- $(am__post_remove_distdir)
-
-dist-tarZ: distdir
- @echo WARNING: "Support for distribution archives compressed with" \
- "legacy program 'compress' is deprecated." >&2
- @echo WARNING: "It will be removed altogether in Automake 2.0" >&2
- tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z
- $(am__post_remove_distdir)
-
-dist-shar: distdir
- @echo WARNING: "Support for shar distribution archives is" \
- "deprecated." >&2
- @echo WARNING: "It will be removed altogether in Automake 2.0" >&2
- shar $(distdir) | eval GZIP= gzip $(GZIP_ENV) -c >$(distdir).shar.gz
- $(am__post_remove_distdir)
-
-dist-zip: distdir
- -rm -f $(distdir).zip
- zip -rq $(distdir).zip $(distdir)
- $(am__post_remove_distdir)
-
-dist dist-all:
- $(MAKE) $(AM_MAKEFLAGS) $(DIST_TARGETS) am__post_remove_distdir='@:'
- $(am__post_remove_distdir)
-
-# This target untars the dist file and tries a VPATH configuration. Then
-# it guarantees that the distribution is self-contained by making another
-# tarfile.
-distcheck: dist
- case '$(DIST_ARCHIVES)' in \
- *.tar.gz*) \
- eval GZIP= gzip $(GZIP_ENV) -dc $(distdir).tar.gz | $(am__untar) ;;\
- *.tar.bz2*) \
- bzip2 -dc $(distdir).tar.bz2 | $(am__untar) ;;\
- *.tar.lz*) \
- lzip -dc $(distdir).tar.lz | $(am__untar) ;;\
- *.tar.xz*) \
- xz -dc $(distdir).tar.xz | $(am__untar) ;;\
- *.tar.Z*) \
- uncompress -c $(distdir).tar.Z | $(am__untar) ;;\
- *.shar.gz*) \
- eval GZIP= gzip $(GZIP_ENV) -dc $(distdir).shar.gz | unshar ;;\
- *.zip*) \
- unzip $(distdir).zip ;;\
- *.tar.zst*) \
- zstd -dc $(distdir).tar.zst | $(am__untar) ;;\
- esac
- chmod -R a-w $(distdir)
- chmod u+w $(distdir)
- mkdir $(distdir)/_build $(distdir)/_build/sub $(distdir)/_inst
- chmod a-w $(distdir)
- test -d $(distdir)/_build || exit 0; \
- dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \
- && dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \
- && am__cwd=`pwd` \
- && $(am__cd) $(distdir)/_build/sub \
- && ../../configure \
- $(AM_DISTCHECK_CONFIGURE_FLAGS) \
- $(DISTCHECK_CONFIGURE_FLAGS) \
- --srcdir=../.. --prefix="$$dc_install_base" \
- && $(MAKE) $(AM_MAKEFLAGS) \
- && $(MAKE) $(AM_MAKEFLAGS) $(AM_DISTCHECK_DVI_TARGET) \
- && $(MAKE) $(AM_MAKEFLAGS) check \
- && $(MAKE) $(AM_MAKEFLAGS) install \
- && $(MAKE) $(AM_MAKEFLAGS) installcheck \
- && $(MAKE) $(AM_MAKEFLAGS) uninstall \
- && $(MAKE) $(AM_MAKEFLAGS) distuninstallcheck_dir="$$dc_install_base" \
- distuninstallcheck \
- && chmod -R a-w "$$dc_install_base" \
- && ({ \
- (cd ../.. && umask 077 && mkdir "$$dc_destdir") \
- && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" install \
- && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" uninstall \
- && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" \
- distuninstallcheck_dir="$$dc_destdir" distuninstallcheck; \
- } || { rm -rf "$$dc_destdir"; exit 1; }) \
- && rm -rf "$$dc_destdir" \
- && $(MAKE) $(AM_MAKEFLAGS) dist \
- && rm -rf $(DIST_ARCHIVES) \
- && $(MAKE) $(AM_MAKEFLAGS) distcleancheck \
- && cd "$$am__cwd" \
- || exit 1
- $(am__post_remove_distdir)
- @(echo "$(distdir) archives ready for distribution: "; \
- list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \
- sed -e 1h -e 1s/./=/g -e 1p -e 1x -e '$$p' -e '$$x'
-distuninstallcheck:
- @test -n '$(distuninstallcheck_dir)' || { \
- echo 'ERROR: trying to run $@ with an empty' \
- '$$(distuninstallcheck_dir)' >&2; \
- exit 1; \
- }; \
- $(am__cd) '$(distuninstallcheck_dir)' || { \
- echo 'ERROR: cannot chdir into $(distuninstallcheck_dir)' >&2; \
- exit 1; \
- }; \
- test `$(am__distuninstallcheck_listfiles) | wc -l` -eq 0 \
- || { echo "ERROR: files left after uninstall:" ; \
- if test -n "$(DESTDIR)"; then \
- echo " (check DESTDIR support)"; \
- fi ; \
- $(distuninstallcheck_listfiles) ; \
- exit 1; } >&2
-distcleancheck: distclean
- @if test '$(srcdir)' = . ; then \
- echo "ERROR: distcleancheck can only run from a VPATH build" ; \
- exit 1 ; \
- fi
- @test `$(distcleancheck_listfiles) | wc -l` -eq 0 \
- || { echo "ERROR: files left in build directory after distclean:" ; \
- $(distcleancheck_listfiles) ; \
- exit 1; } >&2
-check-am: all-am
-check: check-recursive
-all-am: Makefile $(DATA)
-installdirs: installdirs-recursive
-installdirs-am:
- for dir in "$(DESTDIR)$(docdir)"; do \
- test -z "$$dir" || $(MKDIR_P) "$$dir"; \
- done
-install: install-recursive
-install-exec: install-exec-recursive
-install-data: install-data-recursive
-uninstall: uninstall-recursive
-
-install-am: all-am
- @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
-
-installcheck: installcheck-recursive
-install-strip:
- if test -z '$(STRIP)'; then \
- $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
- install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
- install; \
- else \
- $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
- install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
- "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
- fi
-mostlyclean-generic:
-
-clean-generic:
-
-distclean-generic:
- -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
- -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
-
-maintainer-clean-generic:
- @echo "This command is intended for maintainers to use"
- @echo "it deletes files that may require special tools to rebuild."
-clean: clean-recursive
-
-clean-am: clean-generic clean-local mostlyclean-am
-
-distclean: distclean-recursive
- -rm -f $(am__CONFIG_DISTCLEAN_FILES)
- -rm -f Makefile
-distclean-am: clean-am distclean-generic distclean-tags
-
-dvi: dvi-recursive
-
-dvi-am:
-
-html: html-recursive
-
-html-am:
-
-info: info-recursive
-
-info-am:
-
-install-data-am: install-dist_docDATA
-
-install-dvi: install-dvi-recursive
-
-install-dvi-am:
-
-install-exec-am:
-
-install-html: install-html-recursive
-
-install-html-am:
-
-install-info: install-info-recursive
-
-install-info-am:
-
-install-man:
-
-install-pdf: install-pdf-recursive
-
-install-pdf-am:
-
-install-ps: install-ps-recursive
-
-install-ps-am:
-
-installcheck-am:
-
-maintainer-clean: maintainer-clean-recursive
- -rm -f $(am__CONFIG_DISTCLEAN_FILES)
- -rm -rf $(top_srcdir)/autom4te.cache
- -rm -f Makefile
-maintainer-clean-am: distclean-am maintainer-clean-generic
-
-mostlyclean: mostlyclean-recursive
-
-mostlyclean-am: mostlyclean-generic
-
-pdf: pdf-recursive
-
-pdf-am:
-
-ps: ps-recursive
-
-ps-am:
-
-uninstall-am: uninstall-dist_docDATA
-
-.MAKE: $(am__recursive_targets) install-am install-strip
-
-.PHONY: $(am__recursive_targets) CTAGS GTAGS TAGS all all-am \
- am--refresh check check-am clean clean-cscope clean-generic \
- clean-local cscope cscopelist-am ctags ctags-am dist dist-all \
- dist-bzip2 dist-gzip dist-lzip dist-shar dist-tarZ dist-xz \
- dist-zip dist-zstd distcheck distclean distclean-generic \
- distclean-tags distcleancheck distdir distuninstallcheck dvi \
- dvi-am html html-am info info-am install install-am \
- install-data install-data-am install-dist_docDATA install-dvi \
- install-dvi-am install-exec install-exec-am install-html \
- install-html-am install-info install-info-am install-man \
- install-pdf install-pdf-am install-ps install-ps-am \
- install-strip installcheck installcheck-am installdirs \
- installdirs-am maintainer-clean maintainer-clean-generic \
- mostlyclean mostlyclean-generic pdf pdf-am ps ps-am tags \
- tags-am uninstall uninstall-am uninstall-dist_docDATA
-
-.PRECIOUS: Makefile
-
-
-clean-local:
- @rm config.status configure config.log
- @rm Makefile
- @rm -r autom4te.cache/
- @rm aclocal.m4
- @rm compile install-sh missing Makefile.in
-
-# Tell versions [3.59,3.63) of GNU make to not export all variables.
-# Otherwise a system limit (for SysV at least) may be exceeded.
-.NOEXPORT:
diff --git a/Makefile.am b/Makefile.am
new file mode 100644
index 0000000..1afe8bd
--- /dev/null
+++ b/Makefile.am
@@ -0,0 +1,2 @@
+SUBDIRS = src
+dist_doc_DATA = docs/README.md
diff --git a/NEWS b/NEWS
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/NEWS
diff --git a/README b/README
new file mode 120000
index 0000000..0e01b43
--- /dev/null
+++ b/README
@@ -0,0 +1 @@
+docs/README.md \ No newline at end of file
diff --git a/configure.ac b/configure.ac
new file mode 100644
index 0000000..ca82896
--- /dev/null
+++ b/configure.ac
@@ -0,0 +1,9 @@
+AC_INIT([terminal-media-launcher], [0.1], [lshprung@example.com])
+
+AM_INIT_AUTOMAKE
+
+AC_PROG_CC
+
+AC_CONFIG_FILES([Makefile src/Makefile])
+
+AC_OUTPUT
diff --git a/src/Makefile.am b/src/Makefile.am
new file mode 100644
index 0000000..561c767
--- /dev/null
+++ b/src/Makefile.am
@@ -0,0 +1,8 @@
+AUTOMAKE_OPTIONS = subdir-objects
+
+LIBS = -lncurses
+
+bin_PROGRAMS = terminal_media_launcher
+
+terminal_media_launcher_SOURCES = cache.c draw.c read_cfg.c group.c entry.c unix/cache.c unix/draw.c unix/read_cfg.c
+terminal_media_launcher_LDADD = $(LIBS)
diff --git a/src/include/cache.h b/src/include/cache.h
new file mode 100644
index 0000000..0f5a6c4
--- /dev/null
+++ b/src/include/cache.h
@@ -0,0 +1,10 @@
+#ifndef CACHE_H
+#define CACHE_H
+
+void save_to_cache(int g_hover, int e_hover, int true_hover, char *cfg_name);
+
+void load_cache(int *g_hover, int *e_hover, int *true_hover, char *new_cfg_name);
+
+char *get_cache_path(bool create);
+
+#endif
diff --git a/src/include/draw.h b/src/include/draw.h
new file mode 100644
index 0000000..0a6baba
--- /dev/null
+++ b/src/include/draw.h
@@ -0,0 +1,18 @@
+#ifndef DRAW_H
+#define DRAW_H
+
+//These functions are needed by either unix/draw.c or windows/draw.c and must be supplied via a header file
+
+#define BUF_LEN 1024
+
+extern int g_hover;
+extern int e_hover;
+extern struct group **g;
+extern struct entry **e;
+
+char *get_launch();
+
+//functions that differ between os
+void launch();
+
+#endif
diff --git a/src/include/entry.h b/src/include/entry.h
new file mode 100644
index 0000000..51e43ca
--- /dev/null
+++ b/src/include/entry.h
@@ -0,0 +1,28 @@
+#ifndef ENTRY_H
+#define ENTRY_H
+
+typedef struct entry ENTRY;
+
+ENTRY *create_entry(char *new_name, char *new_path, bool force);
+
+void entry_rm(ENTRY *e, ENTRY *prev);
+
+void clear_entries(ENTRY *head);
+
+int entry_add(ENTRY *head, ENTRY *tail, ENTRY *add);
+
+ENTRY **get_entries(ENTRY *head, int count);
+
+char *get_ename(ENTRY *e);
+
+char *get_epath(ENTRY *e);
+
+bool get_eforce(ENTRY *e);
+
+void set_hide(ENTRY *e, bool status);
+
+bool get_hide(ENTRY *e);
+
+void entry_debug(ENTRY *trav);
+
+#endif
diff --git a/src/include/group.h b/src/include/group.h
new file mode 100644
index 0000000..ab6f409
--- /dev/null
+++ b/src/include/group.h
@@ -0,0 +1,40 @@
+#ifndef GROUP_H
+#define GROUP_H
+
+typedef struct group GROUP;
+
+GROUP *create_group(char *new_name);
+
+void group_add(char *gname, ENTRY *addme);
+
+void group_rm(GROUP *g);
+
+void clean_groups(); //remove empty groups from linked list
+
+GROUP **get_groups();
+
+char *get_gname(GROUP *g);
+
+char *get_gprog(GROUP *g);
+
+void set_gprog(GROUP *g, char *p);
+
+char *get_gflags(GROUP *g);
+
+void set_gflags(GROUP *g, char *p);
+
+ENTRY *get_ghead(GROUP *g);
+
+int get_ecount(GROUP *g);
+
+void set_ecount(GROUP *g, int new_count); //for use in hiding entries
+
+void set_gquotes(GROUP *g, bool b);
+
+bool get_gquotes(GROUP *g);
+
+int get_gcount();
+
+void group_debug(); //debug function to output all groups
+
+#endif
diff --git a/src/include/read_cfg.h b/src/include/read_cfg.h
new file mode 100644
index 0000000..b6b996f
--- /dev/null
+++ b/src/include/read_cfg.h
@@ -0,0 +1,23 @@
+#ifndef READ_CFG_H
+#define READ_CFG_H
+
+#define BUF_LEN 1024
+
+bool cfg_interp(char *path);
+bool get_sort();
+bool get_case_sensitivity();
+void refer_to_doc();
+void addme(char *path, char *group, bool force, char *name);
+int search_ch(char *str, char c);
+int search_last_ch(char *str, char c);
+int wild_cmp(char *wild, char *literal);
+char *strip_quotes(char *str);
+void error_mes(int ln, char *message);
+
+//functions that differ by os
+extern char sep;
+char *find_config();
+void mkconfig_wizard();
+void handle_fname(char *path, char *group, bool recurs, bool force, char *name, int ln);
+
+#endif
diff --git a/src/unix/cache.c b/src/unix/cache.c
new file mode 100644
index 0000000..e618602
--- /dev/null
+++ b/src/unix/cache.c
@@ -0,0 +1,35 @@
+#include <assert.h>
+#include <stdbool.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <sys/stat.h>
+#include <sys/types.h>
+
+#include "../include/cache.h"
+#include "../include/read_cfg.h"
+
+char *get_cache_path(bool create){
+ char *path = malloc(sizeof(char) * BUF_LEN);
+ char *home = getenv("HOME");
+
+ assert(path != NULL);
+
+ if(home == NULL){
+ printf("Failed to save cache data: HOME is not set\n");
+ free(path);
+ return NULL;
+ }
+
+ //if create is asserted, build the path to the file
+ if(create){
+ sprintf(path, "%s%c.cache%c", home, sep, sep);
+ mkdir(path, 0755);
+
+ sprintf(path, "%s%c.cache%cterminal-media-launcher%c", home, sep, sep, sep);
+ mkdir(path, 0755);
+ }
+
+ sprintf(path, "%s%c.cache%cterminal-media-launcher%cdata.bin", home, sep, sep, sep);
+
+ return path;
+}
diff --git a/src/unix/draw.c b/src/unix/draw.c
new file mode 100644
index 0000000..ae7f758
--- /dev/null
+++ b/src/unix/draw.c
@@ -0,0 +1,14 @@
+#include <stdlib.h>
+#include <string.h>
+
+#include "../include/draw.h"
+
+void launch(){
+ char full_command[BUF_LEN];
+
+ strcpy(full_command, get_launch());
+ strcat(full_command, " > /dev/null 2>&1 &");
+ system(full_command);
+
+ return;
+}
diff --git a/src/unix/read_cfg.c b/src/unix/read_cfg.c
new file mode 100644
index 0000000..4d98c82
--- /dev/null
+++ b/src/unix/read_cfg.c
@@ -0,0 +1,234 @@
+#include <assert.h>
+#include <dirent.h>
+#include <stdbool.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sys/stat.h>
+#include <sys/types.h>
+#include <unistd.h>
+
+#include "../include/read_cfg.h"
+#include "../include/entry.h"
+
+char sep = '/';
+
+char *find_config(){
+ char *home = getenv("HOME");
+ char *path = malloc(sizeof(char) * BUF_LEN);
+ char choices[2][BUF_LEN];
+ int check_count = 2;
+ int i;
+
+ sprintf(choices[0], "%s%c.config%cterminal-media-launcher%cconfig", home, sep, sep, sep);
+ sprintf(choices[1], "%s%c.terminal-media-launcher%cconfig", home, sep, sep);
+
+ for(i = 0; i < check_count; i++){
+ path = choices[i];
+ printf("Checking for config at %s: ", choices[i]);
+ if(access(path, R_OK) == 0){
+ printf("Using config \"%s\"\n\n", path);
+ return path;
+ }
+ else printf("File does not exist\n");
+ }
+
+ //TODO no config exists, ask user if they want to autogenerate one
+ mkconfig_wizard(choices[0]);
+ path = choices[0];
+ return path;
+}
+
+void mkconfig_wizard(char *path){
+ char input;
+ FILE *fp;
+
+ char *home = getenv("HOME");
+
+ printf("\nNo configuration file found. Auto-generate one now at \"%s\"? [Y/n] ", path);
+ fflush(stdout);
+ scanf(" %c", &input);
+
+ if(input == 'n'){
+ printf("Configuration will not be auto-generated\n");
+ refer_to_doc();
+ exit(0);
+
+ }
+
+ printf("Generating configuration file at \"%s\"...\n", path);
+
+ //ensure directories have been created
+ if(home == NULL){
+ printf("Failed: HOME is NULL\n");
+ exit(1);
+ }
+
+ sprintf(path, "%s%c.config%c", home, sep, sep);
+ mkdir(path, 0755);
+
+ sprintf(path, "%s%c.config%cterminal-media-launcher%c", home, sep, sep, sep);
+ mkdir(path, 0755);
+
+ sprintf(path, "%s%c.config%cterminal-media-launcher%cconfig", home, sep, sep, sep);
+
+ //open file for writing, make sure non-NULL
+ fp = fopen(path, "w");
+ if(fp == NULL){
+ printf("Failed: \"%s\" could not be open for writing\n", path);
+ exit(1);
+ }
+
+ //write to file
+ fprintf(fp, "# This file was auto-generated by terminal-media-launcher. See docs/terminal-media-launcher-config.md or terminal-media-launcher-config(5) for documentation\n"
+ "# The default launcher is set to \"xdg-open\" which will open files based on the relevant default application set through xdg\n\n"
+ "# Recursively add files from %s%cMusic%c to Music group\n"
+ "addGroup Music\n"
+ "setLauncher Music xdg-open\n", home, sep, sep);
+ fprintf(fp, "addR %s%cMusic%c*.aac Music\n", home, sep, sep);
+ fprintf(fp, "addR %s%cMusic%c*.aiff Music\n", home, sep, sep);
+ fprintf(fp, "addR %s%cMusic%c*.alac Music\n", home, sep, sep);
+ fprintf(fp, "addR %s%cMusic%c*.au Music\n", home, sep, sep);
+ fprintf(fp, "addR %s%cMusic%c*.flac Music\n", home, sep, sep);
+ fprintf(fp, "addR %s%cMusic%c*.m4a Music\n", home, sep, sep);
+ fprintf(fp, "addR %s%cMusic%c*.mp3 Music\n", home, sep, sep);
+ fprintf(fp, "addR %s%cMusic%c*.ogg Music\n", home, sep, sep);
+ fprintf(fp, "addR %s%cMusic%c*.pcm Music\n", home, sep, sep);
+ fprintf(fp, "addR %s%cMusic%c*.wav Music\n", home, sep, sep);
+ fprintf(fp, "addR %s%cMusic%c*.wma Music\n\n", home, sep, sep);
+ fprintf(fp, "# Recursively add files from %s%cPictures%c to Pictures group\n"
+ "addGroup Pictures\n"
+ "setLauncher Pictures xdg-open\n", home, sep, sep);
+ fprintf(fp, "addR %s%cPictures%c*.epi Pictures\n", home, sep, sep);
+ fprintf(fp, "addR %s%cPictures%c*.eps Pictures\n", home, sep, sep);
+ fprintf(fp, "addR %s%cPictures%c*.eps2 Pictures\n", home, sep, sep);
+ fprintf(fp, "addR %s%cPictures%c*.eps3 Pictures\n", home, sep, sep);
+ fprintf(fp, "addR %s%cPictures%c*.epsf Pictures\n", home, sep, sep);
+ fprintf(fp, "addR %s%cPictures%c*.epsi Pictures\n", home, sep, sep);
+ fprintf(fp, "addR %s%cPictures%c*.ept Pictures\n", home, sep, sep);
+ fprintf(fp, "addR %s%cPictures%c*.gif Pictures\n", home, sep, sep);
+ fprintf(fp, "addR %s%cPictures%c*.gfa Pictures\n", home, sep, sep);
+ fprintf(fp, "addR %s%cPictures%c*.giff Pictures\n", home, sep, sep);
+ fprintf(fp, "addR %s%cPictures%c*.jpeg Pictures\n", home, sep, sep);
+ fprintf(fp, "addR %s%cPictures%c*.jpg Pictures\n", home, sep, sep);
+ fprintf(fp, "addR %s%cPictures%c*.png Pictures\n", home, sep, sep);
+ fprintf(fp, "addR %s%cPictures%c*.svg Pictures\n", home, sep, sep);
+ fprintf(fp, "addR %s%cPictures%c*.svgz Pictures\n", home, sep, sep);
+ fprintf(fp, "addR %s%cPictures%c*.tif Pictures\n", home, sep, sep);
+ fprintf(fp, "addR %s%cPictures%c*.tiff Pictures\n\n", home, sep, sep);
+ fprintf(fp, "# Recursively add files from %s%cVideos%c to Videos group\n"
+ "addGroup Videos\n"
+ "setLauncher Videos xdg-open\n", home, sep, sep);
+ fprintf(fp, "addR %s%cVideos%c*.asf Videos\n", home, sep, sep);
+ fprintf(fp, "addR %s%cVideos%c*.avi Videos\n", home, sep, sep);
+ fprintf(fp, "addR %s%cVideos%c*.flv Videos\n", home, sep, sep);
+ fprintf(fp, "addR %s%cVideos%c*.mk3d Videos\n", home, sep, sep);
+ fprintf(fp, "addR %s%cVideos%c*.mkv Videos\n", home, sep, sep);
+ fprintf(fp, "addR %s%cVideos%c*.mov Videos\n", home, sep, sep);
+ fprintf(fp, "addR %s%cVideos%c*.mp4 Videos\n", home, sep, sep);
+ fprintf(fp, "addR %s%cVideos%c*.qt Videos\n", home, sep, sep);
+ fprintf(fp, "addR %s%cVideos%c*.webm Videos\n", home, sep, sep);
+ fprintf(fp, "addR %s%cVideos%c*.wmv Videos\n", home, sep, sep);
+
+ fclose(fp);
+ printf("done\nIt is highly recommended to further tweak the configuration file! [press any key to continue]");
+ fflush(stdout);
+ getchar();
+ getchar();
+
+ return;
+}
+
+//TODO augment to involve recurs
+//TODO could use some cleanup...
+void handle_fname(char *path, char *group, bool recurs, bool force, char *name, int ln){
+ ENTRY *new;
+ char *search; //pointer for traversing path
+ char full_path_cpy[BUF_LEN];
+ char relative_path_cpy[BUF_LEN];
+ char arg_cpy[BUF_LEN];
+ char auto_name[BUF_LEN];
+ int plen = strlen(path);
+ char *dirname;
+ char *local_arg; //for use in addR
+ DIR *dp;
+ struct dirent *fname;
+ int i;
+ char *error_p; //helper for complex error messages
+
+ assert(path != NULL && group != NULL);
+
+ if(path[0] == '\0' || group[0] == '\0'){
+ error_mes(ln, "Too few arguments for \"add\"");
+ return;
+ }
+
+ //address potential quotes
+ strcpy(full_path_cpy, strip_quotes(path));
+
+ //don't check that the path arg is valid when forced
+ if(force) addme(full_path_cpy, group, force, name);
+
+ //file is not recognized, perhaps it has a wildcard?
+ //TODO finish rewriting a more robust wildcard thingy
+ else if(access(full_path_cpy, F_OK) == -1){
+ i = search_ch(full_path_cpy, '*');
+ if(i > -1){
+ //look for a directory
+ while(full_path_cpy[i] != sep && (i >= 0)){
+ i--;
+ }
+ dirname = full_path_cpy;
+ strcpy(arg_cpy, full_path_cpy);
+ dirname[i+1] = '\0';
+ dp = opendir(dirname);
+
+ //the directory is real
+ if(dp != NULL){
+ while(fname = readdir(dp)){
+ relative_path_cpy[0] = '\0';
+ strcat(relative_path_cpy, dirname);
+ strcat(relative_path_cpy, fname->d_name);
+
+ //check if path is a file (and not a directory/symlink/etc.) and regex matches
+ if(fname->d_type == DT_REG && !(wild_cmp(&arg_cpy[i+1], fname->d_name))) addme(relative_path_cpy, group, force, name);
+
+ //if the recursive option was specified and the path is a directory, run handle_fname on this directory, but for security reasons, do not consider directories that start with a '.'
+ else if(recurs && fname->d_type == DT_DIR && fname->d_name[0] != '.'){
+ i = search_last_ch(arg_cpy, sep);
+ local_arg = &arg_cpy[i+1];
+ strcat(relative_path_cpy, &sep);
+ strcat(relative_path_cpy, local_arg);
+ handle_fname(relative_path_cpy, group, 1, 0, NULL, ln);
+ }
+
+ }
+
+ closedir(dp);
+ }
+
+ //directory is not real, report error to the user
+ else{
+ error_p = malloc(sizeof(char) * 1024);
+ sprintf(error_p, "\"%s\" bad path", dirname);
+ error_mes(ln, error_p);
+ free(error_p);
+ //printf("Error: \"%s\" bad path\n", dirname);
+ }
+ }
+
+ //path is not real, report error to the user
+ else{
+ error_p = malloc(sizeof(char) * 1024);
+ sprintf(error_p, "\"%s\" bad path", full_path_cpy);
+ error_mes(ln, error_p);
+ free(error_p);
+ }
+ }
+
+ //file name is okay
+ //FIXME does not take into account whether the argument is a file (could be a directory, symlink, etc.)
+ else addme(full_path_cpy, group, force, name);
+
+ return;
+}
diff --git a/src/windows/cache.c b/src/windows/cache.c
new file mode 100644
index 0000000..01db0ef
--- /dev/null
+++ b/src/windows/cache.c
@@ -0,0 +1,30 @@
+#include <assert.h>
+#include <stdbool.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <sys/stat.h>
+#include <sys/types.h>
+
+#include "../include/cache.h"
+#include "../include/read_cfg.h"
+
+char *get_cache_path(bool create){
+ char *path = malloc(sizeof(char) * BUF_LEN);
+ char *appdata = getenv("APPDATA");
+
+ if(appdata == NULL){
+ printf("Failed to save cache data: APPDATA is not set\n");
+ free(path);
+ return NULL;
+ }
+
+ //if create is asserted, build the path to the file
+ if(create){
+ sprintf(path, "%s%cterminal-media-launcher%c", appdata, sep, sep);
+ mkdir(path);
+ }
+
+ sprintf(path, "%s%cterminal-media-launcher%ccache.bin", appdata, sep, sep);
+
+ return path;
+}
diff --git a/src/windows/draw.c b/src/windows/draw.c
new file mode 100644
index 0000000..28bef68
--- /dev/null
+++ b/src/windows/draw.c
@@ -0,0 +1,44 @@
+#include <stdbool.h>
+#include <windows.h>
+
+#include "../include/draw.h"
+#include "../include/entry.h"
+#include "../include/group.h"
+
+void launch(){
+ char *program = get_gprog(g[g_hover]);
+ char *flags = get_gflags(g[g_hover]);
+ char *path = get_epath(e[e_hover]);
+ bool quotes = get_gquotes(g[g_hover]);
+ char file[BUF_LEN];
+ char params[BUF_LEN];
+
+ file[0] = '\0';
+
+ if(!(strcmp(program, "./"))){
+ strcat(file, "/C ");
+ strcat(file, "\"");
+ strcat(file, path);
+ strcat(file, "\"");
+ ShellExecute(NULL, NULL, "cmd.exe", file, NULL, SW_HIDE);
+ }
+
+ else{
+ if(quotes) strcat(file, "\"");
+ strcat(file, program);
+ if(quotes) strcat(file, "\"");
+
+ params[0] = '\0';
+ if(flags[0] != '\0'){
+ strcat(params, flags);
+ strcat(params, " ");
+ }
+ strcat(params, "\"");
+ strcat(params, path);
+ strcat(params, "\"");
+
+ ShellExecute(NULL, NULL, file, params, NULL, SW_SHOW);
+ }
+
+ return;
+}
diff --git a/src/windows/read_cfg.c b/src/windows/read_cfg.c
new file mode 100644
index 0000000..2a56ef8
--- /dev/null
+++ b/src/windows/read_cfg.c
@@ -0,0 +1,232 @@
+#include <assert.h>
+#include <dirent.h>
+#include <stdbool.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sys/stat.h>
+#include <sys/types.h>
+#include <unistd.h>
+
+#include "../include/entry.h"
+#include "../include/read_cfg.h"
+
+char sep = '\\';
+
+char *find_config(){
+ char *appdata = getenv("APPDATA");
+ char *path = malloc(sizeof(char) * BUF_LEN);
+ int check_count = 1;
+ char choices[check_count][BUF_LEN];
+ int i;
+
+ sprintf(choices[0], "%s%cterminal-media-launcher%cconfig", appdata, sep, sep);
+
+ for(i = 0; i < check_count; i++){
+ path = choices[i];
+ printf("Checking for config at %s: ", choices[i]);
+ if(access(path, R_OK) == 0){
+ printf("Using config \"%s\"\n\n", path);
+ return path;
+ }
+ else printf("File does not exist\n");
+ }
+
+ //TODO no config exists, ask user if they want to autogenerate one
+ mkconfig_wizard(choices[0]);
+ path = choices[0];
+ return path;
+}
+
+void mkconfig_wizard(char *path){
+ char input;
+ FILE *fp;
+
+ char *home = getenv("USERPROFILE");
+ char *appdata = getenv("APPDATA");
+
+ printf("\nNo configuration file found. Auto-generate one now at \"%s\"? [Y/n] ", path);
+ fflush(stdout);
+ scanf(" %c", &input);
+
+ if(input == 'n'){
+ printf("Configuration will not be auto-generated\n");
+ refer_to_doc();
+ exit(0);
+
+ }
+
+ printf("Generating configuration file at \"%s\"...\n", path);
+
+ //ensure directories have been created
+ if(appdata == NULL){
+ printf("Failed: \%APPDATA\% is NULL\n");
+ exit(1);
+ }
+
+ if(home == NULL){
+ printf("Failed: \%USERPROFILE\% is NULL\n");
+ exit(1);
+ }
+
+ sprintf(path, "%s%cterminal-media-launcher%c", appdata, sep, sep);
+ mkdir(path);
+
+ sprintf(path, "%s%cterminal-media-launcher%cconfig", appdata, sep, sep);
+
+ //open file for writing, make sure non-NULL
+ fp = fopen(path, "w");
+ if(fp == NULL){
+ printf("Failed: \"%s\" could not be open for writing\n", path);
+ exit(1);
+ }
+
+ fprintf(fp, "# This file was auto-generated by terminal-media-launcher. See docs\\terminal-media-launcher-config.md or terminal-media-launcher-config(5) for documentation\n"
+ "# By default, no launcher is specified for any group. When no launcher is specified on the Windows build of terminal-media-launcher, media files will be opened with their default application.\n"
+ "# It is generally recommended to specify a launcher for groups containing media files using the \"setLauncher\" command\n\n"
+ "# Recursively add files from %s%cMusic%c to Music group\n"
+ "addGroup Music\n", home, sep, sep);
+ fprintf(fp, "addR %s%cMusic%c*.aac Music\n", home, sep, sep);
+ fprintf(fp, "addR %s%cMusic%c*.aiff Music\n", home, sep, sep);
+ fprintf(fp, "addR %s%cMusic%c*.alac Music\n", home, sep, sep);
+ fprintf(fp, "addR %s%cMusic%c*.au Music\n", home, sep, sep);
+ fprintf(fp, "addR %s%cMusic%c*.flac Music\n", home, sep, sep);
+ fprintf(fp, "addR %s%cMusic%c*.m4a Music\n", home, sep, sep);
+ fprintf(fp, "addR %s%cMusic%c*.mp3 Music\n", home, sep, sep);
+ fprintf(fp, "addR %s%cMusic%c*.ogg Music\n", home, sep, sep);
+ fprintf(fp, "addR %s%cMusic%c*.pcm Music\n", home, sep, sep);
+ fprintf(fp, "addR %s%cMusic%c*.wav Music\n", home, sep, sep);
+ fprintf(fp, "addR %s%cMusic%c*.wma Music\n\n", home, sep, sep);
+ fprintf(fp, "# Recursively add files from %s%cPictures%c to Pictures group\n"
+ "addGroup Pictures\n", home, sep, sep);
+ fprintf(fp, "addR %s%cPictures%c*.epi Pictures\n", home, sep, sep);
+ fprintf(fp, "addR %s%cPictures%c*.eps Pictures\n", home, sep, sep);
+ fprintf(fp, "addR %s%cPictures%c*.eps2 Pictures\n", home, sep, sep);
+ fprintf(fp, "addR %s%cPictures%c*.eps3 Pictures\n", home, sep, sep);
+ fprintf(fp, "addR %s%cPictures%c*.epsf Pictures\n", home, sep, sep);
+ fprintf(fp, "addR %s%cPictures%c*.epsi Pictures\n", home, sep, sep);
+ fprintf(fp, "addR %s%cPictures%c*.ept Pictures\n", home, sep, sep);
+ fprintf(fp, "addR %s%cPictures%c*.gif Pictures\n", home, sep, sep);
+ fprintf(fp, "addR %s%cPictures%c*.gfa Pictures\n", home, sep, sep);
+ fprintf(fp, "addR %s%cPictures%c*.giff Pictures\n", home, sep, sep);
+ fprintf(fp, "addR %s%cPictures%c*.jpeg Pictures\n", home, sep, sep);
+ fprintf(fp, "addR %s%cPictures%c*.jpg Pictures\n", home, sep, sep);
+ fprintf(fp, "addR %s%cPictures%c*.png Pictures\n", home, sep, sep);
+ fprintf(fp, "addR %s%cPictures%c*.svg Pictures\n", home, sep, sep);
+ fprintf(fp, "addR %s%cPictures%c*.svgz Pictures\n", home, sep, sep);
+ fprintf(fp, "addR %s%cPictures%c*.tif Pictures\n", home, sep, sep);
+ fprintf(fp, "addR %s%cPictures%c*.tiff Pictures\n\n", home, sep, sep);
+ fprintf(fp, "# Recursively add files from %s%cVideos%c to Videos group\n"
+ "addGroup Videos\n", home, sep, sep);
+ fprintf(fp, "addR %s%cVideos%c*.asf Videos\n", home, sep, sep);
+ fprintf(fp, "addR %s%cVideos%c*.avi Videos\n", home, sep, sep);
+ fprintf(fp, "addR %s%cVideos%c*.flv Videos\n", home, sep, sep);
+ fprintf(fp, "addR %s%cVideos%c*.mk3d Videos\n", home, sep, sep);
+ fprintf(fp, "addR %s%cVideos%c*.mkv Videos\n", home, sep, sep);
+ fprintf(fp, "addR %s%cVideos%c*.mov Videos\n", home, sep, sep);
+ fprintf(fp, "addR %s%cVideos%c*.mp4 Videos\n", home, sep, sep);
+ fprintf(fp, "addR %s%cVideos%c*.qt Videos\n", home, sep, sep);
+ fprintf(fp, "addR %s%cVideos%c*.webm Videos\n", home, sep, sep);
+ fprintf(fp, "addR %s%cVideos%c*.wmv Videos\n", home, sep, sep);
+
+ fclose(fp);
+ printf("done\nIt is highly recommended to further tweak the configuration file! [press any key to continue]");
+ fflush(stdout);
+ getchar();
+ getchar();
+
+ return;
+}
+
+//TODO augment to involve recurs
+//TODO could use some cleanup...
+void handle_fname(char *path, char *group, bool recurs, bool force, char *name, int ln){
+ ENTRY *new;
+ char *search; //pointer for traversing path
+ char full_path_cpy[BUF_LEN];
+ char relative_path_cpy[BUF_LEN];
+ char arg_cpy[BUF_LEN];
+ char auto_name[BUF_LEN];
+ int plen = strlen(path);
+ char *dirname;
+ char *local_arg; //for use in addR
+ DIR *dp;
+ struct dirent *fname;
+ int i;
+ char *error_p; //helper for complex error messages
+
+ assert(path != NULL && group != NULL);
+
+ if(path[0] == '\0' || group[0] == '\0'){
+ error_mes(ln, "Too few arguments for \"add\"");
+ return;
+ }
+
+ //address potential quotes
+ strcpy(full_path_cpy, strip_quotes(path));
+
+ //don't check that the path arg is valid when forced
+ if(force) addme(full_path_cpy, group, force, name);
+
+ //file is not recognized, perhaps it has a wildcard?
+ //TODO finish rewriting a more robust wildcard thingy
+ else if(access(full_path_cpy, F_OK) == -1){
+ i = search_ch(full_path_cpy, '*');
+ if(i > -1){
+ //look for a directory
+ while(full_path_cpy[i] != sep && (i >= 0)){
+ i--;
+ }
+ dirname = full_path_cpy;
+ strcpy(arg_cpy, full_path_cpy);
+ dirname[i+1] = '\0';
+ dp = opendir(dirname);
+
+ //the directory is real
+ if(dp != NULL){
+ while(fname = readdir(dp)){
+ relative_path_cpy[0] = '\0';
+ strcat(relative_path_cpy, dirname);
+ strcat(relative_path_cpy, fname->d_name);
+
+ //Windows cannot tell file types (TODO), so just add relatively indiscriminantly
+ if(!(wild_cmp(&arg_cpy[i+1], fname->d_name))) addme(relative_path_cpy, group, force, name);
+
+ //if the recursive option was specified, run handle_fname on this directory, but for security reasons, do not consider directories that start with a '.'
+ else if(recurs && fname->d_name[0] != '.'){
+ i = search_last_ch(arg_cpy, sep);
+ local_arg = &arg_cpy[i+1];
+ strcat(relative_path_cpy, &sep);
+ strcat(relative_path_cpy, local_arg);
+ handle_fname(relative_path_cpy, group, 1, 0, NULL, ln);
+ }
+ }
+
+ closedir(dp);
+ }
+
+ //directory is not real, report error to the user
+ else if(!recurs){
+ error_p = malloc(sizeof(char) * 1024);
+ sprintf(error_p, "\"%s\" bad path", dirname);
+ error_mes(ln, error_p);
+ free(error_p);
+ //printf("Error: \"%s\" bad path\n", dirname);
+ }
+ }
+
+ //path is not real, report error to the user
+ else{
+ error_p = malloc(sizeof(char) * 1024);
+ sprintf(error_p, "\"%s\" bad path", full_path_cpy);
+ error_mes(ln, error_p);
+ free(error_p);
+ }
+ }
+
+ //file name is okay
+ //FIXME does not take into account whether the argument is a file (could be a directory, symlink, etc.)
+ else addme(full_path_cpy, group, force, name);
+
+ return;
+}