This file is indexed.

/usr/share/doc/libnjb-doc/examples/tracks.c is in libnjb-doc 2.2.7~dfsg0-3ubuntu1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  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
#include "common.h"
#include <stdio.h>
#include <string.h>

static void songid_frame_dump (njb_songid_frame_t *frame, FILE *fp)
{
  fprintf(fp, "%s: ", frame->label);
	
  if ( frame->type == NJB_TYPE_STRING ) {
    fprintf(fp, "%s\n", frame->data.strval);
  } else if (frame->type == NJB_TYPE_UINT16) {
    fprintf(fp, "%d\n", frame->data.u_int16_val);
  } else if (frame->type == NJB_TYPE_UINT32) {
    fprintf(fp, "%u\n", frame->data.u_int32_val);
  } else {
    fprintf(fp, "(weird data word size, cannot display!)\n");
  }
}

static void songid_dump (njb_songid_t *song, FILE *fp)
{
  njb_songid_frame_t *frame;
  
  NJB_Songid_Reset_Getframe(song);
  fprintf(fp, "ID: %u\n", song->trid);
  while( (frame = NJB_Songid_Getframe(song)) ) {
    songid_frame_dump(frame, fp);
  }
}

int main (int argc, char **argv)
{
  njb_t njbs[NJB_MAX_DEVICES], *njb;
  extern char *optarg;
  int opt;
  int n, debug, rc = 1;
  int extended = 0; /* Whether to get extended track info */
  njb_songid_t *songtag;
  char *lang;
  
  debug= 0;
  while ( (opt= getopt(argc, argv, "D:E")) != -1 ) {
    switch (opt) {
    case 'D':
      debug = atoi(optarg);
      break;
    case 'E':
      extended = 1;
      break;
    default:
      fprintf(stderr, "usage: tracks [ -D debuglvl ] -E\n");
      return 1;
    }
  }
  
  if ( debug ) NJB_Set_Debug(debug);
  
  /*
   * Check environment variables $LANG and $LC_CTYPE
   * to see if we want to support UTF-8 unicode
   * $LANG = "xx_XX.UTF-8" or $LC_CTYPE = "?"
   * trigger unicode support.
   */
  lang = getenv("LANG");
  if (lang != NULL) {
    if (strlen(lang) > 5) {
      if (!strcmp(&lang[strlen(lang)-5], "UTF-8")) {
	NJB_Set_Unicode(NJB_UC_UTF8);
      }
    }
  }

  if (NJB_Discover(njbs, 0, &n) == -1) {
    fprintf(stderr, "could not locate any jukeboxes\n");
    return 1;
  }
  
  if ( n == 0 ) {
    fprintf(stderr, "no NJB devices found\n");
    return 0;
  } 
  
  njb = njbs;
  
  if ( NJB_Open(njb) == -1 ) {
    NJB_Error_Dump(njb,stderr);
    return 1;
  }
  
  if ( NJB_Capture(njb) == -1 ) {
    NJB_Error_Dump(njb,stderr);
    goto err1;
  }

  if (extended != 0) {
    NJB_Get_Extended_Tags(njb, 1);
  }
  
  n = 0;
  NJB_Reset_Get_Track_Tag(njb);
  while ( (songtag = NJB_Get_Track_Tag(njb)) ) {
    songid_dump(songtag, stdout);
    NJB_Songid_Destroy(songtag);
    printf("----------------------------------\n");
    n ++;
  }

  /* Dump any pending errors */
  if (NJB_Error_Pending(njb)) {
    NJB_Error_Dump(njb,stderr);
  }

  printf("In total: %u tracks.\n", n);
  
  NJB_Release(njb);
  rc = 0;
  
err1:
  NJB_Close(njb);
  return rc;
}