1956e8222Scf46844 /* 2956e8222Scf46844 * Copyright 2005 Sun Microsystems, Inc. All rights reserved. 3956e8222Scf46844 * Use is subject to license terms. 4956e8222Scf46844 */ 5956e8222Scf46844 67c478bd9Sstevel@tonic-gate /* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */ 77c478bd9Sstevel@tonic-gate /* All Rights Reserved */ 87c478bd9Sstevel@tonic-gate 97c478bd9Sstevel@tonic-gate 107c478bd9Sstevel@tonic-gate /* 117c478bd9Sstevel@tonic-gate * Copyright (c) 1980 Regents of the University of California. 127c478bd9Sstevel@tonic-gate * All rights reserved. The Berkeley software License Agreement 137c478bd9Sstevel@tonic-gate * specifies the terms and conditions for redistribution. 147c478bd9Sstevel@tonic-gate */ 157c478bd9Sstevel@tonic-gate 16956e8222Scf46844 #pragma ident "%Z%%M% %I% %E% SMI" 177c478bd9Sstevel@tonic-gate 187c478bd9Sstevel@tonic-gate #include <stdio.h> 19*f22acdffSgbrunett #include <stdlib.h> 207c478bd9Sstevel@tonic-gate 21956e8222Scf46844 int 22956e8222Scf46844 main(int argc, char **argv) 237c478bd9Sstevel@tonic-gate { 24956e8222Scf46844 char *p1, *p2, *p3; 257c478bd9Sstevel@tonic-gate 267c478bd9Sstevel@tonic-gate if (argc < 2) { 277c478bd9Sstevel@tonic-gate (void) putchar('\n'); 287c478bd9Sstevel@tonic-gate exit(1); 297c478bd9Sstevel@tonic-gate } 307c478bd9Sstevel@tonic-gate p1 = argv[1]; 317c478bd9Sstevel@tonic-gate p2 = p1; 327c478bd9Sstevel@tonic-gate while (*p1) { 337c478bd9Sstevel@tonic-gate if (*p1++ == '/') 347c478bd9Sstevel@tonic-gate p2 = p1; 357c478bd9Sstevel@tonic-gate } 367c478bd9Sstevel@tonic-gate if (argc > 2) { 37*f22acdffSgbrunett p3 = argv[2]; 38*f22acdffSgbrunett while (*p3) 39*f22acdffSgbrunett p3++; 40*f22acdffSgbrunett 417c478bd9Sstevel@tonic-gate while (p3 > argv[2]) 427c478bd9Sstevel@tonic-gate if (p1 <= p2 || *--p3 != *--p1) 437c478bd9Sstevel@tonic-gate goto output; 447c478bd9Sstevel@tonic-gate *p1 = '\0'; 457c478bd9Sstevel@tonic-gate } 467c478bd9Sstevel@tonic-gate output: 47*f22acdffSgbrunett 48*f22acdffSgbrunett (void) fputs(p2, stdout); 49*f22acdffSgbrunett (void) putc('\n', stdout); 50956e8222Scf46844 return (0); 517c478bd9Sstevel@tonic-gate } 52