Add a function to get current zone name 30/68430/2
authorSungbae Yoo <sungbae.yoo@samsung.com>
Wed, 4 May 2016 06:56:04 +0000 (15:56 +0900)
committerSungbae Yoo <sungbae.yoo@samsung.com>
Mon, 9 May 2016 02:52:32 +0000 (19:52 -0700)
Change-Id: Ibe6136e2042bc006abe87536c867cbde9b1d1e14
Signed-off-by: Sungbae Yoo <sungbae.yoo@samsung.com>
include/dpm-toolkit.h
src/dpm-toolkit.c

index e3e0482..e6fd8fe 100755 (executable)
@@ -74,5 +74,6 @@ void display_result_popup(const char* title, const char* popup_message);
 void display_input_popup(const char* title, dpm_toolkit_entity_t* selected_policy);
 void display_radio_popup(const char* title, dpm_toolkit_entity_t* selected_policy, char radio_text[][MAX_RADIO_TEXT_LEN], int array_row);
 
+char* get_now_zone(void);
 
 #endif /* __DPM_TOOLKIT_H__ */
index 67f0ea1..6601d87 100755 (executable)
@@ -139,6 +139,26 @@ void dpm_parser_free_policy_list(void)
 
 }
 
+char* get_now_zone(void) {
+    struct passwd pwd, *result;
+    int bufsize;
+
+    bufsize = sysconf(_SC_GETPW_R_SIZE_MAX);
+    if (bufsize == -1)
+        bufsize = 16384;
+
+    char *buf = malloc(bufsize * sizeof(char));
+
+    getpwuid_r(getuid(), &pwd, buf, bufsize, &result);
+    if (result == NULL) {
+        free(buf);
+        return NULL;
+    }
+    free(buf);
+    return strdup(result->pw_name);
+
+}
+
 static void win_delete_request_cb(void* data, Evas_Object* obj, void* event_info)
 {
        /* To make your application go to background,