int main(int argc, char ** argv) { school_t ** s = school; job_t ** j = jobs; lang_t ** l = langs; honor_t ** h = hon; puts(""); printf("%s\n%s\n%s\n\n", name, email, address); puts("-Education-\n"); while (*s) { print_company(*s); s++; } puts("-Employment-\n"); while (*j) { print_company(*j); j++; } puts("-Languages-\n"); while (*l) { print_blurb(*l); l++; } puts("\n-Honors-\n"); while (*h) { print_blurb(*h); h++; } }
static void parse_args (gint *argc_p, gchar ***argv_p) { guint argc = *argc_p; gchar **argv = *argv_p; guint i, e; for (i = 1; i < argc; i++) { if (strcmp ("--header", argv[i]) == 0) { gen_cheader = TRUE; argv[i] = NULL; } else if (strcmp ("--body", argv[i]) == 0) { gen_cbody = TRUE; argv[i] = NULL; } else if (strcmp ("--skip-source", argv[i]) == 0) { skip_ploc = TRUE; argv[i] = NULL; } else if (strcmp ("--nostdinc", argv[i]) == 0) { std_includes = FALSE; argv[i] = NULL; } else if (strcmp ("--stdinc", argv[i]) == 0) { std_includes = TRUE; argv[i] = NULL; } else if (strcmp ("--internal", argv[i]) == 0) { gen_internal = TRUE; argv[i] = NULL; } else if (strcmp ("--valist-marshallers", argv[i]) == 0) { gen_valist = TRUE; argv[i] = NULL; } else if ((strcmp ("--prefix", argv[i]) == 0) || (strncmp ("--prefix=", argv[i], 9) == 0)) { gchar *equal = argv[i] + 8; if (*equal == '=') marshaller_prefix = g_strdup (equal + 1); else if (i + 1 < argc) { marshaller_prefix = g_strdup (argv[i + 1]); argv[i] = NULL; i += 1; } argv[i] = NULL; } else if (strcmp ("-h", argv[i]) == 0 || strcmp ("-?", argv[i]) == 0 || strcmp ("--help", argv[i]) == 0) { print_blurb (stderr, TRUE); argv[i] = NULL; exit (0); } else if (strcmp ("-v", argv[i]) == 0 || strcmp ("--version", argv[i]) == 0) { print_blurb (stderr, FALSE); argv[i] = NULL; exit (0); } else if (strcmp (argv[i], "--g-fatal-warnings") == 0) { GLogLevelFlags fatal_mask; fatal_mask = g_log_set_always_fatal (G_LOG_FATAL_MASK); fatal_mask |= G_LOG_LEVEL_WARNING | G_LOG_LEVEL_CRITICAL; g_log_set_always_fatal (fatal_mask); argv[i] = NULL; } } e = 0; for (i = 1; i < argc; i++) { if (e) { if (argv[i]) { argv[e++] = argv[i]; argv[i] = NULL; } } else if (!argv[i]) e = i; } if (e) *argc_p = e; }
int main (int argc, char *argv[]) { GdkPixbuf *pixbuf; GError *error = NULL; gchar *infilename; /* parse args and do fast exits */ parse_args (&argc, &argv); if (!build_list) { if (argc != 2) { print_blurb (stderr, TRUE); return 1; } #ifdef G_OS_WIN32 infilename = g_locale_to_utf8 (argv[1], -1, NULL, NULL, NULL); #else infilename = argv[1]; #endif pixbuf = gdk_pixbuf_new_from_file (infilename, &error); if (!pixbuf) { g_fprintf (stderr, "failed to load \"%s\": %s\n", argv[1], error->message); g_error_free (error); return 1; } print_csource (stdout, pixbuf); g_object_unref (pixbuf); } else /* parse name, file pairs */ { gchar **p = argv + 1; guint j = argc - 1; gboolean toggle = FALSE; while (j--) { #ifdef G_OS_WIN32 infilename = g_locale_to_utf8 (*p, -1, NULL, NULL, NULL); #else infilename = *p; #endif if (!toggle) { image_name = infilename; p++; } else { pixbuf = gdk_pixbuf_new_from_file (infilename, &error); if (!pixbuf) { g_fprintf (stderr, "failed to load \"%s\": %s\n", *p, error->message); g_error_free (error); return 1; } print_csource (stdout, pixbuf); g_object_unref (pixbuf); p++; } toggle = !toggle; } } return 0; }
static void parse_args (gint *argc_p, gchar ***argv_p) { guint argc = *argc_p; gchar **argv = *argv_p; guint i, e; for (i = 1; i < argc; i++) { if (strcmp ("--macros", argv[i]) == 0) { gen_type = GDK_PIXDATA_DUMP_MACROS; argv[i] = NULL; } else if (strcmp ("--struct", argv[i]) == 0) { gen_type = GDK_PIXDATA_DUMP_PIXDATA_STRUCT; argv[i] = NULL; } else if (strcmp ("--stream", argv[i]) == 0) { gen_type = GDK_PIXDATA_DUMP_PIXDATA_STREAM; argv[i] = NULL; } else if (strcmp ("--rle", argv[i]) == 0) { use_rle = TRUE; argv[i] = NULL; } else if (strcmp ("--raw", argv[i]) == 0) { use_rle = FALSE; argv[i] = NULL; } else if (strcmp ("--extern", argv[i]) == 0) { gen_ctype &= ~GDK_PIXDATA_DUMP_STATIC; argv[i] = NULL; } else if (strcmp ("--static", argv[i]) == 0) { gen_ctype |= GDK_PIXDATA_DUMP_STATIC; argv[i] = NULL; } else if (strcmp ("--decoder", argv[i]) == 0) { with_decoder = TRUE; argv[i] = NULL; } else if ((strcmp ("--name", argv[i]) == 0) || (strncmp ("--name=", argv[i], 7) == 0)) { gchar *equal = argv[i] + 6; if (*equal == '=') image_name = g_strdup (equal + 1); else if (i + 1 < argc) { image_name = g_strdup (argv[i + 1]); argv[i] = NULL; i += 1; } argv[i] = NULL; } else if (strcmp ("--build-list", argv[i]) == 0) { build_list = TRUE; argv[i] = NULL; } else if (strcmp ("-h", argv[i]) == 0 || strcmp ("--help", argv[i]) == 0) { print_blurb (stderr, TRUE); argv[i] = NULL; exit (0); } else if (strcmp ("-v", argv[i]) == 0 || strcmp ("--version", argv[i]) == 0) { print_blurb (stderr, FALSE); argv[i] = NULL; exit (0); } else if (strcmp (argv[i], "--g-fatal-warnings") == 0) { GLogLevelFlags fatal_mask; fatal_mask = g_log_set_always_fatal (G_LOG_FATAL_MASK); fatal_mask |= G_LOG_LEVEL_WARNING | G_LOG_LEVEL_CRITICAL; g_log_set_always_fatal (fatal_mask); argv[i] = NULL; } } e = 0; for (i = 1; i < argc; i++) { if (e) { if (argv[i]) { argv[e++] = argv[i]; argv[i] = NULL; } } else if (!argv[i]) e = i; } if (e) *argc_p = e; }