home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #30 / NN_1992_30.iso / spool / comp / lang / perl / 7558 < prev    next >
SHell self-extracting ARchive  |  1992-12-21  |  16.8 KB

open in: MacOS 8.1     |     Win98     |     DOS

browse contents    |     view JSON data     |     view as text


This file was processed as: SHell self-extracting ARchive (archive/shar).

ConfidenceProgramDetectionMatch TypeSupport
100% dexvert SHell self-extracting ARchive (archive/shar) magic Supported
1% dexvert Text File (text/txt) fallback Supported
100% file ASCII text default
100% checkBytes Printable ASCII default
100% perlTextCheck Likely Text (Perl) default
100% siegfried fmt/329 Shell Archive Format default
100% detectItEasy Format: plain text[LF] default (weak)



hex view
+--------+-------------------------+-------------------------+--------+--------+
|00000000| 4e 65 77 73 67 72 6f 75 | 70 73 3a 20 63 6f 6d 70 |Newsgrou|ps: comp|
|00000010| 2e 6c 61 6e 67 2e 70 65 | 72 6c 0a 50 61 74 68 3a |.lang.pe|rl.Path:|
|00000020| 20 73 70 61 72 6b 79 21 | 75 75 6e 65 74 21 66 74 | sparky!|uunet!ft|
|00000030| 70 62 6f 78 21 6d 6d 75 | 65 67 65 6c 0a 46 72 6f |pbox!mmu|egel.Fro|
|00000040| 6d 3a 20 6d 6d 75 65 67 | 65 6c 40 6e 65 78 74 33 |m: mmueg|el@next3|
|00000050| 2e 63 6f 72 70 2e 6d 6f | 74 2e 63 6f 6d 20 28 4d |.corp.mo|t.com (M|
|00000060| 69 63 68 61 65 6c 20 53 | 2e 20 4d 75 65 67 65 6c |ichael S|. Muegel|
|00000070| 29 0a 53 75 62 6a 65 63 | 74 3a 20 52 65 3a 20 63 |).Subjec|t: Re: c|
|00000080| 6f 70 79 28 29 20 70 72 | 69 6d 69 74 69 76 65 3f |opy() pr|imitive?|
|00000090| 0a 4d 65 73 73 61 67 65 | 2d 49 44 3a 20 3c 31 39 |.Message|-ID: <19|
|000000a0| 39 32 44 65 63 32 30 2e | 30 36 30 38 35 38 2e 37 |92Dec20.|060858.7|
|000000b0| 35 38 31 40 66 74 70 62 | 6f 78 2e 6d 6f 74 2e 63 |581@ftpb|ox.mot.c|
|000000c0| 6f 6d 3e 0a 53 65 6e 64 | 65 72 3a 20 6e 65 77 73 |om>.Send|er: news|
|000000d0| 40 66 74 70 62 6f 78 2e | 6d 6f 74 2e 63 6f 6d 20 |@ftpbox.|mot.com |
|000000e0| 28 43 20 4e 65 77 73 29 | 0a 4f 72 67 61 6e 69 7a |(C News)|.Organiz|
|000000f0| 61 74 69 6f 6e 3a 20 43 | 6f 72 70 6f 72 61 74 65 |ation: C|orporate|
|00000100| 20 49 6e 66 6f 72 6d 61 | 74 69 6f 6e 20 4f 66 66 | Informa|tion Off|
|00000110| 69 63 65 2c 20 53 63 68 | 61 75 6d 62 75 72 67 2c |ice, Sch|aumburg,|
|00000120| 20 49 6c 6c 69 6e 6f 69 | 73 2c 20 4d 6f 74 6f 72 | Illinoi|s, Motor|
|00000130| 6f 6c 61 2c 20 49 6e 63 | 2e 0a 52 65 66 65 72 65 |ola, Inc|..Refere|
|00000140| 6e 63 65 73 3a 20 3c 31 | 67 71 6b 71 74 49 4e 4e |nces: <1|gqkqtINN|
|00000150| 38 6e 65 40 70 65 72 76 | 2e 68 61 6c 2e 43 4f 4d |8ne@perv|.hal.COM|
|00000160| 3e 0a 44 61 74 65 3a 20 | 53 75 6e 2c 20 32 30 20 |>.Date: |Sun, 20 |
|00000170| 44 65 63 20 31 39 39 32 | 20 30 36 3a 30 38 3a 35 |Dec 1992| 06:08:5|
|00000180| 38 20 47 4d 54 0a 4c 69 | 6e 65 73 3a 20 35 30 32 |8 GMT.Li|nes: 502|
|00000190| 0a 0a 50 72 65 76 69 6f | 75 73 6c 79 2c 20 61 61 |..Previo|usly, aa|
|000001a0| 68 7a 40 68 61 6c 2e 43 | 4f 4d 20 28 54 6f 6d 20 |hz@hal.C|OM (Tom |
|000001b0| 57 79 6c 69 65 29 20 77 | 72 6f 74 65 3a 0a 3e 20 |Wylie) w|rote:.> |
|000001c0| 49 73 20 74 68 65 72 65 | 20 73 6f 6d 65 20 72 65 |Is there| some re|
|000001d0| 61 73 6f 6e 20 74 68 65 | 72 65 20 69 73 6e 27 74 |ason the|re isn't|
|000001e0| 20 61 20 70 72 69 6d 69 | 74 69 76 65 20 66 6f 72 | a primi|tive for|
|000001f0| 20 63 6f 70 79 69 6e 67 | 20 66 69 6c 65 73 3f 0a | copying| files?.|
|00000200| 3e 20 28 61 6c 6f 6e 67 | 20 74 68 65 20 6c 69 6e |> (along| the lin|
|00000210| 65 73 20 6f 66 20 75 6e | 6c 69 6e 6b 20 61 6e 64 |es of un|link and|
|00000220| 20 72 65 6e 61 6d 65 29 | 2e 20 20 66 69 72 69 6e | rename)|. firin|
|00000230| 67 20 6f 66 66 20 62 61 | 63 6b 74 69 63 6b 65 64 |g off ba|ckticked|
|00000240| 20 2f 62 69 6e 2f 63 70 | 27 73 0a 3e 20 73 65 65 | /bin/cp|'s.> see|
|00000250| 6d 73 20 61 6d 61 7a 69 | 6e 67 6c 79 20 69 6e 65 |ms amazi|ngly ine|
|00000260| 66 66 69 63 69 65 6e 74 | 2c 20 61 6e 64 20 77 68 |fficient|, and wh|
|00000270| 69 6c 65 20 79 65 73 20 | 49 20 63 6f 75 6c 64 20 |ile yes |I could |
|00000280| 75 73 65 20 66 69 6c 65 | 68 61 6e 64 6c 65 73 2c |use file|handles,|
|00000290| 20 69 74 0a 3e 20 73 65 | 65 6d 73 20 74 6f 20 6d | it.> se|ems to m|
|000002a0| 65 20 74 68 61 74 20 61 | 20 70 72 69 6d 69 74 69 |e that a| primiti|
|000002b0| 76 65 20 74 68 61 74 20 | 6a 75 73 74 20 68 6f 72 |ve that |just hor|
|000002c0| 6b 73 20 69 6e 20 74 68 | 65 20 66 69 6c 65 20 61 |ks in th|e file a|
|000002d0| 6e 64 20 73 70 69 74 73 | 20 69 74 0a 3e 20 6f 75 |nd spits| it.> ou|
|000002e0| 74 20 73 6f 6d 65 77 68 | 65 72 65 20 65 6c 73 65 |t somewh|ere else|
|000002f0| 20 77 6f 75 6c 64 20 62 | 65 20 6d 75 63 68 20 66 | would b|e much f|
|00000300| 61 73 74 65 72 2e 20 20 | 49 20 63 61 6e 27 74 20 |aster. |I can't |
|00000310| 69 6d 61 67 69 6e 65 20 | 74 68 61 74 20 74 68 69 |imagine |that thi|
|00000320| 73 0a 3e 20 68 61 73 6e | 27 74 20 63 6f 6d 65 20 |s.> hasn|'t come |
|00000330| 75 70 2c 20 73 6f 20 49 | 20 66 69 67 75 72 65 20 |up, so I| figure |
|00000340| 74 68 65 72 65 20 6d 75 | 73 74 20 62 65 20 61 20 |there mu|st be a |
|00000350| 67 6f 6f 64 20 72 65 61 | 73 6f 6e 20 77 68 79 20 |good rea|son why |
|00000360| 74 68 65 72 65 20 69 73 | 6e 27 74 0a 3e 20 61 20 |there is|n't.> a |
|00000370| 63 6f 70 79 28 29 20 70 | 72 69 6d 69 74 69 76 65 |copy() p|rimitive|
|00000380| 2c 20 6a 75 73 74 20 77 | 6f 6e 64 65 72 69 6e 67 |, just w|ondering|
|00000390| 20 77 68 61 74 20 69 74 | 20 69 73 2e 0a 0a 4b 65 | what it| is...Ke|
|000003a0| 65 70 20 74 68 69 6e 67 | 73 20 6d 69 6e 69 6d 61 |ep thing|s minima|
|000003b0| 6c 20 49 20 67 75 65 73 | 73 20 28 68 65 79 2c 20 |l I gues|s (hey, |
|000003c0| 64 6f 6e 27 74 20 61 6c | 6c 20 79 6f 75 20 50 65 |don't al|l you Pe|
|000003d0| 72 6c 20 70 65 6f 70 6c | 65 20 6c 61 75 67 68 20 |rl peopl|e laugh |
|000003e0| 2a 74 6f 6f 2a 0a 6c 6f | 75 64 20 77 68 65 6e 20 |*too*.lo|ud when |
|000003f0| 49 20 73 61 79 20 74 68 | 61 74 20 3b 2d 29 2e 20 |I say th|at ;-). |
|00000400| 49 66 20 49 20 61 6d 20 | 64 6f 69 6e 67 20 73 6f |If I am |doing so|
|00000410| 6d 65 74 68 69 6e 67 20 | 6c 69 6b 65 20 63 70 20 |mething |like cp |
|00000420| 6f 66 74 65 6e 20 49 0a | 61 6c 77 61 79 73 20 77 |often I.|always w|
|00000430| 72 69 74 65 20 61 20 66 | 75 6e 63 74 69 6f 6e 20 |rite a f|unction |
|00000440| 74 6f 20 64 6f 20 74 68 | 65 20 77 6f 72 6b 20 73 |to do th|e work s|
|00000450| 69 6e 63 65 20 49 20 61 | 6d 20 61 20 73 74 69 63 |ince I a|m a stic|
|00000460| 6b 6c 65 72 20 66 6f 72 | 20 65 72 72 6f 72 0a 64 |kler for| error.d|
|00000470| 65 74 65 63 74 69 6f 6e | 2e 0a 0a 48 65 72 65 20 |etection|...Here |
|00000480| 61 72 65 20 61 20 73 65 | 74 20 6f 66 20 6c 69 62 |are a se|t of lib|
|00000490| 72 61 72 69 65 73 20 49 | 20 77 72 6f 74 65 20 74 |raries I| wrote t|
|000004a0| 6f 20 68 65 6c 70 20 64 | 6f 20 66 69 6c 65 20 73 |o help d|o file s|
|000004b0| 74 75 66 66 2e 20 49 20 | 77 72 6f 74 65 20 74 68 |tuff. I |wrote th|
|000004c0| 65 6d 0a 61 20 6c 6f 6e | 67 20 74 69 6d 65 20 61 |em.a lon|g time a|
|000004d0| 67 6f 20 28 77 69 74 68 | 20 61 20 66 65 77 20 75 |go (with| a few u|
|000004e0| 70 64 61 74 65 73 29 20 | 73 6f 20 74 68 65 79 20 |pdates) |so they |
|000004f0| 6d 61 79 20 6e 6f 74 20 | 62 65 20 70 72 65 74 74 |may not |be prett|
|00000500| 79 20 28 6e 6f 74 20 69 | 6e 0a 61 20 70 61 63 6b |y (not i|n.a pack|
|00000510| 61 67 65 2c 20 66 6f 72 | 20 69 6e 73 74 61 6e 63 |age, for| instanc|
|00000520| 65 29 2e 20 41 6c 73 6f | 2c 20 49 20 6d 69 73 70 |e). Also|, I misp|
|00000530| 65 6c 6c 65 64 20 6d 61 | 79 62 65 20 74 68 72 6f |elled ma|ybe thro|
|00000540| 75 67 68 74 20 6f 6e 65 | 20 6f 66 20 74 68 65 0a |ught one| of the.|
|00000550| 6c 69 62 72 61 72 69 65 | 73 2e 0a 0a 48 6f 70 65 |librarie|s...Hope|
|00000560| 20 73 6f 6d 65 6f 6e 65 | 20 66 69 6e 64 73 20 74 | someone| finds t|
|00000570| 68 65 6d 20 75 73 65 66 | 75 6c 2c 20 74 68 6f 75 |hem usef|ul, thou|
|00000580| 67 68 2e 20 43 6f 6e 73 | 74 72 75 63 74 69 76 65 |gh. Cons|tructive|
|00000590| 20 63 6f 6d 6d 65 6e 74 | 73 20 61 6c 77 61 79 73 | comment|s always|
|000005a0| 20 77 65 6c 63 6f 6d 65 | 2e 0a 0a 43 68 65 65 72 | welcome|...Cheer|
|000005b0| 73 2c 0a 2d 4d 69 6b 65 | 0a 0a 2d 2d 2d 2d 20 43 |s,.-Mike|..---- C|
|000005c0| 75 74 20 48 65 72 65 20 | 61 6e 64 20 66 65 65 64 |ut Here |and feed|
|000005d0| 20 74 68 65 20 66 6f 6c | 6c 6f 77 69 6e 67 20 74 | the fol|lowing t|
|000005e0| 6f 20 73 68 20 2d 2d 2d | 2d 0a 23 21 2f 62 69 6e |o sh ---|-.#!/bin|
|000005f0| 2f 73 68 0a 23 20 54 68 | 69 73 20 69 73 20 61 20 |/sh.# Th|is is a |
|00000600| 73 68 65 6c 6c 20 61 72 | 63 68 69 76 65 20 28 70 |shell ar|chive (p|
|00000610| 72 6f 64 75 63 65 64 20 | 62 79 20 73 68 61 72 20 |roduced |by shar |
|00000620| 33 2e 34 39 29 0a 23 20 | 54 6f 20 65 78 74 72 61 |3.49).# |To extra|
|00000630| 63 74 20 74 68 65 20 66 | 69 6c 65 73 20 66 72 6f |ct the f|iles fro|
|00000640| 6d 20 74 68 69 73 20 61 | 72 63 68 69 76 65 2c 20 |m this a|rchive, |
|00000650| 73 61 76 65 20 69 74 20 | 74 6f 20 61 20 66 69 6c |save it |to a fil|
|00000660| 65 2c 20 72 65 6d 6f 76 | 65 0a 23 20 65 76 65 72 |e, remov|e.# ever|
|00000670| 79 74 68 69 6e 67 20 61 | 62 6f 76 65 20 74 68 65 |ything a|bove the|
|00000680| 20 22 21 2f 62 69 6e 2f | 73 68 22 20 6c 69 6e 65 | "!/bin/|sh" line|
|00000690| 20 61 62 6f 76 65 2c 20 | 61 6e 64 20 74 79 70 65 | above, |and type|
|000006a0| 20 22 73 68 20 66 69 6c | 65 5f 6e 61 6d 65 22 2e | "sh fil|e_name".|
|000006b0| 0a 23 0a 23 20 6d 61 64 | 65 20 31 32 2f 32 30 2f |.#.# mad|e 12/20/|
|000006c0| 31 39 39 32 20 30 36 3a | 30 33 20 55 54 43 20 62 |1992 06:|03 UTC b|
|000006d0| 79 20 6d 6d 75 65 67 65 | 6c 40 6d 6f 74 2e 63 6f |y mmuege|l@mot.co|
|000006e0| 6d 20 28 4d 69 63 68 61 | 65 6c 20 53 2e 20 4d 75 |m (Micha|el S. Mu|
|000006f0| 65 67 65 6c 29 0a 23 20 | 53 6f 75 72 63 65 20 64 |egel).# |Source d|
|00000700| 69 72 65 63 74 6f 72 79 | 20 2f 75 73 72 2f 6c 6f |irectory| /usr/lo|
|00000710| 63 61 6c 2f 75 73 74 61 | 72 74 2d 61 6c 6c 2f 4e |cal/usta|rt-all/N|
|00000720| 65 58 54 2f 63 6f 6e 74 | 72 69 62 2f 6c 69 62 2f |eXT/cont|rib/lib/|
|00000730| 70 65 72 6c 0a 23 0a 23 | 20 65 78 69 73 74 69 6e |perl.#.#| existin|
|00000740| 67 20 66 69 6c 65 73 20 | 77 69 6c 6c 20 4e 4f 54 |g files |will NOT|
|00000750| 20 62 65 20 6f 76 65 72 | 77 72 69 74 74 65 6e 20 | be over|written |
|00000760| 75 6e 6c 65 73 73 20 2d | 63 20 69 73 20 73 70 65 |unless -|c is spe|
|00000770| 63 69 66 69 65 64 0a 23 | 0a 23 20 54 68 69 73 20 |cified.#|.# This |
|00000780| 73 68 61 72 20 63 6f 6e | 74 61 69 6e 73 3a 0a 23 |shar con|tains:.#|
|00000790| 20 6c 65 6e 67 74 68 20 | 20 6d 6f 64 65 20 20 20 | length | mode |
|000007a0| 20 20 20 20 6e 61 6d 65 | 0a 23 20 2d 2d 2d 2d 2d | name|.# -----|
|000007b0| 2d 20 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 20 2d 2d 2d |- ------|---- ---|
|000007c0| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|000007d0| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|000007e0| 2d 2d 2d 2d 2d 2d 2d 0a | 23 20 20 31 30 36 34 30 |-------.|# 10640|
|000007f0| 20 2d 72 2d 2d 72 2d 2d | 72 2d 2d 20 66 69 6c 65 | -r--r--|r-- file|
|00000800| 6f 70 2e 70 6c 0a 23 20 | 20 20 32 39 35 34 20 2d |op.pl.# | 2954 -|
|00000810| 72 2d 2d 72 2d 2d 72 2d | 2d 20 66 69 6c 65 69 6e |r--r--r-|- filein|
|00000820| 66 6f 2e 70 6c 0a 23 0a | 23 20 3d 3d 3d 3d 3d 3d |fo.pl.#.|# ======|
|00000830| 3d 3d 3d 3d 3d 3d 3d 20 | 66 69 6c 65 6f 70 2e 70 |======= |fileop.p|
|00000840| 6c 20 3d 3d 3d 3d 3d 3d | 3d 3d 3d 3d 3d 3d 3d 3d |l ======|========|
|00000850| 0a 69 66 20 74 65 73 74 | 20 2d 66 20 27 66 69 6c |.if test| -f 'fil|
|00000860| 65 6f 70 2e 70 6c 27 20 | 2d 61 20 58 22 24 31 22 |eop.pl' |-a X"$1"|
|00000870| 20 21 3d 20 58 22 2d 63 | 22 3b 20 74 68 65 6e 0a | != X"-c|"; then.|
|00000880| 09 65 63 68 6f 20 27 78 | 20 2d 20 73 6b 69 70 70 |.echo 'x| - skipp|
|00000890| 69 6e 67 20 66 69 6c 65 | 6f 70 2e 70 6c 20 28 46 |ing file|op.pl (F|
|000008a0| 69 6c 65 20 61 6c 72 65 | 61 64 79 20 65 78 69 73 |ile alre|ady exis|
|000008b0| 74 73 29 27 0a 65 6c 73 | 65 0a 65 63 68 6f 20 27 |ts)'.els|e.echo '|
|000008c0| 78 20 2d 20 65 78 74 72 | 61 63 74 69 6e 67 20 66 |x - extr|acting f|
|000008d0| 69 6c 65 6f 70 2e 70 6c | 20 28 54 65 78 74 29 27 |ileop.pl| (Text)'|
|000008e0| 0a 73 65 64 20 27 73 2f | 5e 58 2f 2f 27 20 3c 3c |.sed 's/|^X//' <<|
|000008f0| 20 27 53 48 41 52 5f 45 | 4f 46 27 20 3e 20 27 66 | 'SHAR_E|OF' > 'f|
|00000900| 69 6c 65 6f 70 2e 70 6c | 27 20 26 26 0a 3b 23 20 |ileop.pl|' &&.;# |
|00000910| 4e 41 4d 45 0a 3b 23 20 | 20 20 20 66 69 6c 65 6f |NAME.;# | fileo|
|00000920| 70 2e 70 6c 20 2d 20 70 | 65 72 6c 20 66 75 6e 63 |p.pl - p|erl func|
|00000930| 74 69 6f 6e 28 73 29 20 | 63 72 65 61 74 65 2c 20 |tion(s) |create, |
|00000940| 72 65 6d 6f 76 65 2c 20 | 63 6f 70 79 2c 20 61 6e |remove, |copy, an|
|00000950| 64 20 63 68 61 6e 67 65 | 20 6d 6f 64 65 20 6f 66 |d change| mode of|
|00000960| 20 0a 3b 23 09 09 20 20 | 66 69 6c 65 20 73 79 73 | .;#.. |file sys|
|00000970| 74 65 6d 20 6f 62 6a 65 | 63 74 73 0a 3b 23 0a 3b |tem obje|cts.;#.;|
|00000980| 23 20 44 45 53 43 52 49 | 50 54 49 4f 4e 0a 3b 23 |# DESCRI|PTION.;#|
|00000990| 20 20 20 20 26 4d 61 79 | 62 65 65 5f 44 65 6c 65 | &May|bee_Dele|
|000009a0| 74 65 5f 50 61 74 68 2c | 20 26 43 72 65 61 74 65 |te_Path,| &Create|
|000009b0| 5f 53 79 6d 6c 69 6e 6b | 2c 20 61 6e 64 20 26 43 |_Symlink|, and &C|
|000009c0| 72 65 61 74 65 5f 44 69 | 72 20 73 68 61 72 65 20 |reate_Di|r share |
|000009d0| 33 20 63 6f 6d 6d 6f 6e | 20 0a 3b 23 20 20 20 20 |3 common| .;# |
|000009e0| 61 72 67 75 6d 65 6e 74 | 73 3a 20 24 4f 76 65 72 |argument|s: $Over|
|000009f0| 72 69 64 65 5f 49 66 5f | 4c 69 6e 6b 2c 20 24 4f |ride_If_|Link, $O|
|00000a00| 76 65 72 72 69 64 65 5f | 49 66 5f 46 69 6c 65 2c |verride_|If_File,|
|00000a10| 20 61 6e 64 20 24 4f 76 | 65 72 72 69 64 65 5f 49 | and $Ov|erride_I|
|00000a20| 66 5f 44 69 72 2e 0a 3b | 23 20 20 20 20 54 68 65 |f_Dir..;|# The|
|00000a30| 79 20 68 61 76 65 20 74 | 68 65 20 66 6f 6c 6c 6f |y have t|he follo|
|00000a40| 77 69 6e 67 20 6d 65 61 | 6e 69 6e 67 20 77 68 65 |wing mea|ning whe|
|00000a50| 72 65 20 50 61 74 68 20 | 69 73 20 74 68 65 20 6f |re Path |is the o|
|00000a60| 62 6a 65 63 74 20 74 68 | 61 74 20 77 69 6c 6c 20 |bject th|at will |
|00000a70| 62 65 20 0a 3b 23 20 20 | 20 20 63 72 65 61 74 65 |be .;# | create|
|00000a80| 64 3a 0a 3b 23 0a 3b 23 | 20 20 20 20 20 20 20 49 |d:.;#.;#| I|
|00000a90| 66 20 50 61 74 68 20 69 | 73 20 61 20 6c 69 6e 6b |f Path i|s a link|
|00000aa0| 3a 0a 3b 23 20 20 20 20 | 20 20 20 20 20 20 2b 20 |:.;# | + |
|00000ab0| 54 68 65 20 6f 70 65 72 | 61 74 69 6f 6e 20 77 69 |The oper|ation wi|
|00000ac0| 6c 6c 20 62 65 20 66 6f | 72 63 65 64 20 69 66 20 |ll be fo|rced if |
|00000ad0| 24 4f 76 65 72 72 69 64 | 65 5f 49 66 5f 4c 69 6e |$Overrid|e_If_Lin|
|00000ae0| 6b 20 69 73 20 54 52 55 | 45 0a 3b 23 20 20 20 20 |k is TRU|E.;# |
|00000af0| 20 20 20 20 20 20 2b 20 | 54 68 65 20 6f 70 65 72 | + |The oper|
|00000b00| 61 74 69 6f 6e 20 77 69 | 6c 6c 20 6e 6f 74 20 62 |ation wi|ll not b|
|00000b10| 65 20 63 72 65 61 74 65 | 64 20 6f 74 68 65 72 77 |e create|d otherw|
|00000b20| 69 73 65 0a 3b 23 0a 3b | 23 20 20 20 20 20 20 20 |ise.;#.;|# |
|00000b30| 49 66 20 50 61 74 68 20 | 69 73 20 61 20 66 69 6c |If Path |is a fil|
|00000b40| 65 3a 0a 3b 23 20 20 20 | 20 20 20 20 20 20 20 2b |e:.;# | +|
|00000b50| 20 54 68 65 20 6f 70 65 | 72 61 74 69 6f 6e 20 77 | The ope|ration w|
|00000b60| 69 6c 6c 20 62 65 20 66 | 6f 72 63 65 64 20 69 66 |ill be f|orced if|
|00000b70| 20 24 4f 76 65 72 72 69 | 64 65 5f 49 66 5f 46 69 | $Overri|de_If_Fi|
|00000b80| 6c 65 20 69 73 20 54 52 | 55 45 0a 3b 23 20 20 20 |le is TR|UE.;# |
|00000b90| 20 20 20 20 20 20 20 2b | 20 54 68 65 20 6f 70 65 | +| The ope|
|00000ba0| 72 61 74 69 6f 6e 20 77 | 69 6c 6c 20 6e 6f 74 20 |ration w|ill not |
|00000bb0| 62 65 20 63 72 65 61 74 | 65 64 20 6f 74 68 65 72 |be creat|ed other|
|00000bc0| 77 69 73 65 0a 3b 23 0a | 3b 23 20 20 20 20 20 20 |wise.;#.|;# |
|00000bd0| 20 49 66 20 50 61 74 68 | 20 69 73 20 61 20 64 69 | If Path| is a di|
|00000be0| 72 65 63 74 6f 72 79 3a | 0a 3b 23 20 20 20 20 20 |rectory:|.;# |
|00000bf0| 20 20 20 20 20 2b 20 54 | 68 65 20 6f 70 65 72 61 | + T|he opera|
|00000c00| 74 69 6f 6e 20 77 69 6c | 6c 20 62 65 20 66 6f 72 |tion wil|l be for|
|00000c10| 63 65 64 20 69 66 20 24 | 4f 76 65 72 72 69 64 65 |ced if $|Override|
|00000c20| 5f 49 66 5f 44 69 72 20 | 69 73 20 54 52 55 45 0a |_If_Dir |is TRUE.|
|00000c30| 3b 23 20 20 20 20 20 20 | 20 20 20 20 2b 20 54 68 |;# | + Th|
|00000c40| 65 20 6f 70 65 72 61 74 | 69 6f 6e 20 77 69 6c 6c |e operat|ion will|
|00000c50| 20 6e 6f 74 20 62 65 20 | 63 72 65 61 74 65 64 20 | not be |created |
|00000c60| 6f 74 68 65 72 77 69 73 | 65 0a 3b 23 0a 3b 23 20 |otherwis|e.;#.;# |
|00000c70| 20 20 20 20 20 20 49 66 | 20 50 61 74 68 20 64 6f | If| Path do|
|00000c80| 65 73 20 6e 6f 74 20 65 | 78 69 73 74 20 61 74 20 |es not e|xist at |
|00000c90| 61 6c 6c 3a 0a 3b 23 20 | 20 20 20 20 20 20 20 20 |all:.;# | |
|00000ca0| 20 2b 20 54 68 65 20 64 | 69 72 65 63 74 6f 72 79 | + The d|irectory|
|00000cb0| 20 77 69 6c 6c 20 61 6c | 77 61 79 73 20 62 65 20 | will al|ways be |
|00000cc0| 63 72 65 61 74 65 64 0a | 3b 23 0a 3b 23 20 20 20 |created.|;#.;# |
|00000cd0| 20 54 68 65 79 20 61 6c | 6c 20 72 65 74 75 72 6e | They al|l return|
|00000ce0| 20 74 68 65 20 73 61 6d | 65 20 74 68 69 6e 67 2c | the sam|e thing,|
|00000cf0| 20 61 20 28 24 53 74 61 | 74 75 73 2c 20 24 4d 73 | a ($Sta|tus, $Ms|
|00000d00| 67 29 20 70 61 69 72 20 | 77 68 65 72 65 20 24 73 |g) pair |where $s|
|00000d10| 74 61 74 75 73 20 69 73 | 3a 0a 3b 23 0a 3b 23 20 |tatus is|:.;#.;# |
|00000d20| 20 20 20 20 20 20 2d 31 | 20 09 54 68 65 20 61 63 | -1| .The ac|
|00000d30| 74 69 6f 6e 20 63 6f 75 | 6c 64 20 6e 6f 74 20 62 |tion cou|ld not b|
|00000d40| 65 20 70 65 72 66 6f 72 | 6d 65 64 20 62 65 63 61 |e perfor|med beca|
|00000d50| 75 73 65 20 61 20 63 6f | 6e 64 69 74 69 6f 6e 20 |use a co|ndition |
|00000d60| 66 6f 72 20 0a 3b 23 09 | 09 74 68 65 20 61 63 74 |for .;#.|.the act|
|00000d70| 69 6f 6e 20 77 61 73 20 | 6e 6f 74 20 6d 65 74 2e |ion was |not met.|
|00000d80| 20 24 4d 73 67 20 74 65 | 6c 6c 73 20 77 68 79 20 | $Msg te|lls why |
|00000d90| 6e 6f 74 2e 0a 3b 23 0a | 3b 23 20 20 20 20 20 20 |not..;#.|;# |
|00000da0| 20 30 20 09 54 68 65 20 | 61 63 74 69 6f 6e 20 63 | 0 .The |action c|
|00000db0| 6f 75 6c 64 20 6e 6f 74 | 20 62 65 20 70 65 72 66 |ould not| be perf|
|00000dc0| 6f 72 6d 65 64 20 62 65 | 63 61 75 73 65 20 6f 66 |ormed be|cause of|
|00000dd0| 20 61 6e 20 65 72 72 6f | 72 2e 20 24 4d 73 67 20 | an erro|r. $Msg |
|00000de0| 0a 3b 23 09 09 74 65 6c | 6c 73 20 77 68 61 74 20 |.;#..tel|ls what |
|00000df0| 68 61 70 70 65 6e 65 64 | 2e 0a 3b 23 0a 3b 23 20 |happened|..;#.;# |
|00000e00| 20 20 20 09 20 31 20 09 | 54 68 65 20 61 63 74 69 | . 1 .|The acti|
|00000e10| 6f 6e 20 77 61 73 20 73 | 75 63 63 65 73 73 66 75 |on was s|uccessfu|
|00000e20| 6c 79 20 70 65 72 66 6f | 6d 65 64 2e 20 24 4d 73 |ly perfo|med. $Ms|
|00000e30| 67 20 74 65 6c 6c 73 20 | 77 68 61 74 20 77 65 20 |g tells |what we |
|00000e40| 64 69 64 2e 0a 3b 23 0a | 3b 23 20 41 55 54 48 4f |did..;#.|;# AUTHO|
|00000e50| 52 0a 3b 23 20 20 20 20 | 4d 69 63 68 61 65 6c 20 |R.;# |Michael |
|00000e60| 53 2e 20 4d 75 65 67 65 | 6c 20 28 6d 6d 75 65 67 |S. Muege|l (mmueg|
|00000e70| 65 6c 40 6d 6f 74 2e 63 | 6f 6d 29 0a 3b 23 0a 3b |el@mot.c|om).;#.;|
|00000e80| 23 20 52 43 53 20 49 4e | 46 4f 52 4d 41 54 49 4f |# RCS IN|FORMATIO|
|00000e90| 4e 0a 3b 23 20 20 20 20 | 24 41 75 74 68 6f 72 3a |N.;# |$Author:|
|00000ea0| 20 6d 6d 75 65 67 65 6c | 20 24 0a 3b 23 20 20 20 | mmuegel| $.;# |
|00000eb0| 20 24 48 65 61 64 65 72 | 3a 20 2f 75 73 72 2f 6c | $Header|: /usr/l|
|00000ec0| 6f 63 61 6c 2f 75 73 74 | 61 72 74 2f 73 72 63 2f |ocal/ust|art/src/|
|00000ed0| 70 65 72 6c 2d 73 74 75 | 66 66 2f 6c 69 62 73 2f |perl-stu|ff/libs/|
|00000ee0| 66 77 72 64 63 2f 6d 69 | 73 63 2f 52 43 53 2f 66 |fwrdc/mi|sc/RCS/f|
|00000ef0| 69 6c 65 6f 70 2e 70 6c | 2c 76 20 31 2e 36 20 31 |ileop.pl|,v 1.6 1|
|00000f00| 39 39 32 2f 31 31 2f 30 | 32 20 30 32 3a 35 38 3a |992/11/0|2 02:58:|
|00000f10| 32 31 20 6d 6d 75 65 67 | 65 6c 20 45 78 70 20 24 |21 mmueg|el Exp $|
|00000f20| 0a 58 0a 72 65 71 75 69 | 72 65 20 22 66 69 6c 65 |.X.requi|re "file|
|00000f30| 69 6e 66 6f 2e 70 6c 22 | 3b 0a 58 0a 3b 23 23 23 |info.pl"|;.X.;###|
|00000f40| 23 23 23 23 23 23 23 23 | 23 23 23 23 23 23 23 23 |########|########|
|00000f50| 23 23 23 23 23 23 23 23 | 23 23 23 23 23 23 23 23 |########|########|
|00000f60| 23 23 23 23 23 23 23 23 | 23 23 23 23 23 23 23 23 |########|########|
|00000f70| 23 23 23 23 23 23 23 23 | 23 23 23 23 23 23 23 23 |########|########|
|00000f80| 23 23 23 23 23 23 23 23 | 23 23 23 23 0a 3b 23 20 |########|####.;# |
|00000f90| 4d 61 79 62 65 65 5f 44 | 65 6c 65 74 65 5f 50 61 |Maybee_D|elete_Pa|
|00000fa0| 74 68 0a 3b 23 0a 3b 23 | 20 44 65 6c 65 74 65 73 |th.;#.;#| Deletes|
|00000fb0| 20 24 50 61 74 68 20 64 | 65 70 65 6e 64 69 6e 67 | $Path d|epending|
|00000fc0| 20 6f 6e 20 74 68 65 20 | 44 65 6c 65 74 65 20 61 | on the |Delete a|
|00000fd0| 72 67 75 6d 65 6e 74 73 | 2e 20 24 4d 73 67 20 69 |rguments|. $Msg i|
|00000fe0| 73 20 61 20 6d 65 73 73 | 61 67 65 0a 3b 23 20 73 |s a mess|age.;# s|
|00000ff0| 61 79 69 6e 67 20 77 68 | 61 74 20 64 65 6c 74 69 |aying wh|at delti|
|00001000| 6f 6e 20 6f 63 63 75 72 | 65 64 20 28 6e 75 6c 6c |on occur|ed (null|
|00001010| 20 69 66 20 6e 6f 6e 65 | 29 2e 20 24 54 79 70 65 | if none|). $Type|
|00001020| 20 69 73 20 73 65 74 20 | 74 6f 20 22 6c 69 6e 6b | is set |to "link|
|00001030| 22 2c 20 0a 3b 23 20 22 | 64 69 72 65 63 74 6f 72 |", .;# "|director|
|00001040| 79 22 2c 20 22 66 69 6c | 65 22 2c 20 6f 72 20 22 |y", "fil|e", or "|
|00001050| 22 20 64 65 70 65 6e 64 | 69 6e 67 20 6f 6e 20 77 |" depend|ing on w|
|00001060| 68 65 74 68 65 72 20 24 | 50 61 74 68 20 77 61 73 |hether $|Path was|
|00001070| 20 61 6e 79 20 6f 66 20 | 74 68 65 6d 2e 0a 3b 23 | any of |them..;#|
|00001080| 20 46 69 6e 61 6c 6c 79 | 2c 20 24 53 74 61 74 75 | Finally|, $Statu|
|00001090| 73 20 69 73 3a 0a 3b 23 | 0a 3b 23 20 20 20 2d 31 |s is:.;#|.;# -1|
|000010a0| 20 69 66 20 61 20 64 65 | 6c 65 74 69 6f 6e 20 77 | if a de|letion w|
|000010b0| 61 73 20 6e 65 63 65 73 | 73 2e 20 62 75 74 20 66 |as neces|s. but f|
|000010c0| 61 69 6c 65 64 0a 3b 23 | 20 20 20 20 30 20 69 66 |ailed.;#| 0 if|
|000010d0| 20 61 20 64 65 6c 65 74 | 65 20 77 61 73 20 6e 6f | a delet|e was no|
|000010e0| 74 20 6e 65 63 65 73 73 | 0a 3b 23 20 20 20 20 31 |t necess|.;# 1|
|000010f0| 20 69 66 20 61 20 64 65 | 6c 65 74 65 20 77 61 73 | if a de|lete was|
|00001100| 20 6e 65 63 65 73 73 20 | 61 6e 64 20 73 75 63 63 | necess |and succ|
|00001110| 65 65 64 65 64 0a 3b 23 | 0a 3b 23 20 41 72 67 75 |eeded.;#|.;# Argu|
|00001120| 6d 65 6e 74 73 3a 0a 3b | 23 20 20 20 20 24 50 61 |ments:.;|# $Pa|
|00001130| 74 68 2c 20 24 44 65 6c | 65 74 65 5f 49 66 5f 4c |th, $Del|ete_If_L|
|00001140| 69 6e 6b 2c 20 24 44 65 | 6c 65 74 65 5f 49 66 5f |ink, $De|lete_If_|
|00001150| 46 69 6c 65 2c 20 24 44 | 65 6c 65 74 65 5f 49 66 |File, $D|elete_If|
|00001160| 5f 44 69 72 0a 3b 23 0a | 3b 23 20 52 65 74 75 72 |_Dir.;#.|;# Retur|
|00001170| 6e 73 3a 0a 3b 23 20 20 | 20 20 24 53 74 61 74 75 |ns:.;# | $Statu|
|00001180| 73 2c 20 24 54 79 70 65 | 2c 20 24 4d 73 67 0a 3b |s, $Type|, $Msg.;|
|00001190| 23 23 23 23 23 23 23 23 | 23 23 23 23 23 23 23 23 |########|########|
|000011a0| 23 23 23 23 23 23 23 23 | 23 23 23 23 23 23 23 23 |########|########|
|000011b0| 23 23 23 23 23 23 23 23 | 23 23 23 23 23 23 23 23 |########|########|
|000011c0| 23 23 23 23 23 23 23 23 | 23 23 23 23 23 23 23 23 |########|########|
|000011d0| 23 23 23 23 23 23 23 23 | 23 23 23 23 23 23 23 0a |########|#######.|
|000011e0| 73 75 62 20 4d 61 79 62 | 65 65 5f 44 65 6c 65 74 |sub Mayb|ee_Delet|
|000011f0| 65 5f 50 61 74 68 0a 7b | 0a 58 20 20 20 6c 6f 63 |e_Path.{|.X loc|
|00001200| 61 6c 20 28 24 50 61 74 | 68 2c 20 24 44 65 6c 65 |al ($Pat|h, $Dele|
|00001210| 74 65 5f 49 66 5f 4c 69 | 6e 6b 2c 20 24 44 65 6c |te_If_Li|nk, $Del|
|00001220| 65 74 65 5f 49 66 5f 46 | 69 6c 65 2c 20 24 44 65 |ete_If_F|ile, $De|
|00001230| 6c 65 74 65 5f 49 66 5f | 44 69 72 29 20 3d 20 40 |lete_If_|Dir) = @|
|00001240| 5f 3b 0a 58 20 20 20 6c | 6f 63 61 6c 20 28 24 54 |_;.X l|ocal ($T|
|00001250| 79 70 65 2c 20 24 4d 73 | 67 29 3b 0a 58 0a 58 20 |ype, $Ms|g);.X.X |
|00001260| 20 20 23 20 43 68 65 63 | 6b 20 66 6f 72 20 65 78 | # Chec|k for ex|
|00001270| 69 73 74 69 6e 67 20 6c | 69 6e 6b 0a 58 20 20 20 |isting l|ink.X |
|00001280| 69 66 20 28 2d 6c 20 24 | 50 61 74 68 29 0a 58 20 |if (-l $|Path).X |
|00001290| 20 20 7b 0a 58 20 20 20 | 20 20 20 24 54 79 70 65 | {.X | $Type|
|000012a0| 20 3d 20 22 6c 69 6e 6b | 22 3b 0a 58 20 20 20 20 | = "link|";.X |
|000012b0| 20 20 72 65 74 75 72 6e | 20 28 2d 31 2c 20 24 54 | return| (-1, $T|
|000012c0| 79 70 65 2c 20 22 24 50 | 61 74 68 20 69 73 20 61 |ype, "$P|ath is a|
|000012d0| 6c 72 65 61 64 79 20 61 | 20 6c 69 6e 6b 22 29 20 |lready a| link") |
|000012e0| 69 66 20 28 21 20 24 44 | 65 6c 65 74 65 5f 49 66 |if (! $D|elete_If|
|000012f0| 5f 4c 69 6e 6b 29 3b 0a | 58 20 20 20 7d 20 0a 58 |_Link);.|X } .X|
|00001300| 0a 58 20 20 20 23 20 4e | 65 65 64 20 74 6f 20 69 |.X # N|eed to i|
|00001310| 73 6f 6c 61 74 65 20 74 | 68 65 73 65 2c 20 72 65 |solate t|hese, re|
|00001320| 61 6c 6c 79 2e 2e 2e 0a | 58 20 20 20 65 6c 73 65 |ally....|X else|
|00001330| 0a 58 20 20 20 7b 0a 58 | 20 20 20 20 20 20 23 20 |.X {.X| # |
|00001340| 43 68 65 63 6b 20 66 6f | 72 20 65 78 69 73 74 69 |Check fo|r existi|
|00001350| 6e 67 20 66 69 6c 65 2f | 64 69 72 65 63 74 6f 72 |ng file/|director|
|00001360| 79 0a 58 20 20 20 20 20 | 20 69 66 20 28 2d 64 20 |y.X | if (-d |
|00001370| 24 50 61 74 68 29 0a 58 | 20 20 20 20 20 20 7b 0a |$Path).X| {.|
|00001380| 58 20 20 20 20 20 20 20 | 20 20 24 54 79 70 65 20 |X | $Type |
|00001390| 3d 20 22 64 69 72 65 63 | 74 6f 72 79 22 3b 0a 58 |= "direc|tory";.X|
|000013a0| 20 20 20 20 20 20 20 20 | 20 72 65 74 75 72 6e 20 | | return |
|000013b0| 28 2d 31 2c 20 24 54 79 | 70 65 2c 20 22 24 50 61 |(-1, $Ty|pe, "$Pa|
|000013c0| 74 68 20 69 73 20 61 20 | 64 69 72 65 63 74 6f 72 |th is a |director|
|000013d0| 79 22 29 20 69 66 20 28 | 21 20 24 44 65 6c 65 74 |y") if (|! $Delet|
|000013e0| 65 5f 49 66 5f 44 69 72 | 29 3b 0a 58 20 20 20 20 |e_If_Dir|);.X |
|000013f0| 20 20 7d 3b 0a 58 20 20 | 20 20 20 20 69 66 20 28 | };.X | if (|
|00001400| 2d 66 20 5f 29 0a 58 20 | 20 20 20 20 20 7b 0a 58 |-f _).X | {.X|
|00001410| 20 20 20 20 20 20 20 20 | 20 24 54 79 70 65 20 3d | | $Type =|
|00001420| 20 22 66 69 6c 65 22 3b | 0a 58 20 20 20 20 20 20 | "file";|.X |
|00001430| 20 20 20 72 65 74 75 72 | 6e 20 28 2d 31 2c 20 24 | retur|n (-1, $|
|00001440| 54 79 70 65 2c 20 22 24 | 50 61 74 68 20 69 73 20 |Type, "$|Path is |
|00001450| 61 20 66 69 6c 65 22 29 | 20 69 66 20 28 21 20 24 |a file")| if (! $|
|00001460| 44 65 6c 65 74 65 5f 49 | 66 5f 46 69 6c 65 29 3b |Delete_I|f_File);|
|00001470| 0a 58 20 20 20 20 20 20 | 7d 3b 0a 58 20 20 20 7d |.X |};.X }|
|00001480| 3b 0a 58 0a 58 20 20 20 | 23 20 44 65 6c 65 74 65 |;.X.X |# Delete|
|00001490| 20 24 50 61 74 68 20 69 | 66 20 6e 65 63 65 73 73 | $Path i|f necess|
|000014a0| 2e 0a 58 20 20 20 69 66 | 20 28 24 54 79 70 65 29 |..X if| ($Type)|
|000014b0| 0a 58 20 20 20 7b 0a 58 | 20 20 20 20 20 20 72 65 |.X {.X| re|
|000014c0| 74 75 72 6e 20 28 2d 31 | 2c 20 24 54 79 70 65 2c |turn (-1|, $Type,|
|000014d0| 20 22 63 6f 75 6c 64 20 | 6e 6f 74 20 72 65 6d 6f | "could |not remo|
|000014e0| 76 65 20 6f 6c 64 20 24 | 54 79 70 65 20 24 50 61 |ve old $|Type $Pa|
|000014f0| 74 68 22 29 20 0a 58 20 | 20 20 20 20 20 20 20 20 |th") .X | |
|00001500| 69 66 20 28 73 79 73 74 | 65 6d 20 28 22 2f 62 69 |if (syst|em ("/bi|
|00001510| 6e 2f 72 6d 20 2d 72 20 | 24 50 61 74 68 22 29 29 |n/rm -r |$Path"))|
|00001520| 3b 0a 58 20 20 20 20 20 | 20 24 4d 73 67 20 3d 20 |;.X | $Msg = |
|00001530| 22 72 65 6d 6f 76 65 64 | 20 24 54 79 70 65 20 24 |"removed| $Type $|
|00001540| 50 61 74 68 22 3b 0a 58 | 20 20 20 20 20 20 72 65 |Path";.X| re|
|00001550| 74 75 72 6e 20 28 30 2c | 20 24 54 79 70 65 2c 20 |turn (0,| $Type, |
|00001560| 24 4d 73 67 29 3b 0a 58 | 20 20 20 7d 3b 0a 58 0a |$Msg);.X| };.X.|
|00001570| 58 20 20 20 72 65 74 75 | 72 6e 20 28 31 2c 20 24 |X retu|rn (1, $|
|00001580| 54 79 70 65 2c 20 24 4d | 73 67 29 3b 0a 7d 3b 0a |Type, $M|sg);.};.|
|00001590| 58 0a 58 0a 3b 23 23 23 | 23 23 23 23 23 23 23 23 |X.X.;###|########|
|000015a0| 23 23 23 23 23 23 23 23 | 23 23 23 23 23 23 23 23 |########|########|
|000015b0| 23 23 23 23 23 23 23 23 | 23 23 23 23 23 23 23 23 |########|########|
|000015c0| 23 23 23 23 23 23 23 23 | 23 23 23 23 23 23 23 23 |########|########|
|000015d0| 23 23 23 23 23 23 23 23 | 23 23 23 23 23 23 23 23 |########|########|
|000015e0| 23 23 23 23 0a 3b 23 20 | 43 72 65 61 74 65 5f 53 |####.;# |Create_S|
|000015f0| 79 6d 6c 69 6e 6b 0a 3b | 23 0a 3b 23 20 43 72 65 |ymlink.;|#.;# Cre|
|00001600| 61 74 65 73 20 61 20 73 | 79 6d 62 6f 6c 69 63 20 |ates a s|ymbolic |
|00001610| 6c 69 6e 6b 20 66 72 6f | 6d 20 24 4c 69 6e 6b 5f |link fro|m $Link_|
|00001620| 46 72 6f 6d 20 2d 3e 20 | 24 4c 69 6e 6b 5f 54 6f |From -> |$Link_To|
|00001630| 2e 20 4e 6f 74 65 20 74 | 68 61 74 20 74 68 65 20 |. Note t|hat the |
|00001640| 6c 69 6e 6b 20 77 69 6c | 6c 0a 3b 23 20 4e 4f 54 |link wil|l.;# NOT|
|00001650| 20 62 65 20 6e 6f 20 6d | 61 74 74 65 72 20 77 68 | be no m|atter wh|
|00001660| 61 74 20 74 68 65 20 4f | 76 76 65 72 69 64 65 27 |at the O|vveride'|
|00001670| 73 20 61 72 65 20 73 65 | 74 20 74 6f 20 69 66 20 |s are se|t to if |
|00001680| 69 74 20 77 6f 75 6c 64 | 20 72 65 73 75 6c 74 20 |it would| result |
|00001690| 69 6e 20 61 20 0a 3b 23 | 20 72 65 63 75 72 73 69 |in a .;#| recursi|
|000016a0| 76 65 20 6c 69 6e 6b 2e | 20 4d 61 79 20 64 65 6c |ve link.| May del|
|000016b0| 65 74 65 20 61 6e 20 6f | 6c 64 20 20 24 4c 69 6e |ete an o|ld $Lin|
|000016c0| 6b 5f 54 6f 20 64 65 70 | 65 6e 64 69 6e 67 20 6f |k_To dep|ending o|
|000016d0| 6e 20 74 68 65 20 4f 76 | 65 72 72 69 64 65 20 0a |n the Ov|erride .|
|000016e0| 3b 23 20 61 72 67 75 6d | 65 6e 74 73 2e 0a 3b 23 |;# argum|ents..;#|
|000016f0| 0a 3b 23 20 41 72 67 75 | 6d 65 6e 74 73 3a 0a 3b |.;# Argu|ments:.;|
|00001700| 23 20 20 20 20 24 4c 69 | 6e 6b 5f 54 6f 2c 20 24 |# $Li|nk_To, $|
|00001710| 4c 69 6e 6b 5f 46 72 6f | 6d 2c 20 24 4f 76 65 72 |Link_Fro|m, $Over|
|00001720| 72 69 64 65 5f 49 66 5f | 4c 69 6e 6b 2c 20 24 4f |ride_If_|Link, $O|
|00001730| 76 65 72 72 69 64 65 5f | 49 66 5f 46 69 6c 65 2c |verride_|If_File,|
|00001740| 0a 3b 23 20 20 20 20 24 | 4f 76 65 72 72 69 64 65 |.;# $|Override|
|00001750| 5f 49 66 5f 44 69 72 0a | 3b 23 0a 3b 23 20 52 65 |_If_Dir.|;#.;# Re|
|00001760| 74 75 72 6e 73 3a 0a 3b | 23 20 20 20 20 24 53 74 |turns:.;|# $St|
|00001770| 61 74 75 73 2c 20 24 4d | 73 67 0a 3b 23 23 23 23 |atus, $M|sg.;####|
|00001780| 23 23 23 23 23 23 23 23 | 23 23 23 23 23 23 23 23 |########|########|
|00001790| 23 23 23 23 23 23 23 23 | 23 23 23 23 23 23 23 23 |########|########|
|000017a0| 23 23 23 23 23 23 23 23 | 23 23 23 23 23 23 23 23 |########|########|
|000017b0| 23 23 23 23 23 23 23 23 | 23 23 23 23 23 23 23 23 |########|########|
|000017c0| 23 23 23 23 23 23 23 23 | 23 23 23 0a 73 75 62 20 |########|###.sub |
|000017d0| 43 72 65 61 74 65 5f 53 | 79 6d 6c 69 6e 6b 0a 7b |Create_S|ymlink.{|
|000017e0| 0a 58 20 20 20 6c 6f 63 | 61 6c 20 28 24 4c 69 6e |.X loc|al ($Lin|
|000017f0| 6b 5f 54 6f 2c 20 24 4c | 69 6e 6b 5f 46 72 6f 6d |k_To, $L|ink_From|
|00001800| 2c 20 24 4f 76 65 72 72 | 69 64 65 5f 49 66 5f 4c |, $Overr|ide_If_L|
|00001810| 69 6e 6b 2c 20 24 4f 76 | 65 72 72 69 64 65 5f 49 |ink, $Ov|erride_I|
|00001820| 66 5f 46 69 6c 65 2c 0a | 58 20 20 20 20 20 20 20 |f_File,.|X |
|00001830| 20 20 20 24 4f 76 65 72 | 72 69 64 65 5f 49 66 5f | $Over|ride_If_|
|00001840| 44 69 72 29 20 3d 20 40 | 5f 3b 0a 58 20 20 20 6c |Dir) = @|_;.X l|
|00001850| 6f 63 61 6c 20 28 24 52 | 65 6d 6f 76 65 2c 20 24 |ocal ($R|emove, $|
|00001860| 54 79 70 65 2c 20 24 4d | 73 67 2c 20 24 4c 69 6e |Type, $M|sg, $Lin|
|00001870| 6b 5f 46 72 6f 6d 5f 52 | 65 61 6c 2c 20 24 4c 69 |k_From_R|eal, $Li|
|00001880| 6e 6b 5f 54 6f 5f 52 65 | 61 6c 2c 20 0a 58 20 20 |nk_To_Re|al, .X |
|00001890| 20 20 20 20 20 20 20 20 | 24 4c 69 6e 6b 5f 46 72 | |$Link_Fr|
|000018a0| 6f 6d 5f 42 61 73 65 6e | 61 6d 65 2c 20 24 4c 69 |om_Basen|ame, $Li|
|000018b0| 6e 6b 5f 46 72 6f 6d 5f | 44 69 72 2c 20 24 52 65 |nk_From_|Dir, $Re|
|000018c0| 61 6c 5f 50 61 74 68 2c | 20 24 53 74 61 74 75 73 |al_Path,| $Status|
|000018d0| 29 3b 0a 58 0a 58 20 20 | 20 23 20 44 65 74 65 72 |);.X.X | # Deter|
|000018e0| 6d 69 6e 65 20 77 68 65 | 74 68 65 72 20 24 4c 69 |mine whe|ther $Li|
|000018f0| 6e 6b 5f 46 72 6f 6d 20 | 61 6e 64 20 24 4c 69 6e |nk_From |and $Lin|
|00001900| 6b 5f 54 6f 20 70 6f 69 | 6e 74 20 74 6f 20 74 68 |k_To poi|nt to th|
|00001910| 65 20 73 61 6d 65 20 6f | 62 6a 65 63 74 21 0a 58 |e same o|bject!.X|
|00001920| 20 20 20 28 24 4c 69 6e | 6b 5f 46 72 6f 6d 5f 42 | ($Lin|k_From_B|
|00001930| 61 73 65 6e 61 6d 65 20 | 3d 20 24 4c 69 6e 6b 5f |asename |= $Link_|
|00001940| 46 72 6f 6d 29 20 3d 7e | 20 73 2f 2e 2a 5c 2f 2f |From) =~| s/.*\//|
|00001950| 2f 3b 0a 58 20 20 20 24 | 4c 69 6e 6b 5f 46 72 6f |/;.X $|Link_Fro|
|00001960| 6d 5f 44 69 72 20 3d 20 | 26 44 69 72 5f 4e 61 6d |m_Dir = |&Dir_Nam|
|00001970| 65 20 28 24 4c 69 6e 6b | 5f 46 72 6f 6d 29 3b 0a |e ($Link|_From);.|
|00001980| 58 20 20 20 72 65 74 75 | 72 6e 20 28 30 2c 20 24 |X retu|rn (0, $|
|00001990| 52 65 61 6c 5f 50 61 74 | 68 29 20 69 66 20 28 21 |Real_Pat|h) if (!|
|000019a0| 20 28 28 24 53 74 61 74 | 75 73 2c 20 24 52 65 61 | (($Stat|us, $Rea|
|000019b0| 6c 5f 50 61 74 68 29 20 | 3d 20 26 52 65 61 6c 5f |l_Path) |= &Real_|
|000019c0| 50 61 74 68 20 28 24 4c | 69 6e 6b 5f 46 72 6f 6d |Path ($L|ink_From|
|000019d0| 5f 44 69 72 29 29 5b 30 | 5d 29 3b 0a 58 20 20 20 |_Dir))[0|]);.X |
|000019e0| 63 68 6f 70 20 28 24 52 | 65 61 6c 5f 50 61 74 68 |chop ($R|eal_Path|
|000019f0| 29 20 69 66 20 28 24 52 | 65 61 6c 5f 50 61 74 68 |) if ($R|eal_Path|
|00001a00| 20 3d 7e 20 2f 5e 28 5c | 2f 29 7b 31 2c 32 7d 24 | =~ /^(\|/){1,2}$|
|00001a10| 2f 29 3b 0a 58 20 20 20 | 24 4c 69 6e 6b 5f 46 72 |/);.X |$Link_Fr|
|00001a20| 6f 6d 5f 52 65 61 6c 20 | 3d 20 22 24 52 65 61 6c |om_Real |= "$Real|
|00001a30| 5f 50 61 74 68 2f 24 4c | 69 6e 6b 5f 46 72 6f 6d |_Path/$L|ink_From|
|00001a40| 5f 42 61 73 65 6e 61 6d | 65 22 3b 0a 58 20 20 20 |_Basenam|e";.X |
|00001a50| 24 4c 69 6e 6b 5f 54 6f | 5f 52 65 61 6c 20 3d 20 |$Link_To|_Real = |
|00001a60| 22 24 4c 69 6e 6b 5f 46 | 72 6f 6d 5f 44 69 72 2f |"$Link_F|rom_Dir/|
|00001a70| 24 4c 69 6e 6b 5f 54 6f | 22 20 69 66 20 28 24 4c |$Link_To|" if ($L|
|00001a80| 69 6e 6b 5f 54 6f 20 21 | 7e 20 2f 5e 5c 2f 2f 29 |ink_To !|~ /^\//)|
|00001a90| 3b 0a 58 20 20 20 72 65 | 74 75 72 6e 20 28 30 2c |;.X re|turn (0,|
|00001aa0| 20 24 4c 69 6e 6b 5f 54 | 6f 5f 52 65 61 6c 29 20 | $Link_T|o_Real) |
|00001ab0| 69 66 20 28 21 20 28 28 | 24 53 74 61 74 75 73 2c |if (! ((|$Status,|
|00001ac0| 20 24 4c 69 6e 6b 5f 54 | 6f 5f 52 65 61 6c 29 20 | $Link_T|o_Real) |
|00001ad0| 3d 20 26 52 65 61 6c 5f | 50 61 74 68 20 28 24 4c |= &Real_|Path ($L|
|00001ae0| 69 6e 6b 5f 54 6f 5f 52 | 65 61 6c 29 29 5b 30 5d |ink_To_R|eal))[0]|
|00001af0| 29 3b 0a 58 20 20 20 72 | 65 74 75 72 6e 20 28 30 |);.X r|eturn (0|
|00001b00| 2c 20 22 24 4c 69 6e 6b | 5f 46 72 6f 6d 20 2d 3e |, "$Link|_From ->|
|00001b10| 20 24 4c 69 6e 6b 5f 54 | 6f 20 77 6f 75 6c 64 20 | $Link_T|o would |
|00001b20| 62 65 20 61 20 72 65 63 | 75 72 73 69 76 65 20 6c |be a rec|ursive l|
|00001b30| 69 6e 6b 22 29 20 0a 58 | 20 20 20 20 20 20 69 66 |ink") .X| if|
|00001b40| 20 28 24 4c 69 6e 6b 5f | 46 72 6f 6d 5f 52 65 61 | ($Link_|From_Rea|
|00001b50| 6c 20 65 71 20 24 4c 69 | 6e 6b 5f 54 6f 5f 52 65 |l eq $Li|nk_To_Re|
|00001b60| 61 6c 29 3b 0a 58 0a 58 | 20 20 20 23 20 50 6f 73 |al);.X.X| # Pos|
|00001b70| 73 69 62 6c 79 20 64 65 | 6c 65 74 65 20 24 4c 69 |sibly de|lete $Li|
|00001b80| 6e 6b 5f 54 6f 0a 58 20 | 20 20 72 65 74 75 72 6e |nk_To.X | return|
|00001b90| 20 28 2d 31 2c 20 24 4d | 73 67 29 20 0a 58 20 20 | (-1, $M|sg) .X |
|00001ba0| 20 20 20 20 69 66 20 28 | 28 28 24 53 74 61 74 75 | if (|(($Statu|
|00001bb0| 73 2c 20 24 54 79 70 65 | 2c 20 24 4d 73 67 29 20 |s, $Type|, $Msg) |
|00001bc0| 3d 20 26 4d 61 79 62 65 | 65 5f 44 65 6c 65 74 65 |= &Maybe|e_Delete|
|00001bd0| 5f 50 61 74 68 20 28 24 | 4c 69 6e 6b 5f 46 72 6f |_Path ($|Link_Fro|
|00001be0| 6d 2c 20 24 4f 76 65 72 | 72 69 64 65 5f 49 66 5f |m, $Over|ride_If_|
|00001bf0| 4c 69 6e 6b 2c 20 24 4f | 76 65 72 72 69 64 65 5f |Link, $O|verride_|
|00001c00| 49 66 5f 46 69 6c 65 2c | 0a 58 20 20 20 20 20 20 |If_File,|.X |
|00001c10| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00001c20| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00001c30| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00001c40| 20 20 20 24 4f 76 65 72 | 72 69 64 65 5f 49 66 5f | $Over|ride_If_|
|00001c50| 44 69 72 29 29 5b 30 5d | 20 3d 3d 20 2d 31 29 3b |Dir))[0]| == -1);|
|00001c60| 0a 58 0a 58 20 20 20 23 | 20 43 72 65 61 74 65 20 |.X.X #| Create |
|00001c70| 74 68 65 20 6c 69 6e 6b | 21 0a 58 20 20 20 24 4d |the link|!.X $M|
|00001c80| 73 67 20 2e 3d 20 22 2c | 20 22 20 69 66 20 28 24 |sg .= ",| " if ($|
|00001c90| 4d 73 67 29 3b 0a 58 20 | 20 20 72 65 74 75 72 6e |Msg);.X | return|
|00001ca0| 20 28 30 2c 20 22 24 7b | 4d 73 67 7d 65 72 72 6f | (0, "${|Msg}erro|
|00001cb0| 72 20 63 72 65 61 74 69 | 6e 67 20 6c 69 6e 6b 20 |r creati|ng link |
|00001cc0| 24 4c 69 6e 6b 5f 46 72 | 6f 6d 20 2d 3e 20 24 4c |$Link_Fr|om -> $L|
|00001cd0| 69 6e 6b 5f 54 6f 22 29 | 20 0a 58 20 20 20 20 20 |ink_To")| .X |
|00001ce0| 20 69 66 20 28 21 20 73 | 79 6d 6c 69 6e 6b 20 28 | if (! s|ymlink (|
|00001cf0| 24 4c 69 6e 6b 5f 54 6f | 2c 20 24 4c 69 6e 6b 5f |$Link_To|, $Link_|
|00001d00| 46 72 6f 6d 29 29 3b 0a | 58 20 20 20 72 65 74 75 |From));.|X retu|
|00001d10| 72 6e 20 28 31 2c 20 22 | 24 7b 4d 73 67 7d 63 72 |rn (1, "|${Msg}cr|
|00001d20| 65 61 74 65 64 20 6c 69 | 6e 6b 20 24 4c 69 6e 6b |eated li|nk $Link|
|00001d30| 5f 46 72 6f 6d 20 2d 3e | 20 24 4c 69 6e 6b 5f 54 |_From ->| $Link_T|
|00001d40| 6f 22 29 3b 0a 7d 3b 0a | 58 0a 58 0a 3b 23 23 23 |o");.};.|X.X.;###|
|00001d50| 23 23 23 23 23 23 23 23 | 23 23 23 23 23 23 23 23 |########|########|
|00001d60| 23 23 23 23 23 23 23 23 | 23 23 23 23 23 23 23 23 |########|########|
|00001d70| 23 23 23 23 23 23 23 23 | 23 23 23 23 23 23 23 23 |########|########|
|00001d80| 23 23 23 23 23 23 23 23 | 23 23 23 23 23 23 23 23 |########|########|
|00001d90| 23 23 23 23 23 23 23 23 | 23 23 23 23 0a 3b 23 20 |########|####.;# |
|00001da0| 43 72 65 61 74 65 5f 44 | 69 72 0a 3b 23 0a 3b 23 |Create_D|ir.;#.;#|
|00001db0| 20 43 72 65 61 74 65 73 | 20 61 20 64 69 72 65 63 | Creates| a direc|
|00001dc0| 74 6f 72 79 20 24 50 61 | 74 68 2e 20 4d 61 79 20 |tory $Pa|th. May |
|00001dd0| 64 65 6c 65 74 65 20 61 | 6e 20 6f 6c 64 20 24 50 |delete a|n old $P|
|00001de0| 61 74 68 20 64 65 70 65 | 6e 64 69 6e 67 20 6f 6e |ath depe|nding on|
|00001df0| 20 74 68 65 0a 3b 23 20 | 4f 76 65 72 72 69 64 65 | the.;# |Override|
|00001e00| 20 61 72 67 75 6d 65 6e | 74 73 2e 20 55 73 65 73 | argumen|ts. Uses|
|00001e10| 20 24 4d 6f 64 65 20 61 | 73 20 74 68 65 20 6d 6f | $Mode a|s the mo|
|00001e20| 64 65 20 6f 66 20 74 68 | 65 20 64 69 72 65 63 74 |de of th|e direct|
|00001e30| 6f 72 79 2e 20 24 4d 6f | 64 65 20 68 61 64 20 62 |ory. $Mo|de had b|
|00001e40| 65 74 74 65 72 0a 3b 23 | 20 62 65 20 69 6e 20 6f |etter.;#| be in o|
|00001e50| 63 74 61 6c 21 21 0a 3b | 23 0a 3b 23 20 41 72 67 |ctal!!.;|#.;# Arg|
|00001e60| 75 6d 65 6e 74 73 3a 0a | 3b 23 20 20 20 20 24 50 |uments:.|;# $P|
|00001e70| 61 74 68 2c 20 24 4d 6f | 64 65 2c 20 24 4f 76 65 |ath, $Mo|de, $Ove|
|00001e80| 72 72 69 64 65 5f 49 66 | 5f 4c 69 6e 6b 2c 20 24 |rride_If|_Link, $|
|00001e90| 4f 76 65 72 72 69 64 65 | 5f 49 66 5f 46 69 6c 65 |Override|_If_File|
|00001ea0| 2c 20 24 4f 76 65 72 72 | 69 64 65 5f 49 66 5f 44 |, $Overr|ide_If_D|
|00001eb0| 69 72 0a 3b 23 0a 3b 23 | 20 52 65 74 75 72 6e 73 |ir.;#.;#| Returns|
|00001ec0| 3a 0a 3b 23 20 20 20 20 | 24 53 74 61 74 75 73 2c |:.;# |$Status,|
|00001ed0| 20 24 4d 73 67 0a 3b 23 | 23 23 23 23 23 23 23 23 | $Msg.;#|########|
|00001ee0| 23 23 23 23 23 23 23 23 | 23 23 23 23 23 23 23 23 |########|########|
|00001ef0| 23 23 23 23 23 23 23 23 | 23 23 23 23 23 23 23 23 |########|########|
|00001f00| 23 23 23 23 23 23 23 23 | 23 23 23 23 23 23 23 23 |########|########|
|00001f10| 23 23 23 23 23 23 23 23 | 23 23 23 23 23 23 23 23 |########|########|
|00001f20| 23 23 23 23 23 23 0a 73 | 75 62 20 43 72 65 61 74 |######.s|ub Creat|
|00001f30| 65 5f 44 69 72 0a 7b 0a | 58 20 20 20 6c 6f 63 61 |e_Dir.{.|X loca|
|00001f40| 6c 20 28 24 50 61 74 68 | 2c 20 24 4d 6f 64 65 2c |l ($Path|, $Mode,|
|00001f50| 20 24 4f 76 65 72 72 69 | 64 65 5f 49 66 5f 4c 69 | $Overri|de_If_Li|
|00001f60| 6e 6b 2c 20 24 4f 76 65 | 72 72 69 64 65 5f 49 66 |nk, $Ove|rride_If|
|00001f70| 5f 46 69 6c 65 2c 20 0a | 58 20 20 20 20 20 20 20 |_File, .|X |
|00001f80| 20 20 20 24 4f 76 65 72 | 72 69 64 65 5f 49 66 5f | $Over|ride_If_|
|00001f90| 44 69 72 29 20 3d 20 40 | 5f 3b 0a 58 20 20 20 6c |Dir) = @|_;.X l|
|00001fa0| 6f 63 61 6c 20 28 24 53 | 74 61 74 75 73 2c 20 24 |ocal ($S|tatus, $|
|00001fb0| 4d 73 67 29 3b 0a 58 0a | 58 20 20 20 23 20 50 6f |Msg);.X.|X # Po|
|00001fc0| 73 73 69 62 6c 79 20 64 | 65 6c 65 74 65 20 24 4c |ssibly d|elete $L|
|00001fd0| 69 6e 6b 5f 54 6f 0a 58 | 20 20 20 72 65 74 75 72 |ink_To.X| retur|
|00001fe0| 6e 20 28 2d 31 2c 20 24 | 4d 73 67 29 20 0a 58 20 |n (-1, $|Msg) .X |
|00001ff0| 20 20 20 20 20 69 66 20 | 28 28 28 24 53 74 61 74 | if |((($Stat|
|00002000| 75 73 2c 20 24 54 79 70 | 65 2c 20 24 4d 73 67 29 |us, $Typ|e, $Msg)|
|00002010| 20 3d 20 26 4d 61 79 62 | 65 65 5f 44 65 6c 65 74 | = &Mayb|ee_Delet|
|00002020| 65 5f 50 61 74 68 20 28 | 24 50 61 74 68 2c 20 24 |e_Path (|$Path, $|
|00002030| 4f 76 65 72 72 69 64 65 | 5f 49 66 5f 4c 69 6e 6b |Override|_If_Link|
|00002040| 2c 20 24 4f 76 65 72 72 | 69 64 65 5f 49 66 5f 46 |, $Overr|ide_If_F|
|00002050| 69 6c 65 2c 0a 58 20 20 | 20 20 20 20 20 20 20 20 |ile,.X | |
|00002060| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00002070| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00002080| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 24 | | $|
|00002090| 4f 76 65 72 72 69 64 65 | 5f 49 66 5f 44 69 72 29 |Override|_If_Dir)|
|000020a0| 29 5b 30 5d 20 3d 3d 20 | 2d 31 29 3b 0a 58 0a 58 |)[0] == |-1);.X.X|
|000020b0| 20 20 20 23 20 43 6f 6e | 76 65 72 74 20 61 20 6d | # Con|vert a m|
|000020c0| 6f 64 65 20 69 6e 20 66 | 6f 72 6d 20 30 5b 30 2d |ode in f|orm 0[0-|
|000020d0| 39 5d 7b 31 2c 33 7d 20 | 74 6f 20 63 6f 74 61 6c |9]{1,3} |to cotal|
|000020e0| 20 62 65 63 61 75 73 65 | 20 69 74 20 6d 75 73 74 | because| it must|
|000020f0| 20 62 65 20 41 53 43 49 | 49 0a 58 20 20 20 24 4d | be ASCI|I.X $M|
|00002100| 6f 64 65 20 3d 20 6f 63 | 74 20 28 24 4d 6f 64 65 |ode = oc|t ($Mode|
|00002110| 29 20 69 66 20 28 24 4d | 6f 64 65 20 3d 7e 20 2f |) if ($M|ode =~ /|
|00002120| 5e 30 2f 29 3b 0a 58 0a | 58 20 20 20 23 20 43 72 |^0/);.X.|X # Cr|
|00002130| 65 61 74 65 20 74 68 65 | 20 64 69 72 65 63 74 6f |eate the| directo|
|00002140| 72 79 0a 58 20 20 20 24 | 4d 73 67 20 2e 3d 20 22 |ry.X $|Msg .= "|
|00002150| 2c 20 22 20 69 66 20 28 | 24 4d 73 67 29 3b 0a 58 |, " if (|$Msg);.X|
|00002160| 20 20 20 72 65 74 75 72 | 6e 20 28 30 2c 20 22 24 | retur|n (0, "$|
|00002170| 7b 4d 73 67 7d 65 72 72 | 6f 72 20 64 69 72 65 63 |{Msg}err|or direc|
|00002180| 74 6f 72 79 20 24 50 61 | 74 68 22 29 20 0a 58 20 |tory $Pa|th") .X |
|00002190| 20 20 20 20 20 69 66 20 | 28 21 20 6d 6b 64 69 72 | if |(! mkdir|
|000021a0| 20 28 24 50 61 74 68 2c | 20 24 4d 6f 64 65 29 29 | ($Path,| $Mode))|
|000021b0| 3b 0a 58 20 20 20 72 65 | 74 75 72 6e 20 28 31 2c |;.X re|turn (1,|
|000021c0| 20 22 24 7b 4d 73 67 7d | 63 72 65 61 74 65 64 20 | "${Msg}|created |
|000021d0| 64 69 72 65 63 74 6f 72 | 79 20 24 50 61 74 68 22 |director|y $Path"|
|000021e0| 29 3b 0a 7d 3b 0a 58 0a | 3b 23 23 23 23 23 23 23 |);.};.X.|;#######|
|000021f0| 23 23 23 23 23 23 23 23 | 23 23 23 23 23 23 23 23 |########|########|
|00002200| 23 23 23 23 23 23 23 23 | 23 23 23 23 23 23 23 23 |########|########|
|00002210| 23 23 23 23 23 23 23 23 | 23 23 23 23 23 23 23 23 |########|########|
|00002220| 23 23 23 23 23 23 23 23 | 23 23 23 23 23 23 23 23 |########|########|
|00002230| 23 23 23 23 23 23 23 23 | 0a 3b 23 20 43 68 61 6e |########|.;# Chan|
|00002240| 67 65 5f 46 69 6c 65 5f | 49 6e 66 6f 0a 3b 23 0a |ge_File_|Info.;#.|
|00002250| 3b 23 20 54 68 69 73 20 | 66 75 6e 63 74 69 6f 6e |;# This |function|
|00002260| 20 63 61 6e 20 63 68 61 | 6e 67 65 20 74 68 65 20 | can cha|nge the |
|00002270| 6f 77 6e 65 72 2c 20 67 | 72 6f 75 70 2c 20 61 6e |owner, g|roup, an|
|00002280| 64 20 6d 6f 64 65 73 20 | 6f 66 20 61 20 66 69 6c |d modes |of a fil|
|00002290| 65 20 6f 72 20 64 69 72 | 65 63 74 6f 72 79 2e 0a |e or dir|ectory..|
|000022a0| 3b 23 20 49 74 20 77 69 | 6c 6c 20 6f 6e 6c 79 20 |;# It wi|ll only |
|000022b0| 70 65 72 66 6f 72 6d 20 | 74 68 65 73 65 20 6f 70 |perform |these op|
|000022c0| 65 72 61 74 69 6f 6e 73 | 20 69 66 20 74 68 65 20 |erations| if the |
|000022d0| 66 75 6e 63 74 69 6f 6e | 20 61 72 67 75 6d 65 6e |function| argumen|
|000022e0| 74 73 20 61 72 65 0a 3b | 23 20 6e 6f 74 20 2d 31 |ts are.;|# not -1|
|000022f0| 2e 20 41 73 20 61 6e 20 | 65 78 61 6d 70 6c 65 2c |. As an |example,|
|00002300| 20 74 68 65 20 66 6f 6c | 6c 6f 77 69 6e 67 20 77 | the fol|lowing w|
|00002310| 69 6c 6c 20 63 68 61 6e | 67 65 20 74 68 65 20 6d |ill chan|ge the m|
|00002320| 6f 64 65 20 61 6e 64 20 | 67 72 6f 75 70 0a 3b 23 |ode and |group.;#|
|00002330| 20 6f 66 20 61 20 66 69 | 6c 65 20 61 6e 64 20 6c | of a fi|le and l|
|00002340| 65 61 76 65 20 74 68 65 | 20 6f 77 6e 65 72 20 75 |eave the| owner u|
|00002350| 6e 63 68 61 6e 67 65 64 | 3a 0a 3b 23 0a 3b 23 20 |nchanged|:.;#.;# |
|00002360| 20 20 20 28 24 53 74 61 | 74 75 73 2c 20 24 4d 73 | ($Sta|tus, $Ms|
|00002370| 67 29 20 3d 20 26 43 68 | 61 6e 67 65 5f 46 49 6c |g) = &Ch|ange_FIl|
|00002380| 65 5f 49 6e 66 6f 20 28 | 24 46 69 6c 65 2c 20 30 |e_Info (|$File, 0|
|00002390| 35 35 35 2c 20 2d 31 2c | 20 22 73 74 61 66 66 22 |555, -1,| "staff"|
|000023a0| 2c 20 31 29 0a 3b 23 0a | 3b 23 20 42 79 20 64 65 |, 1).;#.|;# By de|
|000023b0| 66 61 75 6c 74 20 74 68 | 69 73 20 66 75 6e 63 74 |fault th|is funct|
|000023c0| 69 6f 6e 20 72 65 71 75 | 69 72 65 73 20 6e 75 6d |ion requ|ires num|
|000023d0| 65 72 69 63 61 6c 20 75 | 73 65 72 20 61 6e 64 20 |erical u|ser and |
|000023e0| 67 72 6f 75 70 20 49 44 | 73 2e 20 48 6f 77 65 76 |group ID|s. Howev|
|000023f0| 65 72 2c 20 69 66 0a 3b | 23 20 24 4c 6f 6f 6b 75 |er, if.;|# $Looku|
|00002400| 70 5f 49 44 73 20 69 73 | 20 31 20 74 68 65 6e 20 |p_IDs is| 1 then |
|00002410| 74 68 65 20 24 4f 77 6e | 65 72 20 61 6e 64 20 24 |the $Own|er and $|
|00002420| 47 72 6f 75 70 20 77 69 | 6c 6c 20 62 65 20 69 6e |Group wi|ll be in|
|00002430| 74 65 72 70 72 65 74 65 | 64 20 61 73 0a 3b 23 20 |terprete|d as.;# |
|00002440| 61 63 74 75 61 6c 20 6c | 6f 67 69 6e 20 6e 61 6d |actual l|ogin nam|
|00002450| 65 73 20 6f 72 20 67 72 | 6f 75 70 20 6e 61 6d 65 |es or gr|oup name|
|00002460| 73 2e 0a 3b 23 0a 3b 23 | 20 52 65 74 75 72 6e 73 |s..;#.;#| Returns|
|00002470| 20 77 69 74 68 20 61 20 | 24 53 74 61 74 75 73 20 | with a |$Status |
|00002480| 6f 66 20 31 20 69 66 20 | 65 76 65 72 79 74 68 69 |of 1 if |everythi|
|00002490| 6e 67 20 77 65 6e 74 20 | 41 4f 4b 3b 20 6f 74 68 |ng went |AOK; oth|
|000024a0| 65 72 77 69 73 65 2c 20 | 24 53 74 61 74 75 73 20 |erwise, |$Status |
|000024b0| 69 73 0a 3b 23 20 30 20 | 61 6e 64 20 24 4d 73 67 |is.;# 0 |and $Msg|
|000024c0| 20 63 6f 6e 74 61 69 6e | 73 20 61 6e 20 65 72 72 | contain|s an err|
|000024d0| 6f 72 20 6d 65 73 73 61 | 67 65 2e 0a 3b 23 0a 3b |or messa|ge..;#.;|
|000024e0| 23 20 41 72 67 75 6d 65 | 6e 74 73 3a 0a 3b 23 20 |# Argume|nts:.;# |
|000024f0| 20 20 20 24 50 61 74 68 | 2c 20 24 4d 6f 64 65 2c | $Path|, $Mode,|
|00002500| 20 24 4f 77 6e 65 72 2c | 20 24 47 72 6f 75 70 2c | $Owner,| $Group,|
|00002510| 20 24 4c 6f 6f 6b 75 70 | 5f 49 44 73 0a 3b 23 0a | $Lookup|_IDs.;#.|
|00002520| 3b 23 20 52 65 74 75 72 | 6e 73 3a 0a 3b 23 20 20 |;# Retur|ns:.;# |
|00002530| 20 20 24 53 74 61 74 75 | 73 2c 20 24 4d 73 67 0a | $Statu|s, $Msg.|
|00002540| 3b 23 23 23 23 23 23 23 | 23 23 23 23 23 23 23 23 |;#######|########|
|00002550| 23 23 23 23 23 23 23 23 | 23 23 23 23 23 23 23 23 |########|########|
|00002560| 23 23 23 23 23 23 23 23 | 23 23 23 23 23 23 23 23 |########|########|
|00002570| 23 23 23 23 23 23 23 23 | 23 23 23 23 23 23 23 23 |########|########|
|00002580| 23 23 23 23 23 23 23 23 | 23 23 23 23 23 23 23 23 |########|########|
|00002590| 0a 73 75 62 20 43 68 61 | 6e 67 65 5f 46 69 6c 65 |.sub Cha|nge_File|
|000025a0| 5f 49 6e 66 6f 0a 7b 0a | 58 20 20 20 6c 6f 63 61 |_Info.{.|X loca|
|000025b0| 6c 20 28 24 50 61 74 68 | 2c 20 24 4d 6f 64 65 2c |l ($Path|, $Mode,|
|000025c0| 20 24 4f 77 6e 65 72 2c | 20 24 47 72 6f 75 70 2c | $Owner,| $Group,|
|000025d0| 20 24 4c 6f 6f 6b 75 70 | 5f 49 44 73 29 20 3d 20 | $Lookup|_IDs) = |
|000025e0| 40 5f 3b 0a 58 20 20 20 | 6c 6f 63 61 6c 20 28 24 |@_;.X |local ($|
|000025f0| 55 69 64 2c 20 24 47 69 | 64 29 3b 0a 58 0a 58 20 |Uid, $Gi|d);.X.X |
|00002600| 20 20 23 20 43 68 61 6e | 67 65 20 6f 77 6e 65 72 | # Chan|ge owner|
|00002610| 20 61 6e 64 2f 6f 72 20 | 6d 6f 64 65 0a 58 20 20 | and/or |mode.X |
|00002620| 20 69 66 20 28 28 24 4f | 77 6e 65 72 20 21 3d 20 | if (($O|wner != |
|00002630| 2d 31 29 20 7c 7c 20 28 | 24 47 72 6f 75 70 20 21 |-1) || (|$Group !|
|00002640| 3d 20 2d 31 29 29 0a 58 | 20 20 20 7b 0a 58 20 20 |= -1)).X| {.X |
|00002650| 20 20 20 20 23 20 47 65 | 74 20 74 68 65 20 64 65 | # Ge|t the de|
|00002660| 66 61 75 6c 74 20 6f 77 | 6e 65 72 20 61 6e 64 20 |fault ow|ner and |
|00002670| 67 72 6f 75 70 20 6f 66 | 20 74 68 65 20 66 69 6c |group of| the fil|
|00002680| 65 0a 58 20 20 20 20 20 | 20 28 28 24 55 69 64 2c |e.X | (($Uid,|
|00002690| 20 24 47 69 64 29 20 3d | 20 28 73 74 61 74 20 28 | $Gid) =| (stat (|
|000026a0| 24 50 61 74 68 29 29 5b | 34 2c 35 5d 29 20 7c 7c |$Path))[|4,5]) |||
|000026b0| 20 72 65 74 75 72 6e 20 | 28 30 2c 20 22 65 72 72 | return |(0, "err|
|000026c0| 6f 72 20 73 74 61 74 69 | 6e 67 20 24 50 61 74 68 |or stati|ng $Path|
|000026d0| 22 29 3b 0a 58 0a 58 20 | 20 20 20 20 20 23 20 4f |");.X.X | # O|
|000026e0| 76 65 72 72 69 64 65 20 | 74 68 65 20 64 65 66 61 |verride |the defa|
|000026f0| 75 6c 74 20 6f 77 6e 65 | 72 3f 0a 58 20 20 20 20 |ult owne|r?.X |
|00002700| 20 20 69 66 20 28 24 4f | 77 6e 65 72 20 21 3d 20 | if ($O|wner != |
|00002710| 2d 31 29 0a 58 20 20 20 | 20 20 20 7b 0a 58 20 20 |-1).X | {.X |
|00002720| 20 20 20 20 20 20 20 69 | 66 20 28 24 4c 6f 6f 6b | i|f ($Look|
|00002730| 75 70 5f 49 44 73 29 0a | 58 20 20 20 20 20 20 20 |up_IDs).|X |
|00002740| 20 20 7b 0a 58 20 20 20 | 20 20 20 20 20 20 20 20 | {.X | |
|00002750| 20 24 55 69 64 20 3d 20 | 28 67 65 74 70 77 6e 61 | $Uid = |(getpwna|
|00002760| 6d 20 28 24 4f 77 6e 65 | 72 29 29 5b 32 5d 3b 0a |m ($Owne|r))[2];.|
|00002770| 58 20 20 20 09 20 20 20 | 20 72 65 74 75 72 6e 20 |X . | return |
|00002780| 28 30 2c 20 22 6e 6f 20 | 73 75 63 68 20 75 73 65 |(0, "no |such use|
|00002790| 72 3a 20 24 4f 77 6e 65 | 72 22 29 20 69 66 20 28 |r: $Owne|r") if (|
|000027a0| 24 55 69 64 20 65 71 20 | 22 22 29 3b 0a 58 20 20 |$Uid eq |"");.X |
|000027b0| 20 20 20 20 20 20 20 7d | 0a 58 09 20 65 6c 73 65 | }|.X. else|
|000027c0| 0a 58 20 20 20 20 20 20 | 20 20 20 7b 0a 58 20 20 |.X | {.X |
|000027d0| 20 20 20 20 20 20 20 20 | 20 20 24 55 69 64 20 3d | | $Uid =|
|000027e0| 20 24 4f 77 6e 65 72 3b | 0a 58 20 20 20 20 20 20 | $Owner;|.X |
|000027f0| 20 20 20 7d 3b 0a 58 20 | 20 20 20 20 20 7d 3b 0a | };.X | };.|
|00002800| 58 0a 58 20 20 20 20 20 | 20 23 20 4f 76 65 72 72 |X.X | # Overr|
|00002810| 69 64 65 20 74 68 65 20 | 64 65 66 61 75 6c 74 20 |ide the |default |
|00002820| 67 72 6f 75 70 3f 0a 58 | 20 20 20 20 20 20 69 66 |group?.X| if|
|00002830| 20 28 24 47 72 6f 75 70 | 20 21 3d 20 2d 31 29 0a | ($Group| != -1).|
|00002840| 58 20 20 20 20 20 20 7b | 0a 58 20 20 20 20 20 20 |X {|.X |
|00002850| 20 20 20 69 66 20 28 24 | 4c 6f 6f 6b 75 70 5f 49 | if ($|Lookup_I|
|00002860| 44 73 29 0a 58 20 20 20 | 20 20 20 20 20 20 7b 0a |Ds).X | {.|
|00002870| 58 20 20 20 09 20 20 20 | 20 24 47 69 64 20 3d 20 |X . | $Gid = |
|00002880| 28 67 65 74 67 72 6e 61 | 6d 20 28 24 47 72 6f 75 |(getgrna|m ($Grou|
|00002890| 70 29 29 5b 32 5d 3b 0a | 58 09 20 20 20 20 72 65 |p))[2];.|X. re|
|000028a0| 74 75 72 6e 20 28 30 2c | 20 22 6e 6f 20 73 75 63 |turn (0,| "no suc|
|000028b0| 68 20 67 72 6f 75 70 3a | 20 24 47 72 6f 75 70 22 |h group:| $Group"|
|000028c0| 29 20 69 66 20 28 24 47 | 69 64 20 65 71 20 22 22 |) if ($G|id eq ""|
|000028d0| 29 3b 0a 58 20 20 20 20 | 20 20 20 20 20 7d 0a 58 |);.X | }.X|
|000028e0| 20 20 20 20 20 20 20 20 | 20 65 6c 73 65 0a 58 20 | | else.X |
|000028f0| 20 20 20 20 20 20 20 20 | 7b 0a 58 20 20 20 20 20 | |{.X |
|00002900| 20 20 20 20 20 20 20 24 | 47 69 64 20 3d 20 24 47 | $|Gid = $G|
|00002910| 72 6f 75 70 3b 0a 58 20 | 20 20 20 20 20 20 20 20 |roup;.X | |
|00002920| 7d 3b 0a 58 20 20 20 20 | 20 20 7d 3b 0a 58 0a 58 |};.X | };.X.X|
|00002930| 20 20 20 20 20 20 23 20 | 43 68 61 6e 67 65 20 6f | # |Change o|
|00002940| 77 6e 65 72 2f 67 72 6f | 75 70 0a 58 20 20 20 20 |wner/gro|up.X |
|00002950| 20 20 63 68 6f 77 6e 20 | 28 24 55 69 64 2c 20 24 | chown |($Uid, $|
|00002960| 47 69 64 2c 20 24 50 61 | 74 68 29 20 7c 7c 20 72 |Gid, $Pa|th) || r|
|00002970| 65 74 75 72 6e 20 28 30 | 2c 20 22 65 72 72 6f 72 |eturn (0|, "error|
|00002980| 20 63 68 61 6e 67 69 6e | 67 20 6f 77 6e 65 72 2f | changin|g owner/|
|00002990| 67 72 6f 75 70 20 6f 66 | 20 24 50 61 74 68 22 29 |group of| $Path")|
|000029a0| 3b 0a 58 20 20 20 7d 3b | 0a 58 0a 58 20 20 20 23 |;.X };|.X.X #|
|000029b0| 20 43 68 61 6e 67 65 20 | 6d 6f 64 65 0a 58 20 20 | Change |mode.X |
|000029c0| 20 69 66 20 28 24 4d 6f | 64 65 20 21 3d 20 2d 31 | if ($Mo|de != -1|
|000029d0| 29 0a 58 20 20 20 7b 0a | 58 20 20 20 20 20 20 24 |).X {.|X $|
|000029e0| 4d 6f 64 65 20 3d 20 6f | 63 74 20 28 24 4d 6f 64 |Mode = o|ct ($Mod|
|000029f0| 65 29 20 69 66 20 28 24 | 4d 6f 64 65 20 3d 7e 20 |e) if ($|Mode =~ |
|00002a00| 2f 5e 30 2f 29 3b 0a 58 | 20 20 20 20 20 20 63 68 |/^0/);.X| ch|
|00002a10| 6d 6f 64 20 28 24 4d 6f | 64 65 2c 20 24 50 61 74 |mod ($Mo|de, $Pat|
|00002a20| 68 29 20 7c 7c 20 72 65 | 74 75 72 6e 20 28 30 2c |h) || re|turn (0,|
|00002a30| 20 22 65 72 72 6f 72 20 | 63 68 61 6e 67 69 6e 67 | "error |changing|
|00002a40| 20 6d 6f 64 65 20 6f 66 | 20 24 50 61 74 68 22 29 | mode of| $Path")|
|00002a50| 3b 0a 58 20 20 20 7d 3b | 0a 58 0a 58 20 20 20 72 |;.X };|.X.X r|
|00002a60| 65 74 75 72 6e 20 28 31 | 29 3b 0a 7d 3b 0a 58 0a |eturn (1|);.};.X.|
|00002a70| 58 0a 3b 23 23 23 23 23 | 23 23 23 23 23 23 23 23 |X.;#####|########|
|00002a80| 23 23 23 23 23 23 23 23 | 23 23 23 23 23 23 23 23 |########|########|
|00002a90| 23 23 23 23 23 23 23 23 | 23 23 23 23 23 23 23 23 |########|########|
|00002aa0| 23 23 23 23 23 23 23 23 | 23 23 23 23 23 23 23 23 |########|########|
|00002ab0| 23 23 23 23 23 23 23 23 | 23 23 23 23 23 23 23 23 |########|########|
|00002ac0| 23 23 0a 3b 23 20 43 6f | 70 79 5f 46 69 6c 65 0a |##.;# Co|py_File.|
|00002ad0| 3b 23 0a 3b 23 20 43 6f | 70 69 65 73 20 24 53 6f |;#.;# Co|pies $So|
|00002ae0| 75 72 63 65 20 74 6f 20 | 24 44 65 73 74 2e 20 49 |urce to |$Dest. I|
|00002af0| 66 20 24 4d 6f 64 65 2c | 20 24 4f 77 6e 65 72 2c |f $Mode,| $Owner,|
|00002b00| 20 6f 72 20 24 47 72 6f | 75 70 20 61 72 65 20 2d | or $Gro|up are -|
|00002b10| 31 20 74 68 65 69 72 20 | 64 65 66 61 75 6c 74 0a |1 their |default.|
|00002b20| 3b 23 20 76 61 6c 75 65 | 73 20 61 72 65 20 75 73 |;# value|s are us|
|00002b30| 65 64 2e 20 54 68 65 69 | 72 20 64 65 66 61 75 6c |ed. Thei|r defaul|
|00002b40| 74 20 77 69 6c 6c 20 62 | 65 20 63 6f 6d 70 75 74 |t will b|e comput|
|00002b50| 65 64 20 76 69 61 20 74 | 68 65 20 75 6d 61 73 6b |ed via t|he umask|
|00002b60| 2c 20 41 43 4c 73 2c 0a | 3b 23 20 65 74 63 20 6f |, ACLs,.|;# etc o|
|00002b70| 72 2c 20 69 66 20 24 50 | 72 65 73 65 72 76 65 20 |r, if $P|reserve |
|00002b80| 69 73 20 31 2c 20 74 68 | 65 20 6d 6f 64 65 2c 20 |is 1, th|e mode, |
|00002b90| 6f 77 6e 65 72 2c 20 61 | 6e 64 20 67 72 6f 75 70 |owner, a|nd group|
|00002ba0| 20 6f 66 20 74 68 65 20 | 6f 72 69 67 69 6e 61 6c | of the |original|
|00002bb0| 20 66 69 6c 65 0a 3b 23 | 20 69 73 20 6d 61 69 6e | file.;#| is main|
|00002bc0| 74 61 69 6e 65 64 2e 20 | 57 68 65 6e 20 24 50 72 |tained. |When $Pr|
|00002bd0| 65 73 65 72 76 65 20 24 | 4d 6f 64 65 2c 20 24 4f |eserve $|Mode, $O|
|00002be0| 77 6e 65 72 2c 20 6f 72 | 20 24 47 72 6f 75 70 20 |wner, or| $Group |
|00002bf0| 61 72 65 20 69 67 6e 6f | 72 65 64 20 61 73 20 79 |are igno|red as y|
|00002c00| 6f 75 0a 3b 23 20 77 6f | 75 6c 64 20 65 78 70 65 |ou.;# wo|uld expe|
|00002c10| 63 74 2e 0a 3b 23 0a 3b | 23 20 42 79 20 64 65 66 |ct..;#.;|# By def|
|00002c20| 61 75 6c 74 20 74 68 69 | 73 20 66 75 6e 63 74 69 |ault thi|s functi|
|00002c30| 6f 6e 20 72 65 71 75 69 | 72 65 73 20 6e 75 6d 65 |on requi|res nume|
|00002c40| 72 69 63 61 6c 20 75 73 | 65 72 20 61 6e 64 20 67 |rical us|er and g|
|00002c50| 72 6f 75 70 20 49 44 73 | 2e 20 48 6f 77 65 76 65 |roup IDs|. Howeve|
|00002c60| 72 2c 20 69 66 0a 3b 23 | 20 24 4c 6f 6f 6b 75 70 |r, if.;#| $Lookup|
|00002c70| 5f 49 44 73 20 69 73 20 | 31 20 74 68 65 6e 20 74 |_IDs is |1 then t|
|00002c80| 68 65 20 24 4f 77 6e 65 | 72 20 61 6e 64 20 24 47 |he $Owne|r and $G|
|00002c90| 72 6f 75 70 20 77 69 6c | 6c 20 62 65 20 69 6e 74 |roup wil|l be int|
|00002ca0| 65 72 70 72 65 74 65 64 | 20 61 73 0a 3b 23 20 61 |erpreted| as.;# a|
|00002cb0| 63 74 75 61 6c 20 6c 6f | 67 69 6e 20 6e 61 6d 65 |ctual lo|gin name|
|00002cc0| 73 20 6f 72 20 67 72 6f | 75 70 20 6e 61 6d 65 73 |s or gro|up names|
|00002cd0| 2e 0a 3b 23 0a 3b 23 20 | 49 66 20 24 46 6f 72 63 |..;#.;# |If $Forc|
|00002ce0| 65 20 69 73 20 31 20 61 | 6e 79 20 70 72 65 2d 65 |e is 1 a|ny pre-e|
|00002cf0| 78 69 73 74 69 6e 67 20 | 64 65 73 74 69 6e 61 74 |xisting |destinat|
|00002d00| 69 6f 6e 20 66 69 6c 65 | 20 77 69 6c 6c 20 62 65 |ion file| will be|
|00002d10| 20 6f 76 65 72 72 69 64 | 65 6e 20 65 76 65 6e 0a | overrid|en even.|
|00002d20| 3b 23 20 69 66 20 74 68 | 65 20 66 69 6c 65 20 69 |;# if th|e file i|
|00002d30| 73 20 72 65 61 64 20 6f | 6e 6c 79 2e 0a 3b 23 0a |s read o|nly..;#.|
|00002d40| 3b 23 20 52 65 74 75 72 | 6e 73 20 77 69 74 68 20 |;# Retur|ns with |
|00002d50| 61 20 24 53 74 61 74 75 | 73 20 6f 66 20 31 20 69 |a $Statu|s of 1 i|
|00002d60| 66 20 65 76 65 72 79 74 | 68 69 6e 67 20 77 65 6e |f everyt|hing wen|
|00002d70| 74 20 41 4f 4b 3b 20 6f | 74 68 65 72 77 69 73 65 |t AOK; o|therwise|
|00002d80| 2c 20 24 53 74 61 74 75 | 73 20 69 73 0a 3b 23 20 |, $Statu|s is.;# |
|00002d90| 30 20 61 6e 64 20 24 4d | 73 67 20 63 6f 6e 74 61 |0 and $M|sg conta|
|00002da0| 69 6e 73 20 61 6e 20 65 | 72 72 6f 72 20 6d 65 73 |ins an e|rror mes|
|00002db0| 73 61 67 65 2e 0a 3b 23 | 0a 3b 23 20 41 72 67 75 |sage..;#|.;# Argu|
|00002dc0| 6d 65 6e 74 73 3a 0a 3b | 23 20 20 20 20 24 53 6f |ments:.;|# $So|
|00002dd0| 75 72 63 65 2c 20 24 44 | 65 73 74 2c 20 24 50 72 |urce, $D|est, $Pr|
|00002de0| 65 73 65 72 76 65 2c 20 | 24 4d 6f 64 65 2c 20 24 |eserve, |$Mode, $|
|00002df0| 4f 77 6e 65 72 2c 20 24 | 47 72 6f 75 70 2c 20 24 |Owner, $|Group, $|
|00002e00| 4c 6f 6f 6b 75 70 5f 49 | 44 73 2c 0a 3b 23 20 20 |Lookup_I|Ds,.;# |
|00002e10| 20 20 24 46 6f 72 63 65 | 0a 3b 23 0a 3b 23 20 52 | $Force|.;#.;# R|
|00002e20| 65 74 75 72 6e 73 3a 0a | 3b 23 20 20 20 20 24 53 |eturns:.|;# $S|
|00002e30| 74 61 74 75 73 2c 20 24 | 4d 73 67 0a 3b 23 23 23 |tatus, $|Msg.;###|
|00002e40| 23 23 23 23 23 23 23 23 | 23 23 23 23 23 23 23 23 |########|########|
|00002e50| 23 23 23 23 23 23 23 23 | 23 23 23 23 23 23 23 23 |########|########|
|00002e60| 23 23 23 23 23 23 23 23 | 23 23 23 23 23 23 23 23 |########|########|
|00002e70| 23 23 23 23 23 23 23 23 | 23 23 23 23 23 23 23 23 |########|########|
|00002e80| 23 23 23 23 23 23 23 23 | 23 23 23 23 0a 73 75 62 |########|####.sub|
|00002e90| 20 43 6f 70 79 5f 46 69 | 6c 65 0a 7b 0a 58 20 20 | Copy_Fi|le.{.X |
|00002ea0| 20 6c 6f 63 61 6c 20 28 | 24 53 6f 75 72 63 65 2c | local (|$Source,|
|00002eb0| 20 24 44 65 73 74 2c 20 | 24 50 72 65 73 65 72 76 | $Dest, |$Preserv|
|00002ec0| 65 2c 20 24 4d 6f 64 65 | 2c 20 24 4f 77 6e 65 72 |e, $Mode|, $Owner|
|00002ed0| 2c 20 24 47 72 6f 75 70 | 2c 20 24 4c 6f 6f 6b 75 |, $Group|, $Looku|
|00002ee0| 70 5f 49 44 73 2c 0a 58 | 09 20 20 24 46 6f 72 63 |p_IDs,.X|. $Forc|
|00002ef0| 65 29 20 3d 20 40 5f 3b | 0a 58 20 20 20 6c 6f 63 |e) = @_;|.X loc|
|00002f00| 61 6c 20 28 24 4f 75 74 | 70 75 74 29 3b 0a 58 0a |al ($Out|put);.X.|
|00002f10| 58 20 20 20 23 20 49 66 | 20 74 68 65 20 64 65 73 |X # If| the des|
|00002f20| 74 20 66 69 6c 65 20 65 | 78 69 73 74 73 20 61 6e |t file e|xists an|
|00002f30| 64 20 69 73 20 6e 6f 74 | 20 77 72 69 74 61 62 6c |d is not| writabl|
|00002f40| 65 20 2e 2e 2e 0a 58 20 | 20 20 23 20 6d 6f 64 65 |e ....X | # mode|
|00002f50| 2e 0a 58 20 20 20 69 66 | 20 28 28 2d 66 20 24 44 |..X if| ((-f $D|
|00002f60| 65 73 74 29 20 26 26 20 | 28 21 20 2d 77 20 24 44 |est) && |(! -w $D|
|00002f70| 65 73 74 29 29 0a 58 20 | 20 20 7b 0a 58 20 20 20 |est)).X | {.X |
|00002f80| 20 20 20 23 20 49 66 20 | 6e 6f 74 20 66 6f 72 63 | # If |not forc|
|00002f90| 65 20 6d 6f 64 65 20 63 | 6f 70 79 20 77 69 6c 6c |e mode c|opy will|
|00002fa0| 20 66 61 69 6c 0a 58 20 | 20 20 20 20 20 72 65 74 | fail.X | ret|
|00002fb0| 75 72 6e 20 28 30 2c 20 | 22 24 44 65 73 74 20 69 |urn (0, |"$Dest i|
|00002fc0| 73 20 6e 6f 74 20 77 72 | 69 74 61 62 6c 65 22 29 |s not wr|itable")|
|00002fd0| 20 69 66 20 28 21 20 24 | 46 6f 72 63 65 29 3b 0a | if (! $|Force);.|
|00002fe0| 58 0a 58 20 20 20 20 20 | 20 23 20 46 6f 72 63 65 |X.X | # Force|
|00002ff0| 20 6d 6f 64 65 2c 20 74 | 72 79 20 74 6f 20 63 68 | mode, t|ry to ch|
|00003000| 61 6e 67 65 20 74 68 65 | 20 6d 6f 64 65 2e 20 57 |ange the| mode. W|
|00003010| 65 20 63 61 6e 20 6f 6e | 6c 79 20 63 68 61 6e 67 |e can on|ly chang|
|00003020| 65 20 69 74 73 20 6d 6f | 64 65 20 69 66 20 0a 58 |e its mo|de if .X|
|00003030| 20 20 20 20 20 20 23 20 | 77 65 20 6f 77 6e 20 69 | # |we own i|
|00003040| 74 0a 58 20 20 20 20 20 | 20 69 66 20 28 28 73 74 |t.X | if ((st|
|00003050| 61 74 20 28 5f 29 29 5b | 34 5d 20 3d 3d 20 24 3e |at (_))[|4] == $>|
|00003060| 29 0a 58 20 20 20 20 20 | 20 7b 0a 58 20 20 20 20 |).X | {.X |
|00003070| 20 20 20 20 20 73 79 73 | 74 65 6d 20 28 22 63 68 | sys|tem ("ch|
|00003080| 6d 6f 64 20 75 2b 77 20 | 24 44 65 73 74 22 29 20 |mod u+w |$Dest") |
|00003090| 26 26 20 72 65 74 75 72 | 6e 20 28 30 2c 20 22 65 |&& retur|n (0, "e|
|000030a0| 72 72 6f 72 20 6d 61 6b | 69 6e 67 20 24 44 65 73 |rror mak|ing $Des|
|000030b0| 74 20 77 72 69 74 61 62 | 6c 65 20 74 6f 20 6f 77 |t writab|le to ow|
|000030c0| 6e 65 72 22 29 3b 0a 58 | 20 20 20 20 20 20 7d 0a |ner");.X| }.|
|000030d0| 58 20 20 20 20 20 20 65 | 6c 73 65 0a 58 20 20 20 |X e|lse.X |
|000030e0| 20 20 20 7b 0a 58 20 20 | 20 20 20 20 20 20 20 72 | {.X | r|
|000030f0| 65 74 75 72 6e 20 28 30 | 2c 20 22 24 44 65 73 74 |eturn (0|, "$Dest|
|00003100| 20 69 73 20 6e 6f 74 20 | 77 72 69 74 61 62 6c 65 | is not |writable|
|00003110| 20 61 6e 64 20 79 6f 75 | 20 64 6f 20 6e 6f 74 20 | and you| do not |
|00003120| 6f 77 6e 20 69 74 22 29 | 3b 0a 58 20 20 20 20 20 |own it")|;.X |
|00003130| 20 7d 3b 0a 58 20 20 20 | 7d 3b 0a 58 0a 58 20 20 | };.X |};.X.X |
|00003140| 20 23 20 43 6f 70 79 0a | 58 20 20 20 24 4f 75 74 | # Copy.|X $Out|
|00003150| 70 75 74 20 3d 20 60 2f | 62 69 6e 2f 73 68 20 2d |put = `/|bin/sh -|
|00003160| 63 20 27 63 70 20 24 53 | 6f 75 72 63 65 20 24 44 |c 'cp $S|ource $D|
|00003170| 65 73 74 27 20 32 3e 26 | 31 60 3b 0a 58 20 20 20 |est' 2>&|1`;.X |
|00003180| 24 4f 75 74 70 75 74 20 | 3d 7e 20 73 2f 5c 6e 24 |$Output |=~ s/\n$|
|00003190| 2f 2f 3b 0a 58 20 20 20 | 72 65 74 75 72 6e 20 28 |//;.X |return (|
|000031a0| 30 2c 20 24 4f 75 74 70 | 75 74 29 20 69 66 20 28 |0, $Outp|ut) if (|
|000031b0| 24 4f 75 74 70 75 74 29 | 3b 0a 58 0a 58 20 20 20 |$Output)|;.X.X |
|000031c0| 23 20 49 66 20 77 65 20 | 77 61 6e 74 20 74 6f 20 |# If we |want to |
|000031d0| 63 68 61 6e 67 65 20 74 | 68 65 20 6d 6f 64 65 20 |change t|he mode |
|000031e0| 6f 66 20 74 68 65 20 64 | 65 73 74 69 6e 61 74 69 |of the d|estinati|
|000031f0| 6f 6e 20 74 6f 20 6d 61 | 74 63 68 20 74 68 65 20 |on to ma|tch the |
|00003200| 73 6f 75 72 63 65 0a 58 | 20 20 20 23 20 74 68 65 |source.X| # the|
|00003210| 6e 20 77 65 20 6e 65 65 | 64 20 74 6f 20 73 74 61 |n we nee|d to sta|
|00003220| 74 28 29 20 69 74 0a 58 | 20 20 20 69 66 20 28 24 |t() it.X| if ($|
|00003230| 50 72 65 73 65 72 76 65 | 29 0a 58 20 20 20 7b 0a |Preserve|).X {.|
|00003240| 58 20 20 20 20 20 20 28 | 28 24 4d 6f 64 65 2c 20 |X (|($Mode, |
|00003250| 24 4f 77 6e 65 72 2c 20 | 24 47 72 6f 75 70 29 20 |$Owner, |$Group) |
|00003260| 3d 20 28 73 74 61 74 20 | 28 24 53 6f 75 72 63 65 |= (stat |($Source|
|00003270| 29 29 5b 32 2c 34 2c 35 | 5d 29 20 7c 7c 20 72 65 |))[2,4,5|]) || re|
|00003280| 74 75 72 6e 20 28 30 2c | 20 22 65 72 72 6f 72 20 |turn (0,| "error |
|00003290| 73 74 61 74 69 6e 67 20 | 24 53 6f 75 72 63 65 22 |stating |$Source"|
|000032a0| 29 3b 0a 58 20 20 20 20 | 20 20 24 4c 6f 6f 6b 75 |);.X | $Looku|
|000032b0| 70 5f 49 44 73 20 3d 20 | 30 3b 0a 58 20 20 20 7d |p_IDs = |0;.X }|
|000032c0| 3b 0a 58 0a 58 20 20 20 | 23 20 43 68 61 6e 67 65 |;.X.X |# Change|
|000032d0| 20 74 68 65 20 75 69 64 | 2c 20 67 69 64 2c 20 6f | the uid|, gid, o|
|000032e0| 72 20 6d 6f 64 65 20 6f | 66 20 74 68 65 20 64 65 |r mode o|f the de|
|000032f0| 73 74 69 6e 61 74 69 6f | 6e 0a 58 20 20 20 72 65 |stinatio|n.X re|
|00003300| 74 75 72 6e 20 26 43 68 | 61 6e 67 65 5f 46 69 6c |turn &Ch|ange_Fil|
|00003310| 65 5f 49 6e 66 6f 20 28 | 24 44 65 73 74 2c 20 24 |e_Info (|$Dest, $|
|00003320| 4d 6f 64 65 2c 20 24 4f | 77 6e 65 72 2c 20 24 47 |Mode, $O|wner, $G|
|00003330| 72 6f 75 70 2c 20 24 4c | 6f 6f 6b 75 70 5f 49 44 |roup, $L|ookup_ID|
|00003340| 73 29 3b 0a 7d 3b 0a 58 | 0a 58 0a 31 3b 0a 53 48 |s);.};.X|.X.1;.SH|
|00003350| 41 52 5f 45 4f 46 0a 63 | 68 6d 6f 64 20 30 34 34 |AR_EOF.c|hmod 044|
|00003360| 34 20 66 69 6c 65 6f 70 | 2e 70 6c 20 7c 7c 0a 65 |4 fileop|.pl ||.e|
|00003370| 63 68 6f 20 27 72 65 73 | 74 6f 72 65 20 6f 66 20 |cho 'res|tore of |
|00003380| 66 69 6c 65 6f 70 2e 70 | 6c 20 66 61 69 6c 65 64 |fileop.p|l failed|
|00003390| 27 0a 57 63 5f 63 3d 22 | 60 77 63 20 2d 63 20 3c |'.Wc_c="|`wc -c <|
|000033a0| 20 27 66 69 6c 65 6f 70 | 2e 70 6c 27 60 22 0a 74 | 'fileop|.pl'`".t|
|000033b0| 65 73 74 20 31 30 36 34 | 30 20 2d 65 71 20 22 24 |est 1064|0 -eq "$|
|000033c0| 57 63 5f 63 22 20 7c 7c | 0a 09 65 63 68 6f 20 27 |Wc_c" |||..echo '|
|000033d0| 66 69 6c 65 6f 70 2e 70 | 6c 3a 20 6f 72 69 67 69 |fileop.p|l: origi|
|000033e0| 6e 61 6c 20 73 69 7a 65 | 20 31 30 36 34 30 2c 20 |nal size| 10640, |
|000033f0| 63 75 72 72 65 6e 74 20 | 73 69 7a 65 27 20 22 24 |current |size' "$|
|00003400| 57 63 5f 63 22 0a 66 69 | 0a 23 20 3d 3d 3d 3d 3d |Wc_c".fi|.# =====|
|00003410| 3d 3d 3d 3d 3d 3d 3d 3d | 20 66 69 6c 65 69 6e 66 |========| fileinf|
|00003420| 6f 2e 70 6c 20 3d 3d 3d | 3d 3d 3d 3d 3d 3d 3d 3d |o.pl ===|========|
|00003430| 3d 3d 3d 0a 69 66 20 74 | 65 73 74 20 2d 66 20 27 |===.if t|est -f '|
|00003440| 66 69 6c 65 69 6e 66 6f | 2e 70 6c 27 20 2d 61 20 |fileinfo|.pl' -a |
|00003450| 58 22 24 31 22 20 21 3d | 20 58 22 2d 63 22 3b 20 |X"$1" !=| X"-c"; |
|00003460| 74 68 65 6e 0a 09 65 63 | 68 6f 20 27 78 20 2d 20 |then..ec|ho 'x - |
|00003470| 73 6b 69 70 70 69 6e 67 | 20 66 69 6c 65 69 6e 66 |skipping| fileinf|
|00003480| 6f 2e 70 6c 20 28 46 69 | 6c 65 20 61 6c 72 65 61 |o.pl (Fi|le alrea|
|00003490| 64 79 20 65 78 69 73 74 | 73 29 27 0a 65 6c 73 65 |dy exist|s)'.else|
|000034a0| 0a 65 63 68 6f 20 27 78 | 20 2d 20 65 78 74 72 61 |.echo 'x| - extra|
|000034b0| 63 74 69 6e 67 20 66 69 | 6c 65 69 6e 66 6f 2e 70 |cting fi|leinfo.p|
|000034c0| 6c 20 28 54 65 78 74 29 | 27 0a 73 65 64 20 27 73 |l (Text)|'.sed 's|
|000034d0| 2f 5e 58 2f 2f 27 20 3c | 3c 20 27 53 48 41 52 5f |/^X//' <|< 'SHAR_|
|000034e0| 45 4f 46 27 20 3e 20 27 | 66 69 6c 65 69 6e 66 6f |EOF' > '|fileinfo|
|000034f0| 2e 70 6c 27 20 26 26 0a | 3b 23 20 4e 41 4d 45 0a |.pl' &&.|;# NAME.|
|00003500| 3b 23 20 20 20 20 66 69 | 6c 65 69 6e 66 6f 2e 70 |;# fi|leinfo.p|
|00003510| 6c 20 2d 20 70 65 72 6c | 20 66 75 6e 63 74 69 6f |l - perl| functio|
|00003520| 6e 28 73 29 20 67 69 76 | 65 20 69 6e 66 6f 72 6d |n(s) giv|e inform|
|00003530| 61 74 69 6f 6e 20 6f 6e | 20 66 69 6c 65 20 73 79 |ation on| file sy|
|00003540| 73 74 65 6d 20 6f 62 6a | 65 63 74 73 0a 3b 23 0a |stem obj|ects.;#.|
|00003550| 3b 23 20 41 55 54 48 4f | 52 0a 3b 23 20 20 20 20 |;# AUTHO|R.;# |
|00003560| 4d 69 63 68 61 65 6c 20 | 53 2e 20 4d 75 65 67 65 |Michael |S. Muege|
|00003570| 6c 20 28 6d 6d 75 65 67 | 65 6c 40 6d 6f 74 2e 63 |l (mmueg|el@mot.c|
|00003580| 6f 6d 29 0a 3b 23 0a 3b | 23 20 52 43 53 20 49 4e |om).;#.;|# RCS IN|
|00003590| 46 4f 52 4d 41 54 49 4f | 4e 0a 3b 23 20 20 20 20 |FORMATIO|N.;# |
|000035a0| 24 41 75 74 68 6f 72 3a | 20 6d 6d 75 65 67 65 6c |$Author:| mmuegel|
|000035b0| 20 24 0a 3b 23 20 20 20 | 20 24 48 65 61 64 65 72 | $.;# | $Header|
|000035c0| 3a 20 2f 75 73 72 2f 6c | 6f 63 61 6c 2f 6c 69 62 |: /usr/l|ocal/lib|
|000035d0| 2f 70 65 72 6c 2f 52 43 | 53 2f 66 69 6c 65 69 6e |/perl/RC|S/filein|
|000035e0| 66 6f 2e 70 6c 2c 76 20 | 31 2e 31 20 31 39 39 31 |fo.pl,v |1.1 1991|
|000035f0| 2f 31 30 2f 32 38 20 31 | 34 3a 34 32 3a 30 31 20 |/10/28 1|4:42:01 |
|00003600| 6d 6d 75 65 67 65 6c 20 | 45 78 70 20 24 0a 3b 23 |mmuegel |Exp $.;#|
|00003610| 20 20 20 20 24 53 6f 75 | 72 63 65 3a 20 2f 75 73 | $Sou|rce: /us|
|00003620| 72 2f 6c 6f 63 61 6c 2f | 6c 69 62 2f 70 65 72 6c |r/local/|lib/perl|
|00003630| 2f 52 43 53 2f 66 69 6c | 65 69 6e 66 6f 2e 70 6c |/RCS/fil|einfo.pl|
|00003640| 2c 76 20 24 0a 58 0a 3b | 23 23 23 23 23 23 23 23 |,v $.X.;|########|
|00003650| 23 23 23 23 23 23 23 23 | 23 23 23 23 23 23 23 23 |########|########|
|00003660| 23 23 23 23 23 23 23 23 | 23 23 23 23 23 23 23 23 |########|########|
|00003670| 23 23 23 23 23 23 23 23 | 23 23 23 23 23 23 23 23 |########|########|
|00003680| 23 23 23 23 23 23 23 23 | 23 23 23 23 23 23 23 23 |########|########|
|00003690| 23 23 23 23 23 23 23 0a | 3b 23 20 44 69 72 5f 4e |#######.|;# Dir_N|
|000036a0| 61 6d 65 0a 3b 23 0a 3b | 23 20 52 65 74 75 72 6e |ame.;#.;|# Return|
|000036b0| 73 20 74 68 65 20 6e 61 | 6d 65 20 6f 66 20 74 68 |s the na|me of th|
|000036c0| 65 20 64 69 72 65 63 74 | 6f 72 79 20 74 68 61 74 |e direct|ory that|
|000036d0| 20 24 50 61 74 68 20 69 | 73 20 69 6e 2e 20 54 68 | $Path i|s in. Th|
|000036e0| 65 20 6e 61 6d 65 20 69 | 73 20 74 68 65 0a 3b 23 |e name i|s the.;#|
|000036f0| 20 6c 6f 67 69 63 61 6c | 20 6e 61 6d 65 2e 20 45 | logical| name. E|
|00003700| 2e 67 2e 20 6e 6f 20 6c | 69 6e 6b 20 66 6f 6c 6c |.g. no l|ink foll|
|00003710| 6f 77 69 6e 67 20 69 73 | 20 64 6f 6e 65 2e 0a 3b |owing is| done..;|
|00003720| 23 0a 3b 23 20 57 72 69 | 74 74 65 6e 20 62 79 20 |#.;# Wri|tten by |
|00003730| 6d 65 40 61 6e 79 77 68 | 65 72 65 2e 45 42 61 79 |me@anywh|ere.EBay|
|00003740| 2e 53 75 6e 2e 43 4f 4d | 20 28 57 61 79 6e 65 20 |.Sun.COM| (Wayne |
|00003750| 54 68 6f 6d 70 73 6f 6e | 29 20 61 6e 64 20 70 6f |Thompson|) and po|
|00003760| 73 74 65 64 20 74 6f 20 | 63 2e 6c 2e 70 2e 0a 3b |sted to |c.l.p..;|
|00003770| 23 20 4d 6f 64 69 66 69 | 65 64 20 74 6f 20 77 6f |# Modifi|ed to wo|
|00003780| 72 6b 20 77 69 74 68 20 | 44 6f 6d 61 69 6e 2f 4f |rk with |Domain/O|
|00003790| 53 20 2f 2f 20 66 69 6c | 65 73 79 73 74 65 6d 2e |S // fil|esystem.|
|000037a0| 0a 3b 23 0a 3b 23 20 41 | 72 67 75 6d 65 6e 74 73 |.;#.;# A|rguments|
|000037b0| 3a 0a 3b 23 20 20 20 20 | 24 50 61 74 68 0a 3b 23 |:.;# |$Path.;#|
|000037c0| 0a 3b 23 20 52 65 74 75 | 72 6e 73 3a 0a 3b 23 20 |.;# Retu|rns:.;# |
|000037d0| 20 20 20 24 44 69 72 0a | 3b 23 23 23 23 23 23 23 | $Dir.|;#######|
|000037e0| 23 23 23 23 23 23 23 23 | 23 23 23 23 23 23 23 23 |########|########|
|000037f0| 23 23 23 23 23 23 23 23 | 23 23 23 23 23 23 23 23 |########|########|
|00003800| 23 23 23 23 23 23 23 23 | 23 23 23 23 23 23 23 23 |########|########|
|00003810| 23 23 23 23 23 23 23 23 | 23 23 23 23 23 23 23 23 |########|########|
|00003820| 23 23 23 23 23 23 23 23 | 0a 73 75 62 20 44 69 72 |########|.sub Dir|
|00003830| 5f 4e 61 6d 65 20 0a 7b | 20 20 20 0a 58 20 20 20 |_Name .{| .X |
|00003840| 20 6c 6f 63 61 6c 20 28 | 24 5f 29 20 3d 20 40 5f | local (|$_) = @_|
|00003850| 3b 0a 58 20 20 20 20 6c | 6f 63 61 6c 20 28 24 72 |;.X l|ocal ($r|
|00003860| 65 74 75 72 6e 29 3b 0a | 58 20 20 20 20 73 23 24 |eturn);.|X s#$|
|00003870| 23 2f 23 3b 0a 58 20 20 | 20 20 28 28 24 72 65 74 |#/#;.X | (($ret|
|00003880| 75 72 6e 29 20 3d 20 6d | 23 5e 28 2f 5b 2f 5d 3f |urn) = m|#^(/[/]?|
|00003890| 29 5b 5e 2f 5d 2a 2f 24 | 23 29 20 7c 7c 0a 58 20 |)[^/]*/$|#) ||.X |
|000038a0| 20 20 20 20 20 20 20 28 | 28 24 72 65 74 75 72 6e | (|($return|
|000038b0| 29 20 3d 20 6d 23 28 2e | 2a 5b 5e 2f 5d 29 2f 2b |) = m#(.|*[^/])/+|
|000038c0| 5b 5e 2f 5d 2b 2f 2b 24 | 23 29 20 7c 7c 0a 58 20 |[^/]+/+$|#) ||.X |
|000038d0| 20 20 20 20 20 20 20 28 | 24 72 65 74 75 72 6e 20 | (|$return |
|000038e0| 3d 20 27 2e 27 29 3b 0a | 58 20 20 20 20 24 72 65 |= '.');.|X $re|
|000038f0| 74 75 72 6e 3b 0a 7d 3b | 0a 58 0a 58 0a 3b 23 23 |turn;.};|.X.X.;##|
|00003900| 23 23 23 23 23 23 23 23 | 23 23 23 23 23 23 23 23 |########|########|
|00003910| 23 23 23 23 23 23 23 23 | 23 23 23 23 23 23 23 23 |########|########|
|00003920| 23 23 23 23 23 23 23 23 | 23 23 23 23 23 23 23 23 |########|########|
|00003930| 23 23 23 23 23 23 23 23 | 23 23 23 23 23 23 23 23 |########|########|
|00003940| 23 23 23 23 23 23 23 23 | 23 23 23 23 23 0a 3b 23 |########|#####.;#|
|00003950| 20 52 65 61 6c 5f 50 61 | 74 68 0a 3b 23 0a 3b 23 | Real_Pa|th.;#.;#|
|00003960| 20 44 65 74 65 72 6d 69 | 6e 65 73 20 74 68 65 20 | Determi|nes the |
|00003970| 61 63 74 75 61 6c 20 70 | 68 79 73 69 63 61 6c 20 |actual p|hysical |
|00003980| 70 61 74 68 20 6f 66 20 | 24 50 61 74 68 2e 20 49 |path of |$Path. I|
|00003990| 74 20 77 69 6c 6c 20 66 | 6f 6c 6c 6f 77 20 6c 69 |t will f|ollow li|
|000039a0| 6e 6b 73 20 69 66 0a 3b | 23 20 6e 65 63 65 73 73 |nks if.;|# necess|
|000039b0| 61 72 79 2e 20 57 68 65 | 6e 20 73 69 74 74 69 6e |ary. Whe|n sittin|
|000039c0| 67 20 69 6e 20 6d 79 20 | 24 48 4f 4d 45 20 61 6e |g in my |$HOME an|
|000039d0| 64 20 67 69 76 65 6e 20 | 22 62 69 6e 22 20 77 69 |d given |"bin" wi|
|000039e0| 6c 6c 20 72 65 74 75 72 | 6e 0a 3b 23 20 2f 2f 66 |ll retur|n.;# //f|
|000039f0| 77 61 73 65 31 32 2f 75 | 73 65 72 73 2f 6d 6d 75 |wase12/u|sers/mmu|
|00003a00| 65 67 65 6c 2f 62 69 6e | 2e 20 52 65 74 75 72 6e |egel/bin|. Return|
|00003a10| 73 20 77 69 74 68 20 24 | 53 74 61 74 75 73 20 54 |s with $|Status T|
|00003a20| 52 55 45 20 69 66 20 69 | 74 20 77 61 73 20 61 62 |RUE if i|t was ab|
|00003a30| 6c 65 20 74 6f 0a 3b 23 | 20 63 6f 6d 70 75 74 65 |le to.;#| compute|
|00003a40| 20 74 68 65 20 72 65 61 | 6c 20 70 61 74 68 3b 20 | the rea|l path; |
|00003a50| 46 41 4c 53 45 20 6f 74 | 68 65 72 77 69 73 65 2e |FALSE ot|herwise.|
|00003a60| 20 49 66 20 46 41 4c 53 | 45 20 61 6e 20 65 72 72 | If FALS|E an err|
|00003a70| 6f 72 20 73 74 72 69 6e | 67 20 69 73 20 72 65 74 |or strin|g is ret|
|00003a80| 75 72 6e 65 64 0a 3b 23 | 20 69 6e 73 74 65 61 64 |urned.;#| instead|
|00003a90| 20 6f 66 20 74 68 65 20 | 70 61 74 68 6e 61 6d 65 | of the |pathname|
|00003aa0| 2e 20 43 61 74 63 68 65 | 73 20 72 65 63 75 72 73 |. Catche|s recurs|
|00003ab0| 69 76 65 20 6c 69 6e 6b | 73 20 62 79 20 73 65 74 |ive link|s by set|
|00003ac0| 74 69 6e 67 20 61 20 6c | 69 6d 69 74 20 6f 6e 20 |ting a l|imit on |
|00003ad0| 74 68 65 20 0a 3b 23 20 | 6e 75 6d 62 65 72 20 6f |the .;# |number o|
|00003ae0| 66 20 74 69 6d 65 73 20 | 61 20 70 61 74 68 6e 61 |f times |a pathna|
|00003af0| 6d 65 20 63 61 6e 20 62 | 65 20 65 6e 63 6f 75 6e |me can b|e encoun|
|00003b00| 74 65 72 65 64 2e 20 54 | 68 65 20 6d 61 78 69 6d |tered. T|he maxim|
|00003b10| 75 6d 20 6e 75 6d 62 65 | 72 20 69 73 20 0a 3b 23 |um numbe|r is .;#|
|00003b20| 20 24 4d 41 58 5f 56 49 | 53 49 54 53 2e 0a 3b 23 | $MAX_VI|SITS..;#|
|00003b30| 0a 3b 23 20 41 72 67 75 | 6d 65 6e 74 73 3a 0a 3b |.;# Argu|ments:.;|
|00003b40| 23 20 20 20 20 24 50 61 | 74 68 0a 3b 23 0a 3b 23 |# $Pa|th.;#.;#|
|00003b50| 20 52 65 74 75 72 6e 73 | 3a 0a 3b 23 20 20 20 20 | Returns|:.;# |
|00003b60| 24 53 74 61 74 75 73 2c | 20 24 52 65 61 6c 5f 50 |$Status,| $Real_P|
|00003b70| 61 74 68 0a 3b 23 23 23 | 23 23 23 23 23 23 23 23 |ath.;###|########|
|00003b80| 23 23 23 23 23 23 23 23 | 23 23 23 23 23 23 23 23 |########|########|
|00003b90| 23 23 23 23 23 23 23 23 | 23 23 23 23 23 23 23 23 |########|########|
|00003ba0| 23 23 23 23 23 23 23 23 | 23 23 23 23 23 23 23 23 |########|########|
|00003bb0| 23 23 23 23 23 23 23 23 | 23 23 23 23 23 23 23 23 |########|########|
|00003bc0| 23 23 23 23 0a 73 75 62 | 20 52 65 61 6c 5f 50 61 |####.sub| Real_Pa|
|00003bd0| 74 68 0a 7b 0a 58 20 20 | 20 6c 6f 63 61 6c 20 28 |th.{.X | local (|
|00003be0| 24 4c 6f 67 69 63 61 6c | 5f 50 61 74 68 29 20 3d |$Logical|_Path) =|
|00003bf0| 20 40 5f 3b 0a 58 20 20 | 20 6c 6f 63 61 6c 20 28 | @_;.X | local (|
|00003c00| 25 54 72 61 76 65 72 73 | 65 64 5f 43 6f 75 6e 74 |%Travers|ed_Count|
|00003c10| 29 3b 0a 58 20 20 20 6c | 6f 63 61 6c 20 28 24 4d |);.X l|ocal ($M|
|00003c20| 41 58 5f 56 49 53 49 54 | 53 29 20 3d 20 38 3b 0a |AX_VISIT|S) = 8;.|
|00003c30| 58 20 20 20 6c 6f 63 61 | 6c 20 28 24 50 57 44 29 |X loca|l ($PWD)|
|00003c40| 20 3d 20 22 2f 62 69 6e | 2f 70 77 64 22 3b 0a 58 | = "/bin|/pwd";.X|
|00003c50| 0a 58 20 20 20 73 75 62 | 20 52 65 61 6c 5f 50 61 |.X sub| Real_Pa|
|00003c60| 74 68 5f 52 65 63 0a 58 | 20 20 20 7b 0a 58 20 20 |th_Rec.X| {.X |
|00003c70| 20 20 20 20 6c 6f 63 61 | 6c 20 28 24 50 61 74 68 | loca|l ($Path|
|00003c80| 29 20 3d 20 40 5f 3b 0a | 58 20 20 20 20 20 20 6c |) = @_;.|X l|
|00003c90| 6f 63 61 6c 20 28 24 42 | 61 73 65 6e 61 6d 65 2c |ocal ($B|asename,|
|00003ca0| 20 24 44 69 72 2c 20 24 | 4e 65 77 5f 50 61 74 68 | $Dir, $|New_Path|
|00003cb0| 2c 20 24 52 65 61 6c 5f | 50 61 74 68 2c 20 24 45 |, $Real_|Path, $E|
|00003cc0| 72 72 6f 72 29 3b 0a 58 | 0a 58 20 20 20 20 20 20 |rror);.X|.X |
|00003cd0| 23 20 43 68 65 63 6b 20 | 66 6f 72 20 72 65 63 75 |# Check |for recu|
|00003ce0| 72 73 69 6f 6e 0a 58 20 | 20 20 20 20 20 72 65 74 |rsion.X | ret|
|00003cf0| 75 72 6e 20 28 30 2c 20 | 22 24 4c 6f 67 69 63 61 |urn (0, |"$Logica|
|00003d00| 6c 5f 50 61 74 68 3a 20 | 70 6f 73 73 69 62 6c 65 |l_Path: |possible|
|00003d10| 20 72 65 63 75 72 73 69 | 6f 6e 20 66 6f 72 20 6f | recursi|on for o|
|00003d20| 62 6a 65 63 74 20 24 50 | 61 74 68 22 29 20 0a 58 |bject $P|ath") .X|
|00003d30| 20 20 20 20 20 20 20 20 | 20 69 66 20 28 24 54 72 | | if ($Tr|
|00003d40| 61 76 65 72 73 65 64 5f | 43 6f 75 6e 74 20 7b 24 |aversed_|Count {$|
|00003d50| 50 61 74 68 7d 2b 2b 20 | 3d 3d 20 24 4d 41 58 5f |Path}++ |== $MAX_|
|00003d60| 56 49 53 49 54 53 29 3b | 0a 58 0a 58 20 20 20 20 |VISITS);|.X.X |
|00003d70| 20 20 23 20 47 65 74 20 | 74 68 65 20 62 61 73 65 | # Get |the base|
|00003d80| 6e 61 6d 65 20 61 6e 64 | 20 64 69 72 65 63 74 6f |name and| directo|
|00003d90| 72 79 20 24 50 61 74 68 | 20 69 73 20 69 6e 0a 58 |ry $Path| is in.X|
|00003da0| 20 20 20 20 20 20 28 24 | 42 61 73 65 6e 61 6d 65 | ($|Basename|
|00003db0| 20 3d 20 24 50 61 74 68 | 29 20 3d 7e 20 73 2f 2e | = $Path|) =~ s/.|
|00003dc0| 2a 5c 2f 2f 2f 3b 0a 58 | 20 20 20 20 20 20 24 44 |*\///;.X| $D|
|00003dd0| 69 72 20 3d 20 26 44 69 | 72 5f 4e 61 6d 65 20 28 |ir = &Di|r_Name (|
|00003de0| 24 50 61 74 68 29 3b 0a | 58 20 20 20 20 20 20 0a |$Path);.|X .|
|00003df0| 58 20 20 20 20 20 20 23 | 20 43 6f 6c 6c 61 70 73 |X #| Collaps|
|00003e00| 65 20 2f 2f 6e 6f 64 65 | 2f 2e 2e 20 2d 3e 20 2f |e //node|/.. -> /|
|00003e10| 2f 20 62 65 63 61 75 73 | 65 20 6f 66 20 62 75 67 |/ becaus|e of bug|
|00003e20| 20 69 6e 20 44 6f 6d 61 | 69 6e 2f 4f 53 0a 58 20 | in Doma|in/OS.X |
|00003e30| 20 20 20 20 20 24 44 69 | 72 20 3d 7e 20 73 23 5e | $Di|r =~ s#^|
|00003e40| 2f 2f 5b 5e 2f 5d 2b 2f | 5c 2e 5c 2e 23 2f 2f 23 |//[^/]+/|\.\.#//#|
|00003e50| 3b 0a 58 0a 58 20 20 20 | 20 20 20 23 20 43 68 61 |;.X.X | # Cha|
|00003e60| 6e 67 65 20 74 6f 20 74 | 68 65 20 64 69 72 65 63 |nge to t|he direc|
|00003e70| 74 6f 72 79 20 24 50 61 | 74 68 20 69 73 20 69 6e |tory $Pa|th is in|
|00003e80| 0a 58 20 20 20 20 20 20 | 63 68 64 69 72 20 28 24 |.X |chdir ($|
|00003e90| 44 69 72 29 20 7c 7c 20 | 72 65 74 75 72 6e 20 28 |Dir) || |return (|
|00003ea0| 30 2c 20 22 24 4c 6f 67 | 69 63 61 6c 5f 50 61 74 |0, "$Log|ical_Pat|
|00003eb0| 68 3a 20 63 6f 75 6c 64 | 20 6e 6f 74 20 63 68 64 |h: could| not chd|
|00003ec0| 69 72 20 74 6f 20 24 44 | 69 72 3a 20 24 21 22 29 |ir to $D|ir: $!")|
|00003ed0| 20 69 66 20 28 24 44 69 | 72 20 6e 65 20 22 2e 22 | if ($Di|r ne "."|
|00003ee0| 29 3b 0a 58 20 20 20 20 | 20 20 63 68 6f 70 20 28 |);.X | chop (|
|00003ef0| 24 44 69 72 20 3d 20 60 | 24 50 57 44 60 29 20 7c |$Dir = `|$PWD`) ||
|00003f00| 7c 20 72 65 74 75 72 6e | 20 28 30 2c 20 22 24 4c || return| (0, "$L|
|00003f10| 6f 67 69 63 61 6c 5f 50 | 61 74 68 3a 20 63 61 6e |ogical_P|ath: can|
|00003f20| 20 6e 6f 74 20 66 69 6e | 64 20 63 75 72 72 65 6e | not fin|d curren|
|00003f30| 74 20 77 6f 72 6b 69 6e | 67 20 64 69 72 65 63 74 |t workin|g direct|
|00003f40| 6f 72 79 3a 20 24 21 22 | 29 3b 0a 58 20 20 20 0a |ory: $!"|);.X .|
|00003f50| 58 20 20 20 20 20 20 69 | 66 20 28 2d 6c 20 24 42 |X i|f (-l $B|
|00003f60| 61 73 65 6e 61 6d 65 29 | 0a 58 20 20 20 20 20 20 |asename)|.X |
|00003f70| 7b 0a 58 20 20 20 20 20 | 20 20 20 20 24 4e 65 77 |{.X | $New|
|00003f80| 5f 50 61 74 68 20 3d 20 | 72 65 61 64 6c 69 6e 6b |_Path = |readlink|
|00003f90| 20 28 24 42 61 73 65 6e | 61 6d 65 29 20 7c 7c 20 | ($Basen|ame) || |
|00003fa0| 72 65 74 75 72 6e 20 28 | 30 2c 20 22 24 4c 6f 67 |return (|0, "$Log|
|00003fb0| 69 63 61 6c 5f 50 61 74 | 68 3a 20 63 61 6e 20 6e |ical_Pat|h: can n|
|00003fc0| 6f 74 20 72 65 61 64 20 | 6c 69 6e 6b 20 24 50 61 |ot read |link $Pa|
|00003fd0| 74 68 2f 24 42 61 73 65 | 6e 61 6d 65 22 29 3b 0a |th/$Base|name");.|
|00003fe0| 58 20 20 20 20 20 20 20 | 20 20 72 65 74 75 72 6e |X | return|
|00003ff0| 20 28 26 52 65 61 6c 5f | 50 61 74 68 5f 52 65 63 | (&Real_|Path_Rec|
|00004000| 20 28 24 4e 65 77 5f 50 | 61 74 68 29 29 3b 0a 58 | ($New_P|ath));.X|
|00004010| 20 20 20 20 20 20 7d 3b | 0a 58 20 20 20 0a 58 20 | };|.X .X |
|00004020| 20 20 20 20 20 63 68 6f | 70 20 28 24 44 69 72 29 | cho|p ($Dir)|
|00004030| 20 69 66 20 28 24 44 69 | 72 20 3d 7e 20 2f 5e 28 | if ($Di|r =~ /^(|
|00004040| 5c 2f 29 7b 31 2c 32 7d | 24 2f 29 3b 0a 58 20 20 |\/){1,2}|$/);.X |
|00004050| 20 20 20 20 72 65 74 75 | 72 6e 20 28 31 2c 20 22 | retu|rn (1, "|
|00004060| 24 44 69 72 2f 24 42 61 | 73 65 6e 61 6d 65 22 29 |$Dir/$Ba|sename")|
|00004070| 3b 0a 58 20 20 20 7d 3b | 0a 58 0a 58 20 20 20 72 |;.X };|.X.X r|
|00004080| 65 74 75 72 6e 20 28 26 | 52 65 61 6c 5f 50 61 74 |eturn (&|Real_Pat|
|00004090| 68 5f 52 65 63 20 28 24 | 4c 6f 67 69 63 61 6c 5f |h_Rec ($|Logical_|
|000040a0| 50 61 74 68 29 29 3b 0a | 58 0a 7d 3b 0a 58 0a 31 |Path));.|X.};.X.1|
|000040b0| 3b 0a 53 48 41 52 5f 45 | 4f 46 0a 63 68 6d 6f 64 |;.SHAR_E|OF.chmod|
|000040c0| 20 30 34 34 34 20 66 69 | 6c 65 69 6e 66 6f 2e 70 | 0444 fi|leinfo.p|
|000040d0| 6c 20 7c 7c 0a 65 63 68 | 6f 20 27 72 65 73 74 6f |l ||.ech|o 'resto|
|000040e0| 72 65 20 6f 66 20 66 69 | 6c 65 69 6e 66 6f 2e 70 |re of fi|leinfo.p|
|000040f0| 6c 20 66 61 69 6c 65 64 | 27 0a 57 63 5f 63 3d 22 |l failed|'.Wc_c="|
|00004100| 60 77 63 20 2d 63 20 3c | 20 27 66 69 6c 65 69 6e |`wc -c <| 'filein|
|00004110| 66 6f 2e 70 6c 27 60 22 | 0a 74 65 73 74 20 32 39 |fo.pl'`"|.test 29|
|00004120| 35 34 20 2d 65 71 20 22 | 24 57 63 5f 63 22 20 7c |54 -eq "|$Wc_c" ||
|00004130| 7c 0a 09 65 63 68 6f 20 | 27 66 69 6c 65 69 6e 66 ||..echo |'fileinf|
|00004140| 6f 2e 70 6c 3a 20 6f 72 | 69 67 69 6e 61 6c 20 73 |o.pl: or|iginal s|
|00004150| 69 7a 65 20 32 39 35 34 | 2c 20 63 75 72 72 65 6e |ize 2954|, curren|
|00004160| 74 20 73 69 7a 65 27 20 | 22 24 57 63 5f 63 22 0a |t size' |"$Wc_c".|
|00004170| 66 69 0a 65 78 69 74 20 | 30 0a 2d 2d 20 0a 2b 2d |fi.exit |0.-- .+-|
|00004180| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|00004190| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|000041a0| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|000041b0| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|000041c0| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2b 0a 7c 20 4d |--------|---+.| M|
|000041d0| 69 63 68 61 65 6c 20 53 | 2e 20 4d 75 65 67 65 6c |ichael S|. Muegel|
|000041e0| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|000041f0| 20 20 7c 20 49 6e 74 65 | 72 6e 65 74 3a 20 20 20 | | Inte|rnet: |
|00004200| 20 6d 6d 75 65 67 65 6c | 40 6d 6f 74 2e 63 6f 6d | mmuegel|@mot.com|
|00004210| 20 20 20 20 20 20 20 20 | 20 20 7c 0a 7c 20 55 4e | | |.| UN|
|00004220| 49 58 20 41 70 70 6c 69 | 63 61 74 69 6f 6e 73 20 |IX Appli|cations |
|00004230| 53 74 61 72 74 75 70 20 | 47 72 6f 75 70 20 20 20 |Startup |Group |
|00004240| 20 7c 20 4d 6f 74 6f 20 | 58 2e 34 30 30 3a 20 20 | | Moto |X.400: |
|00004250| 58 31 30 30 39 30 20 20 | 20 20 20 20 20 20 20 20 |X10090 | |
|00004260| 20 20 20 20 20 20 20 20 | 20 7c 0a 7c 20 43 6f 72 | | |.| Cor|
|00004270| 70 6f 72 61 74 65 20 49 | 6e 66 6f 72 6d 61 74 69 |porate I|nformati|
|00004280| 6f 6e 20 4f 66 66 69 63 | 65 20 20 20 20 20 20 20 |on Offic|e |
|00004290| 7c 20 56 6f 69 63 65 3a | 20 20 20 20 20 20 20 28 || Voice:| (|
|000042a0| 37 30 38 29 20 35 37 36 | 2d 30 35 30 37 20 20 20 |708) 576|-0507 |
|000042b0| 20 20 20 20 20 20 20 20 | 7c 0a 7c 20 4d 6f 74 6f | ||.| Moto|
|000042c0| 72 6f 6c 61 2c 20 49 6e | 63 2e 20 20 20 20 20 20 |rola, In|c. |
|000042d0| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 7c | | ||
|000042e0| 20 2e 2e 2e 20 74 68 65 | 73 65 20 61 72 65 20 6d | ... the|se are m|
|000042f0| 79 20 6f 70 69 6e 69 6f | 6e 73 2c 20 68 6f 6e 65 |y opinio|ns, hone|
|00004300| 73 74 20 2e 2e 2e 20 7c | 0a 2b 2d 2d 2d 2d 2d 2d |st ... ||.+------|
|00004310| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|00004320| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|00004330| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|00004340| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|00004350| 2d 2d 2d 2d 2d 2d 2b 0a | |------+.| |
+--------+-------------------------+-------------------------+--------+--------+