diff options
Diffstat (limited to '')
| -rw-r--r-- | st.c | 44 | ||||
| -rw-r--r-- | st.h | 4 | ||||
| -rw-r--r-- | x.c | 6 |
3 files changed, 28 insertions, 26 deletions
| @@ -186,18 +186,18 @@ static void tputc(Rune); | |||
| 186 | static void treset(void); | 186 | static void treset(void); |
| 187 | static void tscrollup(int, int); | 187 | static void tscrollup(int, int); |
| 188 | static void tscrolldown(int, int); | 188 | static void tscrolldown(int, int); |
| 189 | static void tsetattr(int *, int); | 189 | static void tsetattr(const int *, int); |
| 190 | static void tsetchar(Rune, Glyph *, int, int); | 190 | static void tsetchar(Rune, const Glyph *, int, int); |
| 191 | static void tsetdirt(int, int); | 191 | static void tsetdirt(int, int); |
| 192 | static void tsetscroll(int, int); | 192 | static void tsetscroll(int, int); |
| 193 | static void tswapscreen(void); | 193 | static void tswapscreen(void); |
| 194 | static void tsetmode(int, int, int *, int); | 194 | static void tsetmode(int, int, const int *, int); |
| 195 | static int twrite(const char *, int, int); | 195 | static int twrite(const char *, int, int); |
| 196 | static void tfulldirt(void); | 196 | static void tfulldirt(void); |
| 197 | static void tcontrolcode(uchar ); | 197 | static void tcontrolcode(uchar ); |
| 198 | static void tdectest(char ); | 198 | static void tdectest(char ); |
| 199 | static void tdefutf8(char); | 199 | static void tdefutf8(char); |
| 200 | static int32_t tdefcolor(int *, int *, int); | 200 | static int32_t tdefcolor(const int *, int *, int); |
| 201 | static void tdeftran(char); | 201 | static void tdeftran(char); |
| 202 | static void tstrsequence(uchar); | 202 | static void tstrsequence(uchar); |
| 203 | 203 | ||
| @@ -226,10 +226,10 @@ static int iofd = 1; | |||
| 226 | static int cmdfd; | 226 | static int cmdfd; |
| 227 | static pid_t pid; | 227 | static pid_t pid; |
| 228 | 228 | ||
| 229 | static uchar utfbyte[UTF_SIZ + 1] = {0x80, 0, 0xC0, 0xE0, 0xF0}; | 229 | static const uchar utfbyte[UTF_SIZ + 1] = {0x80, 0, 0xC0, 0xE0, 0xF0}; |
| 230 | static uchar utfmask[UTF_SIZ + 1] = {0xC0, 0x80, 0xE0, 0xF0, 0xF8}; | 230 | static const uchar utfmask[UTF_SIZ + 1] = {0xC0, 0x80, 0xE0, 0xF0, 0xF8}; |
| 231 | static Rune utfmin[UTF_SIZ + 1] = { 0, 0, 0x80, 0x800, 0x10000}; | 231 | static const Rune utfmin[UTF_SIZ + 1] = { 0, 0, 0x80, 0x800, 0x10000}; |
| 232 | static Rune utfmax[UTF_SIZ + 1] = {0x10FFFF, 0x7F, 0x7FF, 0xFFFF, 0x10FFFF}; | 232 | static const Rune utfmax[UTF_SIZ + 1] = {0x10FFFF, 0x7F, 0x7FF, 0xFFFF, 0x10FFFF}; |
| 233 | 233 | ||
| 234 | ssize_t | 234 | ssize_t |
| 235 | xwrite(int fd, const char *s, size_t len) | 235 | xwrite(int fd, const char *s, size_t len) |
| @@ -269,12 +269,14 @@ xrealloc(void *p, size_t len) | |||
| 269 | } | 269 | } |
| 270 | 270 | ||
| 271 | char * | 271 | char * |
| 272 | xstrdup(char *s) | 272 | xstrdup(const char *s) |
| 273 | { | 273 | { |
| 274 | if ((s = strdup(s)) == NULL) | 274 | char *p; |
| 275 | |||
| 276 | if ((p = strdup(s)) == NULL) | ||
| 275 | die("strdup: %s\n", strerror(errno)); | 277 | die("strdup: %s\n", strerror(errno)); |
| 276 | 278 | ||
| 277 | return s; | 279 | return p; |
| 278 | } | 280 | } |
| 279 | 281 | ||
| 280 | size_t | 282 | size_t |
| @@ -518,7 +520,7 @@ selsnap(int *x, int *y, int direction) | |||
| 518 | { | 520 | { |
| 519 | int newx, newy, xt, yt; | 521 | int newx, newy, xt, yt; |
| 520 | int delim, prevdelim; | 522 | int delim, prevdelim; |
| 521 | Glyph *gp, *prevgp; | 523 | const Glyph *gp, *prevgp; |
| 522 | 524 | ||
| 523 | switch (sel.snap) { | 525 | switch (sel.snap) { |
| 524 | case SNAP_WORD: | 526 | case SNAP_WORD: |
| @@ -591,7 +593,7 @@ getsel(void) | |||
| 591 | { | 593 | { |
| 592 | char *str, *ptr; | 594 | char *str, *ptr; |
| 593 | int y, bufsize, lastx, linelen; | 595 | int y, bufsize, lastx, linelen; |
| 594 | Glyph *gp, *last; | 596 | const Glyph *gp, *last; |
| 595 | 597 | ||
| 596 | if (sel.ob.x == -1) | 598 | if (sel.ob.x == -1) |
| 597 | return NULL; | 599 | return NULL; |
| @@ -758,7 +760,7 @@ stty(char **args) | |||
| 758 | } | 760 | } |
| 759 | 761 | ||
| 760 | int | 762 | int |
| 761 | ttynew(char *line, char *cmd, char *out, char **args) | 763 | ttynew(const char *line, char *cmd, const char *out, char **args) |
| 762 | { | 764 | { |
| 763 | int m, s; | 765 | int m, s; |
| 764 | 766 | ||
| @@ -1186,9 +1188,9 @@ tmoveto(int x, int y) | |||
| 1186 | } | 1188 | } |
| 1187 | 1189 | ||
| 1188 | void | 1190 | void |
| 1189 | tsetchar(Rune u, Glyph *attr, int x, int y) | 1191 | tsetchar(Rune u, const Glyph *attr, int x, int y) |
| 1190 | { | 1192 | { |
| 1191 | static char *vt100_0[62] = { /* 0x41 - 0x7e */ | 1193 | static const char *vt100_0[62] = { /* 0x41 - 0x7e */ |
| 1192 | "↑", "↓", "→", "←", "█", "▚", "☃", /* A - G */ | 1194 | "↑", "↓", "→", "←", "█", "▚", "☃", /* A - G */ |
| 1193 | 0, 0, 0, 0, 0, 0, 0, 0, /* H - O */ | 1195 | 0, 0, 0, 0, 0, 0, 0, 0, /* H - O */ |
| 1194 | 0, 0, 0, 0, 0, 0, 0, 0, /* P - W */ | 1196 | 0, 0, 0, 0, 0, 0, 0, 0, /* P - W */ |
| @@ -1300,7 +1302,7 @@ tdeleteline(int n) | |||
| 1300 | } | 1302 | } |
| 1301 | 1303 | ||
| 1302 | int32_t | 1304 | int32_t |
| 1303 | tdefcolor(int *attr, int *npar, int l) | 1305 | tdefcolor(const int *attr, int *npar, int l) |
| 1304 | { | 1306 | { |
| 1305 | int32_t idx = -1; | 1307 | int32_t idx = -1; |
| 1306 | uint r, g, b; | 1308 | uint r, g, b; |
| @@ -1350,7 +1352,7 @@ tdefcolor(int *attr, int *npar, int l) | |||
| 1350 | } | 1352 | } |
| 1351 | 1353 | ||
| 1352 | void | 1354 | void |
| 1353 | tsetattr(int *attr, int l) | 1355 | tsetattr(const int *attr, int l) |
| 1354 | { | 1356 | { |
| 1355 | int i; | 1357 | int i; |
| 1356 | int32_t idx; | 1358 | int32_t idx; |
| @@ -1468,9 +1470,9 @@ tsetscroll(int t, int b) | |||
| 1468 | } | 1470 | } |
| 1469 | 1471 | ||
| 1470 | void | 1472 | void |
| 1471 | tsetmode(int priv, int set, int *args, int narg) | 1473 | tsetmode(int priv, int set, const int *args, int narg) |
| 1472 | { | 1474 | { |
| 1473 | int alt, *lim; | 1475 | int alt; const int *lim; |
| 1474 | 1476 | ||
| 1475 | for (lim = args + narg; args < lim; ++args) { | 1477 | for (lim = args + narg; args < lim; ++args) { |
| 1476 | if (priv) { | 1478 | if (priv) { |
| @@ -2020,7 +2022,7 @@ void | |||
| 2020 | tdumpline(int n) | 2022 | tdumpline(int n) |
| 2021 | { | 2023 | { |
| 2022 | char buf[UTF_SIZ]; | 2024 | char buf[UTF_SIZ]; |
| 2023 | Glyph *bp, *end; | 2025 | const Glyph *bp, *end; |
| 2024 | 2026 | ||
| 2025 | bp = &term.line[n][0]; | 2027 | bp = &term.line[n][0]; |
| 2026 | end = &bp[MIN(tlinelen(n), term.col) - 1]; | 2028 | end = &bp[MIN(tlinelen(n), term.col) - 1]; |
| @@ -91,7 +91,7 @@ void tnew(int, int); | |||
| 91 | void tresize(int, int); | 91 | void tresize(int, int); |
| 92 | void tsetdirtattr(int); | 92 | void tsetdirtattr(int); |
| 93 | void ttyhangup(void); | 93 | void ttyhangup(void); |
| 94 | int ttynew(char *, char *, char *, char **); | 94 | int ttynew(const char *, char *, const char *, char **); |
| 95 | size_t ttyread(void); | 95 | size_t ttyread(void); |
| 96 | void ttyresize(int, int); | 96 | void ttyresize(int, int); |
| 97 | void ttywrite(const char *, size_t, int); | 97 | void ttywrite(const char *, size_t, int); |
| @@ -109,7 +109,7 @@ size_t utf8encode(Rune, char *); | |||
| 109 | 109 | ||
| 110 | void *xmalloc(size_t); | 110 | void *xmalloc(size_t); |
| 111 | void *xrealloc(void *, size_t); | 111 | void *xrealloc(void *, size_t); |
| 112 | char *xstrdup(char *); | 112 | char *xstrdup(const char *); |
| 113 | 113 | ||
| 114 | /* config.h globals */ | 114 | /* config.h globals */ |
| 115 | extern char *utmp; | 115 | extern char *utmp; |
| @@ -156,7 +156,7 @@ static void xresize(int, int); | |||
| 156 | static void xhints(void); | 156 | static void xhints(void); |
| 157 | static int xloadcolor(int, const char *, Color *); | 157 | static int xloadcolor(int, const char *, Color *); |
| 158 | static int xloadfont(Font *, FcPattern *); | 158 | static int xloadfont(Font *, FcPattern *); |
| 159 | static void xloadfonts(char *, double); | 159 | static void xloadfonts(const char *, double); |
| 160 | static void xunloadfont(Font *); | 160 | static void xunloadfont(Font *); |
| 161 | static void xunloadfonts(void); | 161 | static void xunloadfonts(void); |
| 162 | static void xsetenv(void); | 162 | static void xsetenv(void); |
| @@ -952,7 +952,7 @@ xloadfont(Font *f, FcPattern *pattern) | |||
| 952 | } | 952 | } |
| 953 | 953 | ||
| 954 | void | 954 | void |
| 955 | xloadfonts(char *fontstr, double fontsize) | 955 | xloadfonts(const char *fontstr, double fontsize) |
| 956 | { | 956 | { |
| 957 | FcPattern *pattern; | 957 | FcPattern *pattern; |
| 958 | double fontval; | 958 | double fontval; |
| @@ -960,7 +960,7 @@ xloadfonts(char *fontstr, double fontsize) | |||
| 960 | if (fontstr[0] == '-') | 960 | if (fontstr[0] == '-') |
| 961 | pattern = XftXlfdParse(fontstr, False, False); | 961 | pattern = XftXlfdParse(fontstr, False, False); |
| 962 | else | 962 | else |
| 963 | pattern = FcNameParse((FcChar8 *)fontstr); | 963 | pattern = FcNameParse((const FcChar8 *)fontstr); |
| 964 | 964 | ||
| 965 | if (!pattern) | 965 | if (!pattern) |
| 966 | die("can't open font %s\n", fontstr); | 966 | die("can't open font %s\n", fontstr); |
