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 4d3f46e26e8322c49f227c6b0ff30443da82a168

Initial sync commit of favorites with fake loading.
Author: Martin Dvorak
Author date (UTC): 2014-03-16 23:04
Committer name: Martin Dvorak
Committer date (UTC): 2014-03-16 23:04
Parent(s): dd18ef4dc8aaa4f73819b9daa3b0b1a7d23c8253
Signing key:
Tree: dc53ece0dbe98843a8aad16139fc3a075edca047
File Lines added Lines deleted
src/hstr_favorites.c 47 0
src/include/hstr_favorites.h 28 0
File src/hstr_favorites.c added (mode: 100644) (index 0000000..ee38533)
1 /*
2 ============================================================================
3 Name : hstr_favorites.c
4 Author : martin.dvorak@midforger.com
5 Copyright : Apache 2.0
6 Description : Favorite commands.
7 ============================================================================
8 */
9
10 #include "include/hstr_favorites.h"
11
12 FavoriteItems *favorites;
13
14 FavoriteItems *favorites_init() {
15 favorites=malloc(sizeof(FavoriteItems));
16 return favorites;
17 }
18
19 FavoriteItems *favorites_load() {
20 // TODO fake initialization
21 favorites->count=3;
22 favorites->items=malloc(sizeof(char *)*favorites->count);
23 favorites->items[0]="a";
24 favorites->items[1]="b";
25 favorites->items[2]="c";
26
27 return favorites;
28 }
29
30 void favorites_add(char *newFavorite) {
31 favorites->items=realloc(favorites->items, sizeof(char *)*favorites->count);
32 favorites->items[favorites->count++]=newFavorite;
33 }
34
35 void favorites_save() {
36 }
37
38 void favorites_close() {
39 if(favorites) {
40 if(favorites->count) {
41 int i;
42 for(i=0; i<favorites->count; i++) {
43 free(favorites->items[i]);
44 }
45 }
46 }
47 }
File src/include/hstr_favorites.h added (mode: 100644) (index 0000000..b60c9d9)
1 /*
2 ============================================================================
3 Name : hstr_favorites.h
4 Author : martin.dvorak@midforger.com
5 Copyright : Apache 2.0
6 Description : Favorite commands.
7 ============================================================================
8 */
9
10 #ifndef _HSTR_FAVORITES_H_
11 #define _HSTR_FAVORITES_H_
12
13 #include <stdlib.h>
14
15 #define HH_RC_FILE ".hhrc"
16
17 typedef struct {
18 char **items;
19 unsigned count;
20 } FavoriteItems;
21
22 FavoriteItems *favorites_init();
23 FavoriteItems *favorites_load();
24 void favorites_add();
25 void favorites_save();
26 void favorites_close();
27
28 #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