int main (int argc, char *argv[]) { size_t tweet_len, n; mode = MODE_GUI; if (argc > 1) parse_options (argc, argv); rcinit (); int rc = read_config (); /* create GUI */ if (mode == MODE_GUI) { draw_main_window (); } else printf ("mode != gui\n"); if (options->from_stdin == 1) { tweet_len = getline (&options->tweet_text, &n, stdin); printf ("You tweeted: \"%s\" (%d)\n", options->tweet_text, tweet_len); } return EXIT_SUCCESS; } /* end of main */
int main (int argc, char **argv) { int fd1, fd2; char *cp, buffer[BUFSIZ]; char **argp, **arguments; #ifdef LOCALE setlocale(LC_ALL, ""); #endif invo_name = r1bindex (argv[0], '/'); /* foil search of user profile/context */ if (context_foil (NULL) == -1) done (1); arguments = getarguments (invo_name, argc, argv, 0); argp = arguments; while ((cp = *argp++)) if (*cp == '-') switch (smatch (++cp, switches)) { case AMBIGSW: ambigsw (cp, switches); done (1); case UNKWNSW: adios (NULL, "-%s unknown", cp); case HELPSW: snprintf (buffer, sizeof(buffer), "%s [switches]", invo_name); print_help (buffer, switches, 0); done (1); case VERSIONSW: print_version(invo_name); done (1); case READSW: if (!(cp = *argp++) || *cp == '-') adios (NULL, "missing argument to %s", argp[-2]); if ((fd1 = atoi (cp)) < 1) adios (NULL, "bad argument %s %s", argp[-2], cp); continue; case WRITESW: if (!(cp = *argp++) || *cp == '-') adios (NULL, "missing argument to %s", argp[-2]); if ((fd2 = atoi (cp)) < 1) adios (NULL, "bad argument %s %s", argp[-2], cp); continue; } else adios (NULL, "usage: %s [switches]", invo_name); rcinit (fd1, fd2); pINI (); pLOOP (); return done (0); }