all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
blob 1dcf0658dacfd5f29a7954466457cf384a72870b 1305 bytes (raw)
name: src/filemagic.c 	 # 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
 
#include <magic.h>
#include <config.h>
#include <stdio.h>
#include <math.h>
#include <ctype.h>

#include "lisp.h"
/*

 */
/*
     magic_t
     magic_open(int flags);

     void
     magic_close(magic_t cookie);

     const char *
     magic_error(magic_t cookie);

     int
     magic_errno(magic_t cookie);

     const char *
     magic_file(magic_t cookie, const char *filename);

     const char *
     magic_buffer(magic_t cookie, const void *buffer, size_t length);

     int
     magic_setflags(magic_t cookie, int flags);

     int
     magic_check(magic_t cookie, const char *filename);

     int
     magic_compile(magic_t cookie, const char *filename);

     int
     magic_load(magic_t cookie, const char *filename);
*/


DEFUN ("file-magic-file", Ffile_magic_file, Sfile_magic_file, 1,1,0,
       doc: /* return libmagic file description for filename */)
  (filename)
     Lisp_Object filename;
{
  if (!STRINGP (filename)) return Qnil;
  printf("filename:%s\n",SDATA(filename));
  magic_t cookie= magic_open(MAGIC_MIME_TYPE);
  magic_load(cookie,NULL);
  printf("cookie:%d\n",cookie);
  char *rvs=magic_file(cookie, SDATA(filename));
  printf("rvs:%s\n",rvs);  
  Lisp_Object rv=intern(rvs);
  magic_close(cookie);
  return rv;
}

void
syms_of_filemagic ()
{
  defsubr (&Sfile_magic_file);
}

debug log:

solving 1dcf065 ...
found 1dcf065 in https://yhetil.org/emacs/m3prarifla.fsf@verona.se/

applying [1/1] https://yhetil.org/emacs/m3prarifla.fsf@verona.se/
diff --git a/src/filemagic.c b/src/filemagic.c
new file mode 100644
index 0000000..1dcf065

1:61: trailing whitespace.
  printf("rvs:%s\n",rvs);  
Checking patch src/filemagic.c...
Applied patch src/filemagic.c cleanly.
warning: 1 line adds whitespace errors.

index at:
100644 1dcf0658dacfd5f29a7954466457cf384a72870b	src/filemagic.c

(*) 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 external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.