diff options
author | Jan Lipovsky <janlipovsky@gmail.com> | 2010-04-23 18:33:04 +0200 |
---|---|---|
committer | Jan Lipovsky <janlipovsky@gmail.com> | 2010-04-23 18:33:04 +0200 |
commit | a43a36e44cbda8545576f661d4bb8d2f74e0ba13 (patch) | |
tree | fe595d05ca26d0af2d8bcf4944292f4ae8c3e6b9 /sfshare-daemon | |
parent | 6c262474707c3a63e0395d424e3758a3043ac99b (diff) | |
download | sfshare-a43a36e44cbda8545576f661d4bb8d2f74e0ba13.tar.gz sfshare-a43a36e44cbda8545576f661d4bb8d2f74e0ba13.tar.xz sfshare-a43a36e44cbda8545576f661d4bb8d2f74e0ba13.zip |
Code cleanup
Diffstat (limited to 'sfshare-daemon')
-rw-r--r-- | sfshare-daemon/src/Makefile | 2 | ||||
-rw-r--r-- | sfshare-daemon/src/dbus_service.c | 57 | ||||
-rw-r--r-- | sfshare-daemon/src/dbus_service.h | 19 | ||||
-rw-r--r-- | sfshare-daemon/src/samba_share.c | 152 | ||||
-rw-r--r-- | sfshare-daemon/src/samba_share.h | 21 | ||||
-rw-r--r-- | sfshare-daemon/src/sfshare_errors.h | 23 | ||||
-rw-r--r-- | sfshare-daemon/src/sfshared.c | 20 |
7 files changed, 204 insertions, 90 deletions
diff --git a/sfshare-daemon/src/Makefile b/sfshare-daemon/src/Makefile index 3499b8c..b703f87 100644 --- a/sfshare-daemon/src/Makefile +++ b/sfshare-daemon/src/Makefile @@ -1,7 +1,7 @@ # TEMPORARY MAKEFILE CXX=gcc -CXXFLAGS=-std=c99 -Wall `pkg-config --cflags --libs gtk+-2.0 dbus-glib-1 polkit-gtk-1` +CXXFLAGS=-Wall `pkg-config --cflags --libs gtk+-2.0 dbus-glib-1 polkit-gtk-1` # objektove soubory diff --git a/sfshare-daemon/src/dbus_service.c b/sfshare-daemon/src/dbus_service.c index e65aded..da0cabc 100644 --- a/sfshare-daemon/src/dbus_service.c +++ b/sfshare-daemon/src/dbus_service.c @@ -1,3 +1,20 @@ +/* + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + */ + #include <dbus/dbus-glib.h> #include <dbus/dbus-glib-lowlevel.h> #include <glib.h> @@ -64,7 +81,7 @@ gboolean daemon_delete_share (DaemonObject *obj,const gchar *path, DBusGMethodIn #include "dbus_service_glue.h" gchar * -get_error_msg (Error err) +get_error_msg (Error_sfshare err) { gchar *errmsg; @@ -164,7 +181,7 @@ daemon_data_new ( DBusGMethodInvocation *context, AuthorizedCallback auth_cb, co ret->in = g_new0 (gchar *, 6); - int i = 0; + gint i = 0; while(in[i] != NULL) { @@ -179,7 +196,7 @@ daemon_data_new ( DBusGMethodInvocation *context, AuthorizedCallback auth_cb, co void daemon_data_free (DaemonData * data) { - int i; + gint i; i = 0; while (data->in[i] != NULL) @@ -258,7 +275,7 @@ daemon_get_share_status (DaemonObject *obj, const gchar *path, gchar ***result, { puts("daemon_get_share_status"); - Error err; + Error_sfshare err; err = smb_get_share_status(path, result); @@ -271,11 +288,13 @@ daemon_get_share_status (DaemonObject *obj, const gchar *path, gchar ***result, return TRUE; } - +/* +* Authorized call of smb_set_share - write or change share section +*/ void setup_share_authorized (gpointer data) { - Error err; + Error_sfshare err; DaemonData *dd = data; err = smb_set_share (dd->in); @@ -293,7 +312,9 @@ setup_share_authorized (gpointer data) - +/* +* Dbus setup share - polkit authorization check +*/ gboolean daemon_setup_share (DaemonObject *obj,const gchar **parameters, DBusGMethodInvocation *context) { @@ -316,10 +337,14 @@ daemon_setup_share (DaemonObject *obj,const gchar **parameters, DBusGMethodInvoc } + +/* +* Authorized call of smb_delete_share - delete share section +*/ void delete_share_authorized (gpointer data) { - Error err; + Error_sfshare err; DaemonData *dd = data; err = smb_delete_share(dd->in); @@ -336,7 +361,9 @@ delete_share_authorized (gpointer data) } - +/* +* Dbus delete share - polkit authorization check +*/ gboolean daemon_delete_share (DaemonObject *obj, const gchar *path, DBusGMethodInvocation *context) { @@ -363,7 +390,9 @@ daemon_delete_share (DaemonObject *obj, const gchar *path, DBusGMethodInvocation } - +/* +* Start of sfshare deamon +*/ int dbus_sfshare_start () { @@ -380,7 +409,11 @@ dbus_sfshare_start () bus = dbus_g_bus_get (DBUS_BUS_SYSTEM, &error); if (!bus) + { g_warning ("Couldn't connect to system bus : %s", error->message); + g_error_free (error); + return -1; + } /* PolKit */ @@ -396,6 +429,7 @@ dbus_sfshare_start () G_TYPE_INVALID)) { g_warning("Failed to acquire org.fedoraproject.SimpleFileShare : %s", error->message); + g_error_free (error); return -1; } @@ -408,5 +442,8 @@ dbus_sfshare_start () g_main_loop_run (mainloop); + g_object_unref (obj); + + return 0; } diff --git a/sfshare-daemon/src/dbus_service.h b/sfshare-daemon/src/dbus_service.h index 9f4bd09..58fe627 100644 --- a/sfshare-daemon/src/dbus_service.h +++ b/sfshare-daemon/src/dbus_service.h @@ -1,3 +1,20 @@ +/* + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + */ + #ifndef DBUS_SERVICE_H #define DBUS_SERVICE_H @@ -16,7 +33,7 @@ typedef struct } DaemonData; - +/* Daemon start */ int dbus_sfshare_start (); GQuark get_error_quark (void); diff --git a/sfshare-daemon/src/samba_share.c b/sfshare-daemon/src/samba_share.c index d2ccac5..592f53e 100644 --- a/sfshare-daemon/src/samba_share.c +++ b/sfshare-daemon/src/samba_share.c @@ -1,5 +1,21 @@ -#include <string.h> /* strlen, strstr */ +/* + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + */ +#include <string.h> /* strlen, strstr */ #include <stdlib.h> /* system() call */ #include <glib.h> @@ -8,6 +24,7 @@ #include "samba_share.h" #include "sfshare_errors.h" +/* Define */ #define SECTIONS_COUNT 3 /* Count of special sections in smb.conf */ #define KEYWORDS_COUNT 6 /* Count of keywords used for setup share in smb.conf */ @@ -31,7 +48,8 @@ const gchar *smb_special_section [SECTIONS_COUNT] = {"global", "homes", "printer /* Send SIGHUP to smb and nmb */ -void smb_reload_service () +void +smb_reload_service () { system("killall -HUP smb nmb"); } @@ -39,7 +57,8 @@ void smb_reload_service () /* * Function changes path to smb.conf to path */ -void set_smbconf_path (const gchar *path) +void +set_smbconf_path (const gchar *path) { smb_conf_path = g_strdup(path); } @@ -48,12 +67,13 @@ void set_smbconf_path (const gchar *path) /* * Save string str as new smb.conf */ -gint write_smbconf (const gchar *content) +gint +write_smbconf (const gchar *content) { FILE *smb_file; /* smb.conf - File exist test */ - if(!g_file_test(smb_conf_path, G_FILE_TEST_EXISTS)) + if(!g_file_test (smb_conf_path, G_FILE_TEST_EXISTS)) { g_warning ("Config file \"%s\" does not exist!", smb_conf_path); return ERROR_FILE_NOT_EXIST; @@ -68,7 +88,7 @@ gint write_smbconf (const gchar *content) } /* Write to smb.conf */ - if(fputs(content,smb_file) == EOF) + if(fputs (content,smb_file) == EOF) { g_warning ("Can not write to file \"%s\"!", smb_conf_path); return ERROR_CAN_NOT_WRITE_TO_FILE; @@ -83,7 +103,8 @@ gint write_smbconf (const gchar *content) /* * Function free TSmbConfItem from memmory */ -void smbconf_item_free(TSmbConfItem *item) +void +smbconf_item_free(TSmbConfItem *item) { g_string_free(item->guest_ok, TRUE); g_string_free(item->writable, TRUE); @@ -99,7 +120,8 @@ void smbconf_item_free(TSmbConfItem *item) /* * Function allocs memory for TSmbConfItem */ -TSmbConfItem* smbconf_item_new0 () +TSmbConfItem* +smbconf_item_new0 () { TSmbConfItem *ret; ret = g_malloc(sizeof(struct smb_conf_item)); @@ -118,7 +140,8 @@ TSmbConfItem* smbconf_item_new0 () /* * Function allocs memory for TSmbConfItem */ -TSmbConfItem* smbconf_item_new (const gchar *name, const gchar *path, const gchar *comment, const gchar *read_only, const gchar *guest_ok) +TSmbConfItem* +smbconf_item_new (const gchar *name, const gchar *path, const gchar *comment, const gchar *read_only, const gchar *guest_ok) { TSmbConfItem *ret; ret = g_malloc(sizeof(struct smb_conf_item)); @@ -142,7 +165,8 @@ TSmbConfItem* smbconf_item_new (const gchar *name, const gchar *path, const gcha /* * Function returns new array */ -GPtrArray* shared_items_array_new() +GPtrArray* +shared_items_array_new () { GPtrArray *ret = g_ptr_array_new(); return ret; @@ -152,14 +176,15 @@ GPtrArray* shared_items_array_new() /* * Destroy array */ -void shared_items_array_free(GPtrArray *array) +void +shared_items_array_free (GPtrArray *array) { TSmbConfItem *tmp; - int i; + gint i; for(i = 0; i < array->len; i++) { - tmp = g_ptr_array_index(array,i); - smbconf_item_free(tmp); + tmp = g_ptr_array_index (array,i); + smbconf_item_free (tmp); } g_ptr_array_free(array, TRUE); @@ -187,9 +212,9 @@ gint check_item(TSmbConfItem *item) /* * Parse line of smb.conf and fill competent field of item structure -* return id of keyword found on line (txt) */ -void ParseShareItem(gchar *txt, TSmbConfItem *item) +void +ParseShareItem(gchar *txt, TSmbConfItem *item) { gchar *lower = g_ascii_strdown(txt, strlen(txt)); gboolean found = FALSE; @@ -303,7 +328,8 @@ void ParseShareItem(gchar *txt, TSmbConfItem *item) /* * Funciton loads all share section to array */ -gint load_smb_conf (GPtrArray *shared_items) +gint +load_smb_conf (GPtrArray *shared_items) { FILE *smb_file; /* Samba config file */ @@ -313,7 +339,7 @@ gint load_smb_conf (GPtrArray *shared_items) gint arr_index = shared_items->len - 1; /* Count of items in shared_items array - 1; */ /* smb.conf - File exist test */ - if(!g_file_test(smb_conf_path, G_FILE_TEST_EXISTS)) + if (!g_file_test(smb_conf_path, G_FILE_TEST_EXISTS)) { g_warning ("Config file \"%s\" not exist!", smb_conf_path); return ERROR_FILE_NOT_EXIST; @@ -321,7 +347,7 @@ gint load_smb_conf (GPtrArray *shared_items) /* Try open smb.conf */ smb_file = fopen(smb_conf_path, "r"); - if(smb_file == NULL) + if (smb_file == NULL) { g_warning ("Can not open file \"%s\"!", smb_conf_path); return ERROR_CAN_NOT_OPEN_FILE; @@ -331,7 +357,7 @@ gint load_smb_conf (GPtrArray *shared_items) line = g_strnfill(BUFSIZ, '\0'); /* Parse smb.conf file and load shared folders setings */ - while(fgets(line, BUFSIZ, smb_file)) + while (fgets(line, BUFSIZ, smb_file)) { /* Remove white space */ g_strstrip(line); @@ -345,8 +371,8 @@ gint load_smb_conf (GPtrArray *shared_items) skip = FALSE; /* Test special sections */ - int i ; - for(i = 0; i < SECTIONS_COUNT; i++) + gint i ; + for (i = 0; i < SECTIONS_COUNT; i++) { if(strstr(line,smb_special_section[i]) != NULL) { @@ -395,12 +421,13 @@ gint load_smb_conf (GPtrArray *shared_items) * Returns share imte if directory [path] is shared, * if not return NULL; */ -TSmbConfItem *is_shared_item(GPtrArray *shared_items, const gchar *path) +TSmbConfItem +*is_shared_item(GPtrArray *shared_items, const gchar *path) { TSmbConfItem *ret = NULL; TSmbConfItem *tmp; - int i; + gint i; for(i = 0; i < shared_items->len; i++) { tmp = g_ptr_array_index(shared_items,i); @@ -422,7 +449,7 @@ gboolean share_name_exist (GPtrArray *shared_items, const gchar *sharename) { TSmbConfItem *tmp; - int i; + gint i; for(i = 0; i < shared_items->len; i++) { tmp = g_ptr_array_index(shared_items,i); @@ -516,26 +543,22 @@ write_share(GPtrArray *shared_items, TSmbConfItem *share) if(!writed_change[COMMENT_ID] && (share->comment->len > 0)) { - g_sprintf(tmp,"\tcomment = %s\n",share->comment->str); - g_string_append(smb_conf_new,tmp); + g_string_append_printf(smb_conf_new, "\tcomment = %s\n",share->comment->str); } if(!writed_change[READ_ONLY_ID] && (share->read_only->len > 0)) { - g_sprintf(tmp,"\tcomment = %s\n",share->read_only->str); - g_string_append(smb_conf_new,tmp); + g_string_append_printf(smb_conf_new, "\tread only = %s\n",share->read_only->str); } if(!writed_change[WRTITABLE_ID] && (share->writable->len > 0)) { - g_sprintf(tmp,"\tcomment = %s\n",share->writable->str); - g_string_append(smb_conf_new,tmp); + g_string_append_printf(smb_conf_new, "\twritable = %s\n",share->writable->str); } if(!writed_change[GUEST_OK_ID] && (share->guest_ok->len > 0)) { - g_sprintf(tmp,"\tcomment = %s\n",share->guest_ok->str); - g_string_append(smb_conf_new,tmp); + g_string_append_printf(smb_conf_new, "\tguest ok = %s\n",share->guest_ok->str); } } @@ -576,9 +599,7 @@ write_share(GPtrArray *shared_items, TSmbConfItem *share) /* [share name] */ case SHARE_NAME_ID: { - g_sprintf(tmp,"[%s]\n",share->name->str); - g_string_append(smb_conf_new,tmp); - + g_string_append_printf(smb_conf_new, "[%s]\n",share->name->str); writed_change[SHARE_NAME_ID] = TRUE; } break; @@ -599,8 +620,8 @@ write_share(GPtrArray *shared_items, TSmbConfItem *share) { if(share->comment->len > 0) { - g_sprintf(tmp,"\tcomment = %s\n",share->comment->str); - g_string_append(smb_conf_new,tmp); + + g_string_append_printf(smb_conf_new, "\tcomment = %s\n",share->comment->str); writed_change[COMMENT_ID] = TRUE; } } @@ -613,8 +634,7 @@ write_share(GPtrArray *shared_items, TSmbConfItem *share) if(share->read_only->len > 0) { - g_sprintf(tmp,"\tread only = %s\n",share->read_only->str); - g_string_append(smb_conf_new,tmp); + g_string_append_printf(smb_conf_new, "\tread only = %s\n",share->read_only->str); writed_change[READ_ONLY_ID] = TRUE; } } @@ -626,8 +646,7 @@ write_share(GPtrArray *shared_items, TSmbConfItem *share) { if(share->writable->len > 0) { - g_sprintf(tmp,"\twritable = %s\n",share->writable->str); - g_string_append(smb_conf_new,tmp); + g_string_append_printf(smb_conf_new, "\twritable = %s\n",share->writable->str); writed_change[WRTITABLE_ID] = TRUE; } } @@ -639,8 +658,7 @@ write_share(GPtrArray *shared_items, TSmbConfItem *share) { if(share->guest_ok->len > 0) { - g_sprintf(tmp,"\tguest ok = %s\n",share->guest_ok->str); - g_string_append(smb_conf_new,tmp); + g_string_append_printf(smb_conf_new, "\tguest ok = %s\n",share->guest_ok->str); writed_change[GUEST_OK_ID] = TRUE; } } @@ -656,68 +674,60 @@ write_share(GPtrArray *shared_items, TSmbConfItem *share) g_free(orig); } - if(!check_writed_changes && change) - { + if(!check_writed_changes && change) + { /* Section name and path are allways writed */ if(!writed_change[COMMENT_ID] && (share->comment->len > 0)) { - g_sprintf(tmp,"\tcomment = %s\n",share->comment->str); - g_string_append(smb_conf_new,tmp); + g_string_append_printf(smb_conf_new, "\tcomment = %s\n",share->comment->str); } if(!writed_change[READ_ONLY_ID] && (share->read_only->len > 0)) { - g_sprintf(tmp,"\tcomment = %s\n",share->read_only->str); - g_string_append(smb_conf_new,tmp); + g_string_append_printf(smb_conf_new, "\tread only = %s\n",share->read_only->str); } if(!writed_change[WRTITABLE_ID] && (share->writable->len > 0)) { - g_sprintf(tmp,"\tcomment = %s\n",share->writable->str); - g_string_append(smb_conf_new,tmp); + g_string_append_printf(smb_conf_new, "\twritable = %s\n",share->writable->str); } if(!writed_change[GUEST_OK_ID] && (share->guest_ok->len > 0)) { - g_sprintf(tmp,"\tcomment = %s\n",share->guest_ok->str); - g_string_append(smb_conf_new,tmp); + g_string_append_printf(smb_conf_new, "\tguest ok = %s\n",share->guest_ok->str); } - } + } /* Create new share */ if(new_share) { - g_sprintf(tmp,"\n[%s]\n",share->name->str); - g_string_append(smb_conf_new,tmp); - g_sprintf(tmp,"\tpath = %s\n",share->path->str); - g_string_append(smb_conf_new,tmp); + g_string_append_printf(smb_conf_new, "\n[%s]\n",share->name->str); + + g_string_append_printf(smb_conf_new, "\tpath = %s\n",share->path->str); + if(share->comment->len > 0) { - g_sprintf(tmp,"\tcomment = %s\n",share->comment->str); - g_string_append(smb_conf_new,tmp); + g_string_append_printf(smb_conf_new, "\tcomment = %s\n",share->comment->str); } if(share->read_only->len > 0) { - g_sprintf(tmp,"\tread only = %s\n",share->read_only->str); - g_string_append(smb_conf_new,tmp); + g_string_append_printf(smb_conf_new, "\tread only = %s\n",share->read_only->str); } if(share->writable->len > 0) { - g_sprintf(tmp,"\twritable = %s\n",share->writable->str); - g_string_append(smb_conf_new,tmp); + g_string_append_printf(smb_conf_new, "\twritable = %s\n",share->writable->str); } if(share->guest_ok->len > 0) { - g_sprintf(tmp,"\tguest ok = %s\n",share->guest_ok->str); - g_string_append(smb_conf_new,tmp); + g_string_append_printf(smb_conf_new, "\tguest ok = %s\n",share->guest_ok->str); } } @@ -852,7 +862,7 @@ smb_get_share_status (const gchar *path, gchar ***result) gboolean found = FALSE; GPtrArray *shared_items = shared_items_array_new(); - Error err; + Error_sfshare err; err = load_smb_conf (shared_items); @@ -865,7 +875,7 @@ smb_get_share_status (const gchar *path, gchar ***result) TSmbConfItem *test; - int i; + gint i; for (i = 0; i < shared_items->len; i++) { test = g_ptr_array_index(shared_items, i); @@ -892,7 +902,7 @@ smb_get_share_status (const gchar *path, gchar ***result) * Write share to smb.conf */ gint -smb_set_share (const gchar **parameters) +smb_set_share (gchar **parameters) { gint ret = OK; /* Create new items array */ @@ -921,7 +931,7 @@ smb_set_share (const gchar **parameters) * Delete share to smb.conf */ gint -smb_delete_share (const gchar **path) +smb_delete_share (gchar **path) { gint ret = OK; /* Create new items array */ diff --git a/sfshare-daemon/src/samba_share.h b/sfshare-daemon/src/samba_share.h index 61a3d5e..f967126 100644 --- a/sfshare-daemon/src/samba_share.h +++ b/sfshare-daemon/src/samba_share.h @@ -1,3 +1,20 @@ +/* + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + */ + #ifndef SAMBA_SHARE_H #define SAMBA_SHARE_H @@ -26,8 +43,8 @@ gint write_share (GPtrArray *shared_items, TSmbConfItem *share); gboolean smb_get_share_status (const gchar *path, gchar ***result); -gint smb_set_share (const gchar **parameters); -gint smb_delete_share (const gchar **path); +gint smb_set_share (gchar **parameters); +gint smb_delete_share (gchar **path); void item_to_strv (TSmbConfItem *item, gchar ***ret); diff --git a/sfshare-daemon/src/sfshare_errors.h b/sfshare-daemon/src/sfshare_errors.h index 2656717..4fe9fc7 100644 --- a/sfshare-daemon/src/sfshare_errors.h +++ b/sfshare-daemon/src/sfshare_errors.h @@ -1,3 +1,20 @@ +/* + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + */ + #ifndef SFSHARE_ERRORS_H #define SFSHARE_ERRORS_H @@ -20,10 +37,10 @@ typedef enum ERROR_SHARE_NAME_EXIST, NUM_ERRORS -} Error; +} Error_sfshare; -/* Definition inn file: dbus_service.c */ -gchar *get_error_msg (Error err); +/* Definition in file: dbus_service.c */ +gchar *get_error_msg (Error_sfshare err); #endif diff --git a/sfshare-daemon/src/sfshared.c b/sfshare-daemon/src/sfshared.c index 4696008..1c81701 100644 --- a/sfshare-daemon/src/sfshared.c +++ b/sfshare-daemon/src/sfshared.c @@ -1,3 +1,20 @@ +/* + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + */ + #include <stdio.h> #include <stdlib.h> #include <glib.h> @@ -9,6 +26,5 @@ int main() { - dbus_sfshare_start(); - return 0; + return dbus_sfshare_start(); } |