source: bootcd/isolinux/syslinux-6.03/com32/modules/pwd.c @ e16e8f2

Last change on this file since e16e8f2 was e16e8f2, checked in by Edwin Eefting <edwin@datux.nl>, 3 years ago

bootstuff

  • Property mode set to 100644
File size: 1.2 KB
Line 
1/* ----------------------------------------------------------------------- *
2 *
3 *   Copyright 2010 Gene Cumm - All Rights Reserved
4 *
5 *   This program is free software; you can redistribute it and/or modify
6 *   it under the terms of the GNU General Public License as published by
7 *   the Free Software Foundation, Inc., 53 Temple Place Ste 330,
8 *   Boston MA 02111-1307, USA; either version 2 of the License, or
9 *   (at your option) any later version; incorporated herein by reference.
10 *
11 * ----------------------------------------------------------------------- */
12
13/*
14 * Display present (current) working directory
15 */
16
17#include <errno.h>
18#include <stdio.h>
19#include <console.h>
20#include <unistd.h>
21#include <dirent.h>
22
23/* Size of path buffer string */
24#ifndef PATH_MAX
25#  ifdef NAME_MAX
26#    define PATH_MAX   NAME_MAX
27#  elif FILENAME_MAX
28#    define PATH_MAX   FILENAME_MAX
29#  else
30#    define PATH_MAX   256
31#  endif       /* NAME_MAX */
32#endif /* PATH_MAX */
33
34int main(void)
35{
36    int rv = 0;
37    char pwd[PATH_MAX], *pwdptr;
38
39    pwdptr = getcwd(pwd, PATH_MAX);
40    if (pwdptr) {
41       if (pwd[0] != 0)
42           puts(pwd);
43       else
44           puts(".");
45    } else {
46       rv = errno;
47       puts("ERROR: getcwd() returned NULL");
48    }
49    return rv;
50}
Note: See TracBrowser for help on using the repository browser.