Removed unused code. - sam - An updated version of the sam text editor.
(HTM) git clone git://vernunftzentrum.de/sam.git
(DIR) Log
(DIR) Files
(DIR) Refs
(DIR) LICENSE
---
(DIR) commit ce2e8bbdf63deb582d1e7b8c270e5f7e885e0d1f
(DIR) parent fc5f7e2b89f0f7c5aeecacf8f668a3c5c7c9acf8
(HTM) Author: Rob King <jking@deadpixi.com>
Date: Tue, 4 Oct 2016 10:36:40 -0500
Removed unused code.
Diffstat:
include/libc.h | 3 ++-
libframe/Makefile | 2 +-
libframe/misc.c | 30 ------------------------------
samterm/unix.c | 4 +---
4 files changed, 4 insertions(+), 35 deletions(-)
---
(DIR) diff --git a/include/libc.h b/include/libc.h
@@ -18,6 +18,8 @@
#define _exits(v) _exit((v) ? 1 : 0)
+#define getuser() (getenv("LOGNAME") ? getenv("LOGNAME") : "unknown")
+
/*
* new rune routines
*/
@@ -27,6 +29,5 @@ extern int chartorune(wchar_t*, char*);
* Miscellaneous functions
*/
extern int notify (void(*)(void *, char *));
-extern char* getuser(void);
extern void exits(char*);
(DIR) diff --git a/libframe/Makefile b/libframe/Makefile
@@ -21,7 +21,7 @@ LIB=libframe.a
CC?=c99
OBJ=frbox.o frdelete.o frdraw.o frinit.o frinsert.o frptofchar.o\
- frselect.o frstr.o frutil.o misc.o
+ frselect.o frstr.o frutil.o
all: $(LIB)
(DIR) diff --git a/libframe/misc.c b/libframe/misc.c
@@ -1,30 +0,0 @@
-/* Copyright (c) 1998 Lucent Technologies - All rights reserved. */
-#include <u.h>
-#include <libc.h>
-#include <pwd.h>
-#ifdef NEEDVARARG
-#include <varargs.h>
-#else
-#include <stdarg.h>
-#endif
-#include <errno.h>
-
-char*
-getuser(void)
-{
- struct passwd *p;
-
- static char *user = 0;
-
- if (!user) {
- p = getpwuid(getuid());
- if (p && p->pw_name) {
- user = malloc(strlen(p->pw_name)+1);
- if (user)
- strcpy(user, p->pw_name);
- }
- }
- if(!user)
- user = "unknown";
- return user;
-}
(DIR) diff --git a/samterm/unix.c b/samterm/unix.c
@@ -93,13 +93,11 @@ extstart(void)
int fd;
int flags;
- user = getuser();
+ user = getenv("LOGNAME") ? getenv("LOGNAME") : getenv("USER") ? getenv("USER") : "unknown";
home = getenv("HOME");
if (home == NULL)
- {
return;
- }
exname = (char *)alloc(4 + 6 + strlen(home) + 1 + strlen(user) + 1 + strlen(machine) + 100);
sprint(exname, "%s/.sam.%s", home, machine);