unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
blob d8a1c6a886d48e78ffc92545ee5a752a175ccc98 3185 bytes (raw)
name: lib-src/be_resources.cc 	 # note: path name is non-authoritative(*)

  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
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
 
/* Haiku window system support
   Copyright (C) 2021 Free Software Foundation, Inc.

This file is part of GNU Emacs.

GNU Emacs 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 3 of the License, or (at
your option) any later version.

GNU Emacs 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 GNU Emacs.  If not, see <https://www.gnu.org/licenses/>.  */

#include <config.h>

#include <cstdio>
#include <cstring>
#include <cstdlib>

#include <SupportDefs.h>
#include <Path.h>
#include <AppFileInfo.h>
#include <TranslationUtils.h>
#include <Application.h>
#include <Catalog.h>

using namespace std;

static void
be_perror (status_t code, char *arg)
{
  if (code != B_OK)
    {
      switch (code)
	{
	case B_BAD_VALUE:
	  fprintf (stderr, "%s: Bad value\n", arg);
	  break;
	case B_ENTRY_NOT_FOUND:
	  fprintf (stderr, "%s: Not found\n", arg);
	  break;
	case B_PERMISSION_DENIED:
	  fprintf (stderr, "%s: Permission denied\n", arg);
	  break;
	case B_NO_MEMORY:
	  fprintf (stderr, "%s: No memory\n", arg);
	  break;
	case B_LINK_LIMIT:
	  fprintf (stderr, "%s: Link limit reached\n", arg);
	  break;
	case B_BUSY:
	  fprintf (stderr, "%s: Busy\n", arg);
	  break;
	case B_NO_MORE_FDS:
	  fprintf (stderr, "%s: No more file descriptors\n", arg);
	  break;
	case B_FILE_ERROR:
	  fprintf (stderr, "%s: File error\n", arg);
	  break;
	default:
	  fprintf (stderr, "%s: Unknown error\n", arg);
	}
    }
  else
    {
      abort ();
    }
}

int
main (int argc, char **argv)
{
  BApplication app ("application/x-vnd.GNU-emacs-resource-helper");
  BFile file;
  BBitmap *icon;
  BAppFileInfo info;
  status_t code;
  struct version_info vinfo;
  char *v = strdup (PACKAGE_VERSION);

  if (argc != 3)
    {
      printf ("be-resources ICON FILE: make FILE appropriate for Emacs.\n");
      return EXIT_FAILURE;
    }

  code = file.SetTo (argv[2], B_READ_WRITE);
  if (code != B_OK)
    {
      be_perror (code, argv[2]);
      return EXIT_FAILURE;
    }
  code = info.SetTo (&file);
  if (code != B_OK)
    {
      be_perror (code, argv[2]);
      return EXIT_FAILURE;
    }

  icon = BTranslationUtils::GetBitmapFile (argv[1], NULL);

  if (!icon)
    {
      be_perror (B_ERROR, argv[1]);
      return EXIT_FAILURE;
    }

  info.SetIcon (icon, B_MINI_ICON);
  info.SetIcon (icon, B_LARGE_ICON);
  info.SetSignature ("application/x-vnd.GNU-emacs");

  v = strtok (v, ".");
  vinfo.major = atoi (v);

  v = strtok (NULL, ".");
  vinfo.middle = atoi (v);

  v = strtok (NULL, ".");
  vinfo.minor = v ? atoi (v) : 0;

  vinfo.variety = 0;
  vinfo.internal = 0;

  strncpy ((char *) &vinfo.short_info, PACKAGE_VERSION,
	   sizeof vinfo.short_info - 1);
  strncpy ((char *) &vinfo.long_info, PACKAGE_STRING,
	   sizeof vinfo.long_info - 1);

  info.SetVersionInfo (&vinfo, B_APP_VERSION_KIND);

  return EXIT_SUCCESS;
}

debug log:

solving d8a1c6a886 ...
found d8a1c6a886 in https://yhetil.org/emacs-devel/87ee9tjjmt.fsf@yahoo.com/

applying [1/1] https://yhetil.org/emacs-devel/87ee9tjjmt.fsf@yahoo.com/
diff --git a/lib-src/be_resources.cc b/lib-src/be_resources.cc
new file mode 100644
index 0000000000..d8a1c6a886

Checking patch lib-src/be_resources.cc...
Applied patch lib-src/be_resources.cc cleanly.

index at:
100644 d8a1c6a886d48e78ffc92545ee5a752a175ccc98	lib-src/be_resources.cc

(*) Git path names are given by the tree(s) the blob belongs to.
    Blobs themselves have no identifier aside from the hash of its contents.^

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).