aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorGravatar Tom Willemsen2012-12-29 16:54:16 +0100
committerGravatar Tom Willemsen2012-12-29 16:54:16 +0100
commitb46793938598358a9ab5249bd97e8999d5ac67e6 (patch)
tree3461b18599341fd3be19b0c094d6a62775478b88 /src
parentf379783d28e73b4613852fca58e0af3f8ea6ab87 (diff)
downloadmarkam-b46793938598358a9ab5249bd97e8999d5ac67e6.tar.gz
markam-b46793938598358a9ab5249bd97e8999d5ac67e6.zip
Rename linkwave to markam
Diffstat (limited to 'src')
-rw-r--r--src/.gitignore2
-rw-r--r--src/Makefile4
-rw-r--r--src/common.scm6
-rw-r--r--src/convert.scm20
-rw-r--r--src/markam.scm (renamed from src/linkwave.scm)10
-rw-r--r--src/paths.scm23
6 files changed, 31 insertions, 34 deletions
diff --git a/src/.gitignore b/src/.gitignore
index 36833f1..83dc013 100644
--- a/src/.gitignore
+++ b/src/.gitignore
@@ -1,3 +1,3 @@
convert
-linkwave
+markam
*.o
diff --git a/src/Makefile b/src/Makefile
index f64fb7f..95baea2 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -2,8 +2,8 @@ objects = paths.o common.o
.PHONY: all
-all: linkwave convert
-linkwave: linkwave.scm $(objects)
+all: markam convert
+markam: markam.scm $(objects)
csc $^ -o $@
convert: convert.scm $(objects)
diff --git a/src/common.scm b/src/common.scm
index 7d4fec2..20baece 100644
--- a/src/common.scm
+++ b/src/common.scm
@@ -1,4 +1,4 @@
-;;; linkwave -- Store/retrieve/manage bookmarks
+;;; markam -- Store/retrieve/manage bookmarks
;; Copyright (C) 2012 Tom Willemsen <tom at ryuslash dot org>
;; This program is free software: you can redistribute it and/or modify
@@ -26,5 +26,5 @@
(define version "0.1.0")
(define (display-version)
- ;; Display linkwave's version number.
- (format #t "linkwave v~a~%" version))
+ ;; Display markam's version number.
+ (format #t "markam version ~a~%" version))
diff --git a/src/convert.scm b/src/convert.scm
index 45e3101..199a2a5 100644
--- a/src/convert.scm
+++ b/src/convert.scm
@@ -1,4 +1,4 @@
-;;; linkwave -- Store/retrieve/manage bookmarks
+;;; markam -- Store/retrieve/manage bookmarks
;; Copyright (C) 2012 Tom Willemsen <tom at ryuslash dot org>
;; This program is free software: you can redistribute it and/or modify
@@ -17,7 +17,7 @@
;;; Commentary:
;; Convert any old database file to one usable with this version of
-;; linkwave. If you're just starting to use linkwave there should be
+;; markam. If you're just starting to use markam there should be
;; no need to use this.
;;; Code:
@@ -31,7 +31,7 @@
(define (blob->seconds blob)
;; Convert BLOB to an integer representing the seconds since
;; 01-01-1970 (standard unix timstamp). This has to be done because
- ;; in the previous version of linkwave I stored the timestamp as a
+ ;; in the previous version of markam I stored the timestamp as a
;; blob and CHICKEN doesn't seem to like blobs much.
(if (u32vector? blob)
(u32vector-ref (blob->u32vector blob) 0)
@@ -53,8 +53,8 @@
(define (convert)
;; Convert an old database into a new one and then replace the old
;; with the new.
- (let ((old-db (open-database (data-file "linkwave.db")))
- (new-db (open-database (data-file "nlinkwave.db"))))
+ (let ((old-db (open-database (data-file "linkwave.db" "linkwave")))
+ (new-db (open-database (data-file "markam.db"))))
(execute new-db "CREATE TABLE bookmark (url VARCHAR(255) UNIQUE, date INTEGER, name VARCHAR(255), description TEXT)")
(execute new-db "CREATE TABLE tag (name VARCHAR(255) UNIQUE)")
(execute new-db "CREATE TABLE bookmark_tag (bookmark_id INTEGER REFERENCES bookmark(rowid), tag_id INTEGER REFERENCES tag(rowid), PRIMARY KEY (bookmark_id, tag_id))")
@@ -75,12 +75,10 @@
(first-result new-db "SELECT rowid FROM tag WHERE name = ?" tag)))
"SELECT url, name FROM bookmark_tag JOIN tag ON (tag_id = tag.rowid)")
- (rename-file (data-file "linkwave.db") (data-file "old-linkwave.db"))
- (rename-file (data-file "nlinkwave.db") (data-file "linkwave.db"))
(format #t "Database converted.~%")))
(define (display-help)
- ;; Display linkwave's help message.
+ ;; Display markam's help message.
(format #t (string-append
"Usage: convert [options]...~%"
"~%"
@@ -93,9 +91,9 @@
;; Convert an old database file unless a conversion database already
;; exists.
(if (null? args)
- (if (file-exists? (data-file "nlinkwave.db"))
- (format #t (string-append "Conversion database already exists. "
- "Something may have gone wrong during the last run~%"))
+ (if (file-exists? (data-file "markam.db"))
+ (format #t (string-append "Converted database already exists, or something may have gone "
+ "wrong during the last run~%"))
(convert))
(do ((arg (car args) (and (not (null? args))
(car args))))
diff --git a/src/linkwave.scm b/src/markam.scm
index a84e3ee..38bfc42 100644
--- a/src/linkwave.scm
+++ b/src/markam.scm
@@ -1,4 +1,4 @@
-;;; linkwave -- Store/retrieve/manage bookmarks
+;;; markam -- Store/retrieve/manage bookmarks
;; Copyright (C) 2012 Tom Willemsen <tom at ryuslash dot org>
;; This program is free software: you can redistribute it and/or modify
@@ -78,10 +78,10 @@
(string= (substring str 0 8) "https://"))))
(define (display-help)
- ;; Display linkwave's help message.
+ ;; Display markam's help message.
(format #t (string-append
- "Usage: linkwave [options]...~%"
- " linkwave <url> <name> <description> [<tag>...]~%"
+ "Usage: markam [options]...~%"
+ " markam <url> <name> <description> [<tag>...]~%"
"~%"
"Possible options:~%"
"~%"
@@ -91,7 +91,7 @@
(define (main args)
;; Open a database connection, do what the user asked and close it
;; again.
- (let ((db (open-database (data-file "linkwave.db"))))
+ (let ((db (open-database (data-file "markam.db"))))
(if (null? args)
(for-each-row print-row db "select * from bookmark")
(if (url-string? (car args))
diff --git a/src/paths.scm b/src/paths.scm
index 5f4f2d2..cfd8838 100644
--- a/src/paths.scm
+++ b/src/paths.scm
@@ -1,4 +1,4 @@
-;;; linkwave -- Store/retrieve/manage bookmarks
+;;; markam -- Store/retrieve/manage bookmarks
;; Copyright (C) 2012 Tom Willemsen <tom at ryuslash dot org>
;; This program is free software: you can redistribute it and/or modify
@@ -22,25 +22,24 @@
(declare (unit paths))
-(define (stored-file xdg-env file)
- ;; Get FILE either from `XDG-ENV/linkwave/' or from
- ;; `$HOME/.linkwave/'. Prefer any existing file over any other, but
- ;; prefer files using XDG-ENV over `$HOME'.
- (let ((xdg (get-environment-variable xdg-env))
- (stored-file (string-append (get-environment-variable "HOME") "/.linkwave/" file)))
+(define (stored-file xdg-env file #!optional dir)
+ ;; Get FILE either from `XDG-ENV/markam/' or from `$HOME/.markam/'.
+ ;; Prefer any existing file over any other, but prefer files using
+ ;; XDG-ENV over `$HOME'.
+ (let* ((xdg (get-environment-variable xdg-env))
+ (dir (or dir "markam"))
+ (stored-file (string-append (get-environment-variable "HOME") "/." dir "/" file)))
(unless (or (file-exists? stored-file) (not xdg))
- (set! stored-file (string-append xdg "/linkwave/" file)))
+ (set! stored-file (string-append xdg "/" dir "/" file)))
stored-file))
-(: config-file (string -> string))
(define (config-file file)
;; Use `stored-file' to get configuration file FILE. Configuration
;; files are stored under `$XDG_CONFIG_HOME' if the XDG standard is
;; used.
(stored-file "XDG_CONFIG_HOME" file))
-(: data-file (string -> string))
-(define (data-file file)
+(define (data-file file #!optional dir)
;; Use `stored-file' to get data file FILE. Data files are stored
;; under `$XDG_DATA_HOME' if the XDG standard is used.
- (stored-file "XDG_DATA_HOME" file))
+ (stored-file "XDG_DATA_HOME" file dir))