File: view_file.c

package info (click to toggle)
libcdk5 5.0.20250116-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 3,584 kB
  • sloc: ansic: 32,706; sh: 5,364; makefile: 1,198; sed: 48; cpp: 41
file content (41 lines) | stat: -rw-r--r-- 764 bytes parent folder | download
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
#include <cdk_int.h>

/*
 * $Author: tom $
 * $Date: 2025/01/09 00:20:21 $
 * $Revision: 1.5 $
 */

/*
 * This allows the user to view a file.
 */
int viewFile (CDKSCREEN *screen,
	      const char *title,
	      const char *filename,
	      CDK_CSTRING2 buttons,
	      int buttonCount)
{
   /* *INDENT-EQLS* */
   int lines            = 0;
   char **info          = NULL;
   int result;

   /* Open the file and read the contents. */
   lines = CDKreadFile (filename, &info);

   /* If we couldn't read the file, return an error. */
   if (lines == -1)
   {
      result = lines;
   }
   else
   {

      result = viewInfo (screen, title,
			 (CDK_CSTRING2) info, lines,
			 buttons, buttonCount,
			 TRUE);
      CDKfreeStrings (info);
   }
   return result;
}