This file is indexed.

/usr/include/klfbackend/klfblockprocess.h is in libklatexformula3-dev 3.2.7-1.

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
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
/***************************************************************************
 *   file klfblockprocess.h
 *   This file is part of the KLatexFormula Project.
 *   Copyright (C) 2011 by Philippe Faist
 *   philippe.faist@bluewin.ch
 *                                                                         *
 *   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.             *
 ***************************************************************************/
/* $Id: klfblockprocess.h 603 2011-02-26 23:14:55Z phfaist $ */

#ifndef KLFBLOCKPROCESS_H
#define KLFBLOCKPROCESS_H

//! Defines the KLFBlockProcess class
/** \file
 * Defines the KLFBlockProcess class */


#include <klfdefs.h>

#include <qprocess.h>
#include <qstring.h>
#ifdef KLFBACKEND_QT4
#include <QByteArray>
#else
#include <qcstring.h>
#include <qmemarray.h>
#endif


//! A QProcess subclass for code-blocking process execution
/** A Code-blocking (but not GUI-blocking) process executor
 *
 * Use for example like:
 * \code
 *   KLFBlockProcess proc;
 *   QStringList args;
 *   args << "ls" << "/dev";
 *   proc.startProcess(args);
 *   QString alldevices = proc.readStdoutString();
 * \endcode
 *
 * This class provides functionality for passing data to STDIN and
 * getting data from STDOUT and STDERR afterwards.
 *
 * \author Philippe Faist &lt;philippe.faist@bluewin.ch&gt;
 */
class KLF_EXPORT KLFBlockProcess : public QProcess
{
  Q_OBJECT
public:
  /** Normal constructor, like QProcess constructor */
  KLFBlockProcess(QObject *parent = 0);
  /** Normal destructor */
  ~KLFBlockProcess();

#ifdef KLFBACKEND_QT4
  /** Qt4 ONLY: specify whether or not to call regularly qApp->processEvents() while executing.
   * This will prevent the GUI to freeze. Enabled is the default. However you can choose to
   * disable this behavior by passing FALSE here. */
  inline void setProcessAppEvents(bool processAppEvents) { mProcessAppEvents = processAppEvents; }
#endif

  /** Returns all standard error output as a QByteArray. This function is to standardize the
   * readStderr() and readAllStandardError() functions in QT 3 or QT 4 respectively */
  QByteArray getAllStderr() {
#ifdef KLFBACKEND_QT4
    return readAllStandardError();
#else
    return readStderr();
#endif
  }

  /** Returns all standard output as a QByteArray. This function is to standardize the
   * readStdout() and readAllStandardOutput() functions in QT 3 or QT 4 respectively */
  QByteArray getAllStdout() {
#ifdef KLFBACKEND_QT4
    return readAllStandardOutput();
#else
    return readStdout();
#endif
  }

  /** A function that normalizes Qt3 and Qt4 api: Qt3: normalExit(), Qt4: exitStatus()==NormalExit */
  bool processNormalExit() const {
#ifdef KLFBACKEND_QT4
    return QProcess::exitStatus() == NormalExit;
#else
    return normalExit();
#endif
  }

  /** A function that normalizes Qt3 and Qt4 api: Qt3: exitStatus(), Qt4: exitCode() */
  int processExitStatus() const {
#ifdef KLFBACKEND_QT4
    return exitCode();
#else
    return exitStatus();
#endif
  }


public slots:
  /** Starts cmd (which is a list of arguments, the first being the
   * program itself) and blocks until process stopped. The QT event
   * loop is updated regularly so that the GUI doesn't freeze.
   *
   * Read result with QProcess::readStdout() and QProcess::readStderr(),
   * get process exit info with processNormalExit() and processExitStatus().
   *
   * \returns TRUE upon success, FALSE upon failure.
   */
  bool startProcess(QStringList cmd, QByteArray stdindata, QStringList env = QStringList());
#ifndef KLFBACKEND_QT4
  /** Convenient function if you want to pass string input to program
   * This mostly truncates the last '\\0' because programs don't like it.
   *
   * \warning this function is only available with QT 3. */
  bool startProcess(QStringList cmd, QCString str, QStringList env = QStringList());
#endif
  /** Convenient function to be used in the case where program doesn't
   * expect stdin data or if you chose to directly close stdin without writing
   * anything to it. */
  bool startProcess(QStringList cmd, QStringList env = QStringList());

#ifdef KLFBACKEND_QT4
  /** Same as getAllStderr(), except result is returned here as QString. */
  QString readStderrString() {
    return QString::fromLocal8Bit(getAllStderr());
  }
  /** Same as getAllStdout(), except result is returned here as QString. */
  QString readStdoutString() {
    return QString::fromLocal8Bit(getAllStdout());
  }
#else
  /** Like QProcess::readStdout(), except returns a QString instead of a QByteArray */
  QString readStdoutString() {
    QCString sstdout = "";
    QByteArray stdout = readStdout();
    if (stdout.size() > 0 && stdout.data() != 0)
      sstdout = QCString(stdout.data(), stdout.size());
    return QString(sstdout);
  }
  /** Like QProcess::readStderr(), except returns a QString instead of a QByteArray */
  QString readStderrString() {
    QCString sstderr = "";
    QByteArray stderr = readStderr();
    if (stderr.size() > 0 && stderr.data() != 0)
      sstderr = QCString(stderr.data(), stderr.size());
    return QString(sstderr);
  }
#endif


private slots:
  void ourProcExited();
  void ourProcGotOurStdinData();

private:
  bool _runstatus;
#ifdef KLFBACKEND_QT4
  bool mProcessAppEvents;
#endif
};


//! The current process environment
/** Returns the current process environment, as a QStringList. */
KLF_EXPORT QStringList klf_cur_environ();


#endif