This file is indexed.

/usr/share/sdpa/mex/mexFprintf.c is in sdpam 7.3.9+dfsg-1build2.

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
/* -------------------------------------------------------------

This file is a component of SDPA
Copyright (C) 2004-2013 SDPA Project

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 <stdio.h>
#include <stdarg.h>
#include <string.h>
#include <stdlib.h>

#include <mex.h>


#define BUF_LENGTH 4096

int fprintf(FILE *stream, const char *format, ...)
{
  va_list arg;
  va_start(arg,format);
  int return_size = 0;
  if (stream == stdout) {
    char tmp_buf[BUF_LENGTH];
    vsprintf(tmp_buf,format,arg);
    #if 0
    printf("tmp_buf = %s",tmp_buf);
    #endif
    mexPrintf(tmp_buf);
    mexEvalString("drawnow;"); /* to dump string.*/
    return_size = strlen(tmp_buf);
    if ( return_size >= BUF_LENGTH ) {
      mexPrintf("Too Long Message To PrintOut "
		"(some part might be truncated)");
    }
  }
  else {
    return_size = vfprintf(stream,format,arg);
  }
  va_end(arg);
  return return_size;
}

static int internal_fprintf(FILE *stream, const char *format, ...)
{
  va_list arg;
  va_start(arg,format);
  int return_size = 0;
  return_size = vfprintf(stream,format,arg);
  va_end(arg);
  return return_size;
}

size_t fwrite(const void *ptr, size_t size, size_t nmemb,
              FILE *stream)
{
  #if 1
  fprintf(stream,"%s",(const char*)ptr);
  #else
  // internal_fprintf does not work well here
  internal_fprintf(stream, (const char*) internal_fprintf);
  #endif
  return 1;
}

int fputc(int c, FILE* fp)
{
  if (fp == stdout) {
    mexPrintf("%c",(unsigned char)c);
  }
  else {
    internal_fprintf(fp,"%c",c);
    /*    fprintf(fp,"%c ",c);*/
  }
  return c;
}

#ifdef __GNUC__
/*Only GNU, to avoid
      warning: 'noreturn' function does return
*/
static void internal_exit()           __attribute__ ((noreturn));
extern void mexErrMsgTxt(const char*) __attribute__ ((noreturn));
       void exit()                    __attribute__ ((noreturn));
       void abort()                   __attribute__ ((noreturn));
#endif

static void internal_exit()
{
  mexWarnMsgTxt("SDPA exits with some error.");
  mexWarnMsgTxt("Matlab should be reboot to clear up memory space.");
  mexErrMsgTxt("SDPA exits with some error.");
}

void exit(int status)
{
  internal_exit();
}
void abort(void)
{
  internal_exit();
}