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 a8337ad952515dedd560d0cd15895ba3321a9148

Fake in-memory favorites work without adding and load/save.
Author: Martin Dvorak
Author date (UTC): 2014-03-23 02:50
Committer name: Martin Dvorak
Committer date (UTC): 2014-03-23 02:50
Parent(s): 683289f15ce687817a1881d552127453ec585a1d
Signing key:
Tree: 6196274315f7330d2febda3d82d593a045b0ac77
File Lines added Lines deleted
src/hstr_favorites.c 16 8
File src/hstr_favorites.c changed (mode: 100644) (index dc423af..1dbfd81)
7 7 ============================================================================ ============================================================================
8 8 */ */
9 9
10 #include <string.h>
10 11 #include "include/hstr_favorites.h" #include "include/hstr_favorites.h"
11 12
12 13 #define FAVORITE_SEGMENT_SIZE 10 #define FAVORITE_SEGMENT_SIZE 10
13 14
14 void favorites_init(FavoriteItems *favorites) {
15 void favorites_init(FavoriteItems *favorites)
16 {
15 17 favorites->items=NULL; favorites->items=NULL;
16 18 favorites->count=0; favorites->count=0;
17 19 } }
18 20
19 void favorites_load(FavoriteItems *favorites) {
21 void favorites_load(FavoriteItems *favorites)
22 {
20 23 // TODO fake initialization instead of .hhrc load // TODO fake initialization instead of .hhrc load
21 favorites->count=3;
24 favorites->count=2;
22 25 favorites->items=malloc(sizeof(char *)*favorites->count); favorites->items=malloc(sizeof(char *)*favorites->count);
23 favorites->items[0]="a";
24 favorites->items[1]="b";
25 favorites->items[2]="c";
26 favorites->items[0]=malloc(2);
27 strcpy(favorites->items[0],"a");
28 favorites->items[1]=malloc(2);
29 strcpy(favorites->items[1],"b");
26 30 } }
27 31
28 void favorites_add(FavoriteItems *favorites, char *newFavorite) {
32 void favorites_add(FavoriteItems *favorites, char *newFavorite)
33 {
29 34 favorites->items=realloc(favorites->items, sizeof(char *)*favorites->count); favorites->items=realloc(favorites->items, sizeof(char *)*favorites->count);
30 35 favorites->items[favorites->count++]=newFavorite; favorites->items[favorites->count++]=newFavorite;
36
37 favorites_save(favorites);
31 38 } }
32 39
33 void favorites_save(FavoriteItems *favorites) {
40 void favorites_save(FavoriteItems *favorites)
41 {
34 42 } }
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