Skip to content

Commit

Permalink
Move usage() to be with run() in x.c
Browse files Browse the repository at this point in the history
run/usage/xinit are now all internal to x.c

Signed-off-by: Devin J. Pohly <[email protected]>
  • Loading branch information
djpohly committed Feb 26, 2018
1 parent 3e44ee5 commit 3518dba
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 19 deletions.
15 changes: 0 additions & 15 deletions st.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,6 @@
#include <X11/cursorfont.h>
#include <X11/Xft/Xft.h>

char *argv0;

#define Glyph Glyph_
#define Font Font_

Expand Down Expand Up @@ -2687,16 +2685,3 @@ cresize(int width, int height)
tresize(col, row);
xresize(col, row);
}

void
usage(void)
{
die("usage: %s [-aiv] [-c class] [-f font] [-g geometry]"
" [-n name] [-o file]\n"
" [-T title] [-t title] [-w windowid]"
" [[-e] command [args ...]]\n"
" %s [-aiv] [-c class] [-f font] [-g geometry]"
" [-n name] [-o file]\n"
" [-T title] [-t title] [-w windowid] -l line"
" [stty_args ...]\n", argv0, argv0);
}
2 changes: 0 additions & 2 deletions st.h
Original file line number Diff line number Diff line change
Expand Up @@ -214,8 +214,6 @@ size_t utf8encode(Rune, char *);
void *xmalloc(size_t);
char *xstrdup(char *);

void usage(void);

/* Globals */
extern TermWindow win;
extern Term term;
Expand Down
2 changes: 0 additions & 2 deletions win.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,11 @@ typedef XftGlyphFontSpec GlyphFontSpec;

void draw(void);
void drawregion(int, int, int, int);
void run(void);

void xbell(int);
void xclipcopy(void);
void xclippaste(void);
void xhints(void);
void xinit(void);
void xloadcols(void);
int xsetcolorname(int, const char *);
void xloadfonts(char *, double);
Expand Down
18 changes: 18 additions & 0 deletions x.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
#include <X11/Xft/Xft.h>
#include <X11/XKBlib.h>

static char *argv0;
#include "arg.h"

#define Glyph Glyph_
Expand Down Expand Up @@ -87,6 +88,7 @@ static void xdrawglyph(Glyph, int, int);
static void xclear(int, int, int, int);
static void xdrawcursor(void);
static int xgeommasktogravity(int);
static void xinit(void);
static int xloadfont(Font *, FcPattern *);
static void xunloadfont(Font *);
static void xsetenv(void);
Expand All @@ -110,6 +112,9 @@ static void selcopy(Time);
static void getbuttoninfo(XEvent *);
static void mousereport(XEvent *);

static void run(void);
static void usage(void);

static void (*handler[LASTEvent])(XEvent *) = {
[KeyPress] = kpress,
[ClientMessage] = cmessage,
Expand Down Expand Up @@ -1698,6 +1703,19 @@ run(void)
}
}

void
usage(void)
{
die("usage: %s [-aiv] [-c class] [-f font] [-g geometry]"
" [-n name] [-o file]\n"
" [-T title] [-t title] [-w windowid]"
" [[-e] command [args ...]]\n"
" %s [-aiv] [-c class] [-f font] [-g geometry]"
" [-n name] [-o file]\n"
" [-T title] [-t title] [-w windowid] -l line"
" [stty_args ...]\n", argv0, argv0);
}

int
main(int argc, char *argv[])
{
Expand Down

0 comments on commit 3518dba

Please sign in to comment.