xaizek / hstr (License: Apachev2) (since 2018-12-07)
Bash and Zsh shell history suggest box - easily view, navigate, search and manage your command history.
Commit eef3a67183f3b3f8a97800c97c02b7f3e90dc5d4

Making source C99 compliant
Author: Martin Dvorak
Author date (UTC): 2013-12-25 23:58
Committer name: Martin Dvorak
Committer date (UTC): 2013-12-25 23:58
Parent(s): 7e91f2bcd3a659e55dbff2c355ba7ba038534f14
Signing key:
Tree: 92e383137bc70c5ba0657217a8e1a8680b898671
File Lines added Lines deleted
bin/deb-build.sh 0 1
src/hashset.c 2 1
src/hstr.c 1 2
src/hstr_utils.c 17 1
src/include/hstr_utils.h 2 0
File bin/deb-build.sh changed (mode: 100755) (index dc2e3ca..5b3e234)
2 2
3 3 rm -vf *.*~ rm -vf *.*~
4 4
5 # copy hstr/ source code to a work directory and run this script to create DEB package
6 5 cd .. cd ..
7 6 bzr commit -m "Sync." bzr commit -m "Sync."
8 7 bzr builddeb -- -us -uc bzr builddeb -- -us -uc
File src/hashset.c changed (mode: 100644) (index 8f80fec..20ba53c)
... ... int hashset_put(HashSet * hs, const char *key, void *value) {
59 59 return 0; return 0;
60 60 } }
61 61
62 newNode->key = strdup( key );
62 newNode->key = malloc(strlen(key)+1);
63 strcpy(newNode->key, key);
63 64 newNode->value = value; newNode->value = value;
64 65 newNode->next = hs->lists[ listNum ]; newNode->next = hs->lists[ listNum ];
65 66 hs->lists[ listNum ] = newNode; hs->lists[ listNum ] = newNode;
File src/hstr.c changed (mode: 100644) (index 7d685a8..5c8194f)
... ... static bool terminalHasColors=FALSE;
63 63 static char screenLine[1000]; static char screenLine[1000];
64 64
65 65 int print_prompt(WINDOW *win) { int print_prompt(WINDOW *win) {
66 char hostname[128];
66 char *hostname = get_hostname();
67 67 char *user = getenv(ENV_VAR_USER); char *user = getenv(ENV_VAR_USER);
68 68 int xoffset = 1; int xoffset = 1;
69 69
70 gethostname(hostname, sizeof hostname);
71 70 mvwprintw(win, xoffset, Y_OFFSET_PROMPT, "%s@%s$ ", user, hostname); mvwprintw(win, xoffset, Y_OFFSET_PROMPT, "%s@%s$ ", user, hostname);
72 71 refresh(); refresh();
73 72
File src/hstr_utils.c changed (mode: 100644) (index 093fc1a..4aa45ee)
10 10 #include "include/hstr_utils.h" #include "include/hstr_utils.h"
11 11
12 12 #define DEFAULT_COMMAND "pwd" #define DEFAULT_COMMAND "pwd"
13 #define HOSTNAME_BUFFER 100
14 #define PROC_HOSTNAME "/proc/sys/kernel/hostname"
13 15
14 16 void tiocsti() { void tiocsti() {
15 17 char buf[] = DEFAULT_COMMAND; char buf[] = DEFAULT_COMMAND;
 
... ... void reverse_char_pointer_array(char **array, unsigned length) {
43 45 } }
44 46 } }
45 47
46
48 char *get_hostname()
49 {
50 char *b=malloc(HOSTNAME_BUFFER);
51 if(access( PROC_HOSTNAME, F_OK ) != -1) {
52 FILE *f = fopen(PROC_HOSTNAME, "r");
53 b=fgets(b, HOSTNAME_BUFFER, f);
54 fclose(f);
55 if(b) {
56 b[strlen(b)-1]=0;
57 return b;
58 }
59 }
60 strcpy(b,"localhost");
61 return b;
62 }
47 63
File src/include/hstr_utils.h changed (mode: 100644) (index d7c86dd..2539087)
15 15 #include <string.h> #include <string.h>
16 16 #include <stdio.h> #include <stdio.h>
17 17 #include <stdbool.h> #include <stdbool.h>
18 #include <unistd.h>
18 19
19 20 #define MIN(a,b) (((a)<(b))?(a):(b)) #define MIN(a,b) (((a)<(b))?(a):(b))
20 21 #define MAX(a,b) (((a)>(b))?(a):(b)) #define MAX(a,b) (((a)>(b))?(a):(b))
 
22 23 void tiocsti(); void tiocsti();
23 24 void fill_terminal_input(char* cmd, bool padding); void fill_terminal_input(char* cmd, bool padding);
24 25 void reverse_char_pointer_array(char **array, unsigned length); void reverse_char_pointer_array(char **array, unsigned length);
26 char *get_hostname();
25 27
26 28 #endif #endif
Hints

Before first commit, do not forget to setup your git environment:
git config --global user.name "your_name_here"
git config --global user.email "your@email_here"

Clone this repository using HTTP(S):
git clone https://code.reversed.top/user/xaizek/hstr

Clone this repository using ssh (do not forget to upload a key first):
git clone ssh://rocketgit@code.reversed.top/user/xaizek/hstr

You are allowed to anonymously push to this repository.
This means that your pushed commits will automatically be transformed into a pull request:
... clone the repository ...
... make some changes and some commits ...
git push origin master