Merge lp:~bennabiy/ltsp/ldm-cleanup into lp:~ltsp-upstream/ltsp/ldm-trunk

Proposed by ben-Nabiy Derush
Status: Merged
Merge reported by: Vagrant Cascadian
Merged at revision: not available
Proposed branch: lp:~bennabiy/ltsp/ldm-cleanup
Merge into: lp:~ltsp-upstream/ltsp/ldm-trunk
Diff against target: 4364 lines (+1180/-914)
24 files modified
README-DEVELOPMENT-POLICY (+3/-0)
gtkgreet/greeter.c (+195/-170)
gtkgreet/langwin.c (+5/-4)
gtkgreet/prefs.c (+43/-26)
gtkgreet/prefwin.c (+13/-13)
gtkgreet/sesswin.c (+4/-2)
misc/ldm-dialog.c (+73/-55)
src/ldm.c (+40/-29)
src/ldmgreetercomm.c (+41/-23)
src/ldminfo.c (+61/-31)
src/ldmplugin.c (+88/-57)
src/ldmutils.c (+59/-44)
src/logging.c (+20/-11)
src/plugin.c (+58/-29)
src/plugins/rdesktop/rdesktop.c (+60/-43)
src/plugins/ssh/ssh.c (+86/-55)
wwm/client.c (+60/-55)
wwm/events.c (+27/-26)
wwm/main.c (+51/-51)
wwm/mapfunctions.c (+101/-101)
wwm/misc.c (+15/-15)
wwm/new.c (+15/-15)
wwm/screen.c (+54/-51)
wwm/sendkey.c (+8/-8)
To merge this branch: bzr merge lp:~bennabiy/ltsp/ldm-cleanup
Reviewer Review Type Date Requested Status
Jakob Unterwurzacher (community) Disapprove
Vagrant Cascadian Pending
Review via email: mp+228474@code.launchpad.net

Description of the change

Ran indent -kr -i4 -nut -c50 -psl on all .c files in branch.

Pure code cleanup.

To post a comment you must log in.
lp:~bennabiy/ltsp/ldm-cleanup updated
1551. By ben-Nabiy Derush

Revised README-DEVELOPMENT-POLICY to clarify whitespace changes in existing
code needing a separate merge request.

Revision history for this message
Jakob Unterwurzacher (jakobunt) wrote :

Looks like this has already been merged for the most part. Still I'd like to add: Please don't do that (again). It breaks everybody's patches against ldm and breaks bzr blame.

review: Disapprove
Revision history for this message
Vagrant Cascadian (vagrantc) wrote :

On 2014-09-22 16:36:13 -0500, Jakob Unterwurzacher wrote:
> Looks like this has already been merged for the most part. Still I'd
> like to add: Please don't do that (again). It breaks everybody's
> patches against ldm and breaks bzr blame.

I have to disagree.

As upstream, patches that bring code consistant with our own style
guidelines are appreciated and welcomed.

We should be more strict about accepting and submitting patches that
don't follow them, which was the real problem, and I take my share of
the blame for that.

live well,
  vagrant

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'README-DEVELOPMENT-POLICY'
2--- README-DEVELOPMENT-POLICY 2008-07-25 22:40:00 +0000
3+++ README-DEVELOPMENT-POLICY 2014-07-28 15:29:30 +0000
4@@ -21,5 +21,8 @@
5 - 4 character tab width, and spaces instead of tabs
6 - Align inline comments on column 50
7 - A newline after function definitions
8+ - If you change whitespace or formatting of existing code, please do this in a
9+ separate merge proposal. This includes running the above indent command on
10+ existing code.
11 - All if() else blocks will have {}'s, even if only 1 line long, or Ollie will break your thumbs.
12 - Comments will be /* */ or Scott will break the rest of your fingers.
13
14=== modified file 'gtkgreet/greeter.c'
15--- gtkgreet/greeter.c 2012-08-21 14:33:07 +0000
16+++ gtkgreet/greeter.c 2014-07-28 15:29:30 +0000
17@@ -79,67 +79,67 @@
18
19 GList *host_list = NULL;
20 GIOChannel *g_stdout; /* stdout io channel */
21-gchar * ldm_theme_dir;
22+gchar *ldm_theme_dir;
23
24 int allowguest;
25 gint login_timeout;
26 gint timeout_left;
27
28 gchar *
29-ldm_theme_file(char * file)
30+ldm_theme_file(char *file)
31 {
32- gchar * filename;
33- gchar * filename_default;
34+ gchar *filename;
35+ gchar *filename_default;
36 filename = g_strconcat("/", ldm_theme_dir, "/", file, NULL);
37- filename_default = g_strconcat("/", LDM_THEME_DIR, "ltsp", "/", file, NULL);
38- if (access(g_strconcat(filename, ".png", NULL), F_OK ) != -1)
39- {
40+ filename_default =
41+ g_strconcat("/", LDM_THEME_DIR, "ltsp", "/", file, NULL);
42+ if (access(g_strconcat(filename, ".png", NULL), F_OK) != -1) {
43 filename = g_strconcat(filename, ".png", NULL);
44- }
45- else if (access(g_strconcat(filename, ".jpg", NULL), F_OK ) != -1)
46- {
47+ } else if (access(g_strconcat(filename, ".jpg", NULL), F_OK) != -1) {
48 filename = g_strconcat(filename, ".jpg", NULL);
49- }
50- else if (access(g_strconcat(filename_default, ".png", NULL), F_OK ) != -1)
51- {
52+ } else if (access(g_strconcat(filename_default, ".png", NULL), F_OK) !=
53+ -1) {
54 filename = g_strconcat(filename_default, ".png", NULL);
55- }
56- else if (access(g_strconcat(filename_default, ".jpg", NULL), F_OK ) != -1)
57- {
58+ } else if (access(g_strconcat(filename_default, ".jpg", NULL), F_OK) !=
59+ -1) {
60 filename = g_strconcat(filename_default, ".jpg", NULL);
61 }
62 return filename;
63 }
64-GdkPixmap* root_bg = 0;
65-void load_root_background(const gchar* filename, gboolean scale, gboolean reload) {
66- if (root_bg != 0){
67+
68+GdkPixmap *root_bg = 0;
69+void
70+load_root_background(const gchar * filename, gboolean scale,
71+ gboolean reload)
72+{
73+ if (root_bg != 0) {
74 if (reload) {
75- g_object_unref(G_OBJECT (root_bg));
76+ g_object_unref(G_OBJECT(root_bg));
77 root_bg = 0;
78 } else {
79 return;
80 }
81 }
82
83- GtkWidget* image = gtk_image_new_from_file(filename);
84- g_object_ref(G_OBJECT (image));
85- GdkPixbuf* pixbuf = gtk_image_get_pixbuf(GTK_IMAGE (image));
86- double img_width = (double)gdk_pixbuf_get_width(pixbuf);
87- double img_height = (double)gdk_pixbuf_get_height(pixbuf);
88+ GtkWidget *image = gtk_image_new_from_file(filename);
89+ g_object_ref(G_OBJECT(image));
90+ GdkPixbuf *pixbuf = gtk_image_get_pixbuf(GTK_IMAGE(image));
91+ double img_width = (double) gdk_pixbuf_get_width(pixbuf);
92+ double img_height = (double) gdk_pixbuf_get_height(pixbuf);
93
94- GdkWindow* root = gdk_get_default_root_window();
95+ GdkWindow *root = gdk_get_default_root_window();
96 gint width, height;
97- gdk_drawable_get_size(GDK_DRAWABLE (root), &width, &height);
98+ gdk_drawable_get_size(GDK_DRAWABLE(root), &width, &height);
99
100 // create pixmap
101- gdk_drawable_get_size(GDK_DRAWABLE (root), &width, &height);
102- root_bg = gdk_pixmap_new(GDK_DRAWABLE (root), width, height, -1);
103- g_object_ref(G_OBJECT (root_bg));
104+ gdk_drawable_get_size(GDK_DRAWABLE(root), &width, &height);
105+ root_bg = gdk_pixmap_new(GDK_DRAWABLE(root), width, height, -1);
106+ g_object_ref(G_OBJECT(root_bg));
107
108 // paint pixmap onto bg
109- cairo_t* ctx = gdk_cairo_create(GDK_DRAWABLE (root_bg));
110+ cairo_t *ctx = gdk_cairo_create(GDK_DRAWABLE(root_bg));
111 if (scale) {
112- cairo_scale(ctx, width/img_width, height/img_height);
113+ cairo_scale(ctx, width / img_width, height / img_height);
114 }
115 gdk_cairo_set_source_pixbuf(ctx, pixbuf, 0, 0);
116 cairo_paint(ctx);
117@@ -147,46 +147,42 @@
118
119 //g_object_unref(G_OBJECT (bg));
120
121- g_object_unref(G_OBJECT (image));
122+ g_object_unref(G_OBJECT(image));
123 }
124
125 void
126-set_root_background() {
127- GdkWindow* root = gdk_get_default_root_window();
128+set_root_background()
129+{
130+ GdkWindow *root = gdk_get_default_root_window();
131
132
133 // bg needs to be set and painted, so it refreshes now and in the future
134- gdk_window_set_back_pixmap(GDK_WINDOW (root), GDK_PIXMAP (root_bg), 0);
135- gdk_draw_drawable(GDK_DRAWABLE (root),
136- gdk_gc_new(GDK_DRAWABLE (root)),
137- GDK_DRAWABLE (root_bg),
138- 0, 0,
139- 0, 0,
140- -1, -1);
141+ gdk_window_set_back_pixmap(GDK_WINDOW(root), GDK_PIXMAP(root_bg), 0);
142+ gdk_draw_drawable(GDK_DRAWABLE(root),
143+ gdk_gc_new(GDK_DRAWABLE(root)),
144+ GDK_DRAWABLE(root_bg), 0, 0, 0, 0, -1, -1);
145 }
146
147 void
148-draw_background(GtkWidget* widget, gpointer data) {
149- GdkWindow* window;
150+draw_background(GtkWidget * widget, gpointer data)
151+{
152+ GdkWindow *window;
153 gint width, height, x, y;
154
155 window = gtk_widget_get_window(widget);
156 if (window == NULL) {
157 return;
158 }
159- gdk_drawable_get_size(GDK_DRAWABLE (window), &width, &height);
160- gdk_window_get_origin(GDK_WINDOW (window), &x, &y);
161- GdkPixmap* new_bg = gdk_pixmap_new(root_bg, width, height, -1);
162- g_object_ref(G_OBJECT (new_bg));
163- gdk_draw_drawable(GDK_DRAWABLE (new_bg),
164- gdk_gc_new(GDK_DRAWABLE (new_bg)),
165- GDK_DRAWABLE (root_bg),
166- x, y,
167- 0, 0,
168- width, height);
169- gdk_window_set_back_pixmap(GDK_WINDOW (window), new_bg, 0);
170+ gdk_drawable_get_size(GDK_DRAWABLE(window), &width, &height);
171+ gdk_window_get_origin(GDK_WINDOW(window), &x, &y);
172+ GdkPixmap *new_bg = gdk_pixmap_new(root_bg, width, height, -1);
173+ g_object_ref(G_OBJECT(new_bg));
174+ gdk_draw_drawable(GDK_DRAWABLE(new_bg),
175+ gdk_gc_new(GDK_DRAWABLE(new_bg)),
176+ GDK_DRAWABLE(root_bg), x, y, 0, 0, width, height);
177+ gdk_window_set_back_pixmap(GDK_WINDOW(window), new_bg, 0);
178
179- gtk_widget_queue_draw(GTK_WIDGET (widget));
180+ gtk_widget_queue_draw(GTK_WIDGET(widget));
181 }
182
183 static void
184@@ -196,7 +192,7 @@
185 }
186
187 static void
188-spawn_command(GtkWidget * widget, const gchar *command)
189+spawn_command(GtkWidget * widget, const gchar * command)
190 {
191 GError **error = NULL;
192 g_spawn_command_line_async(command, error);
193@@ -215,12 +211,12 @@
194 // use 12 hour clock format if LDM_12HOURCLOCK is set to true
195 if (ldm_getenv_bool("LDM_12HOURCLOCK")) {
196 timestring = g_strdup_printf("<b>%.2d:%.2d</b>",
197- (timePtr->tm_hour % 12) ? (timePtr->tm_hour % 12) : 12,
198- timePtr->tm_min);
199- }
200- else {
201+ (timePtr->tm_hour %
202+ 12) ? (timePtr->tm_hour % 12) : 12,
203+ timePtr->tm_min);
204+ } else {
205 timestring = g_strdup_printf("<b>%.2d:%.2d</b>",
206- timePtr->tm_hour, timePtr->tm_min);
207+ timePtr->tm_hour, timePtr->tm_min);
208 }
209
210 gtk_label_set_markup((GtkLabel *) label, timestring);
211@@ -235,19 +231,22 @@
212 {
213 gchar *string;
214 int entry_length;
215- entry_length = strlen(gtk_entry_get_text((GtkEntry *)entry));
216- if(entry_length == 0 && timeout_enabled) {
217- if (timeout_left > 1){
218+ entry_length = strlen(gtk_entry_get_text((GtkEntry *) entry));
219+ if (entry_length == 0 && timeout_enabled) {
220+ if (timeout_left > 1) {
221 timeout_left--;
222 } else if (timeout_left == 1) {
223- g_io_channel_write_chars(g_stdout, "@GUEST@\n", -1, NULL, NULL);
224+ g_io_channel_write_chars(g_stdout, "@GUEST@\n", -1, NULL,
225+ NULL);
226 g_io_channel_flush(g_stdout, NULL);
227 timeout_left = 0;
228 timeout_enabled = FALSE;
229- } else if (timeout_left == 0){
230+ } else if (timeout_left == 0) {
231 timeout_left = login_timeout;
232 }
233- string = g_strdup_printf(_("Automatic login in %d seconds"), timeout_left);
234+ string =
235+ g_strdup_printf(_("Automatic login in %d seconds"),
236+ timeout_left);
237 gtk_label_set_markup((GtkLabel *) label, string);
238 g_free(string);
239 gtk_widget_show(timeoutbox);
240@@ -274,17 +273,14 @@
241 guchar **data = NULL;
242 gboolean result;
243
244- result=gdk_property_get(
245- gdk_get_default_root_window(),
246- gdk_atom_intern(property,TRUE),
247- GDK_NONE,
248- 0,
249- 512,
250- FALSE,
251- actual_property_type,
252- actual_format,
253- actual_length,
254- data);
255+ result = gdk_property_get(gdk_get_default_root_window(),
256+ gdk_atom_intern(property, TRUE),
257+ GDK_NONE,
258+ 0,
259+ 512,
260+ FALSE,
261+ actual_property_type,
262+ actual_format, actual_length, data);
263 return result;
264 }
265
266@@ -298,7 +294,7 @@
267 g_io_channel_read_line_string(io_input, buf, NULL, NULL);
268 g_strstrip(buf->str);
269
270- log_entry("gtkgreet",7,"Got command: %s",buf->str);
271+ log_entry("gtkgreet", 7, "Got command: %s", buf->str);
272
273 if (!g_ascii_strncasecmp(buf->str, "msg", 3)) {
274 gchar **split_buf;
275@@ -319,7 +315,7 @@
276 g_strfreev(split_buf);
277 } else if (!g_ascii_strncasecmp(buf->str, "userid", 6)) {
278 timeout_enabled = login_timeout > 0;
279- if(timeout_enabled) {
280+ if (timeout_enabled) {
281 gtk_widget_show(timeoutbox);
282 }
283 gtk_widget_show(entry);
284@@ -368,12 +364,12 @@
285 buf->str[buf->len] = '\0';
286
287 // choice;choice 1|choice 2|choice 3
288- gchar** choices = g_strsplit(buf->str+7, "|", -1);
289+ gchar **choices = g_strsplit(buf->str + 7, "|", -1);
290
291 // drop combo box to drop model
292 gtk_list_store_clear(choiceList);
293
294- for (i=0; i<g_strv_length(choices); ++i) {
295+ for (i = 0; i < g_strv_length(choices); ++i) {
296 gtk_list_store_append(GTK_LIST_STORE(choiceList), &iter);
297 gtk_list_store_set(GTK_LIST_STORE(choiceList), &iter, 0,
298 choices[i], -1);
299@@ -391,8 +387,8 @@
300 buf->str[buf->len] = '\0';
301
302 // pref choice;key;title;menu;icon;choice 1|choice 2|choice 3
303- gchar** args = g_strsplit(buf->str, ";", 6);
304- gchar** choices = g_strsplit(args[5], "|", -1);
305+ gchar **args = g_strsplit(buf->str, ";", 6);
306+ gchar **choices = g_strsplit(args[5], "|", -1);
307
308 GreeterPref *pref = greeter_pref_new(g_strdup(args[1]));
309 pref->type = PREF_CHOICE;
310@@ -400,8 +396,9 @@
311 pref->menu = g_strdup(args[3]);
312 pref->icon = g_strdup(args[4]);
313
314- for (i=0; i<g_strv_length(choices); ++i) {
315- pref->choices = g_list_append(pref->choices, g_strdup(choices[i]));
316+ for (i = 0; i < g_strv_length(choices); ++i) {
317+ pref->choices =
318+ g_list_append(pref->choices, g_strdup(choices[i]));
319 }
320
321 g_strfreev(choices);
322@@ -414,12 +411,13 @@
323 buf->len--;
324 buf->str[buf->len] = '\0';
325
326- valstr = g_strdup_printf("%s\n", greeter_pref_get_value(name).str_val);
327+ valstr =
328+ g_strdup_printf("%s\n", greeter_pref_get_value(name).str_val);
329 g_io_channel_write_chars(g_stdout, valstr, -1, NULL, NULL);
330 g_io_channel_flush(g_stdout, NULL);
331 g_free(valstr);
332 } else if (!g_ascii_strncasecmp(buf->str, "allowguest", 10)) {
333- gchar* valstr = buf->str + 11;
334+ gchar *valstr = buf->str + 11;
335 allowguest = g_ascii_strncasecmp(valstr, "false", 2);
336 if (!allowguest)
337 gtk_widget_hide(GTK_WIDGET(GuestButton));
338@@ -454,8 +452,8 @@
339 static void
340 handle_choice(GtkComboBox * combo, GdkWindow * window)
341 {
342- gchar* selection;
343- gchar* entrystr;
344+ gchar *selection;
345+ gchar *entrystr;
346
347 selection = gtk_combo_box_get_active_text(GTK_COMBO_BOX(choiceCombo));
348 entrystr = g_strdup_printf("%s\n", selection);
349@@ -473,19 +471,19 @@
350 g_io_channel_write_chars(g_stdout, entrystr, -1, NULL, NULL);
351 g_io_channel_flush(g_stdout, NULL);
352 g_free(entrystr);
353- if(gtk_entry_get_visibility(GTK_ENTRY(entry)))
354+ if (gtk_entry_get_visibility(GTK_ENTRY(entry)))
355 gtk_entry_set_text(entry, "");
356 }
357
358 static gboolean
359-menu_append_pref(gpointer akey, gpointer avalue, gpointer adata) {
360- char* key = (char*)akey;
361- GreeterPref* pref = (GreeterPref*)avalue;
362- GtkWidget* menu = (GtkWidget*)adata;
363+menu_append_pref(gpointer akey, gpointer avalue, gpointer adata)
364+{
365+ char *key = (char *) akey;
366+ GreeterPref *pref = (GreeterPref *) avalue;
367+ GtkWidget *menu = (GtkWidget *) adata;
368 GtkWidget *pref_item, *prefico;
369
370- pref_item =
371- gtk_image_menu_item_new_with_mnemonic(_(pref->menu));
372+ pref_item = gtk_image_menu_item_new_with_mnemonic(_(pref->menu));
373 prefico = gtk_image_new_from_file(ldm_theme_file(pref->icon));
374 gtk_image_menu_item_set_image((GtkImageMenuItem *) pref_item, prefico);
375
376@@ -510,9 +508,11 @@
377
378 if (getenv("LDM_FORCE_LANGUAGE") == NULL) {
379 lang_item =
380- gtk_image_menu_item_new_with_mnemonic(_("Select _Language ..."));
381+ gtk_image_menu_item_new_with_mnemonic(_
382+ ("Select _Language ..."));
383 langico = gtk_image_new_from_file(ldm_theme_file("language"));
384- gtk_image_menu_item_set_image((GtkImageMenuItem *) lang_item, langico);
385+ gtk_image_menu_item_set_image((GtkImageMenuItem *) lang_item,
386+ langico);
387 g_signal_connect_swapped(G_OBJECT(lang_item), "activate",
388 G_CALLBACK(langwin), window);
389 gtk_menu_shell_append(GTK_MENU_SHELL(menu), lang_item);
390@@ -520,9 +520,11 @@
391
392 if (getenv("LDM_FORCE_SESSION") == NULL) {
393 sess_item =
394- gtk_image_menu_item_new_with_mnemonic(_("Select _Session ..."));
395+ gtk_image_menu_item_new_with_mnemonic(_
396+ ("Select _Session ..."));
397 sessico = gtk_image_new_from_file(ldm_theme_file("session"));
398- gtk_image_menu_item_set_image((GtkImageMenuItem *) sess_item, sessico);
399+ gtk_image_menu_item_set_image((GtkImageMenuItem *) sess_item,
400+ sessico);
401 g_signal_connect_swapped(G_OBJECT(sess_item), "activate",
402 G_CALLBACK(sesswin), window);
403 gtk_menu_shell_append(GTK_MENU_SHELL(menu), sess_item);
404@@ -532,30 +534,32 @@
405 host_item =
406 gtk_image_menu_item_new_with_mnemonic(_("Select _Host ..."));
407 hostico = gtk_image_new_from_file(ldm_theme_file("host"));
408- gtk_image_menu_item_set_image((GtkImageMenuItem *) host_item, hostico);
409+ gtk_image_menu_item_set_image((GtkImageMenuItem *) host_item,
410+ hostico);
411 g_signal_connect_swapped(G_OBJECT(host_item), "activate",
412 G_CALLBACK(hostwin), window);
413 gtk_menu_shell_append(GTK_MENU_SHELL(menu), host_item);
414 }
415
416- for (i=0; i<=9; i++) {
417+ for (i = 0; i <= 9; i++) {
418 g_sprintf(custom_env_var, "LDM_MENU_ITEM_%d", i);
419- custom_mnemonic=getenv(custom_env_var);
420+ custom_mnemonic = getenv(custom_env_var);
421 if (custom_mnemonic == NULL)
422 continue;
423 custom_item =
424 gtk_image_menu_item_new_with_mnemonic(custom_mnemonic);
425 g_sprintf(custom_env_var, "LDM_MENU_COMMAND_%d", i);
426- custom_command=getenv(custom_env_var);
427+ custom_command = getenv(custom_env_var);
428 if (custom_command == NULL) {
429 gtk_widget_destroy(custom_item);
430 continue;
431 }
432 customico = gtk_image_new_from_file(ldm_theme_file("backend"));
433 gtk_image_menu_item_set_image((GtkImageMenuItem *) custom_item,
434- customico);
435+ customico);
436 g_signal_connect(G_OBJECT(custom_item), "activate",
437- G_CALLBACK(spawn_command), g_strdup(custom_command));
438+ G_CALLBACK(spawn_command),
439+ g_strdup(custom_command));
440 gtk_menu_shell_append(GTK_MENU_SHELL(menu), custom_item);
441 }
442 greeter_pref_foreach(menu_append_pref, menu);
443@@ -602,7 +606,7 @@
444 *dest = '\0';
445 else {
446 strncpy(dest, source, MAXSTRSZ - 1);
447- *(dest + MAXSTRSZ - 1) = '\0'; /* ensure null termination */
448+ *(dest + MAXSTRSZ - 1) = '\0'; /* ensure null termination */
449 }
450
451 return dest;
452@@ -613,13 +617,15 @@
453 * Inspired by gdm/gui/gdmlogin.c
454 */
455 static gboolean
456-key_press_event(GtkWidget *widget, GdkEventKey *event, gpointer window)
457+key_press_event(GtkWidget * widget, GdkEventKey * event, gpointer window)
458 {
459 if ((event->keyval == GDK_Tab ||
460 event->keyval == GDK_KP_Tab) &&
461- (event->state & (GDK_CONTROL_MASK|GDK_MOD1_MASK|GDK_SHIFT_MASK)) == 0) {
462- handle_entry(GTK_ENTRY(entry), window);
463- return TRUE;
464+ (event->
465+ state & (GDK_CONTROL_MASK | GDK_MOD1_MASK | GDK_SHIFT_MASK)) ==
466+ 0) {
467+ handle_entry(GTK_ENTRY(entry), window);
468+ return TRUE;
469 }
470
471 return FALSE;
472@@ -642,30 +648,28 @@
473 GdkPixbuf *pix;
474 gint width, height;
475 GIOChannel *g_stdin;
476- char * ldm_theme;
477+ char *ldm_theme;
478
479 #ifdef ENABLE_NLS
480- setlocale (LC_ALL, "");
481- bindtextdomain (GETTEXT_PACKAGE, LOCALE_DIR);
482- bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
483- textdomain (GETTEXT_PACKAGE);
484+ setlocale(LC_ALL, "");
485+ bindtextdomain(GETTEXT_PACKAGE, LOCALE_DIR);
486+ bind_textdomain_codeset(GETTEXT_PACKAGE, "UTF-8");
487+ textdomain(GETTEXT_PACKAGE);
488 #endif
489
490 /* Init log settings */
491- log_init(ldm_getenv_bool("LDM_SYSLOG"),ldm_getenv_int("LDM_LOGLEVEL",-1));
492+ log_init(ldm_getenv_bool("LDM_SYSLOG"),
493+ ldm_getenv_int("LDM_LOGLEVEL", -1));
494
495 gtk_init(&argc, &argv);
496 ldm_theme = getenv("LDM_THEME");
497
498- if (ldm_theme)
499- {
500- if(*ldm_theme == '/')
501+ if (ldm_theme) {
502+ if (*ldm_theme == '/')
503 ldm_theme_dir = g_strdup(ldm_theme);
504 else
505 ldm_theme_dir = g_strconcat(LDM_THEME_DIR, ldm_theme, NULL);
506- }
507- else
508- {
509+ } else {
510 ldm_theme_dir = g_strconcat(LDM_THEME_DIR, "default", NULL);
511 }
512
513@@ -697,10 +701,12 @@
514 timelabel = gtk_label_new("");
515 #ifdef K12LINUX
516 hoststring =
517- g_strdup_printf("<b>%s</b> (%s)", get_sysname(), getenv("LDMINFO_IPADDR"));
518+ g_strdup_printf("<b>%s</b> (%s)", get_sysname(),
519+ getenv("LDMINFO_IPADDR"));
520 #else
521 hoststring =
522- g_strdup_printf("<b>%s</b> (%s) //", get_sysname(), getenv("LDMINFO_IPADDR"));
523+ g_strdup_printf("<b>%s</b> (%s) //", get_sysname(),
524+ getenv("LDMINFO_IPADDR"));
525 #endif
526 gtk_label_set_markup((GtkLabel *) syslabel, hoststring);
527 update_time(timelabel);
528@@ -727,29 +733,31 @@
529 }
530
531 /**** Create the login window ****/
532- gtk_window_set_position(GTK_WINDOW(loginWindow), GTK_WIN_POS_CENTER_ALWAYS);
533+ gtk_window_set_position(GTK_WINDOW(loginWindow),
534+ GTK_WIN_POS_CENTER_ALWAYS);
535 {
536- GtkWidget *guestbox, *guestspacer1, *guestspacer2, *vbox, *vbox2, *hbox;
537+ GtkWidget *guestbox, *guestspacer1, *guestspacer2, *vbox, *vbox2,
538+ *hbox;
539 GtkCellRenderer *renderer;
540
541- g_signal_connect(G_OBJECT(loginWindow), "destroy", G_CALLBACK(destroy),
542- NULL);
543+ g_signal_connect(G_OBJECT(loginWindow), "destroy",
544+ G_CALLBACK(destroy), NULL);
545
546 gtk_widget_set_app_paintable(loginWindow, TRUE);
547 g_signal_connect(loginWindow, "configure-event",
548- G_CALLBACK(draw_background), NULL);
549+ G_CALLBACK(draw_background), NULL);
550 //gtk_widget_set_size_request(loginWindow, width/2, height/2);
551 //gtk_widget_realize(loginWindow);
552- gtk_window_set_decorated(GTK_WINDOW (loginWindow), FALSE);
553+ gtk_window_set_decorated(GTK_WINDOW(loginWindow), FALSE);
554
555 logo = gtk_image_new_from_file(ldm_theme_file("logo"));
556 #ifdef K12LINUX
557- if(access(ldm_theme_file("bottom_right"), R_OK) == 0) {
558- bottom_right = gtk_image_new_from_file(ldm_theme_file("bottom_right"));
559- has_bottom_right_image=TRUE;
560- }
561- else
562- has_bottom_right_image=FALSE;
563+ if (access(ldm_theme_file("bottom_right"), R_OK) == 0) {
564+ bottom_right =
565+ gtk_image_new_from_file(ldm_theme_file("bottom_right"));
566+ has_bottom_right_image = TRUE;
567+ } else
568+ has_bottom_right_image = FALSE;
569 #endif
570
571 pix = gtk_image_get_pixbuf((GtkImage *) logo);
572@@ -779,18 +787,18 @@
573 G_CALLBACK(key_press_event), loginWindow);
574
575 choiceList = gtk_list_store_new(1, G_TYPE_STRING);
576- choiceCombo = gtk_combo_box_new_with_model(GTK_TREE_MODEL(choiceList));
577+ choiceCombo =
578+ gtk_combo_box_new_with_model(GTK_TREE_MODEL(choiceList));
579 renderer = gtk_cell_renderer_text_new();
580 gtk_cell_layout_pack_start(GTK_CELL_LAYOUT(choiceCombo),
581- GTK_CELL_RENDERER(renderer),
582- TRUE);
583+ GTK_CELL_RENDERER(renderer), TRUE);
584 gtk_cell_layout_add_attribute(GTK_CELL_LAYOUT(choiceCombo),
585 GTK_CELL_RENDERER(renderer),
586 "text", 0);
587 g_signal_connect(G_OBJECT(choiceCombo), "changed",
588 G_CALLBACK(handle_choice), root);
589
590- if (getenv("LDM_LOGIN_TIMEOUT") != NULL ) {
591+ if (getenv("LDM_LOGIN_TIMEOUT") != NULL) {
592 login_timeout = atoi(getenv("LDM_LOGIN_TIMEOUT"));
593 } else {
594 login_timeout = 0;
595@@ -802,33 +810,43 @@
596 timeoutlabel = gtk_label_new("");
597 timeoutbox = gtk_hbox_new(FALSE, 0);
598 gtk_box_pack_start(GTK_BOX(vbox), timeoutbox, FALSE, FALSE, 0);
599- gtk_box_pack_start(GTK_BOX(timeoutbox), timeoutspacer1, TRUE, FALSE, 0);
600- gtk_box_pack_start(GTK_BOX(timeoutbox), timeoutlabel, FALSE, FALSE, 0);
601- gtk_box_pack_start(GTK_BOX(timeoutbox), timeoutspacer2, TRUE, FALSE, 0);
602+ gtk_box_pack_start(GTK_BOX(timeoutbox), timeoutspacer1, TRUE,
603+ FALSE, 0);
604+ gtk_box_pack_start(GTK_BOX(timeoutbox), timeoutlabel, FALSE, FALSE,
605+ 0);
606+ gtk_box_pack_start(GTK_BOX(timeoutbox), timeoutspacer2, TRUE,
607+ FALSE, 0);
608 g_timeout_add(1000, (GSourceFunc) update_timeout, timeoutlabel);
609
610 guestspacer1 = gtk_label_new("");
611 guestspacer2 = gtk_label_new("");
612- GuestButton = gtk_button_new_with_label (_("Login as Guest"));
613+ GuestButton = gtk_button_new_with_label(_("Login as Guest"));
614 g_signal_connect(G_OBJECT(GuestButton), "clicked",
615- G_CALLBACK(handle_guestbutton), root);
616- gtk_button_set_focus_on_click((GtkButton *)GuestButton, FALSE);
617+ G_CALLBACK(handle_guestbutton), root);
618+ gtk_button_set_focus_on_click((GtkButton *) GuestButton, FALSE);
619 guestbox = gtk_hbox_new(FALSE, 0);
620- gtk_box_pack_start(GTK_BOX(guestbox), guestspacer1, TRUE, FALSE, 0);
621- gtk_box_pack_start(GTK_BOX(guestbox), GuestButton, FALSE, FALSE, 0);
622- gtk_box_pack_start(GTK_BOX(guestbox), guestspacer2, TRUE, FALSE, 0);
623+ gtk_box_pack_start(GTK_BOX(guestbox), guestspacer1, TRUE, FALSE,
624+ 0);
625+ gtk_box_pack_start(GTK_BOX(guestbox), GuestButton, FALSE, FALSE,
626+ 0);
627+ gtk_box_pack_start(GTK_BOX(guestbox), guestspacer2, TRUE, FALSE,
628+ 0);
629
630 entryspacer1 = gtk_label_new("");
631 entryspacer2 = gtk_label_new("");
632- gtk_box_pack_start(GTK_BOX(EntryBox), entryspacer1, TRUE, FALSE, 0);
633+ gtk_box_pack_start(GTK_BOX(EntryBox), entryspacer1, TRUE, FALSE,
634+ 0);
635 gtk_box_pack_start(GTK_BOX(EntryBox), UserPrompt, FALSE, FALSE, 0);
636 gtk_box_pack_start(GTK_BOX(EntryBox), entry, FALSE, FALSE, 0);
637- gtk_box_pack_start(GTK_BOX(EntryBox), choiceCombo, FALSE, FALSE, 0);
638- gtk_box_pack_start(GTK_BOX(EntryBox), entryspacer2, TRUE, FALSE, 0);
639+ gtk_box_pack_start(GTK_BOX(EntryBox), choiceCombo, FALSE, FALSE,
640+ 0);
641+ gtk_box_pack_start(GTK_BOX(EntryBox), entryspacer2, TRUE, FALSE,
642+ 0);
643
644 gtk_box_pack_start(GTK_BOX(vbox), logo, FALSE, FALSE, 5);
645 gtk_box_pack_start(GTK_BOX(vbox), EntryBox, TRUE, FALSE, 0);
646- if(allowguest) gtk_box_pack_start(GTK_BOX(vbox), guestbox, FALSE, FALSE, 0);
647+ if (allowguest)
648+ gtk_box_pack_start(GTK_BOX(vbox), guestbox, FALSE, FALSE, 0);
649 gtk_box_pack_start(GTK_BOX(vbox), timeoutbox, FALSE, FALSE, 0);
650 gtk_box_pack_start(GTK_BOX(vbox), StatusMessages, TRUE, FALSE, 0);
651 gtk_box_pack_start(GTK_BOX(hbox), vbox, TRUE, FALSE, 0);
652@@ -842,10 +860,10 @@
653 {
654 GtkWidget *BottomBarBox;
655
656- gtk_widget_set_app_paintable(GTK_WIDGET (prefBar), TRUE);
657+ gtk_widget_set_app_paintable(GTK_WIDGET(prefBar), TRUE);
658 g_signal_connect(prefBar, "configure-event",
659- G_CALLBACK(draw_background), NULL);
660- gtk_window_set_decorated(GTK_WINDOW (prefBar), FALSE);
661+ G_CALLBACK(draw_background), NULL);
662+ gtk_window_set_decorated(GTK_WINDOW(prefBar), FALSE);
663 gtk_widget_set_size_request(prefBar, width, BOTTOM_BAR_HEIGHT);
664
665 BottomBarBox = gtk_hbox_new(FALSE, 0);
666@@ -861,21 +879,28 @@
667 #else
668 optionbutton_box = gtk_vbox_new(FALSE, 0);
669 optionbutton_spacer = gtk_label_new("");
670- gtk_box_pack_start(GTK_BOX(optionbutton_box), GTK_WIDGET(optionbutton_spacer), TRUE, FALSE, 0);
671- gtk_box_pack_end(GTK_BOX(optionbutton_box), GTK_WIDGET(optionbutton), FALSE, FALSE, 5);
672+ gtk_box_pack_start(GTK_BOX(optionbutton_box),
673+ GTK_WIDGET(optionbutton_spacer), TRUE, FALSE,
674+ 0);
675+ gtk_box_pack_end(GTK_BOX(optionbutton_box),
676+ GTK_WIDGET(optionbutton), FALSE, FALSE, 5);
677 gtk_box_pack_start(GTK_BOX(BottomBarBox),
678 GTK_WIDGET(optionbutton_box), FALSE, FALSE, 5);
679
680- if(has_bottom_right_image == TRUE) {
681+ if (has_bottom_right_image == TRUE) {
682 bottom_right_box = gtk_vbox_new(FALSE, 0);
683 bottom_right_spacer = gtk_label_new("");
684- gtk_box_pack_start(GTK_BOX(bottom_right_box), GTK_WIDGET(bottom_right_spacer), TRUE, FALSE, 0);
685- gtk_box_pack_end(GTK_BOX(bottom_right_box), GTK_WIDGET(bottom_right), FALSE, FALSE, 0);
686+ gtk_box_pack_start(GTK_BOX(bottom_right_box),
687+ GTK_WIDGET(bottom_right_spacer), TRUE,
688+ FALSE, 0);
689+ gtk_box_pack_end(GTK_BOX(bottom_right_box),
690+ GTK_WIDGET(bottom_right), FALSE, FALSE, 0);
691 gtk_box_pack_end(GTK_BOX(BottomBarBox),
692- GTK_WIDGET(bottom_right_box), FALSE, FALSE, 0);
693+ GTK_WIDGET(bottom_right_box), FALSE, FALSE,
694+ 0);
695 }
696 #endif
697- gtk_container_add(GTK_CONTAINER (prefBar), BottomBarBox);
698+ gtk_container_add(GTK_CONTAINER(prefBar), BottomBarBox);
699 }
700
701 #ifdef K12LINUX
702@@ -884,12 +909,12 @@
703 {
704 GtkWidget *TopBarBox;
705
706- gtk_window_set_decorated(GTK_WINDOW (topBar), FALSE);
707+ gtk_window_set_decorated(GTK_WINDOW(topBar), FALSE);
708 gtk_widget_set_size_request(topBar, width, TOP_BAR_HEIGHT);
709
710 TopBarBox = gtk_hbox_new(FALSE, 5);
711 gtk_box_pack_start(GTK_BOX(TopBarBox),
712- GTK_WIDGET(syslabel), FALSE, FALSE, 5);
713+ GTK_WIDGET(syslabel), FALSE, FALSE, 5);
714 gtk_box_pack_end(GTK_BOX(TopBarBox),
715 GTK_WIDGET(timelabel), FALSE, FALSE, 5);
716 }
717@@ -898,10 +923,10 @@
718
719 gtk_widget_show_all(loginWindow);
720 gtk_widget_show_all(prefBar);
721- gtk_window_move(GTK_WINDOW (prefBar), 0, height - BOTTOM_BAR_HEIGHT);
722+ gtk_window_move(GTK_WINDOW(prefBar), 0, height - BOTTOM_BAR_HEIGHT);
723 #ifdef K12LINUX
724 gtk_widget_show_all(topBar);
725- gtk_window_move(GTK_WINDOW (topBar), 0, 0);
726+ gtk_window_move(GTK_WINDOW(topBar), 0, 0);
727 #endif
728
729 gdk_window_set_cursor(root, normcursor);
730
731=== modified file 'gtkgreet/langwin.c'
732--- gtkgreet/langwin.c 2010-10-11 03:32:02 +0000
733+++ gtkgreet/langwin.c 2014-07-28 15:29:30 +0000
734@@ -69,8 +69,7 @@
735 GList *l = NULL;
736
737 curr_host =
738- ldminfo_lookup(g_list_nth_data(host_list,
739- selected_host_id));
740+ ldminfo_lookup(g_list_nth_data(host_list, selected_host_id));
741 l = curr_host->languages;
742 g_strlcpy(language, g_list_nth_data(l, lang_selected - 1),
743 MAXSTRSZ);
744@@ -98,7 +97,8 @@
745 * Populate lang with default host hash
746 */
747
748- curr_host = ldminfo_lookup(g_list_nth_data(host_list, selected_host_id));
749+ curr_host =
750+ ldminfo_lookup(g_list_nth_data(host_list, selected_host_id));
751
752 gtk_combo_box_append_text(GTK_COMBO_BOX(lang_select),
753 g_strdup(_("Default")));
754@@ -135,7 +135,8 @@
755
756 label = gtk_label_new("");
757 gtk_label_set_markup((GtkLabel *) label,
758- _("Select the language for your session to use:"));
759+ _
760+ ("Select the language for your session to use:"));
761
762 gtk_box_pack_start((GtkBox *) vbox, (GtkWidget *) label, FALSE, FALSE,
763 0);
764
765=== modified file 'gtkgreet/prefs.c'
766--- gtkgreet/prefs.c 2012-08-21 13:10:36 +0000
767+++ gtkgreet/prefs.c 2014-07-28 15:29:30 +0000
768@@ -25,13 +25,17 @@
769 #include <unistd.h>
770 #include <sys/socket.h>
771
772-static GTree* greeter_prefs = NULL;
773+static GTree *greeter_prefs = NULL;
774
775-static int g_strcmp(gconstpointer a, gconstpointer b) {
776- return strcmp((char*)a, (char*)b);
777+static int
778+g_strcmp(gconstpointer a, gconstpointer b)
779+{
780+ return strcmp((char *) a, (char *) b);
781 }
782
783-void greeter_pref_init() {
784+void
785+greeter_pref_init()
786+{
787 if (greeter_prefs) {
788 g_tree_destroy(greeter_prefs);
789 greeter_prefs = NULL;
790@@ -39,23 +43,27 @@
791 greeter_prefs = g_tree_new(g_strcmp);
792 }
793
794-GreeterPref* greeter_pref_new(const gchar* name) {
795- GreeterPref* pref = g_malloc0(sizeof(GreeterPref));
796+GreeterPref *
797+greeter_pref_new(const gchar * name)
798+{
799+ GreeterPref *pref = g_malloc0(sizeof(GreeterPref));
800 g_tree_replace(greeter_prefs, g_strdup(name), pref);
801 pref->choices = g_list_alloc();
802
803 return pref;
804 }
805
806-void greeter_pref_destroy(const gchar* name) {
807+void
808+greeter_pref_destroy(const gchar * name)
809+{
810 gpointer key;
811 gpointer valptr;
812- GreeterPref* value;
813+ GreeterPref *value;
814
815 g_tree_lookup_extended(greeter_prefs, name, &key, &valptr);
816- value = (GreeterPref*)valptr;
817+ value = (GreeterPref *) valptr;
818 if (value->choices) {
819- g_list_foreach(value->choices, (GFunc)g_free, NULL);
820+ g_list_foreach(value->choices, (GFunc) g_free, NULL);
821 g_list_free(value->choices);
822 }
823 if (value->title) {
824@@ -73,26 +81,35 @@
825 g_free(key);
826 }
827
828-void greeter_pref_prompt(const gchar* name) {
829-}
830-
831-GreeterPref* greeter_pref_get_pref(const gchar* name) {
832- return (GreeterPref*)g_tree_lookup(greeter_prefs, name);
833-}
834-
835-PrefValue greeter_pref_get_value(const gchar* name) {
836- GreeterPref* value = (GreeterPref*) g_tree_lookup(greeter_prefs, name);
837+void
838+greeter_pref_prompt(const gchar * name)
839+{
840+}
841+
842+GreeterPref *
843+greeter_pref_get_pref(const gchar * name)
844+{
845+ return (GreeterPref *) g_tree_lookup(greeter_prefs, name);
846+}
847+
848+PrefValue
849+greeter_pref_get_value(const gchar * name)
850+{
851+ GreeterPref *value =
852+ (GreeterPref *) g_tree_lookup(greeter_prefs, name);
853 if (!value) {
854- return (PrefValue)"None";
855- } if (value->value.int_val == 0) {
856- return (PrefValue)"None";
857+ return (PrefValue) "None";
858+ }
859+ if (value->value.int_val == 0) {
860+ return (PrefValue) "None";
861 }
862
863- return (PrefValue)(char*)g_list_nth_data(value->choices,
864- value->value.int_val);
865+ return (PrefValue) (char *) g_list_nth_data(value->choices,
866+ value->value.int_val);
867 }
868
869-void greeter_pref_foreach(GTraverseFunc func, gpointer user_data) {
870+void
871+greeter_pref_foreach(GTraverseFunc func, gpointer user_data)
872+{
873 g_tree_foreach(greeter_prefs, func, user_data);
874 }
875-
876
877=== modified file 'gtkgreet/prefwin.c'
878--- gtkgreet/prefwin.c 2012-08-21 14:33:07 +0000
879+++ gtkgreet/prefwin.c 2014-07-28 15:29:30 +0000
880@@ -27,14 +27,14 @@
881 #include "../src/ldminfo.h"
882 #include "greeter.h"
883
884-static GtkWidget* pref_combo = NULL;
885+static GtkWidget *pref_combo = NULL;
886 static gint choice_total = 0;
887
888 extern GIOChannel *g_stdout;
889
890 typedef struct {
891- GtkWidget* prefwin;
892- const gchar* prefname;
893+ GtkWidget *prefwin;
894+ const gchar *prefname;
895 } PrefData;
896
897 /*
898@@ -42,12 +42,13 @@
899 */
900
901 static void
902-prefwin_accept(GtkWidget * widget, PrefData* data)
903+prefwin_accept(GtkWidget * widget, PrefData * data)
904 {
905- GreeterPref* pref = greeter_pref_get_pref(data->prefname);
906- gchar* notif;
907+ GreeterPref *pref = greeter_pref_get_pref(data->prefname);
908+ gchar *notif;
909
910- pref->value.int_val = gtk_combo_box_get_active(GTK_COMBO_BOX(pref_combo));
911+ pref->value.int_val =
912+ gtk_combo_box_get_active(GTK_COMBO_BOX(pref_combo));
913 gtk_widget_destroy(data->prefwin);
914
915 notif = g_strconcat("@", data->prefname, "@\n", NULL);
916@@ -74,7 +75,7 @@
917 prefwin(GtkWidget * widget, gpointer pref_name)
918 {
919
920- GreeterPref* pref;
921+ GreeterPref *pref;
922 GtkWidget *prefwin, *label, *vbox, *buttonbox;
923 GtkWidget *cancel, *accept, *frame;
924
925@@ -90,7 +91,8 @@
926 g_list_foreach(pref->choices,
927 (GFunc) populate_pref_combo_box, pref_combo);
928
929- gtk_combo_box_set_active(GTK_COMBO_BOX(pref_combo), pref->value.int_val);
930+ gtk_combo_box_set_active(GTK_COMBO_BOX(pref_combo),
931+ pref->value.int_val);
932
933 /*
934 * Build window
935@@ -110,7 +112,7 @@
936 G_CALLBACK(destroy_popup), prefwin);
937
938 accept = gtk_button_new_from_stock("gtk-ok");
939- PrefData* data = g_malloc0(sizeof(PrefData));
940+ PrefData *data = g_malloc0(sizeof(PrefData));
941 data->prefwin = prefwin;
942 data->prefname = pref_name;
943 g_signal_connect(G_OBJECT(accept), "clicked",
944@@ -122,8 +124,7 @@
945 FALSE, 0);
946
947 label = gtk_label_new("");
948- gtk_label_set_markup((GtkLabel *) label,
949- _(pref->title));
950+ gtk_label_set_markup((GtkLabel *) label, _(pref->title));
951
952 gtk_box_pack_start((GtkBox *) vbox, (GtkWidget *) label, FALSE, FALSE,
953 0);
954@@ -143,4 +144,3 @@
955
956 return;
957 }
958-
959
960=== modified file 'gtkgreet/sesswin.c'
961--- gtkgreet/sesswin.c 2010-10-11 03:32:02 +0000
962+++ gtkgreet/sesswin.c 2014-07-28 15:29:30 +0000
963@@ -67,7 +67,8 @@
964 ldminfo *curr_host = NULL;
965 GList *s = NULL;
966
967- curr_host = ldminfo_lookup(g_list_nth_data(host_list, selected_host_id));
968+ curr_host =
969+ ldminfo_lookup(g_list_nth_data(host_list, selected_host_id));
970 s = curr_host->sessions;
971 g_strlcpy(session, g_list_nth_data(s, sess_selected - 2),
972 MAXSTRSZ);
973@@ -99,7 +100,8 @@
974 * Populate sess with default host hash
975 */
976
977- curr_host = ldminfo_lookup(g_list_nth_data(host_list, current_host_id));
978+ curr_host =
979+ ldminfo_lookup(g_list_nth_data(host_list, current_host_id));
980
981 gtk_combo_box_append_text(GTK_COMBO_BOX(sess_select),
982 g_strdup(_("Default")));
983
984=== modified file 'misc/ldm-dialog.c'
985--- misc/ldm-dialog.c 2009-11-20 22:13:05 +0000
986+++ misc/ldm-dialog.c 2014-07-28 15:29:30 +0000
987@@ -45,42 +45,48 @@
988 GIOChannel *g_stdin;
989 int auto_close;
990
991-void yes_clicked(GtkWidget * widget, GtkWidget * mywin)
992+void
993+yes_clicked(GtkWidget * widget, GtkWidget * mywin)
994 {
995 gtk_main_quit();
996 exit(0);
997 }
998
999-void no_clicked(GtkWidget * widget, GtkWidget * mywin)
1000+void
1001+no_clicked(GtkWidget * widget, GtkWidget * mywin)
1002 {
1003 gtk_main_quit();
1004 exit(1);
1005 }
1006
1007-void link_clicked(GtkWidget * widget, GtkLabel * mywin)
1008+void
1009+link_clicked(GtkWidget * widget, GtkLabel * mywin)
1010 {
1011- printf("url: %s\n",gtk_label_get_current_uri(GTK_LABEL(widget)));
1012+ printf("url: %s\n", gtk_label_get_current_uri(GTK_LABEL(widget)));
1013 gtk_main_quit();
1014 exit(0);
1015 }
1016
1017-void update_progressbar()
1018+void
1019+update_progressbar()
1020 {
1021- gtk_progress_bar_set_fraction(GTK_PROGRESS_BAR(progress), current_number/100.0);
1022- if(current_number < 100.0) {
1023- if(yes)
1024+ gtk_progress_bar_set_fraction(GTK_PROGRESS_BAR(progress),
1025+ current_number / 100.0);
1026+ if (current_number < 100.0) {
1027+ if (yes)
1028 gtk_widget_set_sensitive(yes, FALSE);
1029 } else {
1030- if(auto_close == TRUE)
1031+ if (auto_close == TRUE)
1032 yes_clicked(NULL, NULL);
1033- if(yes) {
1034+ if (yes) {
1035 gtk_widget_set_sensitive(yes, TRUE);
1036 gtk_widget_grab_focus(yes);
1037 }
1038 }
1039 }
1040
1041-void update_progressbar_from_channel(GIOChannel * channel)
1042+void
1043+update_progressbar_from_channel(GIOChannel * channel)
1044 {
1045 GString *buf;
1046 buf = g_string_new("");
1047@@ -91,29 +97,36 @@
1048 g_io_channel_flush(g_stdin, NULL);
1049 }
1050
1051-void usage(char * progname) {
1052- printf("Usage: %s --message|--question|--progress [mode specific options] \"message\"\n", progname);
1053+void
1054+usage(char *progname)
1055+{
1056+ printf
1057+ ("Usage: %s --message|--question|--progress [mode specific options] \"message\"\n",
1058+ progname);
1059 printf("Progress mode options: --auto-close\n");
1060 exit(1);
1061 }
1062
1063 #define USAGE() usage(argv[0])
1064
1065-int main(int argc, char ** argv){
1066- GtkWidget *mywin, *vbox, *hbox, *label, *spacer, *big_hbox, *ospacer, *o2spacer;
1067+int
1068+main(int argc, char **argv)
1069+{
1070+ GtkWidget *mywin, *vbox, *hbox, *label, *spacer, *big_hbox, *ospacer,
1071+ *o2spacer;
1072 int mode;
1073 int retval;
1074- char * message;
1075+ char *message;
1076 int has_no_button, has_yes_button;
1077 mode = NOTHING;
1078 has_no_button = TRUE;
1079 has_yes_button = TRUE;
1080 auto_close = FALSE;
1081
1082- setlocale (LC_ALL, "");
1083- bindtextdomain (GETTEXT_PACKAGE, LOCALE_DIR);
1084- bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
1085- textdomain (GETTEXT_PACKAGE);
1086+ setlocale(LC_ALL, "");
1087+ bindtextdomain(GETTEXT_PACKAGE, LOCALE_DIR);
1088+ bind_textdomain_codeset(GETTEXT_PACKAGE, "UTF-8");
1089+ textdomain(GETTEXT_PACKAGE);
1090
1091 // Option processing
1092 struct option longopts[] = {
1093@@ -121,17 +134,17 @@
1094 {"question", 0, 0, QUESTION},
1095 {"progress", 0, 0, PROGRESS},
1096 {"auto-close", 0, 0, AUTO_CLOSE_OPTION},
1097- {0,0,0,0}
1098+ {0, 0, 0, 0}
1099 };
1100- while(1) {
1101+ while (1) {
1102 retval = getopt_long(argc, argv, "", longopts, NULL);
1103- if(retval == -1)
1104+ if (retval == -1)
1105 break;
1106- switch(retval) {
1107+ switch (retval) {
1108 case MESSAGE:
1109 case QUESTION:
1110 case PROGRESS:
1111- if(mode != NOTHING)
1112+ if (mode != NOTHING)
1113 USAGE();
1114 mode = retval;
1115 break;
1116@@ -143,21 +156,21 @@
1117 break;
1118 }
1119 }
1120- if(mode == NOTHING)
1121- USAGE();
1122- if((argc - optind) != 1)
1123- USAGE();
1124- if(auto_close == TRUE && mode != PROGRESS)
1125+ if (mode == NOTHING)
1126+ USAGE();
1127+ if ((argc - optind) != 1)
1128+ USAGE();
1129+ if (auto_close == TRUE && mode != PROGRESS)
1130 USAGE();
1131 message = argv[optind];
1132- switch(mode) {
1133+ switch (mode) {
1134 case MESSAGE:
1135 has_no_button = FALSE;
1136 break;
1137 case QUESTION:
1138 break;
1139 case PROGRESS:
1140- if(auto_close == TRUE)
1141+ if (auto_close == TRUE)
1142 has_yes_button = FALSE;
1143 break;
1144 }
1145@@ -166,27 +179,31 @@
1146 gtk_init(&argc, &argv);
1147
1148 // Theme
1149- char * ldm_theme;
1150- gchar * ldm_gtkrc;
1151+ char *ldm_theme;
1152+ gchar *ldm_gtkrc;
1153 ldm_theme = getenv("LDM_THEME");
1154- if (ldm_theme)
1155- {
1156- if(*ldm_theme == '/')
1157+ if (ldm_theme) {
1158+ if (*ldm_theme == '/')
1159 ldm_gtkrc = g_strconcat(ldm_theme, "/greeter-gtkrc", NULL);
1160 else
1161- ldm_gtkrc = g_strconcat(LDM_THEME_DIR, ldm_theme, "/greeter-gtkrc", NULL);
1162+ ldm_gtkrc =
1163+ g_strconcat(LDM_THEME_DIR, ldm_theme, "/greeter-gtkrc",
1164+ NULL);
1165 } else
1166- ldm_gtkrc = g_strconcat(LDM_THEME_DIR, "default", "/greeter-gtkrc", NULL);
1167+ ldm_gtkrc =
1168+ g_strconcat(LDM_THEME_DIR, "default", "/greeter-gtkrc", NULL);
1169 gtk_rc_add_default_file(ldm_gtkrc);
1170 g_free(ldm_gtkrc);
1171 // Finish setting up the basic stuff
1172 mywin = gtk_window_new(GTK_WINDOW_TOPLEVEL);
1173- gdk_window_set_cursor(gdk_get_default_root_window(), gdk_cursor_new(GDK_LEFT_PTR));
1174- gtk_window_set_title(GTK_WINDOW(mywin),"");
1175- gtk_window_set_skip_taskbar_hint(GTK_WINDOW(mywin),TRUE);
1176- gtk_window_set_resizable (GTK_WINDOW(mywin),0);
1177+ gdk_window_set_cursor(gdk_get_default_root_window(),
1178+ gdk_cursor_new(GDK_LEFT_PTR));
1179+ gtk_window_set_title(GTK_WINDOW(mywin), "");
1180+ gtk_window_set_skip_taskbar_hint(GTK_WINDOW(mywin), TRUE);
1181+ gtk_window_set_resizable(GTK_WINDOW(mywin), 0);
1182 gtk_window_set_position(GTK_WINDOW(mywin), GTK_WIN_POS_CENTER_ALWAYS);
1183- g_signal_connect(GTK_WINDOW(mywin), "destroy", G_CALLBACK(no_clicked), mywin);
1184+ g_signal_connect(GTK_WINDOW(mywin), "destroy", G_CALLBACK(no_clicked),
1185+ mywin);
1186 hbox = gtk_hbox_new(FALSE, 3);
1187 spacer = gtk_label_new("");
1188 ospacer = gtk_label_new("");
1189@@ -196,33 +213,34 @@
1190 gtk_box_pack_start(GTK_BOX(hbox), spacer, TRUE, FALSE, 0);
1191
1192 // Make the yes button
1193- if(has_yes_button == TRUE) {
1194+ if (has_yes_button == TRUE) {
1195 yes = gtk_button_new_from_stock("gtk-ok");
1196- g_signal_connect(G_OBJECT(yes), "clicked", G_CALLBACK(yes_clicked), mywin);
1197+ g_signal_connect(G_OBJECT(yes), "clicked", G_CALLBACK(yes_clicked),
1198+ mywin);
1199 gtk_box_pack_start(GTK_BOX(hbox), yes, FALSE, FALSE, 0);
1200 }
1201-
1202 // Make the no button
1203- if(has_no_button == TRUE) {
1204+ if (has_no_button == TRUE) {
1205 no = gtk_button_new_from_stock("gtk-cancel");
1206- g_signal_connect(G_OBJECT(no), "clicked", G_CALLBACK(no_clicked), mywin);
1207+ g_signal_connect(G_OBJECT(no), "clicked", G_CALLBACK(no_clicked),
1208+ mywin);
1209 gtk_box_pack_start(GTK_BOX(hbox), no, FALSE, FALSE, 0);
1210 }
1211-
1212 // Create the label
1213 label = gtk_label_new(message);
1214 gtk_label_set_markup(GTK_LABEL(label), message);
1215 gtk_label_set_line_wrap(GTK_LABEL(label), TRUE);
1216 gtk_window_set_default_size(GTK_WINDOW(mywin), 300, -1);
1217- g_signal_connect(GTK_LABEL(label), "activate-link", G_CALLBACK(link_clicked), label);
1218+ g_signal_connect(GTK_LABEL(label), "activate-link",
1219+ G_CALLBACK(link_clicked), label);
1220
1221 vbox = gtk_vbox_new(FALSE, 0);
1222- GtkWidget * blah;
1223+ GtkWidget *blah;
1224 blah = gtk_alignment_new(0, 0.5, 0, 0);
1225 gtk_container_add(GTK_CONTAINER(blah), label);
1226 gtk_box_pack_start(GTK_BOX(vbox), GTK_WIDGET(blah), FALSE, FALSE, 10);
1227
1228- if(mode == PROGRESS) {
1229+ if (mode == PROGRESS) {
1230 // Make the progress bar
1231 progress = gtk_progress_bar_new();
1232 gtk_box_pack_start(GTK_BOX(vbox), progress, FALSE, FALSE, 0);
1233@@ -234,9 +252,9 @@
1234
1235 // Set up the hook that listens for input
1236 g_stdin = g_io_channel_unix_new(0);
1237- g_io_add_watch(g_stdin, G_IO_IN, (GIOFunc) update_progressbar_from_channel, g_stdin);
1238+ g_io_add_watch(g_stdin, G_IO_IN,
1239+ (GIOFunc) update_progressbar_from_channel, g_stdin);
1240 }
1241-
1242 // More basic GTK stuff
1243 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0);
1244 gtk_box_pack_start(GTK_BOX(vbox), ospacer, FALSE, FALSE, 0);
1245
1246=== modified file 'src/ldm.c'
1247--- src/ldm.c 2013-02-27 08:55:18 +0000
1248+++ src/ldm.c 2014-07-28 15:29:30 +0000
1249@@ -46,7 +46,9 @@
1250 * get_ldm_env
1251 * Setting up LDM env. variables
1252 */
1253-void get_ldm_env() {
1254+void
1255+get_ldm_env()
1256+{
1257 gchar *greeter_path, *wm_path;
1258
1259 ldminfo_init(&host_list, getenv("LDM_SERVER"));
1260@@ -66,18 +68,19 @@
1261 if (!greeter_path)
1262 greeter_path = g_strdup("ldmgtkgreet");
1263
1264- if(greeter_path[0] != '/') {
1265- ldm.greeter_prog = g_strjoin("/", LDM_EXEC_DIR, greeter_path, NULL);
1266+ if (greeter_path[0] != '/') {
1267+ ldm.greeter_prog =
1268+ g_strjoin("/", LDM_EXEC_DIR, greeter_path, NULL);
1269 g_free(greeter_path);
1270 } else {
1271 ldm.greeter_prog = greeter_path;
1272 }
1273
1274 wm_path = g_strdup(getenv("LDM_WINMANAGER"));
1275- if(!wm_path)
1276+ if (!wm_path)
1277 wm_path = g_strdup("wwm");
1278
1279- if(wm_path[0] != '/') {
1280+ if (wm_path[0] != '/') {
1281 ldm.wm_prog = g_strjoin("/", LDM_EXEC_DIR, wm_path, NULL);
1282 g_free(wm_path);
1283 } else {
1284@@ -89,19 +92,22 @@
1285 /*
1286 * main entry point
1287 */
1288-int main(int argc, char *argv[]) {
1289+int
1290+main(int argc, char *argv[])
1291+{
1292 /* decls */
1293 gchar *auth_plugin = NULL;
1294 struct sigaction action;
1295
1296 /* Init log settings */
1297- log_init(ldm_getenv_bool("LDM_SYSLOG"),ldm_getenv_int("LDM_LOGLEVEL",-1));
1298+ log_init(ldm_getenv_bool("LDM_SYSLOG"),
1299+ ldm_getenv_int("LDM_LOGLEVEL", -1));
1300
1301 #ifdef ENABLE_NLS
1302- setlocale (LC_ALL, "");
1303- bindtextdomain (GETTEXT_PACKAGE, LOCALE_DIR);
1304- bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
1305- textdomain (GETTEXT_PACKAGE);
1306+ setlocale(LC_ALL, "");
1307+ bindtextdomain(GETTEXT_PACKAGE, LOCALE_DIR);
1308+ bind_textdomain_codeset(GETTEXT_PACKAGE, "UTF-8");
1309+ textdomain(GETTEXT_PACKAGE);
1310 #endif
1311
1312 g_type_init();
1313@@ -110,21 +116,22 @@
1314 action.sa_handler = handle_sigchld;
1315 sigemptyset(&action.sa_mask);
1316 action.sa_flags = SA_SIGINFO;
1317- sigaction (SIGCHLD, &action, NULL);
1318+ sigaction(SIGCHLD, &action, NULL);
1319
1320 /*
1321 * Zero out our info struct.
1322 */
1323 bzero(&ldm, sizeof ldm);
1324
1325- ldm.pid = getpid(); /* Get our pid, to use in the command_socket */
1326+ ldm.pid = getpid(); /* Get our pid, to use in the command_socket */
1327 ldm.display = g_strdup(getenv("DISPLAY"));
1328
1329 /*
1330 * Get our IP address.
1331 */
1332 get_ipaddr();
1333- log_entry("ldm",6,"started on client with IP address: %s", ldm.ipaddr);
1334+ log_entry("ldm", 6, "started on client with IP address: %s",
1335+ ldm.ipaddr);
1336
1337 /*
1338 * Put ip address in environment so that it is available to to the greeter
1339@@ -139,22 +146,22 @@
1340 /*
1341 * Load plugins
1342 */
1343- if(ldm_load_plugins())
1344- log_entry("ldm",3,"unable to load plugins");
1345+ if (ldm_load_plugins())
1346+ log_entry("ldm", 3, "unable to load plugins");
1347
1348 /*
1349 * Begin running display manager
1350 */
1351- log_entry("ldm",6,"calling rc.d init scripts");
1352- rc_files("init"); /* Execute any rc files */
1353+ log_entry("ldm", 6, "calling rc.d init scripts");
1354+ rc_files("init"); /* Execute any rc files */
1355
1356 if (!ldm.autologin) {
1357 /* start interactive greeter only if no autologin */
1358 gint rfd, wfd, rfd2, wfd2;
1359
1360- log_entry("ldm",7,"spawning window manager: %s", ldm.wm_prog);
1361+ log_entry("ldm", 7, "spawning window manager: %s", ldm.wm_prog);
1362 ldm.wmpid = ldm_spawn(ldm.wm_prog, &rfd2, &wfd2, NULL);
1363- log_entry("ldm",7,"spawning greeter: %s", ldm.greeter_prog);
1364+ log_entry("ldm", 7, "spawning greeter: %s", ldm.greeter_prog);
1365 ldm.greeterpid = ldm_spawn(ldm.greeter_prog, &rfd, &wfd, NULL);
1366 set_greeter_pid(ldm.greeterpid);
1367 /* create GIOChannels for the greeter */
1368@@ -170,9 +177,11 @@
1369
1370 /* allow choosing backend */
1371 backends = g_strjoinv("|", ldm_get_plugins());
1372- cmd = g_strconcat("pref choice;backend;Authentication Backend;Select _Backend ...;session;",
1373- backends, "\n", NULL);
1374- if(ask_greeter(cmd))
1375+ cmd =
1376+ g_strconcat
1377+ ("pref choice;backend;Authentication Backend;Select _Backend ...;session;",
1378+ backends, "\n", NULL);
1379+ if (ask_greeter(cmd))
1380 die("ldm", "%s from greeter failed", cmd);
1381 g_free(backends);
1382 g_free(cmd);
1383@@ -195,7 +204,8 @@
1384
1385 /* Init plugin */
1386 set_current_plugin(auth_plugin);
1387- log_entry("ldm",6,"authenticating with backend: %s", auth_plugin);
1388+ log_entry("ldm", 6, "authenticating with backend: %s",
1389+ auth_plugin);
1390 ldm_setup_plugin();
1391 } while (ldm_auth_plugin());
1392 } else {
1393@@ -204,7 +214,8 @@
1394 auth_plugin = g_strdup(DEFAULT_AUTH_PLUGIN);
1395
1396 set_current_plugin(auth_plugin);
1397- log_entry("ldm",6,"guest authenticating with backend: %s", auth_plugin);
1398+ log_entry("ldm", 6, "guest authenticating with backend: %s",
1399+ auth_plugin);
1400 ldm_setup_plugin();
1401
1402 ldm_guest_auth_plugin();
1403@@ -221,10 +232,10 @@
1404 * From here plugins has taken control. When plugin return, close everything
1405 */
1406
1407- log_entry("ldm",6,"X session ended");
1408+ log_entry("ldm", 6, "X session ended");
1409
1410- log_entry("ldm",6,"calling rc.d stop scripts");
1411- rc_files("stop"); /* Execute any rc files */
1412+ log_entry("ldm", 6, "calling rc.d stop scripts");
1413+ rc_files("stop"); /* Execute any rc files */
1414
1415 /* Closing plugin */
1416 ldm_close_plugin();
1417@@ -244,7 +255,7 @@
1418 g_free(ldm.greeter_prog);
1419 g_free(ldm.control_socket);
1420 g_free(ldm.ipaddr);
1421- g_list_foreach(host_list, (GFunc)g_free, NULL);
1422+ g_list_foreach(host_list, (GFunc) g_free, NULL);
1423 g_list_free(host_list);
1424
1425 exit(EXIT_SUCCESS);
1426
1427=== modified file 'src/ldmgreetercomm.c'
1428--- src/ldmgreetercomm.c 2012-08-21 14:33:07 +0000
1429+++ src/ldmgreetercomm.c 2014-07-28 15:29:30 +0000
1430@@ -19,21 +19,27 @@
1431 /*
1432 * set_greeter_pid
1433 */
1434-void set_greeter_pid(GPid p) {
1435+void
1436+set_greeter_pid(GPid p)
1437+{
1438 greeterpid = p;
1439 }
1440
1441 /*
1442 * set_greeter_read_channel
1443 */
1444-void set_greeter_read_channel(GIOChannel *gr) {
1445+void
1446+set_greeter_read_channel(GIOChannel * gr)
1447+{
1448 greeterr = gr;
1449 }
1450
1451 /*
1452 * set_greeter_read_channel
1453 */
1454-void set_greeter_write_channel(GIOChannel *gw) {
1455+void
1456+set_greeter_write_channel(GIOChannel * gw)
1457+{
1458 greeterw = gw;
1459 }
1460
1461@@ -44,17 +50,20 @@
1462 *
1463 * Return 1 if fails, else 0
1464 */
1465-int ask_greeter(gchar *cmd) {
1466+int
1467+ask_greeter(gchar * cmd)
1468+{
1469 /* Write command to io channel of the greeter */
1470 GError *ge = NULL;
1471- if(g_io_channel_write_chars(greeterw, cmd, -1, NULL, &ge) != G_IO_STATUS_NORMAL) {
1472- log_entry("ldm",4,"%s", ge->message);
1473+ if (g_io_channel_write_chars(greeterw, cmd, -1, NULL, &ge) !=
1474+ G_IO_STATUS_NORMAL) {
1475+ log_entry("ldm", 4, "%s", ge->message);
1476 return 1;
1477 }
1478
1479 /* Flush buffer */
1480- if(g_io_channel_flush(greeterw, &ge) != G_IO_STATUS_NORMAL) {
1481- log_entry("ldm",4,"%s", ge->message);
1482+ if (g_io_channel_flush(greeterw, &ge) != G_IO_STATUS_NORMAL) {
1483+ log_entry("ldm", 4, "%s", ge->message);
1484 return 1;
1485 }
1486 return 0;
1487@@ -66,20 +75,22 @@
1488 * Close greeter properly
1489 * s_ldm -- struct ldm_info
1490 */
1491-void close_greeter() {
1492+void
1493+close_greeter()
1494+{
1495 gboolean failed = 0;
1496 gchar *cmd = "quit\n";
1497
1498 if (!greeterpid)
1499 return;
1500
1501- if(ask_greeter(cmd))
1502+ if (ask_greeter(cmd))
1503 failed = 1;
1504
1505- if(failed) {
1506- log_entry("ldm",3,"quit command failed. SIGTERM to greeter");
1507- if(kill(greeterpid, SIGTERM) < 0) {
1508- log_entry("ldm",3,"SIGTERM failed. SIGKILL to greeter");
1509+ if (failed) {
1510+ log_entry("ldm", 3, "quit command failed. SIGTERM to greeter");
1511+ if (kill(greeterpid, SIGTERM) < 0) {
1512+ log_entry("ldm", 3, "SIGTERM failed. SIGKILL to greeter");
1513 kill(greeterpid, SIGKILL);
1514 }
1515 }
1516@@ -96,14 +107,16 @@
1517 * set_message
1518 * Ask greeter to print a message to UI
1519 */
1520-int set_message(gchar *msg) {
1521+int
1522+set_message(gchar * msg)
1523+{
1524 gchar *cmd;
1525
1526 if (!greeterpid)
1527 return 1;
1528
1529 cmd = g_strconcat("msg ", msg, "\n", NULL);
1530- if(ask_greeter(cmd))
1531+ if (ask_greeter(cmd))
1532 return 1;
1533 g_free(cmd);
1534
1535@@ -119,17 +132,20 @@
1536 *
1537 * Return 1 if fails, else 0 and buffer with data in
1538 */
1539-int listen_greeter(gchar **buffer, gsize *buflen, gsize *end) {
1540+int
1541+listen_greeter(gchar ** buffer, gsize * buflen, gsize * end)
1542+{
1543 while (1) {
1544 /* Reads data from I/O channel of the greeter */
1545 GError *ge = NULL;
1546- if(g_io_channel_read_line(greeterr, buffer, buflen, end, &ge) != G_IO_STATUS_NORMAL) {
1547- log_entry("ldm",3,"%s", ge->message);
1548+ if (g_io_channel_read_line(greeterr, buffer, buflen, end, &ge) !=
1549+ G_IO_STATUS_NORMAL) {
1550+ log_entry("ldm", 3, "%s", ge->message);
1551 return 1;
1552 }
1553
1554 g_strstrip(*buffer);
1555- log_entry("ldm",7,"Got command: %s",*buffer);
1556+ log_entry("ldm", 7, "Got command: %s", *buffer);
1557
1558 /* handle callbacks */
1559 if (**buffer == '@') {
1560@@ -153,13 +169,15 @@
1561 * cmd -- command to send
1562 * buffer -- buffer to write to answer
1563 */
1564-gchar *ask_value_greeter(gchar *cmd) {
1565+gchar *
1566+ask_value_greeter(gchar * cmd)
1567+{
1568 gsize len, end;
1569 gchar *buffer;
1570- if(ask_greeter(cmd))
1571+ if (ask_greeter(cmd))
1572 die("ldm", "%s from greeter failed", cmd);
1573
1574- if(listen_greeter(&buffer, &len, &end))
1575+ if (listen_greeter(&buffer, &len, &end))
1576 die("ldm", "%s from greeter failed", cmd);
1577
1578 return buffer;
1579
1580=== modified file 'src/ldminfo.c'
1581--- src/ldminfo.c 2012-08-21 13:10:36 +0000
1582+++ src/ldminfo.c 2014-07-28 15:29:30 +0000
1583@@ -39,35 +39,41 @@
1584 static GHashTable *display_names;
1585 static GHashTable *ldminfo_hash = NULL;
1586
1587-static void generate_hash_table(void) {
1588+static void
1589+generate_hash_table(void)
1590+{
1591 char buffer[1024];
1592- FILE * file;
1593- char ** ret;
1594- display_names = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, g_free);
1595+ FILE *file;
1596+ char **ret;
1597+ display_names =
1598+ g_hash_table_new_full(g_str_hash, g_str_equal, g_free, g_free);
1599 file = fopen(RC_DIR "/locales", "r");
1600- if(file == NULL) {
1601+ if (file == NULL) {
1602 return;
1603 }
1604- while(fgets(buffer, sizeof(buffer), file) != NULL) {
1605+ while (fgets(buffer, sizeof(buffer), file) != NULL) {
1606 ret = g_strsplit(buffer, " ", 2);
1607- g_hash_table_insert(display_names, g_strdup(ret[0]), g_strdup(g_strchomp(ret[1])));
1608+ g_hash_table_insert(display_names, g_strdup(ret[0]),
1609+ g_strdup(g_strchomp(ret[1])));
1610 g_strfreev(ret);
1611 }
1612 fclose(file);
1613 }
1614
1615-static gchar * get_display_name(gchar * locale) {
1616- gchar * compare_to;
1617- char ** ret;
1618- gchar * result;
1619+static gchar *
1620+get_display_name(gchar * locale)
1621+{
1622+ gchar *compare_to;
1623+ char **ret;
1624+ gchar *result;
1625 ret = g_strsplit(locale, ".", 2);
1626 compare_to = g_strdup(ret[0]);
1627 g_strfreev(ret);
1628- if(compare_to == NULL) {
1629+ if (compare_to == NULL) {
1630 return g_strdup(locale);
1631 }
1632 result = g_hash_table_lookup(display_names, compare_to);
1633- if(result == NULL) {
1634+ if (result == NULL) {
1635 result = g_strdup(locale);
1636 }
1637 return result;
1638@@ -77,28 +83,36 @@
1639 * ldminfo_free
1640 * ldminfo struct freed
1641 */
1642-void ldminfo_free() {
1643+void
1644+ldminfo_free()
1645+{
1646 g_hash_table_destroy(ldminfo_hash);
1647 }
1648
1649 /*
1650 * ldminfo_lookup
1651 */
1652-ldminfo *ldminfo_lookup(gconstpointer key) {
1653+ldminfo *
1654+ldminfo_lookup(gconstpointer key)
1655+{
1656 return g_hash_table_lookup(ldminfo_hash, key);
1657 }
1658
1659 /*
1660 * ldminfo_size
1661 */
1662-int ldminfo_size() {
1663+int
1664+ldminfo_size()
1665+{
1666 return g_hash_table_size(ldminfo_hash);
1667 }
1668
1669 /*
1670 * ldminfo_init
1671 */
1672-void ldminfo_init(GList **host_list, const char *ldm_server) {
1673+void
1674+ldminfo_init(GList ** host_list, const char *ldm_server)
1675+{
1676 char **hosts_char = NULL;
1677 ldminfo *ldm_host_info = NULL;
1678 int i;
1679@@ -107,7 +121,7 @@
1680
1681 /* Static hash table */
1682 ldminfo_hash = g_hash_table_new_full(g_str_hash, g_str_equal,
1683- g_free, g_free);
1684+ g_free, g_free);
1685 hosts_char = g_strsplit(ldm_server, " ", -1);
1686
1687 for (i = 0; hosts_char != NULL && hosts_char[i] != NULL; i++) {
1688@@ -151,7 +165,9 @@
1689 * external script. This script will query ldminfo, perform ssh port testing,
1690 * etc. Things like nc -z hostname ssh, etc.
1691 */
1692-void _ldminfo_query_one(const char *hostname, ldminfo * ldm_host_info) {
1693+void
1694+_ldminfo_query_one(const char *hostname, ldminfo * ldm_host_info)
1695+{
1696 int filedes, numbytes;
1697 char buf[MAXBUFSIZE];
1698 char hostfile[BUFSIZ];
1699@@ -180,7 +196,9 @@
1700 /*
1701 * split string by line and then construct the ldm_host_info
1702 */
1703-void _ldminfo_parse_string(const char *s, ldminfo * ldm_host_info) {
1704+void
1705+_ldminfo_parse_string(const char *s, ldminfo * ldm_host_info)
1706+{
1707 char **lines = NULL;
1708 int i;
1709
1710@@ -193,26 +211,34 @@
1711 ldm_host_info->languages =
1712 g_list_append(ldm_host_info->languages, g_strdup(val[1]));
1713 ldm_host_info->language_names =
1714- g_list_append(ldm_host_info->language_names, get_display_name(val[1]));
1715+ g_list_append(ldm_host_info->language_names,
1716+ get_display_name(val[1]));
1717 g_strfreev(val);
1718- } else if (!g_ascii_strncasecmp(lines[i], "session:", 8) && !g_strstr_len(s, -1, "session-with-name")) {
1719+ } else if (!g_ascii_strncasecmp(lines[i], "session:", 8)
1720+ && !g_strstr_len(s, -1, "session-with-name")) {
1721 gchar **val;
1722 gchar *name;
1723 val = g_strsplit(lines[i], ":", 2);
1724 name = g_strrstr(val[1], "/");
1725- if(name) {
1726+ if (name) {
1727 name++;
1728 } else {
1729 name = val[1];
1730 }
1731- ldm_host_info->sessions = g_list_append(ldm_host_info->sessions, g_strdup(val[1]));
1732- ldm_host_info->session_names = g_list_append(ldm_host_info->session_names, g_strdup(name));
1733+ ldm_host_info->sessions =
1734+ g_list_append(ldm_host_info->sessions, g_strdup(val[1]));
1735+ ldm_host_info->session_names =
1736+ g_list_append(ldm_host_info->session_names,
1737+ g_strdup(name));
1738 g_strfreev(val);
1739 } else if (!g_ascii_strncasecmp(lines[i], "session-with-name:", 8)) {
1740 gchar **val;
1741 val = g_strsplit(lines[i], ":", 3);
1742- ldm_host_info->sessions = g_list_append(ldm_host_info->sessions, g_strdup(val[2]));
1743- ldm_host_info->session_names = g_list_append(ldm_host_info->session_names, g_strdup(val[1]));
1744+ ldm_host_info->sessions =
1745+ g_list_append(ldm_host_info->sessions, g_strdup(val[2]));
1746+ ldm_host_info->session_names =
1747+ g_list_append(ldm_host_info->session_names,
1748+ g_strdup(val[1]));
1749 g_strfreev(val);
1750 } else if (!g_ascii_strncasecmp(lines[i], "rating:", 7)) {
1751 gchar **val;
1752@@ -237,10 +263,12 @@
1753 * Return if env variable is set to true or false
1754 * name -- env. variable name
1755 */
1756-int ldm_getenv_bool(const char *name) {
1757+int
1758+ldm_getenv_bool(const char *name)
1759+{
1760 char *env = getenv(name);
1761
1762- if(env) {
1763+ if (env) {
1764 if (*env == 'y' || *env == 't' || *env == 'T' || *env == 'Y')
1765 return 1;
1766 }
1767@@ -251,10 +279,12 @@
1768 * ldm_getenv_int
1769 * Return an int, will return default_value if not set
1770 */
1771-int ldm_getenv_int(const char *name,int default_value) {
1772+int
1773+ldm_getenv_int(const char *name, int default_value)
1774+{
1775 char *env = getenv(name);
1776
1777- if(env) {
1778+ if (env) {
1779 return atoi(env);
1780 }
1781 return default_value;
1782
1783=== modified file 'src/ldmplugin.c'
1784--- src/ldmplugin.c 2012-08-21 14:33:07 +0000
1785+++ src/ldmplugin.c 2014-07-28 15:29:30 +0000
1786@@ -12,20 +12,24 @@
1787 #include "ldmgreetercomm.h"
1788 #include "logging.h"
1789
1790-GTree* plugin_list = NULL;
1791-gchar** plugin_names = NULL;
1792+GTree *plugin_list = NULL;
1793+gchar **plugin_names = NULL;
1794 static jmp_buf auth_jmp_buf;
1795-static gchar* current_plugin = NULL;
1796+static gchar *current_plugin = NULL;
1797
1798-static int g_strcmp(gconstpointer a, gconstpointer b) {
1799- return strcmp((char*)a, (char*)b);
1800+static int
1801+g_strcmp(gconstpointer a, gconstpointer b)
1802+{
1803+ return strcmp((char *) a, (char *) b);
1804 }
1805
1806 /*
1807 * set_current_plugin
1808 * Set current plugin name
1809 */
1810-void set_current_plugin(char *plug_name) {
1811+void
1812+set_current_plugin(char *plug_name)
1813+{
1814 current_plugin = plug_name;
1815 }
1816
1817@@ -33,9 +37,12 @@
1818 * ldm_start_plugin
1819 * Iterate over plugin_list and start plugin
1820 */
1821-void ldm_start_plugin() {
1822- LdmBackend *desc = (LdmBackend*) g_tree_lookup(plugin_list, current_plugin);
1823- if(desc->start_cb)
1824+void
1825+ldm_start_plugin()
1826+{
1827+ LdmBackend *desc =
1828+ (LdmBackend *) g_tree_lookup(plugin_list, current_plugin);
1829+ if (desc->start_cb)
1830 desc->start_cb();
1831 }
1832
1833@@ -43,9 +50,12 @@
1834 * ldm_close_plugin
1835 * Iterate over plugin_list and close plugin
1836 */
1837-void ldm_close_plugin() {
1838- LdmBackend *desc = (LdmBackend*) g_tree_lookup(plugin_list, current_plugin);
1839- if(desc->clean_cb)
1840+void
1841+ldm_close_plugin()
1842+{
1843+ LdmBackend *desc =
1844+ (LdmBackend *) g_tree_lookup(plugin_list, current_plugin);
1845+ if (desc->clean_cb)
1846 desc->clean_cb();
1847 }
1848
1849@@ -53,10 +63,13 @@
1850 * ldm_setup_plugin
1851 * Call setup callback function of plugin
1852 */
1853-void ldm_setup_plugin() {
1854- log_entry("ldm",7,"setting up plugin: %s", current_plugin);
1855- LdmBackend *desc = (LdmBackend*) g_tree_lookup(plugin_list, current_plugin);
1856- if(desc->init_cb)
1857+void
1858+ldm_setup_plugin()
1859+{
1860+ log_entry("ldm", 7, "setting up plugin: %s", current_plugin);
1861+ LdmBackend *desc =
1862+ (LdmBackend *) g_tree_lookup(plugin_list, current_plugin);
1863+ if (desc->init_cb)
1864 desc->init_cb();
1865 }
1866
1867@@ -64,10 +77,13 @@
1868 * ldm_guest_auth_plugin
1869 * Call setup guest authentication values of plugin
1870 */
1871-void ldm_guest_auth_plugin() {
1872- log_entry("ldm",7,"guest auth plugin: %s", current_plugin);
1873- LdmBackend *desc = (LdmBackend*) g_tree_lookup(plugin_list, current_plugin);
1874- if(desc->guest_cb)
1875+void
1876+ldm_guest_auth_plugin()
1877+{
1878+ log_entry("ldm", 7, "guest auth plugin: %s", current_plugin);
1879+ LdmBackend *desc =
1880+ (LdmBackend *) g_tree_lookup(plugin_list, current_plugin);
1881+ if (desc->guest_cb)
1882 desc->guest_cb();
1883 }
1884
1885@@ -76,8 +92,11 @@
1886 * Call auth callback function of plugin
1887 * Returns 0 on success, 1 otherwise
1888 */
1889-int ldm_auth_plugin() {
1890- LdmBackend *desc = (LdmBackend*) g_tree_lookup(plugin_list, current_plugin);
1891+int
1892+ldm_auth_plugin()
1893+{
1894+ LdmBackend *desc =
1895+ (LdmBackend *) g_tree_lookup(plugin_list, current_plugin);
1896
1897 if (desc->guest_cb)
1898 ask_greeter("allowguest true\n");
1899@@ -85,19 +104,19 @@
1900 ask_greeter("allowguest false\n");
1901
1902 switch (setjmp(auth_jmp_buf)) {
1903- case AUTH_EXC_NONE:
1904- if(desc->auth_cb)
1905- desc->auth_cb();
1906- return 0;
1907- case AUTH_EXC_RELOAD_BACKEND:
1908- ldm_close_plugin();
1909+ case AUTH_EXC_NONE:
1910+ if (desc->auth_cb)
1911+ desc->auth_cb();
1912+ return 0;
1913+ case AUTH_EXC_RELOAD_BACKEND:
1914+ ldm_close_plugin();
1915
1916- log_entry("ldm",7,"reloading backend");
1917- return 1;
1918- case AUTH_EXC_GUEST:
1919- if(desc->guest_cb)
1920- desc->guest_cb();
1921- return 0;
1922+ log_entry("ldm", 7, "reloading backend");
1923+ return 1;
1924+ case AUTH_EXC_GUEST:
1925+ if (desc->guest_cb)
1926+ desc->guest_cb();
1927+ return 0;
1928 }
1929 return 1;
1930 }
1931@@ -107,22 +126,23 @@
1932 * Init plugin function. Must be called at each plugin's init
1933 */
1934 void __attribute__ ((visibility("default")))
1935-ldm_init_plugin(LdmBackend* descriptor) {
1936- gchar** new_plugin_names;
1937+ ldm_init_plugin(LdmBackend * descriptor)
1938+{
1939+ gchar **new_plugin_names;
1940 int plugin_names_len;
1941
1942 plugin_names_len = g_strv_length(plugin_names);
1943 new_plugin_names = g_realloc(plugin_names,
1944- (plugin_names_len+1)*sizeof(gchar*));
1945+ (plugin_names_len + 1) * sizeof(gchar *));
1946 if (new_plugin_names != plugin_names) {
1947 g_free(plugin_names);
1948 plugin_names = new_plugin_names;
1949 }
1950 plugin_names[plugin_names_len] = g_strdup(descriptor->name);
1951- plugin_names[plugin_names_len+1] = NULL;
1952+ plugin_names[plugin_names_len + 1] = NULL;
1953
1954 g_tree_replace(plugin_list, descriptor->name, descriptor);
1955- log_entry("ldm",7,"%s initialized", descriptor->name);
1956+ log_entry("ldm", 7, "%s initialized", descriptor->name);
1957 }
1958
1959 /*
1960@@ -130,45 +150,53 @@
1961 * open plugin's lib
1962 * path -- plugin path
1963 */
1964-void _load_plugin(const char *path) {
1965+void
1966+_load_plugin(const char *path)
1967+{
1968 void *handle = dlopen(path, RTLD_LAZY);
1969 if (handle) {
1970- log_entry("ldm",7,"loaded %s", path);
1971+ log_entry("ldm", 7, "loaded %s", path);
1972 return;
1973 }
1974
1975- log_entry("ldm",4,"%s: Invalid LDM plugin %s", dlerror(), path);
1976+ log_entry("ldm", 4, "%s: Invalid LDM plugin %s", dlerror(), path);
1977 }
1978
1979 /*
1980 * ldm_load_plugins
1981 * Load all plugins at LDM_PLUG_DIR
1982 */
1983-int ldm_load_plugins() {
1984+int
1985+ldm_load_plugins()
1986+{
1987 plugin_list = g_tree_new(g_strcmp);
1988 g_tree_ref(plugin_list);
1989- plugin_names = g_malloc0(sizeof(gchar*));
1990+ plugin_names = g_malloc0(sizeof(gchar *));
1991
1992- DIR* plugin_dir = opendir(LDM_PLUG_DIR);
1993+ DIR *plugin_dir = opendir(LDM_PLUG_DIR);
1994
1995 if (!plugin_dir) {
1996- log_entry("ldm",3,"unable to open plugin dir: %s", LDM_PLUG_DIR);
1997+ log_entry("ldm", 3, "unable to open plugin dir: %s", LDM_PLUG_DIR);
1998 return 1;
1999 }
2000- struct dirent* entry;
2001- while ( (entry = readdir(plugin_dir)) ) {
2002- if ((entry->d_type == DT_REG || entry->d_type == DT_UNKNOWN) && (strstr(entry->d_name, ".so") != NULL)) {
2003- int name_len = strlen(entry->d_name)+strlen(LDM_PLUG_DIR)+2;
2004- char* plug_name = (char *) malloc(name_len);
2005- snprintf(plug_name, name_len, "%s/%s", LDM_PLUG_DIR, entry->d_name);
2006- log_entry("ldm",7,"loading: %s", plug_name);
2007+ struct dirent *entry;
2008+ while ((entry = readdir(plugin_dir))) {
2009+ if ((entry->d_type == DT_REG || entry->d_type == DT_UNKNOWN)
2010+ && (strstr(entry->d_name, ".so") != NULL)) {
2011+ int name_len =
2012+ strlen(entry->d_name) + strlen(LDM_PLUG_DIR) + 2;
2013+ char *plug_name = (char *) malloc(name_len);
2014+ snprintf(plug_name, name_len, "%s/%s", LDM_PLUG_DIR,
2015+ entry->d_name);
2016+ log_entry("ldm", 7, "loading: %s", plug_name);
2017
2018 _load_plugin(plug_name);
2019 free(plug_name);
2020 }
2021 }
2022
2023- if (errno) perror(strerror(errno));
2024+ if (errno)
2025+ perror(strerror(errno));
2026 closedir(plugin_dir);
2027 return 0;
2028 }
2029@@ -178,11 +206,14 @@
2030 * Will unwind the stack up to the frame above the callback and handle the
2031 * error before retrying.
2032 */
2033-void ldm_raise_auth_except(LdmAuthException n) {
2034+void
2035+ldm_raise_auth_except(LdmAuthException n)
2036+{
2037 longjmp(auth_jmp_buf, n);
2038 }
2039
2040-gchar** ldm_get_plugins() {
2041+gchar **
2042+ldm_get_plugins()
2043+{
2044 return plugin_names;
2045 }
2046-
2047
2048=== modified file 'src/ldmutils.c'
2049--- src/ldmutils.c 2012-08-21 14:33:07 +0000
2050+++ src/ldmutils.c 2014-07-28 15:29:30 +0000
2051@@ -21,11 +21,14 @@
2052 *
2053 * Run startup commands.
2054 */
2055-void rc_files(char *action) {
2056+void
2057+rc_files(char *action)
2058+{
2059 GPid rcpid;
2060 gchar *command;
2061
2062- command = g_strjoin(" ", "/bin/sh", RC_DIR "/ldm-script", action, NULL);
2063+ command =
2064+ g_strjoin(" ", "/bin/sh", RC_DIR "/ldm-script", action, NULL);
2065
2066 rcpid = ldm_spawn(command, NULL, NULL, NULL);
2067
2068@@ -37,10 +40,12 @@
2069 * get_ipaddr
2070 * Get ip address of host
2071 */
2072-void get_ipaddr() {
2073+void
2074+get_ipaddr()
2075+{
2076 int numreqs = 10;
2077 struct ifconf ifc;
2078- struct ifreq *ifr; /* netdevice(7) */
2079+ struct ifreq *ifr; /* netdevice(7) */
2080 struct ifreq info;
2081 struct sockaddr_in *sa;
2082
2083@@ -48,7 +53,7 @@
2084
2085 skfd = socket(PF_INET, SOCK_DGRAM, IPPROTO_IP);
2086 if (skfd < 0)
2087- die("ldm","socket");
2088+ die("ldm", "socket");
2089
2090 /*
2091 * Get a list of all the interfaces.
2092@@ -58,16 +63,16 @@
2093
2094 while (TRUE) {
2095 ifc.ifc_len = sizeof(struct ifreq) * numreqs;
2096- ifc.ifc_buf = (char *)realloc(ifc.ifc_buf, ifc.ifc_len);
2097+ ifc.ifc_buf = (char *) realloc(ifc.ifc_buf, ifc.ifc_len);
2098 if (ifc.ifc_buf == NULL)
2099- die("ldm","out of memory");
2100+ die("ldm", "out of memory");
2101
2102 if (ioctl(skfd, SIOCGIFCONF, &ifc) < 0) {
2103- log_entry("ldm",4,"SIOCGIFCONF");
2104+ log_entry("ldm", 4, "SIOCGIFCONF");
2105 goto out;
2106 }
2107
2108- if (ifc.ifc_len == (int)sizeof(struct ifreq) * numreqs){
2109+ if (ifc.ifc_len == (int) sizeof(struct ifreq) * numreqs) {
2110 /* assume it overflowed and try again */
2111 numreqs += 10;
2112 continue;
2113@@ -88,7 +93,7 @@
2114
2115 strcpy(info.ifr_name, ifr->ifr_name);
2116 if (ioctl(skfd, SIOCGIFFLAGS, &info) < 0) {
2117- log_entry("ldm",4,"SIOCGIFFLAGS");
2118+ log_entry("ldm", 4, "SIOCGIFFLAGS");
2119 goto out;
2120 }
2121
2122@@ -101,12 +106,12 @@
2123 ifr++;
2124 }
2125
2126-out:
2127+ out:
2128 if (ifc.ifc_buf)
2129 free(ifc.ifc_buf);
2130
2131 if (n == ifc.ifc_len)
2132- die("ldm","no configured interface found");
2133+ die("ldm", "no configured interface found");
2134 }
2135
2136 /*
2137@@ -114,37 +119,40 @@
2138 *
2139 * Execute commands. Prints nice error message if failure.
2140 */
2141-GPid ldm_spawn(gchar *command, gint *rfd, gint *wfd, GSpawnChildSetupFunc setup) {
2142+GPid
2143+ldm_spawn(gchar * command, gint * rfd, gint * wfd,
2144+ GSpawnChildSetupFunc setup)
2145+{
2146 GPid pid;
2147 GError *error = NULL;
2148 GSpawnFlags flags = G_SPAWN_SEARCH_PATH | G_SPAWN_DO_NOT_REAP_CHILD;
2149 gint argc;
2150 gchar **argv = NULL;
2151
2152- g_shell_parse_argv (command, &argc, &argv, NULL);
2153+ g_shell_parse_argv(command, &argc, &argv, NULL);
2154
2155 if (!wfd)
2156 flags |= G_SPAWN_STDOUT_TO_DEV_NULL;
2157
2158- g_spawn_async_with_pipes (
2159- NULL, /* Working directory: inherit */
2160- argv, /* Arguments, null term */
2161- NULL, /* Environment, inherit from parent */
2162- flags, /* Flags, set above */
2163- setup, /* Child setup function: passed to us */
2164- NULL, /* No user data */
2165- &pid, /* child pid */
2166- wfd, /* Pointer to in file descriptor */
2167- rfd, /* Pointer to out file descriptor */
2168- NULL, /* No stderr */
2169- &error); /* GError handler */
2170+ g_spawn_async_with_pipes(NULL, /* Working directory: inherit */
2171+ argv, /* Arguments, null term */
2172+ NULL, /* Environment, inherit from parent */
2173+ flags, /* Flags, set above */
2174+ setup, /* Child setup function: passed to us */
2175+ NULL, /* No user data */
2176+ &pid, /* child pid */
2177+ wfd, /* Pointer to in file descriptor */
2178+ rfd, /* Pointer to out file descriptor */
2179+ NULL, /* No stderr */
2180+ &error); /* GError handler */
2181
2182 g_strfreev(argv);
2183
2184 if (error) {
2185- log_entry("ldm",3,"ldm_spawn failed to execute: %s", error->message);
2186+ log_entry("ldm", 3, "ldm_spawn failed to execute: %s",
2187+ error->message);
2188 } else {
2189- log_entry("ldm",7,"ldm_spawn: pid = %d", pid);
2190+ log_entry("ldm", 7, "ldm_spawn: pid = %d", pid);
2191 }
2192
2193 return pid;
2194@@ -157,7 +165,9 @@
2195 * since we wait for things to happen in order via
2196 * ldm_wait
2197 */
2198-void handle_sigchld(int signo) {
2199+void
2200+handle_sigchld(int signo)
2201+{
2202 /* do nothing */
2203 child_exited = TRUE;
2204 }
2205@@ -167,17 +177,20 @@
2206 *
2207 * wait for child process
2208 */
2209-void ldm_wait(GPid pid) {
2210+void
2211+ldm_wait(GPid pid)
2212+{
2213 siginfo_t info;
2214- log_entry("ldm",7,"waiting for process: %d", pid);
2215+ log_entry("ldm", 7, "waiting for process: %d", pid);
2216 do {
2217 int res;
2218- res = waitid (P_PID, pid, &info, WEXITED | WSTOPPED);
2219+ res = waitid(P_PID, pid, &info, WEXITED | WSTOPPED);
2220 if (res == -1) {
2221 int temp;
2222 temp = errno;
2223- log_entry("ldm",4,"waitid returned an error: %s", strerror(errno));
2224- if(temp == ECHILD) {
2225+ log_entry("ldm", 4, "waitid returned an error: %s",
2226+ strerror(errno));
2227+ if (temp == ECHILD) {
2228 break;
2229 }
2230 } else {
2231@@ -188,19 +201,20 @@
2232 */
2233 break;
2234 } else {
2235- log_entry("ldm",4,"unexpected terminated process, pid: %d",
2236- info.si_pid);
2237+ log_entry("ldm", 4,
2238+ "unexpected terminated process, pid: %d",
2239+ info.si_pid);
2240 unexpected_child = TRUE;
2241 }
2242 }
2243 } while (TRUE);
2244
2245 if (info.si_code == CLD_EXITED) {
2246- log_entry("ldm",7,"process %d exited with status %d", info.si_pid,
2247- WEXITSTATUS(info.si_status));
2248+ log_entry("ldm", 7, "process %d exited with status %d",
2249+ info.si_pid, WEXITSTATUS(info.si_status));
2250 } else if (info.si_code == CLD_KILLED) {
2251- log_entry("ldm",7,"process %d killed by signal %d", info.si_pid,
2252- info.si_status);
2253+ log_entry("ldm", 7, "process %d killed by signal %d", info.si_pid,
2254+ info.si_status);
2255 }
2256 }
2257
2258@@ -208,16 +222,17 @@
2259 * close_wm
2260 * Close window manager by SIGKILL
2261 */
2262-void close_wm() {
2263+void
2264+close_wm()
2265+{
2266 if (!(ldm.wmpid)) {
2267 return;
2268 }
2269
2270- log_entry("ldm",7,"closing window manager");
2271+ log_entry("ldm", 7, "closing window manager");
2272 if (kill(ldm.wmpid, SIGKILL) < 0) {
2273- log_entry("ldm",3,"sending SIGKILL to window manager failed");
2274+ log_entry("ldm", 3, "sending SIGKILL to window manager failed");
2275 }
2276 ldm_wait(ldm.wmpid);
2277 ldm.wmpid = 0;
2278 }
2279-
2280
2281=== modified file 'src/logging.c'
2282--- src/logging.c 2012-08-21 14:33:07 +0000
2283+++ src/logging.c 2014-07-28 15:29:30 +0000
2284@@ -30,7 +30,9 @@
2285
2286 FILE *logfile = NULL;
2287 char *LOG_LEVEL_NAMES[] = { "EMERGENCY", "ALERT", "CRITICAL", "ERROR",
2288- "WARNING", "NOTICE", "INFO", "DEBUG" };
2289+ "WARNING", "NOTICE", "INFO", "DEBUG"
2290+};
2291+
2292 int loglevel = 0;
2293
2294 /*
2295@@ -39,24 +41,24 @@
2296 * Open log. Will log locally or back to the server based upon
2297 * the boolean LDM_SYSLOG.
2298 */
2299-void log_init(int syslog, int level) {
2300+void
2301+log_init(int syslog, int level)
2302+{
2303 if (level < 0 || level > 7) {
2304 loglevel = LOGLEVEL;
2305- }
2306- else {
2307+ } else {
2308 loglevel = level;
2309 }
2310
2311 if (syslog) {
2312 openlog("ldm", LOG_PID | LOG_NOWAIT, LOG_DAEMON);
2313- }
2314- else {
2315+ } else {
2316 logfile = fopen(LOGFILE, "a");
2317 if (!logfile) {
2318 fprintf(stderr, "Couldn't open logfile " LOGFILE "\n");
2319 exit(1);
2320 }
2321- setbuf(logfile, NULL); /* unbuffered writes to the log file */
2322+ setbuf(logfile, NULL); /* unbuffered writes to the log file */
2323 }
2324 }
2325
2326@@ -64,7 +66,9 @@
2327 * log_close
2328 * Close logging and clean exit
2329 */
2330-void log_close() {
2331+void
2332+log_close()
2333+{
2334 if (logfile)
2335 fclose(logfile);
2336 else
2337@@ -75,7 +79,9 @@
2338 /*
2339 * log_entry: log messages to file or syslog
2340 */
2341-void log_entry(char *component, int level, const char *format, ...) {
2342+void
2343+log_entry(char *component, int level, const char *format, ...)
2344+{
2345 if (level < 0 || level > 7 || level > loglevel)
2346 return;
2347
2348@@ -91,7 +97,8 @@
2349 ptr = localtime(&lt);
2350 strftime(timestr, sizeof(timestr), "%b %e %H:%M:%S", ptr);
2351
2352- fprintf(logfile, "%s: [%s] %s: ", timestr, component, LOG_LEVEL_NAMES[level]);
2353+ fprintf(logfile, "%s: [%s] %s: ", timestr, component,
2354+ LOG_LEVEL_NAMES[level]);
2355 vfprintf(logfile, format, ap);
2356 fprintf(logfile, "\n");
2357 } else {
2358@@ -107,7 +114,9 @@
2359 * Shut things down gracefully if we can
2360 * msg -- log message
2361 */
2362-void die(char *component, const char *format, ...) {
2363+void
2364+die(char *component, const char *format, ...)
2365+{
2366 va_list ap;
2367 va_start(ap, format);
2368
2369
2370=== modified file 'src/plugin.c'
2371--- src/plugin.c 2012-08-21 14:33:07 +0000
2372+++ src/plugin.c 2014-07-28 15:29:30 +0000
2373@@ -14,7 +14,9 @@
2374 * get_userid
2375 * Ask the greeter to check autologin or get username
2376 */
2377-void get_userid(gchar **username) {
2378+void
2379+get_userid(gchar ** username)
2380+{
2381 gchar *cmd;
2382
2383 cmd = g_strconcat("prompt <b>", _("Username"), "</b>\nuserid\n", NULL);
2384@@ -26,26 +28,33 @@
2385 /*
2386 * get_passwd
2387 */
2388-void get_passwd(gchar **password) {
2389+void
2390+get_passwd(gchar ** password)
2391+{
2392 gchar *cmd;
2393
2394- cmd = g_strconcat("prompts <b>", _("Password"), "</b>\npasswd\n", NULL);
2395- *password = (gchar*) ask_value_greeter(cmd);
2396+ cmd =
2397+ g_strconcat("prompts <b>", _("Password"), "</b>\npasswd\n", NULL);
2398+ *password = (gchar *) ask_value_greeter(cmd);
2399
2400- set_message(g_strconcat("<b>", _("Verifying password. Please wait."), "</b>", NULL));
2401+ set_message(g_strconcat
2402+ ("<b>", _("Verifying password. Please wait."), "</b>",
2403+ NULL));
2404 g_free(cmd);
2405 }
2406
2407 /*
2408 * get_host
2409 */
2410-void get_host(gchar **server) {
2411+void
2412+get_host(gchar ** server)
2413+{
2414 gchar *cmd = "hostname\n";
2415 gchar *host;
2416
2417- host = (gchar*) ask_value_greeter(cmd);
2418- if(g_ascii_strncasecmp(host, "None", 4)) {
2419- if(*server)
2420+ host = (gchar *) ask_value_greeter(cmd);
2421+ if (g_ascii_strncasecmp(host, "None", 4)) {
2422+ if (*server)
2423 g_free(*server);
2424 *server = host;
2425 }
2426@@ -54,14 +63,16 @@
2427 /*
2428 * get_language
2429 */
2430-void get_language(gchar **language) {
2431+void
2432+get_language(gchar ** language)
2433+{
2434 gchar *cmd = "language\n";
2435 gchar *lang;
2436
2437- lang = (gchar*) ask_value_greeter(cmd);
2438+ lang = (gchar *) ask_value_greeter(cmd);
2439
2440- if(g_ascii_strncasecmp(lang, "None", 4)) {
2441- if(*language)
2442+ if (g_ascii_strncasecmp(lang, "None", 4)) {
2443+ if (*language)
2444 g_free(*language);
2445 *language = lang;
2446 setenv("LDM_LANGUAGE", lang, 1);
2447@@ -71,11 +82,13 @@
2448 /*
2449 * get_session
2450 */
2451-void get_session(gchar **session) {
2452+void
2453+get_session(gchar ** session)
2454+{
2455 gchar *cmd = "session\n";
2456 gchar *sess;
2457
2458- sess = (gchar*) ask_value_greeter(cmd);
2459+ sess = (gchar *) ask_value_greeter(cmd);
2460
2461 if (g_ascii_strncasecmp(sess, "None", 4)) {
2462 if (*session)
2463@@ -89,19 +102,23 @@
2464 *
2465 * Return to variable xsession the LDM_XSESSION info
2466 */
2467-void __attribute__ ((visibility("default"))) get_Xsession(gchar **xsession, gconstpointer server) {
2468+void __attribute__ ((visibility("default"))) get_Xsession(gchar **
2469+ xsession,
2470+ gconstpointer
2471+ server)
2472+{
2473 ldminfo *curr_host = NULL;
2474 gchar *tmp_xsess = NULL;
2475 tmp_xsess = g_strdup(getenv("LDM_XSESSION"));
2476
2477 if (!tmp_xsess || strlen(tmp_xsess) == 0) {
2478 curr_host = ldminfo_lookup(server);
2479- if(curr_host) {
2480+ if (curr_host) {
2481 tmp_xsess = curr_host->xsession;
2482 if (!tmp_xsess || strlen(tmp_xsess) == 0) {
2483 tmp_xsess = g_strdup(getenv("LDM_DEFAULT_XSESSION"));
2484 if (!tmp_xsess || strlen(tmp_xsess) == 0)
2485- die("ldm","no Xsession");
2486+ die("ldm", "no Xsession");
2487 }
2488 }
2489 }
2490@@ -115,13 +132,21 @@
2491 * Set LDM_SESSION and LDM_XSESSION env variable with param
2492 * Then run xsession script
2493 */
2494-void __attribute__ ((visibility("default"))) set_session_env(gchar *xsession, gchar *session) {
2495- if (g_strcmp0(session,"default") != 0 || getenv("LDM_SESSION") == NULL) {
2496- log_entry("ldm",7,"Export LDM_SELECTED_SESSION to environment: \"%s\"", session);
2497+void __attribute__ ((visibility("default"))) set_session_env(gchar *
2498+ xsession,
2499+ gchar *
2500+ session)
2501+{
2502+ if (g_strcmp0(session, "default") != 0
2503+ || getenv("LDM_SESSION") == NULL) {
2504+ log_entry("ldm", 7,
2505+ "Export LDM_SELECTED_SESSION to environment: \"%s\"",
2506+ session);
2507 setenv("LDM_SELECTED_SESSION", session, 1);
2508- }
2509- else {
2510- log_entry("ldm",7,"Using existing LDM_SESSION from environment: \"%s\"", getenv("LDM_SESSION"));
2511+ } else {
2512+ log_entry("ldm", 7,
2513+ "Using existing LDM_SESSION from environment: \"%s\"",
2514+ getenv("LDM_SESSION"));
2515 }
2516
2517 setenv("LDM_XSESSION", xsession, 1);
2518@@ -134,19 +159,23 @@
2519 * get_ltsp_cfg
2520 * Check for LTSP-Cluster. If true, contact loadbalancer for an IP
2521 */
2522-void __attribute__ ((visibility("default"))) get_ltsp_cfg(gchar **server) {
2523+void __attribute__ ((visibility("default"))) get_ltsp_cfg(gchar ** server)
2524+{
2525 /* Check for LTSP-Cluster, if true, contact the loadbalancer for an IP */
2526 if (access(LTSP_CLUSTER_CONFILE, F_OK) == 0) {
2527 FILE *fp;
2528 fp = popen("getltscfg-cluster -l ldm", "r");
2529 if (fp != NULL) {
2530- log_entry("ltsp-cluster",6,"IP before load-balancing: %s", *server);
2531+ log_entry("ltsp-cluster", 6, "IP before load-balancing: %s",
2532+ *server);
2533 if (fgets(*server, PATH_MAX, fp) == NULL)
2534- log_entry("ltsp-cluster",4,"failed to get an IP from the load-balancer");
2535+ log_entry("ltsp-cluster", 4,
2536+ "failed to get an IP from the load-balancer");
2537
2538- log_entry("ltsp-cluster",6,"IP after loadbalancing: %s", *server);
2539+ log_entry("ltsp-cluster", 6, "IP after loadbalancing: %s",
2540+ *server);
2541 }
2542 if (pclose(fp) == -1)
2543- log_entry("ltsp-cluster",3,"load-balancing failed");
2544+ log_entry("ltsp-cluster", 3, "load-balancing failed");
2545 }
2546 }
2547
2548=== modified file 'src/plugins/rdesktop/rdesktop.c'
2549--- src/plugins/rdesktop/rdesktop.c 2012-08-21 14:33:07 +0000
2550+++ src/plugins/rdesktop/rdesktop.c 2014-07-28 15:29:30 +0000
2551@@ -22,8 +22,9 @@
2552 LdmBackend *descriptor;
2553 RdpInfo *rdpinfo;
2554
2555-void __attribute__((constructor)) initialize() {
2556- descriptor = (LdmBackend*) malloc(sizeof(LdmBackend));
2557+void __attribute__ ((constructor)) initialize()
2558+{
2559+ descriptor = (LdmBackend *) malloc(sizeof(LdmBackend));
2560 bzero(descriptor, sizeof(LdmBackend));
2561
2562 descriptor->name = "rdesktop";
2563@@ -39,8 +40,10 @@
2564 * init_rdesktop
2565 * Callback function for initialization
2566 */
2567-void init_rdesktop() {
2568- rdpinfo = (RdpInfo*) malloc(sizeof(RdpInfo));
2569+void
2570+init_rdesktop()
2571+{
2572+ rdpinfo = (RdpInfo *) malloc(sizeof(RdpInfo));
2573 bzero(rdpinfo, sizeof(RdpInfo));
2574
2575 /* Get ENV value */
2576@@ -52,46 +55,51 @@
2577 * start_rdesktop
2578 * Callback function for starting rdesktop session
2579 */
2580-void start_rdesktop() {
2581+void
2582+start_rdesktop()
2583+{
2584 gboolean error = FALSE;
2585
2586 /* Variable validation */
2587- if(!rdpinfo->username) {
2588- log_entry("rdesktop",3,"no username");
2589- error = TRUE;
2590- }
2591-
2592- if(!rdpinfo->password) {
2593- log_entry("rdesktop",3,"no password");
2594- error = TRUE;
2595- }
2596-
2597- if(!rdpinfo->server) {
2598- log_entry("rdesktop",3,"no server");
2599- error = TRUE;
2600- }
2601-
2602- if(!rdpinfo->domain) {
2603- log_entry("rdesktop",3,"no domain");
2604- error = TRUE;
2605- }
2606-
2607- if(error) {
2608- die("rdesktop","missing mandatory information");
2609+ if (!rdpinfo->username) {
2610+ log_entry("rdesktop", 3, "no username");
2611+ error = TRUE;
2612+ }
2613+
2614+ if (!rdpinfo->password) {
2615+ log_entry("rdesktop", 3, "no password");
2616+ error = TRUE;
2617+ }
2618+
2619+ if (!rdpinfo->server) {
2620+ log_entry("rdesktop", 3, "no server");
2621+ error = TRUE;
2622+ }
2623+
2624+ if (!rdpinfo->domain) {
2625+ log_entry("rdesktop", 3, "no domain");
2626+ error = TRUE;
2627+ }
2628+
2629+ if (error) {
2630+ die("rdesktop", "missing mandatory information");
2631 }
2632
2633 /* Greeter not needed anymore */
2634 close_greeter();
2635
2636- log_entry("rdesktop",6,"starting rdesktop session to '%s' as '%s'", rdpinfo->server, rdpinfo->username);
2637+ log_entry("rdesktop", 6, "starting rdesktop session to '%s' as '%s'",
2638+ rdpinfo->server, rdpinfo->username);
2639 rdesktop_session();
2640- log_entry("rdesktop",6,"closing rdesktop session");
2641+ log_entry("rdesktop", 6, "closing rdesktop session");
2642 }
2643
2644 /*
2645 * _get_domain
2646 */
2647-void _get_domain() {
2648+void
2649+_get_domain()
2650+{
2651 gchar *cmd = "value domain\n";
2652
2653 rdpinfo->domain = ask_value_greeter(cmd);
2654@@ -101,17 +109,23 @@
2655 * auth_rdesktop
2656 * Callback function for authentication
2657 */
2658-void auth_rdesktop() {
2659+void
2660+auth_rdesktop()
2661+{
2662 gchar *cmd;
2663
2664 /* Separator for domains : '|' */
2665 gchar *domains = getenv("RDP_DOMAIN");
2666- cmd = g_strconcat("pref choice;domain;Domain;Select Domai_n ...;session;", domains, "\n", NULL);
2667+ cmd =
2668+ g_strconcat
2669+ ("pref choice;domain;Domain;Select Domai_n ...;session;", domains,
2670+ "\n", NULL);
2671 if (domains) {
2672- if(ask_greeter(cmd))
2673+ if (ask_greeter(cmd))
2674 die("rdesktop", "%s from greeter failed", cmd);
2675 } else {
2676- log_entry("rdesktop",7,"RDP_DOMAIN isn't defined, rdesktop will connect on default domain");
2677+ log_entry("rdesktop", 7,
2678+ "RDP_DOMAIN isn't defined, rdesktop will connect on default domain");
2679 }
2680
2681 /* Ask for UserID */
2682@@ -121,7 +135,7 @@
2683 get_passwd(&(rdpinfo->password));
2684
2685 /* Get hostname */
2686- if(!rdpinfo->server)
2687+ if (!rdpinfo->server)
2688 get_host(&(rdpinfo->server));
2689
2690 /* Get Domain (rdesktop plugin specific) */
2691@@ -137,8 +151,10 @@
2692 * close_rdesktop
2693 * Callback function for closing the plugins
2694 */
2695-void close_rdesktop() {
2696- log_entry("rdesktop",7,"closing rdesktop session");
2697+void
2698+close_rdesktop()
2699+{
2700+ log_entry("rdesktop", 7, "closing rdesktop session");
2701 free(rdpinfo);
2702 }
2703
2704@@ -146,17 +162,18 @@
2705 * rdesktop_session
2706 * Start a rdesktop session to server
2707 */
2708-void rdesktop_session() {
2709+void
2710+rdesktop_session()
2711+{
2712 gchar *cmd;
2713
2714 cmd = g_strjoin(" ", "rdesktop", "-f",
2715- "-u", rdpinfo->username,
2716- "-p", rdpinfo->password, NULL);
2717+ "-u", rdpinfo->username,
2718+ "-p", rdpinfo->password, NULL);
2719
2720 /* Only append the domain if it's set */
2721- if (g_strcmp0(rdpinfo->domain,"None") != 0) {
2722- cmd = g_strjoin(" ", cmd,
2723- "-d", rdpinfo->domain, NULL);
2724+ if (g_strcmp0(rdpinfo->domain, "None") != 0) {
2725+ cmd = g_strjoin(" ", cmd, "-d", rdpinfo->domain, NULL);
2726 }
2727
2728 /* If we have custom options, append them */
2729
2730=== modified file 'src/plugins/ssh/ssh.c'
2731--- src/plugins/ssh/ssh.c 2013-02-27 08:55:18 +0000
2732+++ src/plugins/ssh/ssh.c 2014-07-28 15:29:30 +0000
2733@@ -32,8 +32,9 @@
2734 LdmBackend *descriptor;
2735 SSHInfo *sshinfo;
2736
2737-void __attribute__((constructor)) initialize() {
2738- descriptor = (LdmBackend*) malloc(sizeof(LdmBackend));
2739+void __attribute__ ((constructor)) initialize()
2740+{
2741+ descriptor = (LdmBackend *) malloc(sizeof(LdmBackend));
2742 bzero(descriptor, sizeof(LdmBackend));
2743
2744 descriptor->name = "ssh";
2745@@ -50,8 +51,10 @@
2746 * init_ssh
2747 * Callback function for initialization
2748 */
2749-void init_ssh() {
2750- sshinfo = (SSHInfo*) malloc(sizeof(SSHInfo));
2751+void
2752+init_ssh()
2753+{
2754+ sshinfo = (SSHInfo *) malloc(sizeof(SSHInfo));
2755 bzero(sshinfo, sizeof(SSHInfo));
2756
2757 /* Get ENV Variables */
2758@@ -63,22 +66,24 @@
2759 * start_ssh
2760 * Start ssh session
2761 */
2762-void start_ssh() {
2763+void
2764+start_ssh()
2765+{
2766 gboolean error = FALSE;
2767
2768 /* Variable validation */
2769 if (!(sshinfo->username)) {
2770- log_entry("ssh",3,"no username");
2771+ log_entry("ssh", 3, "no username");
2772 error = TRUE;
2773 }
2774
2775 if (!(sshinfo->password)) {
2776- log_entry("ssh",3,"no password");
2777+ log_entry("ssh", 3, "no password");
2778 error = TRUE;
2779 }
2780
2781 if (!(sshinfo->server)) {
2782- log_entry("ssh",3,"no server");
2783+ log_entry("ssh", 3, "no server");
2784 error = TRUE;
2785 }
2786
2787@@ -86,7 +91,7 @@
2788 sshinfo->session = g_strdup("default");
2789
2790 if (error) {
2791- die("ssh","missing mandatory information");
2792+ die("ssh", "missing mandatory information");
2793 }
2794
2795 /* Getting Xsession */
2796@@ -99,25 +104,28 @@
2797 * If we run multiple ldm sessions on multiply vty's we need separate
2798 * control sockets.
2799 */
2800- sshinfo->ctl_socket = g_strdup_printf("/var/run/ldm_socket_%d_%s", ldm.pid, sshinfo->server);
2801+ sshinfo->ctl_socket =
2802+ g_strdup_printf("/var/run/ldm_socket_%d_%s", ldm.pid,
2803+ sshinfo->server);
2804
2805 /* Setting ENV variables for plugin */
2806 _set_env();
2807
2808 /* Execute any rc files */
2809- log_entry("ssh",6,"calling rc.d pressh scripts");
2810+ log_entry("ssh", 6, "calling rc.d pressh scripts");
2811 rc_files("pressh");
2812
2813 ssh_session();
2814- log_entry("ssh",6,"established ssh session on '%s' as '%s'",sshinfo->server,sshinfo->username);
2815+ log_entry("ssh", 6, "established ssh session on '%s' as '%s'",
2816+ sshinfo->server, sshinfo->username);
2817
2818 /* Greeter not needed anymore */
2819 close_greeter();
2820
2821- log_entry("ssh",6,"calling rc.d start scripts");
2822- rc_files("start"); /* Execute any rc files */
2823+ log_entry("ssh", 6, "calling rc.d start scripts");
2824+ rc_files("start"); /* Execute any rc files */
2825
2826- log_entry("ssh",6,"starting X session");
2827+ log_entry("ssh", 6, "starting X session");
2828 set_session_env(sshinfo->xsession, sshinfo->session);
2829 }
2830
2831@@ -125,8 +133,10 @@
2832 * get_guest
2833 * Callback function for setting guest login
2834 */
2835-void get_guest() {
2836- log_entry("ssh",6,"setting guest login");
2837+void
2838+get_guest()
2839+{
2840+ log_entry("ssh", 6, "setting guest login");
2841
2842 /* Get credentials */
2843 g_free(sshinfo->username);
2844@@ -178,11 +188,11 @@
2845 good = FALSE;
2846 if (sshinfo->server) {
2847 i = 0;
2848- while(1) {
2849- if(hosts_char[i] == NULL) {
2850+ while (1) {
2851+ if (hosts_char[i] == NULL) {
2852 break;
2853 }
2854- if(!g_strcmp0(hosts_char[i], sshinfo->server)) {
2855+ if (!g_strcmp0(hosts_char[i], sshinfo->server)) {
2856 good = TRUE;
2857 break;
2858 }
2859@@ -203,7 +213,9 @@
2860 * _set_env
2861 * Set environment variables used by LDM and Greeter
2862 */
2863-void _set_env() {
2864+void
2865+_set_env()
2866+{
2867 setenv("LDM_SERVER", sshinfo->server, 1);
2868 setenv("LDM_USERNAME", sshinfo->username, 1);
2869 setenv("LDM_SOCKET", sshinfo->ctl_socket, 1);
2870@@ -213,7 +225,9 @@
2871 * get_auth
2872 * Callback function for authentication
2873 */
2874-void get_auth() {
2875+void
2876+get_auth()
2877+{
2878 /* Get UserID */
2879 get_userid(&(sshinfo->username));
2880
2881@@ -234,8 +248,10 @@
2882 * close_ssh
2883 * Callback function for closing the plugins
2884 */
2885-void close_ssh() {
2886- log_entry("ssh",7,"closing ssh session");
2887+void
2888+close_ssh()
2889+{
2890+ log_entry("ssh", 7, "closing ssh session");
2891 ssh_endsession();
2892
2893 // leave no crumbs and free memory allocated for auth values
2894@@ -247,7 +263,9 @@
2895 free(sshinfo);
2896 }
2897
2898-int expect(int fd, char *p, int seconds, ...) {
2899+int
2900+expect(int fd, char *p, int seconds, ...)
2901+{
2902 fd_set set;
2903 struct timeval timeout;
2904 int i, st;
2905@@ -281,8 +299,8 @@
2906 * Main loop.
2907 */
2908
2909- while(1) {
2910- timeout.tv_sec = (long)1; /* one second timeout */
2911+ while (1) {
2912+ timeout.tv_sec = (long) 1; /* one second timeout */
2913 timeout.tv_usec = 0;
2914
2915 FD_ZERO(&set);
2916@@ -290,10 +308,10 @@
2917 st = select(FD_SETSIZE, &set, NULL, NULL, &timeout);
2918
2919 if (child_exited) {
2920- break; /* someone died on us */
2921+ break; /* someone died on us */
2922 }
2923
2924- if (st < 0) { /* bad thing */
2925+ if (st < 0) { /* bad thing */
2926 break;
2927 }
2928
2929@@ -301,8 +319,8 @@
2930 break;
2931 }
2932
2933- if (!st) { /* timeout */
2934- loopcount--; /* We've not seen the data we want */
2935+ if (!st) { /* timeout */
2936+ loopcount--; /* We've not seen the data we want */
2937 continue;
2938 }
2939
2940@@ -332,19 +350,21 @@
2941 }
2942 }
2943
2944- log_entry("ldm",7,"expect saw: %s", p);
2945+ log_entry("ldm", 7, "expect saw: %s", p);
2946
2947 if (size < 0 || st < 0 || child_exited) {
2948- return ERROR; /* error occured */
2949+ return ERROR; /* error occured */
2950 }
2951 if (loopcount == 0) {
2952- return TIMED_OUT; /* timed out */
2953+ return TIMED_OUT; /* timed out */
2954 } else {
2955- return i; /* which expect did we see? */
2956+ return i; /* which expect did we see? */
2957 }
2958 }
2959
2960-void ssh_chat(gint fd) {
2961+void
2962+ssh_chat(gint fd)
2963+{
2964 int seen;
2965 gchar lastseen[MAXEXP];
2966 int first_time = 1;
2967@@ -388,15 +408,17 @@
2968 set_message(_("No response from server, restarting..."));
2969 sleep(5);
2970 close_greeter();
2971- die("ssh","no response, restarting");
2972+ die("ssh", "no response, restarting");
2973 }
2974 }
2975 }
2976
2977-void ssh_tty_init(void) {
2978+void
2979+ssh_tty_init(void)
2980+{
2981 (void) setsid();
2982- if (login_tty(sshinfo->sshslavefd) < 0 ) {
2983- die("ssh","login_tty failed");
2984+ if (login_tty(sshinfo->sshslavefd) < 0) {
2985+ die("ssh", "login_tty failed");
2986 }
2987 }
2988
2989@@ -404,25 +426,28 @@
2990 * ssh_session()
2991 * Start an ssh login to the server.
2992 */
2993-void ssh_session(void) {
2994+void
2995+ssh_session(void)
2996+{
2997 gchar *command;
2998 gchar *port = NULL;
2999 pthread_t pt;
3000
3001 /* Check for port Override */
3002- if(sshinfo->override_port)
3003- port = g_strconcat(" -p ", sshinfo->override_port, " ", NULL);
3004+ if (sshinfo->override_port)
3005+ port = g_strconcat(" -p ", sshinfo->override_port, " ", NULL);
3006
3007 openpty(&(sshinfo->sshfd), &(sshinfo->sshslavefd), NULL, NULL, NULL);
3008
3009 command = g_strjoin(" ", "ssh", "-Y", "-t", "-M",
3010- "-S", sshinfo->ctl_socket,
3011- "-o", "NumberOfPasswordPrompts=1",
3012- "-l", sshinfo->username,
3013- port ? port : "",
3014- sshinfo->sshoptions ? sshinfo->sshoptions : "",
3015- sshinfo->server, "echo " SENTINEL "; exec /bin/sh -", NULL);
3016- log_entry("ssh",7,"ssh_session: %s", command);
3017+ "-S", sshinfo->ctl_socket,
3018+ "-o", "NumberOfPasswordPrompts=1",
3019+ "-l", sshinfo->username,
3020+ port ? port : "",
3021+ sshinfo->sshoptions ? sshinfo->sshoptions : "",
3022+ sshinfo->server,
3023+ "echo " SENTINEL "; exec /bin/sh -", NULL);
3024+ log_entry("ssh", 7, "ssh_session: %s", command);
3025
3026 sshinfo->sshpid = ldm_spawn(command, NULL, NULL, ssh_tty_init);
3027
3028@@ -437,7 +462,9 @@
3029 g_free(port);
3030 }
3031
3032-void ssh_endsession(void) {
3033+void
3034+ssh_endsession(void)
3035+{
3036 GPid pid;
3037 gchar *command;
3038 struct stat stbuf;
3039@@ -445,8 +472,10 @@
3040 if (!stat(sshinfo->ctl_socket, &stbuf)) {
3041 /* socket still exists, so we need to shut down the ssh link */
3042
3043- command = g_strjoin(" ", "ssh", "-S", sshinfo->ctl_socket, "-O", "exit", sshinfo->server, NULL);
3044- log_entry("ssh",7,"closing ssh session: %s"), command;
3045+ command =
3046+ g_strjoin(" ", "ssh", "-S", sshinfo->ctl_socket, "-O", "exit",
3047+ sshinfo->server, NULL);
3048+ log_entry("ssh", 7, "closing ssh session: %s"), command;
3049 pid = ldm_spawn(command, NULL, NULL, NULL);
3050 ldm_wait(pid);
3051 close(sshinfo->sshfd);
3052@@ -456,7 +485,9 @@
3053 }
3054 }
3055
3056-void *eater() {
3057+void *
3058+eater()
3059+{
3060 fd_set set;
3061 struct timeval timeout;
3062 int st;
3063@@ -468,7 +499,7 @@
3064 break;
3065 }
3066
3067- timeout.tv_sec = (long)1; /* one second timeout */
3068+ timeout.tv_sec = (long) 1; /* one second timeout */
3069 timeout.tv_usec = 0;
3070 FD_ZERO(&set);
3071 FD_SET(sshinfo->sshfd, &set);
3072
3073=== modified file 'wwm/client.c'
3074--- wwm/client.c 2010-10-05 21:34:03 +0000
3075+++ wwm/client.c 2014-07-28 15:29:30 +0000
3076@@ -20,12 +20,12 @@
3077
3078 for (c = head_client; c; c = c->next)
3079 if (w == c->parent || w == c->window)
3080- return(c);
3081- return(NULL);
3082+ return (c);
3083+ return (NULL);
3084 }
3085
3086 Client *
3087-next_client_on_vdesk(Client *c)
3088+next_client_on_vdesk(Client * c)
3089 {
3090 Client *newc = c, *marker = c;
3091 int v = vdesk_get();
3092@@ -37,16 +37,16 @@
3093 newc = (newc->next ? newc->next : head_client);
3094 while (newc != marker && newc->vdesk != v);
3095
3096- return((newc == marker) ? NULL : newc);
3097+ return ((newc == marker) ? NULL : newc);
3098 }
3099
3100 void
3101-set_wm_state(Client *c, int state)
3102+set_wm_state(Client * c, int state)
3103 {
3104 long data[2];
3105
3106 data[0] = (long) state;
3107- data[1] = None; /* icon window */
3108+ data[1] = None; /* icon window */
3109
3110 XChangeProperty(display, c->window, xa_wm_state, xa_wm_state,
3111 sz_xInternAtomReply, PropModeReplace,
3112@@ -54,27 +54,28 @@
3113 }
3114
3115 void
3116-send_config(Client *c)
3117+send_config(Client * c)
3118 {
3119 XConfigureEvent ce;
3120
3121- ce.type = ConfigureNotify;
3122- ce.event = c->window;
3123- ce.window = c->window;
3124- ce.x = c->x;
3125- ce.y = c->y;
3126- ce.width = c->width;
3127- ce.height = c->height;
3128- ce.border_width = c->border;
3129- ce.above = None;
3130+ ce.type = ConfigureNotify;
3131+ ce.event = c->window;
3132+ ce.window = c->window;
3133+ ce.x = c->x;
3134+ ce.y = c->y;
3135+ ce.width = c->width;
3136+ ce.height = c->height;
3137+ ce.border_width = c->border;
3138+ ce.above = None;
3139 ce.override_redirect = False;
3140
3141- XSendEvent(display, c->window, False, StructureNotifyMask, (XEvent *) &ce);
3142+ XSendEvent(display, c->window, False, StructureNotifyMask,
3143+ (XEvent *) & ce);
3144 XSync(display, False);
3145 }
3146
3147 void
3148-remove_client(Client *c, int from_cleanup)
3149+remove_client(Client * c, int from_cleanup)
3150 {
3151 Window root = ROOTWINDOW;
3152 Client *p;
3153@@ -104,7 +105,7 @@
3154 if (c->size)
3155 XFree(c->size);
3156 if (current == c)
3157- current = NULL; /* an enter event should set this up again */
3158+ current = NULL; /* an enter event should set this up again */
3159 free(c);
3160
3161 XSync(display, False);
3162@@ -113,35 +114,35 @@
3163 }
3164
3165 void
3166-change_gravity(Client *c, int invert)
3167+change_gravity(Client * c, int invert)
3168 {
3169 int dx = 0, dy = 0;
3170 int gravity = (c->size->flags & PWinGravity) ?
3171- c->size->win_gravity : NorthWestGravity;
3172+ c->size->win_gravity : NorthWestGravity;
3173
3174 switch (gravity) {
3175- case CenterGravity:
3176- case StaticGravity:
3177- case NorthWestGravity:
3178- case NorthGravity:
3179- case WestGravity:
3180- dx = c->border;
3181- dy = c->border;
3182- break;
3183- case NorthEastGravity:
3184- case EastGravity:
3185- dx = -(c->border);
3186- dy = c->border;
3187- break;
3188- case SouthEastGravity:
3189- dx = -(c->border);
3190- dy = -(c->border);
3191- break;
3192- case SouthGravity:
3193- case SouthWestGravity:
3194- dx = c->border;
3195- dy = -(c->border);
3196- break;
3197+ case CenterGravity:
3198+ case StaticGravity:
3199+ case NorthWestGravity:
3200+ case NorthGravity:
3201+ case WestGravity:
3202+ dx = c->border;
3203+ dy = c->border;
3204+ break;
3205+ case NorthEastGravity:
3206+ case EastGravity:
3207+ dx = -(c->border);
3208+ dy = c->border;
3209+ break;
3210+ case SouthEastGravity:
3211+ dx = -(c->border);
3212+ dy = -(c->border);
3213+ break;
3214+ case SouthGravity:
3215+ case SouthWestGravity:
3216+ dx = c->border;
3217+ dy = -(c->border);
3218+ break;
3219 }
3220
3221 if (invert) {
3222@@ -154,7 +155,7 @@
3223 }
3224
3225 void
3226-send_wm_delete(Client *c)
3227+send_wm_delete(Client * c)
3228 {
3229 int i, n, found = 0;
3230 Atom *protocols;
3231@@ -180,19 +181,21 @@
3232 {
3233 XEvent ev;
3234
3235- ev.type = ClientMessage;
3236- ev.xclient.window = w;
3237+ ev.type = ClientMessage;
3238+ ev.xclient.window = w;
3239 ev.xclient.message_type = a;
3240- ev.xclient.format = 32;
3241- ev.xclient.data.l[0] = x;
3242- ev.xclient.data.l[1] = CurrentTime;
3243+ ev.xclient.format = 32;
3244+ ev.xclient.data.l[0] = x;
3245+ ev.xclient.data.l[1] = CurrentTime;
3246
3247- return(XSendEvent(display, w, False, NoEventMask, &ev));
3248+ return (XSendEvent(display, w, False, NoEventMask, &ev));
3249 }
3250
3251 void
3252-set_shape(Client *c) {
3253- int i, b; unsigned int u; /* dummies */
3254+set_shape(Client * c)
3255+{
3256+ int i, b;
3257+ unsigned int u; /* dummies */
3258 int bounding_shaped;
3259 Status retval;
3260
3261@@ -208,9 +211,11 @@
3262 * XShapeGetRectangles) worked _most_ of the time.
3263 */
3264
3265- retval = XShapeQueryExtents(display, c->window, &bounding_shaped, &i, &i,
3266- &u, &u, &b, &i, &i, &u, &u);
3267+ retval =
3268+ XShapeQueryExtents(display, c->window, &bounding_shaped, &i, &i,
3269+ &u, &u, &b, &i, &i, &u, &u);
3270 if (retval && bounding_shaped)
3271 XShapeCombineShape(display, c->parent, ShapeBounding,
3272- c->border, c->border, c->window, ShapeBounding, ShapeSet);
3273+ c->border, c->border, c->window, ShapeBounding,
3274+ ShapeSet);
3275 }
3276
3277=== modified file 'wwm/events.c'
3278--- wwm/events.c 2012-08-21 14:33:07 +0000
3279+++ wwm/events.c 2014-07-28 15:29:30 +0000
3280@@ -9,7 +9,7 @@
3281 #include "wwm.h"
3282
3283 void
3284-handle_key_event(XKeyEvent *e)
3285+handle_key_event(XKeyEvent * e)
3286 {
3287 int i;
3288 Client *c = find_client(e->window);
3289@@ -34,13 +34,13 @@
3290
3291 for (i = 0; keytab[i].key != 0; i++)
3292 if (keytab[i].key == key) {
3293- keytab[i].f(c); /* dispatch the function */
3294+ keytab[i].f(c); /* dispatch the function */
3295 break;
3296 }
3297 }
3298
3299 void
3300-handle_button_event(XButtonEvent *e)
3301+handle_button_event(XButtonEvent * e)
3302 {
3303 // We want a minimal WM, so no mouse actions
3304 return;
3305@@ -51,27 +51,28 @@
3306 if (e->window == root) {
3307 return;
3308 switch (e->button) {
3309- case Button4: /* Scrolly wheel up in root */
3310- prev_vdesk((Client *) NULL);
3311- return;
3312- case Button5: /* Scrolly wheel down in root */
3313- next_vdesk((Client *) NULL);
3314- return;
3315+ case Button4: /* Scrolly wheel up in root */
3316+ prev_vdesk((Client *) NULL);
3317+ return;
3318+ case Button5: /* Scrolly wheel down in root */
3319+ next_vdesk((Client *) NULL);
3320+ return;
3321 }
3322 } else if (c) {
3323 switch (e->button) {
3324- case Button1: /* Left mouse = move */
3325- move(c, 0);
3326- return;
3327- case Button3: /* Right mouse = resize */
3328- resize(c, 0);
3329+ case Button1: /* Left mouse = move */
3330+ move(c, 0);
3331+ return;
3332+ case Button3: /* Right mouse = resize */
3333+ resize(c, 0);
3334 return;
3335 }
3336 }
3337 }
3338
3339 void
3340-handle_shape_event(XShapeEvent *e) {
3341+handle_shape_event(XShapeEvent * e)
3342+{
3343 Client *c = find_client(e->window);
3344
3345 if (c)
3346@@ -79,7 +80,7 @@
3347 }
3348
3349 void
3350-handle_configure_request(XConfigureRequestEvent *e)
3351+handle_configure_request(XConfigureRequestEvent * e)
3352 {
3353 Client *c = find_client(e->window);
3354 XWindowChanges wc;
3355@@ -121,7 +122,7 @@
3356 }
3357
3358 void
3359-handle_map_request(XMapRequestEvent *e)
3360+handle_map_request(XMapRequestEvent * e)
3361 {
3362 Client *c = find_client(e->window);
3363
3364@@ -134,7 +135,7 @@
3365 }
3366
3367 void
3368-handle_unmap_event(XUnmapEvent *e)
3369+handle_unmap_event(XUnmapEvent * e)
3370 {
3371 Client *c = find_client(e->window);
3372 Client *focus_to;
3373@@ -156,19 +157,19 @@
3374 }
3375
3376 void
3377-handle_client_message(XClientMessageEvent *e)
3378+handle_client_message(XClientMessageEvent * e)
3379 {
3380 Client *c = find_client(e->window);
3381
3382- if (c && /* Client exists */
3383- e->message_type == xa_wm_change_state && /* Changing state */
3384- e->format == sz_xInternAtomReply && /* Data is long */
3385- e->data.l[0] == IconicState) /* We're now iconic */
3386+ if (c && /* Client exists */
3387+ e->message_type == xa_wm_change_state && /* Changing state */
3388+ e->format == sz_xInternAtomReply && /* Data is long */
3389+ e->data.l[0] == IconicState) /* We're now iconic */
3390 hide(c);
3391 }
3392
3393 void
3394-handle_property_change(XPropertyEvent *e)
3395+handle_property_change(XPropertyEvent * e)
3396 {
3397 Client *c = find_client(e->window);
3398 long dummy;
3399@@ -179,11 +180,11 @@
3400 }
3401
3402 void
3403-handle_enter_event(XCrossingEvent *e)
3404+handle_enter_event(XCrossingEvent * e)
3405 {
3406 Client *c = find_client(e->window);
3407
3408- if (nomousefocus || !c) /* Ignore focus follows mouse */
3409+ if (nomousefocus || !c) /* Ignore focus follows mouse */
3410 return;
3411
3412 if (c->vdesk != vdesk_get() && c->vdesk != LOCKED)
3413
3414=== modified file 'wwm/main.c'
3415--- wwm/main.c 2012-03-12 19:35:24 +0000
3416+++ wwm/main.c 2014-07-28 15:29:30 +0000
3417@@ -13,25 +13,25 @@
3418
3419 #include "wwm.h"
3420
3421-void handle_shape_event(XShapeEvent *e);
3422+void handle_shape_event(XShapeEvent * e);
3423
3424 /*
3425 * Globals definitions
3426 */
3427
3428-Client *head_client = NULL; /* First client */
3429-Client *current = NULL; /* "current" client */
3430-Display *display; /* Our display */
3431-Atom xa_wm_state; /* atoms for window manager functions */
3432+Client *head_client = NULL; /* First client */
3433+Client *current = NULL; /* "current" client */
3434+Display *display; /* Our display */
3435+Atom xa_wm_state; /* atoms for window manager functions */
3436 Atom xa_wm_change_state;
3437 Atom xa_wm_protos;
3438 Atom xa_wm_delete;
3439-XColor fg, bg, fc; /* Forground, Background, and locked colours */
3440-int nomousefocus = 0; /* focus follows mouse status */
3441-int passthrough = 0; /* current passthrough state */
3442-char *term = NULL; /* terminal to launch */
3443-int have_shape = 0; /* Do we support shaped windows? */
3444-int ignore_xerror = 0; /* Ignore X errors */
3445+XColor fg, bg, fc; /* Forground, Background, and locked colours */
3446+int nomousefocus = 0; /* focus follows mouse status */
3447+int passthrough = 0; /* current passthrough state */
3448+char *term = NULL; /* terminal to launch */
3449+int have_shape = 0; /* Do we support shaped windows? */
3450+int ignore_xerror = 0; /* Ignore X errors */
3451
3452 struct wmkeys keytab[] = {
3453 {0, dummy_func}
3454@@ -45,7 +45,7 @@
3455 XEvent ev;
3456 int shape_event;
3457
3458- dpy = getenv("DISPLAY"); /* manage the display in $DISPLAY */
3459+ dpy = getenv("DISPLAY"); /* manage the display in $DISPLAY */
3460
3461 if (!dpy)
3462 dpy = strdup(DEF_DISPLAY);
3463@@ -53,13 +53,13 @@
3464 act.sa_handler = handle_signal;
3465 sigemptyset(&act.sa_mask);
3466 #ifdef SA_NOCLDSTOP
3467- act.sa_flags = SA_NOCLDSTOP; /* don't care about STOP, CONT */
3468+ act.sa_flags = SA_NOCLDSTOP; /* don't care about STOP, CONT */
3469 #else
3470 act.sa_flags = 0;
3471 #endif
3472 sigaction(SIGTERM, &act, NULL);
3473- sigaction(SIGINT, &act, NULL);
3474- sigaction(SIGHUP, &act, NULL);
3475+ sigaction(SIGINT, &act, NULL);
3476+ sigaction(SIGHUP, &act, NULL);
3477 sigaction(SIGCHLD, &act, NULL);
3478
3479 setup_display(dpy);
3480@@ -89,38 +89,38 @@
3481 for (;;) {
3482 XNextEvent(display, &ev);
3483 switch (ev.type) {
3484- case KeyPress:
3485- handle_key_event(&ev.xkey);
3486- break;
3487- case ButtonPress:
3488- handle_button_event(&ev.xbutton);
3489- break;
3490- case ConfigureRequest:
3491- handle_configure_request(&ev.xconfigurerequest);
3492- break;
3493- case MapRequest:
3494- handle_map_request(&ev.xmaprequest);
3495- break;
3496- case ClientMessage:
3497- handle_client_message(&ev.xclient);
3498- break;
3499- case EnterNotify:
3500- handle_enter_event(&ev.xcrossing);
3501- break;
3502- case PropertyNotify:
3503- handle_property_change(&ev.xproperty);
3504- break;
3505- case UnmapNotify:
3506- handle_unmap_event(&ev.xunmap);
3507- break;
3508- default:
3509- if (have_shape && ev.type == shape_event) {
3510- handle_shape_event((XShapeEvent *)&ev);
3511- }
3512+ case KeyPress:
3513+ handle_key_event(&ev.xkey);
3514+ break;
3515+ case ButtonPress:
3516+ handle_button_event(&ev.xbutton);
3517+ break;
3518+ case ConfigureRequest:
3519+ handle_configure_request(&ev.xconfigurerequest);
3520+ break;
3521+ case MapRequest:
3522+ handle_map_request(&ev.xmaprequest);
3523+ break;
3524+ case ClientMessage:
3525+ handle_client_message(&ev.xclient);
3526+ break;
3527+ case EnterNotify:
3528+ handle_enter_event(&ev.xcrossing);
3529+ break;
3530+ case PropertyNotify:
3531+ handle_property_change(&ev.xproperty);
3532+ break;
3533+ case UnmapNotify:
3534+ handle_unmap_event(&ev.xunmap);
3535+ break;
3536+ default:
3537+ if (have_shape && ev.type == shape_event) {
3538+ handle_shape_event((XShapeEvent *) & ev);
3539+ }
3540 }
3541 }
3542
3543- return(1); /* ?!? shouldn't get here */
3544+ return (1); /* ?!? shouldn't get here */
3545 }
3546
3547 void
3548@@ -144,7 +144,7 @@
3549 */
3550
3551 display = XOpenDisplay(dpy);
3552- if (!display) /* couldn't open display */
3553+ if (!display) /* couldn't open display */
3554 exit(1);
3555
3556 XSetErrorHandler(handle_xerror);
3557@@ -158,10 +158,10 @@
3558 * Set up our window management atoms.
3559 */
3560
3561- xa_wm_state = XInternAtom(display, "WM_STATE", False);
3562- xa_wm_change_state = XInternAtom(display, "WM_CHANGE_STATE", False);
3563- xa_wm_protos = XInternAtom(display, "WM_PROTOCOLS", False);
3564- xa_wm_delete = XInternAtom(display, "WM_DELETE_WINDOW", False);
3565+ xa_wm_state = XInternAtom(display, "WM_STATE", False);
3566+ xa_wm_change_state = XInternAtom(display, "WM_CHANGE_STATE", False);
3567+ xa_wm_protos = XInternAtom(display, "WM_PROTOCOLS", False);
3568+ xa_wm_delete = XInternAtom(display, "WM_DELETE_WINDOW", False);
3569
3570 XAllocNamedColor(display, colormap, DEF_FG, &fg, &dummy);
3571 XAllocNamedColor(display, colormap, DEF_BG, &bg, &dummy);
3572@@ -183,7 +183,7 @@
3573 XFreeModifiermap(modmap);
3574
3575 attr.event_mask = KeyPressMask | ChildMask | PropertyChangeMask |
3576- EnterWindowMask | ButtonMask;
3577+ EnterWindowMask | ButtonMask;
3578 XChangeWindowAttributes(display, root, CWEventMask, &attr);
3579
3580 for (i = 0; keytab[i].key != 0; i++) {
3581@@ -201,7 +201,7 @@
3582 {
3583 Window root = RootWindow(display, DefaultScreen(display));
3584 XGrabKey(display, XKeysymToKeycode(display, keycode),
3585- modifiers, root, True, GrabModeAsync, GrabModeAsync);
3586+ modifiers, root, True, GrabModeAsync, GrabModeAsync);
3587 }
3588
3589 void
3590
3591=== modified file 'wwm/mapfunctions.c'
3592--- wwm/mapfunctions.c 2010-10-05 21:34:03 +0000
3593+++ wwm/mapfunctions.c 2014-07-28 15:29:30 +0000
3594@@ -14,7 +14,7 @@
3595 */
3596
3597 void
3598-move_win_up(Client *c)
3599+move_win_up(Client * c)
3600 {
3601 if (!c)
3602 return;
3603@@ -27,7 +27,7 @@
3604 */
3605
3606 void
3607-move_win_down(Client *c)
3608+move_win_down(Client * c)
3609 {
3610 if (!c)
3611 return;
3612@@ -40,7 +40,7 @@
3613 */
3614
3615 void
3616-move_win_left(Client *c)
3617+move_win_left(Client * c)
3618 {
3619 if (!c)
3620 return;
3621@@ -53,7 +53,7 @@
3622 */
3623
3624 void
3625-move_win_right(Client *c)
3626+move_win_right(Client * c)
3627 {
3628 if (!c)
3629 return;
3630@@ -66,7 +66,7 @@
3631 */
3632
3633 void
3634-expand_win_y(Client *c)
3635+expand_win_y(Client * c)
3636 {
3637 if (!c)
3638 return;
3639@@ -79,7 +79,7 @@
3640 */
3641
3642 void
3643-contract_win_y(Client *c)
3644+contract_win_y(Client * c)
3645 {
3646 if (!c || c->height <= WMDELTA)
3647 return;
3648@@ -88,7 +88,7 @@
3649 }
3650
3651 void
3652-expand_win_x(Client *c)
3653+expand_win_x(Client * c)
3654 {
3655 if (!c)
3656 return;
3657@@ -97,7 +97,7 @@
3658 }
3659
3660 void
3661-contract_win_x(Client *c)
3662+contract_win_x(Client * c)
3663 {
3664 if (!c || c->width <= WMDELTA)
3665 return;
3666@@ -106,7 +106,7 @@
3667 }
3668
3669 void
3670-kill_client(Client *c)
3671+kill_client(Client * c)
3672 {
3673 if (!c)
3674 return;
3675@@ -114,7 +114,7 @@
3676 }
3677
3678 void
3679-raise_client(Client *c)
3680+raise_client(Client * c)
3681 {
3682 if (!c)
3683 return;
3684@@ -122,7 +122,7 @@
3685 }
3686
3687 void
3688-lower_client(Client *c)
3689+lower_client(Client * c)
3690 {
3691 if (!c)
3692 return;
3693@@ -130,118 +130,118 @@
3694 }
3695
3696 void
3697-horizontal_toggle(Client *c)
3698-{
3699- if (!c)
3700- return;
3701- maximise_horiz(c);
3702- resize(c, 1);
3703-}
3704-
3705-void
3706-vertical_toggle(Client *c)
3707-{
3708- if (!c)
3709- return;
3710- maximise_vert(c);
3711- resize(c, 1);
3712-}
3713-
3714-void
3715-maximize_toggle(Client *c)
3716-{
3717- if (!c)
3718- return;
3719- maximise_horiz(c);
3720- maximise_vert(c);
3721- resize(c, 1);
3722-}
3723-
3724-void
3725-lock_window(Client *c)
3726+horizontal_toggle(Client * c)
3727+{
3728+ if (!c)
3729+ return;
3730+ maximise_horiz(c);
3731+ resize(c, 1);
3732+}
3733+
3734+void
3735+vertical_toggle(Client * c)
3736+{
3737+ if (!c)
3738+ return;
3739+ maximise_vert(c);
3740+ resize(c, 1);
3741+}
3742+
3743+void
3744+maximize_toggle(Client * c)
3745+{
3746+ if (!c)
3747+ return;
3748+ maximise_horiz(c);
3749+ maximise_vert(c);
3750+ resize(c, 1);
3751+}
3752+
3753+void
3754+lock_window(Client * c)
3755 {
3756 if (!c)
3757 return;
3758 XSetWindowBackground(display, c->parent,
3759- c->vdesk == LOCKED ? fg.pixel : fc.pixel);
3760+ c->vdesk == LOCKED ? fg.pixel : fc.pixel);
3761 XClearWindow(display, c->parent);
3762 c->vdesk = c->vdesk == LOCKED ? vdesk_get() : LOCKED;
3763 }
3764
3765 void
3766-new_term(Client *c)
3767+new_term(Client * c)
3768 {
3769 spawn(term);
3770 }
3771
3772 void
3773-next_client(Client *c)
3774+next_client(Client * c)
3775 {
3776 next(current);
3777 }
3778
3779 void
3780-quit_wm(Client *c)
3781+quit_wm(Client * c)
3782 {
3783 handle_signal(SIGHUP);
3784 }
3785
3786 void
3787-start_passthrough(Client *c)
3788+start_passthrough(Client * c)
3789 {
3790 passthrough++;
3791 }
3792
3793 void
3794-goto_vdesk_0(Client *c)
3795+goto_vdesk_0(Client * c)
3796 {
3797 switch_vdesk(0);
3798 }
3799
3800 void
3801-goto_vdesk_1(Client *c)
3802+goto_vdesk_1(Client * c)
3803 {
3804 switch_vdesk(1);
3805 }
3806
3807 void
3808-goto_vdesk_2(Client *c)
3809+goto_vdesk_2(Client * c)
3810 {
3811 switch_vdesk(2);
3812 }
3813
3814 void
3815-goto_vdesk_3(Client *c)
3816+goto_vdesk_3(Client * c)
3817 {
3818 switch_vdesk(3);
3819 }
3820
3821 void
3822-goto_vdesk_4(Client *c)
3823+goto_vdesk_4(Client * c)
3824 {
3825 switch_vdesk(4);
3826 }
3827
3828 void
3829-goto_vdesk_5(Client *c)
3830+goto_vdesk_5(Client * c)
3831 {
3832 switch_vdesk(5);
3833 }
3834
3835 void
3836-goto_vdesk_6(Client *c)
3837+goto_vdesk_6(Client * c)
3838 {
3839 switch_vdesk(6);
3840 }
3841
3842 void
3843-goto_vdesk_7(Client *c)
3844+goto_vdesk_7(Client * c)
3845 {
3846 switch_vdesk(7);
3847 }
3848
3849 void
3850-prev_vdesk(Client *c)
3851+prev_vdesk(Client * c)
3852 {
3853 int v = vdesk(VDESK_PREV, VDESK_NULL);
3854 switch_vdesk(v);
3855@@ -249,7 +249,7 @@
3856 }
3857
3858 void
3859-next_vdesk(Client *c)
3860+next_vdesk(Client * c)
3861 {
3862 int v = vdesk(VDESK_NEXT, VDESK_NULL);
3863 switch_vdesk(v);
3864@@ -257,57 +257,57 @@
3865 }
3866
3867 void
3868-top_left(Client *c)
3869-{
3870- if (!c)
3871- return;
3872-
3873- c->x = c->border;
3874- c->y = c->border;
3875- move(c, 1);
3876-}
3877-
3878-void
3879-top_right(Client *c)
3880-{
3881- if (!c)
3882- return;
3883-
3884- c->x = xmax() - (c->width + c->border);
3885- c->y = c->border;
3886- move(c, 1);
3887-}
3888-
3889-void
3890-bottom_left(Client *c)
3891-{
3892- if (!c)
3893- return;
3894-
3895- c->x = c->border;
3896- c->y = ymax() - (c->height + c->border);
3897- move(c, 1);
3898-}
3899-
3900-void
3901-bottom_right(Client *c)
3902-{
3903- if (!c)
3904- return;
3905-
3906- c->x = xmax() - (c->width + c->border);
3907- c->y = ymax() - (c->height + c->border);
3908- move(c, 1);
3909-}
3910-
3911-void
3912-toggle_focus(Client *c)
3913+top_left(Client * c)
3914+{
3915+ if (!c)
3916+ return;
3917+
3918+ c->x = c->border;
3919+ c->y = c->border;
3920+ move(c, 1);
3921+}
3922+
3923+void
3924+top_right(Client * c)
3925+{
3926+ if (!c)
3927+ return;
3928+
3929+ c->x = xmax() - (c->width + c->border);
3930+ c->y = c->border;
3931+ move(c, 1);
3932+}
3933+
3934+void
3935+bottom_left(Client * c)
3936+{
3937+ if (!c)
3938+ return;
3939+
3940+ c->x = c->border;
3941+ c->y = ymax() - (c->height + c->border);
3942+ move(c, 1);
3943+}
3944+
3945+void
3946+bottom_right(Client * c)
3947+{
3948+ if (!c)
3949+ return;
3950+
3951+ c->x = xmax() - (c->width + c->border);
3952+ c->y = ymax() - (c->height + c->border);
3953+ move(c, 1);
3954+}
3955+
3956+void
3957+toggle_focus(Client * c)
3958 {
3959 nomousefocus = (nomousefocus + 1) % 2;
3960 }
3961
3962 void
3963-dummy_func(Client *c)
3964+dummy_func(Client * c)
3965 {
3966 return;
3967 }
3968
3969=== modified file 'wwm/misc.c'
3970--- wwm/misc.c 2010-10-31 17:59:56 +0000
3971+++ wwm/misc.c 2014-07-28 15:29:30 +0000
3972@@ -52,12 +52,12 @@
3973 }
3974
3975 int
3976-handle_xerror(Display *dpy, XErrorEvent *e)
3977+handle_xerror(Display * dpy, XErrorEvent * e)
3978 {
3979 Client *c = find_client(e->resourceid);
3980
3981 if (ignore_xerror)
3982- return(0);
3983+ return (0);
3984
3985 if (e->error_code == BadAccess &&
3986 e->request_code == X_ChangeWindowAttributes)
3987@@ -66,11 +66,11 @@
3988 if (c)
3989 remove_client(c, NOT_QUITTING);
3990
3991- return(0);
3992+ return (0);
3993 }
3994
3995 int
3996-handle_xexit(Display *dpy)
3997+handle_xexit(Display * dpy)
3998 {
3999 exit(0);
4000 }
4001@@ -81,16 +81,16 @@
4002 static int my_vdesk = 0;
4003
4004 switch (vdesk_command) {
4005- case VDESK_GET:
4006- return(my_vdesk);
4007- case VDESK_SET:
4008- my_vdesk = vdesk_option;
4009- return(my_vdesk);
4010- case VDESK_NEXT:
4011- return((my_vdesk + 1) % VDESK_MAX);
4012- case VDESK_PREV:
4013- return((my_vdesk ? my_vdesk - 1 : ( VDESK_MAX - 1)) % VDESK_MAX);
4014- default:
4015- return(my_vdesk);
4016+ case VDESK_GET:
4017+ return (my_vdesk);
4018+ case VDESK_SET:
4019+ my_vdesk = vdesk_option;
4020+ return (my_vdesk);
4021+ case VDESK_NEXT:
4022+ return ((my_vdesk + 1) % VDESK_MAX);
4023+ case VDESK_PREV:
4024+ return ((my_vdesk ? my_vdesk - 1 : (VDESK_MAX - 1)) % VDESK_MAX);
4025+ default:
4026+ return (my_vdesk);
4027 }
4028 }
4029
4030=== modified file 'wwm/new.c'
4031--- wwm/new.c 2010-10-07 22:52:40 +0000
4032+++ wwm/new.c 2014-07-28 15:29:30 +0000
4033@@ -85,13 +85,13 @@
4034
4035 XGetWindowAttributes(display, c->window, &attr);
4036
4037- c->x = attr.x;
4038- c->y = attr.y;
4039- c->width = attr.width;
4040+ c->x = attr.x;
4041+ c->y = attr.y;
4042+ c->width = attr.width;
4043 c->height = attr.height;
4044 c->border = DEF_BW;
4045- c->oldw = c->oldh = 0;
4046- c->vdesk = vdesk_get();
4047+ c->oldw = c->oldh = 0;
4048+ c->vdesk = vdesk_get();
4049
4050 /*
4051 * Check to make sure that windows are sized properly on map.
4052@@ -130,11 +130,11 @@
4053 set_shape(c);
4054 }
4055
4056- focus_client(c, RAISE); /* new windows get focus */
4057+ focus_client(c, RAISE); /* new windows get focus */
4058 }
4059
4060 void
4061-init_position(Client *c)
4062+init_position(Client * c)
4063 {
4064 int x, y;
4065 int xmax = xmax();
4066@@ -170,7 +170,7 @@
4067 }
4068
4069 void
4070-reparent(Client *c)
4071+reparent(Client * c)
4072 {
4073 XSetWindowAttributes p_attr;
4074 int screen = DefaultScreen(display);
4075@@ -181,15 +181,15 @@
4076 p_attr.override_redirect = True;
4077 p_attr.background_pixel = bg.pixel;
4078 p_attr.event_mask =
4079- ChildMask | ButtonPressMask | ExposureMask | EnterWindowMask;
4080+ ChildMask | ButtonPressMask | ExposureMask | EnterWindowMask;
4081 c->parent =
4082 XCreateWindow(display, root, c->x - c->border,
4083- c->y - c->border, c->width + (2 * c->border),
4084- c->height + (2 * c->border), 0, DefaultDepth(display,
4085- screen),
4086- CopyFromParent, DefaultVisual(display, screen),
4087- CWOverrideRedirect | CWBackPixel | CWEventMask,
4088- &p_attr);
4089+ c->y - c->border, c->width + (2 * c->border),
4090+ c->height + (2 * c->border), 0, DefaultDepth(display,
4091+ screen),
4092+ CopyFromParent, DefaultVisual(display, screen),
4093+ CWOverrideRedirect | CWBackPixel | CWEventMask,
4094+ &p_attr);
4095
4096 XAddToSaveSet(display, c->window);
4097 XSetWindowBorderWidth(display, c->window, 0);
4098
4099=== modified file 'wwm/screen.c'
4100--- wwm/screen.c 2010-10-07 22:45:21 +0000
4101+++ wwm/screen.c 2014-07-28 15:29:30 +0000
4102@@ -7,7 +7,7 @@
4103 #include "wwm.h"
4104
4105 void
4106-draw_outline(Client *c)
4107+draw_outline(Client * c)
4108 {
4109 Window root = ROOTWINDOW;
4110 static int gc_initialized = 0;
4111@@ -19,10 +19,11 @@
4112 gc_initialized++;
4113 gv.function = GXinvert;
4114 gv.subwindow_mode = IncludeInferiors;
4115- gv.line_width = DEF_BW; /* opt_bw */
4116+ gv.line_width = DEF_BW; /* opt_bw */
4117
4118 invert_gc = XCreateGC(display, root,
4119- GCFunction | GCSubwindowMode | GCLineWidth, &gv);
4120+ GCFunction | GCSubwindowMode | GCLineWidth,
4121+ &gv);
4122 }
4123
4124 XDrawRectangle(display, root, invert_gc, c->x - c->border,
4125@@ -42,7 +43,7 @@
4126 }
4127
4128 void
4129-recalculate_sweep(Client *c, int x1, int y1, int x2, int y2)
4130+recalculate_sweep(Client * c, int x1, int y1, int x2, int y2)
4131 {
4132 int basex, basey;
4133
4134@@ -51,9 +52,9 @@
4135
4136 if (c->size->flags & PResizeInc) {
4137 basex = (c->size->flags & PBaseSize) ? c->size->base_width :
4138- (c->size->flags & PMinSize) ? c->size->min_width : 0;
4139+ (c->size->flags & PMinSize) ? c->size->min_width : 0;
4140 basey = (c->size->flags & PBaseSize) ? c->size->base_height :
4141- (c->size->flags & PMinSize) ? c->size->min_height : 0;
4142+ (c->size->flags & PMinSize) ? c->size->min_height : 0;
4143 c->width -= (c->width - basex) % c->size->width_inc;
4144 c->height -= (c->height - basey) % c->size->height_inc;
4145 }
4146@@ -77,7 +78,7 @@
4147 }
4148
4149 void
4150-sweep(Client *c)
4151+sweep(Client * c)
4152 {
4153 Window root = ROOTWINDOW;
4154 static int resize_cursor_initialized = 0;
4155@@ -98,31 +99,32 @@
4156
4157 draw_outline(c);
4158
4159- XWarpPointer(display, None, c->window, 0, 0, 0, 0, c->width, c->height);
4160+ XWarpPointer(display, None, c->window, 0, 0, 0, 0, c->width,
4161+ c->height);
4162
4163 for (;;) {
4164 XMaskEvent(display, MouseMask, &ev);
4165 switch (ev.type) {
4166- case MotionNotify:
4167- draw_outline(c); /* clear */
4168- XUngrabServer(display);
4169- recalculate_sweep(c, old_cx, old_cy,
4170- ev.xmotion.x, ev.xmotion.y);
4171- XSync(display, False);
4172- XGrabServer(display);
4173- draw_outline(c);
4174- break;
4175- case ButtonRelease:
4176- draw_outline(c); /* clear */
4177- XUngrabServer(display);
4178- XUngrabPointer(display, CurrentTime);
4179- return;
4180+ case MotionNotify:
4181+ draw_outline(c); /* clear */
4182+ XUngrabServer(display);
4183+ recalculate_sweep(c, old_cx, old_cy,
4184+ ev.xmotion.x, ev.xmotion.y);
4185+ XSync(display, False);
4186+ XGrabServer(display);
4187+ draw_outline(c);
4188+ break;
4189+ case ButtonRelease:
4190+ draw_outline(c); /* clear */
4191+ XUngrabServer(display);
4192+ XUngrabPointer(display, CurrentTime);
4193+ return;
4194 }
4195 }
4196 }
4197
4198 void
4199-drag(Client *c)
4200+drag(Client * c)
4201 {
4202 Window root = ROOTWINDOW;
4203 static int drag_cursor_initialized = 0;
4204@@ -145,28 +147,28 @@
4205 for (;;) {
4206 XMaskEvent(display, MouseMask, &ev);
4207 switch (ev.type) {
4208- case MotionNotify:
4209- draw_outline(c); /* clear */
4210- XUngrabServer(display);
4211- c->x = old_cx + (ev.xmotion.x - x1);
4212- c->y = old_cy + (ev.xmotion.y - y1);
4213- XSync(display, False);
4214- XGrabServer(display);
4215- draw_outline(c);
4216- break;
4217- case ButtonRelease:
4218- draw_outline(c); /* clear */
4219- XUngrabServer(display);
4220- XUngrabPointer(display, CurrentTime);
4221- return;
4222- default:
4223- break;
4224+ case MotionNotify:
4225+ draw_outline(c); /* clear */
4226+ XUngrabServer(display);
4227+ c->x = old_cx + (ev.xmotion.x - x1);
4228+ c->y = old_cy + (ev.xmotion.y - y1);
4229+ XSync(display, False);
4230+ XGrabServer(display);
4231+ draw_outline(c);
4232+ break;
4233+ case ButtonRelease:
4234+ draw_outline(c); /* clear */
4235+ XUngrabServer(display);
4236+ XUngrabPointer(display, CurrentTime);
4237+ return;
4238+ default:
4239+ break;
4240 }
4241 }
4242 }
4243
4244 void
4245-move(Client *c, int set)
4246+move(Client * c, int set)
4247 {
4248 if (!set)
4249 drag(c);
4250@@ -177,7 +179,7 @@
4251 }
4252
4253 void
4254-resize(Client *c, int set)
4255+resize(Client * c, int set)
4256 {
4257 if (!set)
4258 sweep(c);
4259@@ -192,7 +194,7 @@
4260 }
4261
4262 void
4263-maximise_horiz(Client *c)
4264+maximise_horiz(Client * c)
4265 {
4266 if (c->oldw) {
4267 c->x = c->oldx;
4268@@ -207,7 +209,7 @@
4269 }
4270
4271 void
4272-maximise_vert(Client *c)
4273+maximise_vert(Client * c)
4274 {
4275 if (c->oldh) {
4276 c->y = c->oldy;
4277@@ -222,7 +224,7 @@
4278 }
4279
4280 void
4281-hide(Client *c)
4282+hide(Client * c)
4283 {
4284 c->ignore_unmap = 2;
4285 XUnmapWindow(display, c->parent);
4286@@ -231,11 +233,12 @@
4287 }
4288
4289 void
4290-unhide(Client *c, int raiseit)
4291+unhide(Client * c, int raiseit)
4292 {
4293 c->ignore_unmap = 0;
4294 XMapWindow(display, c->window);
4295- raiseit ? XMapRaised(display, c->parent) : XMapWindow(display, c->parent);
4296+ raiseit ? XMapRaised(display, c->parent) : XMapWindow(display,
4297+ c->parent);
4298 set_wm_state(c, NormalState);
4299 }
4300
4301@@ -244,14 +247,14 @@
4302 */
4303
4304 void
4305-next(Client *c)
4306+next(Client * c)
4307 {
4308 Client *newc;
4309
4310- newc = next_client_on_vdesk(( c ? c : head_client));
4311+ newc = next_client_on_vdesk((c ? c : head_client));
4312
4313 if (!newc)
4314- return; /* couldn't find a next on this screen */
4315+ return; /* couldn't find a next on this screen */
4316
4317 focus_client(newc, RAISE);
4318 }
4319@@ -284,7 +287,7 @@
4320 }
4321
4322 void
4323-focus_client(Client *c, int raiseit)
4324+focus_client(Client * c, int raiseit)
4325 {
4326 Client *cp;
4327
4328@@ -304,7 +307,7 @@
4329
4330
4331 void
4332-unfocus_client(Client *c)
4333+unfocus_client(Client * c)
4334 {
4335 XSetInputFocus(display, PointerRoot, RevertToPointerRoot, CurrentTime);
4336 XSetWindowBackground(display, c->parent, bg.pixel);
4337
4338=== modified file 'wwm/sendkey.c'
4339--- wwm/sendkey.c 2010-10-07 22:45:21 +0000
4340+++ wwm/sendkey.c 2014-07-28 15:29:30 +0000
4341@@ -12,16 +12,16 @@
4342 */
4343
4344 void
4345-key_to_event(KeySym key, XEvent *event, Window w, int type)
4346+key_to_event(KeySym key, XEvent * event, Window w, int type)
4347 {
4348- event->xkey.type = type;
4349+ event->xkey.type = type;
4350 event->xkey.display = display;
4351- event->xkey.root = RootWindow(display, DefaultScreen(display));
4352- event->xkey.time = CurrentTime;
4353- event->xkey.x = event->xkey.y = 0;
4354- event->xkey.x_root = event->xkey.y_root = 0;
4355- event->xkey.state = WMMODMASK;
4356- event->xkey.window = w;
4357+ event->xkey.root = RootWindow(display, DefaultScreen(display));
4358+ event->xkey.time = CurrentTime;
4359+ event->xkey.x = event->xkey.y = 0;
4360+ event->xkey.x_root = event->xkey.y_root = 0;
4361+ event->xkey.state = WMMODMASK;
4362+ event->xkey.window = w;
4363 event->xkey.keycode = XKeysymToKeycode(display, key);
4364 }
4365

Subscribers

People subscribed via source and target branches