This file is indexed.

/usr/share/doc/libnjb-doc/examples/gettr.c is in libnjb-doc 2.2.7~dfsg0-4.

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
122
123
124
125
126
127
128
129
#include "common.h"

static int progress (u_int64_t sent, u_int64_t total, const char* buf, unsigned len, void *data)
{
  int percent = (sent*100)/total;
#ifdef __WIN32__
  printf("Progress: %I64u of %I64u (%d%%)\r", sent, total, percent);
#else
  printf("Progress: %llu of %llu (%d%%)\r", sent, total, percent);
#endif
  fflush(stdout);
  return 0;
}

static void usage (void)
{
  fprintf(stderr, "gettr [ -s size ] <trackid> <filename>\n");
}

int main (int argc, char **argv)
{
  njb_t njbs[NJB_MAX_DEVICES], *njb;
  int n, opt, debug;
  u_int32_t id, size;
  extern int optind;
  extern char *optarg;
  char *endptr;
  char *file;
  
  debug= 0;
  size= 0;
  while ( (opt= getopt(argc, argv, "D:s:")) != -1 ) {
    switch (opt) {
    case 'D':
      debug= atoi(optarg);
      break;
    case 's':
      size= strtoul(optarg, &endptr, 10);
      if ( *endptr != '\0' ) {
	fprintf(stderr, "illegal size value %s\n",
		optarg);
	return 1;
      }
      break;
    default:
      usage();
      return 1;
    }
  }
  argc -= optind;
  argv += optind;
  
  if ( argc != 2 ) {
    usage();
    return 1;
  }
  
  id= strtoul(argv[0], &endptr, 10);
  if ( *endptr != 0 ) {
    fprintf(stderr, "illegal value %s\n", optarg);
    return 1;
  } else if ( ! id ) {
    fprintf(stderr, "bad song id %u\n", id);
    return 1;
  }
  
  file= argv[1];
  
  if ( debug ) NJB_Set_Debug(debug);

  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 1;
  } 
  
  njb = njbs;
  
  if ( NJB_Open(njb) == -1 ) {
    NJB_Error_Dump(njb,stderr);
    return 1;
  }
  
  NJB_Capture(njb);
  
  if ( ! size ) {
    njb_songid_t *tag;
    
    printf("Locating track %u\n", id);
    NJB_Reset_Get_Track_Tag(njb);
    while ( (tag = NJB_Get_Track_Tag(njb)) ) {
      if ( tag->trid == id ) {
	njb_songid_frame_t *frame;
	
	frame = NJB_Songid_Findframe(tag, FR_SIZE);
	size = frame->data.u_int32_val;
      }
      NJB_Songid_Destroy(tag);
    }

    /* Dump any pending errors */
    if (NJB_Error_Pending(njb)) {
      NJB_Error_Dump(njb, stderr);
    }
    
    if ( size ) {
      printf("%u bytes\n", size);
    } else {
      fprintf(stderr, "Track %u not found\n", id);
    }
  }
  
  if ( size ) {
    if ( NJB_Get_Track(njb, id, size, file, progress, NULL) == -1 ) {
      NJB_Error_Dump(njb, stderr);
    }
    printf("\n");
  }
  
  NJB_Release(njb);
  
  NJB_Close(njb);
  
  return 0;
}