realpath.c (894fd2da788ecf13e14176f20d2781f4375f0b71) | realpath.c (de216a83c249f840ed7ab77170e2f235aed2d937) |
---|---|
1/*- 2 * Copyright (c) 1991, 1993, 1994 3 * The Regents of the University of California. All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 32 unchanged lines hidden (view full) --- 41#include <stdlib.h> 42#include <unistd.h> 43 44static void usage(void) __dead2; 45 46int 47main(int argc, char *argv[]) 48{ | 1/*- 2 * Copyright (c) 1991, 1993, 1994 3 * The Regents of the University of California. All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 32 unchanged lines hidden (view full) --- 41#include <stdlib.h> 42#include <unistd.h> 43 44static void usage(void) __dead2; 45 46int 47main(int argc, char *argv[]) 48{ |
49 char buf[MAXPATHLEN]; | 49 char buf[PATH_MAX]; |
50 char *p; 51 52 if (argc == 2) { 53 if ((p = realpath(argv[1], buf)) == NULL) 54 err(1, "%s", buf); 55 } else 56 usage(); 57 (void)printf("%s\n", p); 58 exit(0); 59} 60 61static void 62usage(void) 63{ 64 65 (void)fprintf(stderr, "usage: realpath path\n"); 66 exit(1); 67} | 50 char *p; 51 52 if (argc == 2) { 53 if ((p = realpath(argv[1], buf)) == NULL) 54 err(1, "%s", buf); 55 } else 56 usage(); 57 (void)printf("%s\n", p); 58 exit(0); 59} 60 61static void 62usage(void) 63{ 64 65 (void)fprintf(stderr, "usage: realpath path\n"); 66 exit(1); 67} |