source: trunk/src/kmk/helpers.c@ 35

Last change on this file since 35 was 35, checked in by bird, 22 years ago

emx is kind of working again...

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 1.9 KB
Line 
1/* $Id: helpers.c 35 2003-03-18 03:58:49Z bird $
2 *
3 * Helpers.
4 *
5 * Copyright (c) 2003 knut st. osmundsen <bird@anduin.net>
6 *
7 */
8
9/*******************************************************************************
10* Header Files *
11*******************************************************************************/
12#ifdef USE_KLIB
13 #include <kLib/kLib.h>
14#endif
15#include <stdlib.h>
16#include <io.h>
17#include <sys/types.h>
18#include <sys/stat.h>
19#include <stdarg.h>
20#ifdef OS2
21 #define INCL_BASE
22 #include <os2.h>
23#endif
24#include <stdio.h>
25#include <err.h>
26
27
28#ifdef OS2
29/**
30 * Resolve pszFileName to a full name.
31 * @return pszResolvedName on success.
32 * @returns NULL if not found.
33 */
34char *realpath(const char *pszFileName, char *pszResolvedName)
35{
36 #if 0 //def USE_KLIB //@todo
37 if (kPathCanonifyEx(pszFileName, NULL, '/', '/', pszResolvedName, KFILE_LENGTH))
38 if (kPathExist(pszFileName))
39 return pszResolvedName;
40 #else
41 if (_fullpath(pszResolvedName, pszFileName, _MAX_PATH))
42 {
43 struct stat s;
44 if (!stat(pszResolvedName, &s))
45 return pszResolvedName;
46 }
47 #endif
48 return NULL;
49}
50#endif
51
52#ifdef OS2
53void err(int flags, const char *pszFormat, ...)
54{
55 va_list args;
56 va_start(args, pszFormat);
57 vfprintf(stderr, pszFormat, args);
58 va_end(args);
59 fprintf(stderr, "\n");
60}
61
62void errx(int flags, const char *pszFormat, ...)
63{
64 va_list args;
65 va_start(args, pszFormat);
66 vfprintf(stderr, pszFormat, args);
67 va_end(args);
68 fprintf(stderr, "\n");
69}
70
71void warnx(const char *pszFormat, ...)
72{
73 va_list args;
74 va_start(args, pszFormat);
75 vfprintf(stderr, pszFormat, args);
76 va_end(args);
77 fprintf(stderr, "\n");
78}
79
80void warn(const char *pszFormat, ...)
81{
82 va_list args;
83 va_start(args, pszFormat);
84 vfprintf(stderr, pszFormat, args);
85 va_end(args);
86 fprintf(stderr, "\n");
87}
88
89#endif
Note: See TracBrowser for help on using the repository browser.