[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemacs-commit] qemacs qe.h util.c
From: |
Charlie Gordon |
Subject: |
[Qemacs-commit] qemacs qe.h util.c |
Date: |
Tue, 03 Dec 2013 17:35:06 +0000 |
CVSROOT: /sources/qemacs
Module name: qemacs
Changes by: Charlie Gordon <chqrlie> 13/12/03 17:35:06
Modified files:
. : qe.h util.c
Log message:
added make_user_path to compute path relative to user HOME directory
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/qemacs/qe.h?cvsroot=qemacs&r1=1.98&r2=1.99
http://cvs.savannah.gnu.org/viewcvs/qemacs/util.c?cvsroot=qemacs&r1=1.54&r2=1.55
Patches:
Index: qe.h
===================================================================
RCS file: /sources/qemacs/qemacs/qe.h,v
retrieving revision 1.98
retrieving revision 1.99
diff -u -b -r1.98 -r1.99
--- qe.h 23 Nov 2013 10:55:20 -0000 1.98
+++ qe.h 3 Dec 2013 17:35:06 -0000 1.99
@@ -2,7 +2,7 @@
* QEmacs, tiny but powerful multimode editor
*
* Copyright (c) 2000,2001 Fabrice Bellard.
- * Copyright (c) 2000-2008 Charlie Gordon.
+ * Copyright (c) 2000-2013 Charlie Gordon.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -195,6 +195,7 @@
int is_directory(const char *path);
void canonicalize_path(char *buf, int buf_size, const char *path);
void canonicalize_absolute_path(char *buf, int buf_size, const char *path1);
+char *make_user_path(char *buf, int buf_size, const char *path);
char *reduce_filename(char *dest, int size, const char *filename);
int match_extension(const char *filename, const char *extlist);
int remove_slash(char *buf);
Index: util.c
===================================================================
RCS file: /sources/qemacs/qemacs/util.c,v
retrieving revision 1.54
retrieving revision 1.55
diff -u -b -r1.54 -r1.55
--- util.c 28 Nov 2013 15:52:38 -0000 1.54
+++ util.c 3 Dec 2013 17:35:06 -0000 1.55
@@ -2,7 +2,7 @@
* Utilities for qemacs.
*
* Copyright (c) 2001 Fabrice Bellard.
- * Copyright (c) 2002-2008 Charlie Gordon.
+ * Copyright (c) 2002-2013 Charlie Gordon.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -280,6 +280,26 @@
canonicalize_path(buf, buf_size, path1);
}
+/* reduce path relative to homedir */
+char *make_user_path(char *buf, int buf_size, const char *path)
+{
+ char *homedir;
+
+ homedir = getenv("HOME");
+ if (homedir) {
+ int len = strlen(homedir);
+
+ if (len && homedir[len - 1] == '/')
+ len--;
+
+ if (!memcmp(path, homedir, len) && path[len] == '/') {
+ pstrcpy(buf, buf_size, "~");
+ return pstrcat(buf, buf_size, path + len);
+ }
+ }
+ return pstrcpy(buf, buf_size, path);
+}
+
char *reduce_filename(char *dest, int size, const char *filename)
{
const char *base = get_basename(filename);
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Qemacs-commit] qemacs qe.h util.c,
Charlie Gordon <=