Ignore:
Timestamp:
Nov 24, 2016, 1:14:11 PM (9 years ago)
Author:
Silvan Scherrer
Message:

Samba Server: update vendor to version 4.4.3

File:
1 edited

Legend:

Unmodified
Added
Removed
  • vendor/current/examples/libsmbclient/testbrowse2.c

    r414 r988  
    66#include <stdio.h>
    77#include <stdlib.h>
    8 #include <malloc.h>
    98#include <string.h>
    109#include <libsmbclient.h>
    1110
    1211int     debuglevel      = 0;
    13 char    *workgroup      = "NT";
    14 char    *username       = "guest";
    15 char    *password       = "";
     12const char      *workgroup      = "NT";
     13const char      *username       = "guest";
     14const char      *password       = "";
    1615
    1716typedef struct smbitem smbitem;
     
    2423};
    2524
    26 int smbitem_cmp(smbitem *elem1, smbitem *elem2){
    27     return strcmp(elem1->name, elem2->name);
    28 }
    29 
    30 int smbitem_list_count(smbitem *list){
    31     int count = 0;
    32    
    33     while(list != NULL){
    34         list = list->next;
    35         count++;
    36     }
    37     return count;
    38 }
    39 
    40 void smbitem_list_delete(smbitem *list){
    41     smbitem     *elem;
    42    
    43     while(list != NULL){
    44         elem = list;
    45         list = list->next;
    46         free(elem);
    47     }
    48 }
    49 
    50 smbitem* smbitem_list_sort(smbitem *list){
    51     smbitem     *item, **array;
    52     int         count, i;
    53 
    54     if ((count = smbitem_list_count(list)) == 0) return NULL;
    55     if ((array = malloc(count * sizeof(smbitem*))) == NULL){
    56         smbitem_list_delete(list);
    57         return NULL;
    58     }
    59    
    60     for(i = 0; i < count; i++){
    61         array[i] = list;
    62         list = list->next;
    63     }   
    64     qsort(array, count, sizeof(smbitem*), (qsort_cmp)smbitem_cmp);
    65    
    66     for(i = 0; i < count - 1; i++) array[i]->next = array[i + 1];
    67     array[count - 1]->next = NULL;
    68    
    69     list = array[0];
    70     free(array);
    71     return list;
    72 }
    73 
    74 void smbc_auth_fn(
     25static void smbc_auth_fn(
    7526                const char      *server,
    7627                const char      *share,
     
    8940}
    9041
    91 SMBCCTX* create_smbctx(){
     42static SMBCCTX* create_smbctx(void){
    9243    SMBCCTX     *ctx;
    9344
     
    10556}
    10657
    107 void delete_smbctx(SMBCCTX* ctx){
     58static void delete_smbctx(SMBCCTX* ctx){
    10859    smbc_getFunctionPurgeCachedServers(ctx)(ctx);
    10960    smbc_free_context(ctx, 1);
    11061}
    11162
    112 smbitem* get_smbitem_list(SMBCCTX *ctx, char *smb_path){
     63static smbitem* get_smbitem_list(SMBCCTX *ctx, char *smb_path){
    11364    SMBCFILE            *fd;
    11465    struct smbc_dirent  *dirent;
     
    13586}
    13687
    137 void print_smb_path(char *group, char *path){
     88static void print_smb_path(const char *group, const char *path){
    13889    if ((strlen(group) == 0) && (strlen(path) == 0)) printf("/\n");
    13990    else if (strlen(path) == 0) printf("/%s\n", group);
     
    14495}
    14596
    146 void recurse(SMBCCTX *ctx, char *smb_group, char *smb_path, int maxlen){
     97static void recurse(SMBCCTX *ctx, const char *smb_group, char *smb_path, int maxlen){
    14798    int         len;
    14899    smbitem     *list, *item;
Note: See TracChangeset for help on using the changeset viewer.