summaryrefslogtreecommitdiff
path: root/group.c
diff options
context:
space:
mode:
authorlouie <lshprung@yahoo.com>2020-08-02 19:26:52 -0700
committerlouie <lshprung@yahoo.com>2020-08-02 19:26:52 -0700
commitae45bbeb76120c71e034459e550a52123cea9f0a (patch)
treef76160266ecb8fb3251245ab696d9e9d626ddc3f /group.c
parentb8881cc837238c238b78436d9b156e206feea71e (diff)
Set sort on by default, simplified entry_add
Diffstat (limited to 'group.c')
-rw-r--r--group.c36
1 files changed, 14 insertions, 22 deletions
diff --git a/group.c b/group.c
index a9253c0..6b293a6 100644
--- a/group.c
+++ b/group.c
@@ -6,7 +6,6 @@
#include <unistd.h>
#include "entry.h"
#include "group.h"
-#include "read_cfg.h"
#define BUF_LEN 1024
typedef struct group{
@@ -104,29 +103,22 @@ void group_add(char *gname, ENTRY *addme){
//add the entry to the list of entries in the group
if(addme != NULL){
- if(get_sort()){
- i = entry_add_sorted(gp->head, gp->tail, addme);
- switch(i){
- case 1:
- gp->head = addme;
- break;
-
- case 2:
- gp->tail = addme;
- break;
-
- case 3:
- gp->head = addme;
- gp->tail = addme;
- break;
+ i = entry_add(gp->head, gp->tail, addme);
+ switch(i){
+ case 1:
+ gp->head = addme;
+ break;
- }
- }
+ case 2:
+ gp->tail = addme;
+ break;
- else{
- gp->tail = entry_add_last(gp->tail, addme);
- if(gp->head == NULL) gp->head = gp->tail; //first element of the new list
- }
+ case 3:
+ gp->head = addme;
+ gp->tail = addme;
+ break;
+
+ }
gp->entry_count++;
total_count++;