view 3rdparty/packages/uucpbb/src/fixpath.c @ 3295:6b7a7b233925 default tip

makefile: Allow PORTS with level1/2 mix https://sourceforge.net/p/nitros9/feature-requests/10/
author Tormod Volden <debian.tormod@gmail.com>
date Tue, 19 Apr 2022 18:12:17 +0200
parents 5ba8e711a1a3
children
line wrap: on
line source

/*  fixpath.c  
    Copyright (C) 1990, 1993  Rick Adams and Bob Billson

    This file is part of the OS-9 UUCP package, UUCPbb.

    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., 675 Mass Ave, Cambridge, MA 02139, USA.

    The author of UUCPbb, Bob Billson, can be contacted at:
    bob@kc2wz.bubble.org  or  uunet!kc2wz!bob  or  by snail mail:
    21 Bates Way, Westfield, NJ 07090
*/

#include "uucp.h"

int fixpath (pathname)
char *pathname;
{
     char string[200], user[40];

     strcpy (string, pathname);

     if (strncmp (pathname, "~/", 2) == 0)
       {
          /* relative to uucppublic */
          sprintf (pathname, "%s/%s", pubdir, &string[2]);
       }
     else if (*pathname == '~')
       {
          /* relative to user directory */
          getuser (user);
          sprintf (pathname, "%s/%s/%s", userdir, user, &string[1]);

       }
     else if (*pathname == '/')
       {
          /* absolute path */
          return;
       }
     else
       {
          /* relative to current directory */
       }
}