summaryrefslogtreecommitdiff
path: root/utils/Etbg.c
blob: 09109af63e76198d6546a0e83dec9cd532486c68 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
/* Eterm background switching helper
 * by keebler 3/26/99
 *
 * This program is original work by Brian McFee <keebler@themes.org>.
 * This program is distributed under the GNU Public License (GPL) as
 * outlined in the COPYING file.
 *
 * Copyright (C) 1999-2000, Brian McFee.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 * 
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 * 
 */

#include <config.h>

#include <stdio.h>
#include <string.h>

#ifndef FALSE
#  define FALSE (0)
#endif
#ifndef TRUE
#  define TRUE (1)
#endif

int
main(int argc, char **argv)
{
  int scale = FALSE, trans = FALSE;
  unsigned int pic = 0;
  int i;

  for (i = 1; i < argc; i++) {
    if (strcasecmp(argv[i], "-scale") == 0) {
      scale = TRUE;
    } else if (strcasecmp(argv[i], "-trans") == 0) {
      trans = TRUE;
    } else if (strncasecmp(argv[i], "-h", 2) == 0) {
      printf("Usage: %s [[-scale] file] [-trans]\n", argv[0]);
      return 0;
    } else {
      pic = i;
    }
  }

  if (pic && argv[pic]) {
    printf("\033]6;0;0\a");
    printf("\033]20;%s%s\a", argv[pic], scale ? "@100x100+50+50:scale" : "@0x0+0+0:tile");
  }
  if (trans) {
    printf("\033]6;0;1\a");
  }
  return 0;
}